/* assets/css/learn.css — Learn page: word of the day + practice games (pages/learn.php, assets/js/learn.js) */

/* ── Word of the day (inside the dark hero) ── */
.wotd {
  margin-top: 1.6rem; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1.4rem;
  padding: .9rem 1.1rem; border-radius: 16px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(242,201,53,.28);
}
.wotd-k { font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-lt); }
.wotd-main { display: flex; align-items: center; gap: .8rem; flex: 1 1 220px; min-width: 0; }
.wotd-main b { display: block; font-family: var(--font-head); font-size: 1.45rem; color: #fff; line-height: 1.2; overflow-wrap: anywhere; }
.wotd-main span { color: rgba(255,255,255,.75); font-size: .95rem; }
.wotd-play {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--gold-grad); color: var(--forest); font-size: 1.05rem;
  transition: transform .15s var(--ease, ease);
}
.wotd-play:hover { transform: scale(1.06); }
.wotd-play:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.wotd-lang { color: rgba(255,255,255,.8); font-size: .86rem; text-decoration: none; }
.wotd-lang:hover { color: var(--gold-lt); }

/* ── Practice panel ── */
.lp {
  position: relative; max-width: 760px; margin: 0 auto; padding: 1.1rem;
  background: #fff; border: 1px solid var(--sand); border-radius: 22px;
  box-shadow: 0 10px 40px rgba(17,38,29,.08);
}
.lp-top { display: flex; align-items: flex-end; gap: .9rem; flex-wrap: wrap; }
.lp-lang { flex: 1 1 220px; }
.lp-lang label { display: block; font-size: .78rem; font-weight: 700; color: var(--muted, #6b6b6b); margin-bottom: .25rem; }
.lp-lang .form-select { border-radius: 12px; border-color: var(--sand); min-height: 46px; font-weight: 600; }

.lp-goal { display: flex; align-items: center; gap: .5rem; }
.lp-goal svg { width: 46px; height: 46px; transform: rotate(-90deg); }
.lp-ring-bg, .lp-ring { fill: none; stroke-width: 4; }
.lp-ring-bg { stroke: var(--cream-2); }
.lp-ring { stroke: var(--cm-green); stroke-linecap: round; stroke-dasharray: 0 100; transition: stroke-dasharray .4s ease; }
.lp-goal.is-done .lp-ring { stroke: var(--gold); }
.lp-goal b { display: block; font-size: 1rem; line-height: 1.1; color: var(--forest); }
.lp-goal span { font-size: .75rem; color: var(--muted, #6b6b6b); }
.lp-streak { align-self: center; padding: .35rem .7rem; border-radius: 999px; background: #fff3f0; color: var(--cm-red); font-size: .85rem; }

/* topics: one scrolling row of chips */
.lp-topics {
  display: flex; gap: .45rem; overflow-x: auto; padding: .9rem 0 .5rem; margin: 0 -.2rem;
  scrollbar-width: thin; -webkit-overflow-scrolling: touch; align-items: center;
}
.lp-tgroup { flex: none; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-dk); padding: 0 .2rem 0 .4rem; }
.lp-topic {
  flex: none; display: inline-flex; align-items: center; gap: .4rem; min-height: 40px;
  padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--sand); background: var(--cream);
  font-size: .88rem; font-weight: 600; color: var(--forest-2); white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.lp-topic i { color: var(--gold); font-size: .85em; }
.lp-topic:hover { border-color: var(--gold); }
.lp-topic.is-on { background: var(--forest-2); border-color: var(--forest-2); color: #fff; }
.lp-topic.is-on i { color: var(--gold-lt); }
.lp-skel { flex: none; width: 110px; height: 40px; border-radius: 999px; background: linear-gradient(90deg, var(--cream-2), var(--cream), var(--cream-2)); background-size: 200% 100%; animation: lpShimmer 1.2s infinite linear; }
@keyframes lpShimmer { to { background-position: -200% 0; } }

/* game modes: segmented control */
.lp-modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; padding: .3rem; margin: .3rem 0 1rem; background: var(--cream-2); border-radius: 14px; }
.lp-mode {
  display: flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px;
  border: 0; border-radius: 11px; background: transparent; font-weight: 700; font-size: .9rem; color: var(--forest-2);
  transition: background .15s, box-shadow .15s;
}
.lp-mode i { color: var(--gold-dk); }
.lp-mode.is-on { background: #fff; box-shadow: 0 2px 8px rgba(17,38,29,.12); }
.lp-mode:focus-visible, .lp-topic:focus-visible, .lp-opt:focus-visible, .lp-tile:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
@media (max-width: 420px) { .lp-mode { flex-direction: column; gap: .1rem; font-size: .76rem; min-height: 52px; } }

/* stage */
.lp-stage { min-height: 300px; display: flex; flex-direction: column; justify-content: center; }
.lp-msg { text-align: center; color: var(--muted, #6b6b6b); margin: 2rem 0; }

.lp-card, .lp-q {
  position: relative; text-align: center; border-radius: 18px; padding: 2rem 1.2rem 2.2rem;
  background: var(--forest-2) var(--ndop-dark); color: #fff; overflow: hidden;
}
.lp-card::after, .lp-q::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: var(--toghu) repeat-x center / auto 10px; }
.lp-card { min-height: 220px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .6rem; }
.lp-card[data-side="back"] { animation: lpFlip .28s ease; }
@keyframes lpFlip { from { transform: rotateX(70deg); opacity: .4; } to { transform: none; opacity: 1; } }
.lp-tag { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.6); margin-bottom: .4rem; }
.lp-prompt { font-size: 1.35rem; font-weight: 600; margin: 0; overflow-wrap: anywhere; }
.lp-local { font-family: var(--font-head); font-size: 1.9rem; font-weight: 700; color: var(--gold-lt); margin: 0; overflow-wrap: anywhere; }
.lp-answer { display: flex; align-items: center; justify-content: center; gap: .7rem; flex-wrap: wrap; }
.lp-audio, .lp-listen {
  border: 0; border-radius: 50%; background: var(--gold-grad); color: var(--forest);
  display: inline-grid; place-items: center; transition: transform .15s;
}
.lp-audio { width: 44px; height: 44px; }
.lp-listen { width: 84px; height: 84px; font-size: 1.8rem; box-shadow: 0 0 0 10px rgba(242,201,53,.15); }
.lp-audio:hover, .lp-listen:hover { transform: scale(1.06); }
.lp-hint { display: block; margin-top: .9rem; font-size: .82rem; color: rgba(255,255,255,.6); }
.lp-count { position: absolute; top: .8rem; right: 1rem; font-size: .75rem; color: rgba(255,255,255,.5); }

.lp-actions { display: flex; justify-content: center; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.lp-big { min-height: 48px; padding-inline: 1.3rem; border-radius: 12px; font-weight: 700; }

/* multiple choice */
.lp-opts { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-top: 1rem; }
@media (max-width: 520px) { .lp-opts { grid-template-columns: 1fr; } }
.lp-opt {
  display: flex; align-items: center; gap: .7rem; min-height: 56px; padding: .6rem .9rem; text-align: left;
  border: 2px solid var(--sand); border-radius: 14px; background: #fff; font-weight: 600; color: var(--forest-2);
  overflow-wrap: anywhere; transition: border-color .15s, background .15s, transform .1s;
}
.lp-opt:hover { border-color: var(--gold); }
.lp-opt:active { transform: scale(.98); }
.lp-key { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--cream-2); font-size: .78rem; color: var(--muted, #6b6b6b); }
.lp-opts.is-answered .lp-opt { pointer-events: none; }
.lp-opts.is-answered .lp-opt:not(.is-right):not(.is-wrong) { opacity: .55; }
.lp-opt.is-right { border-color: var(--cm-green); background: #e8f6f1; }
.lp-opt.is-right .lp-key { background: var(--cm-green); color: #fff; }
.lp-opt.is-wrong { border-color: var(--cm-red); background: #fdecee; animation: lpShake .3s; }
.lp-opt.is-wrong .lp-key { background: var(--cm-red); color: #fff; }
@keyframes lpShake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.lp-fb { margin: .8rem 0 0; text-align: center; font-weight: 600; }
.lp-fb.ok { color: var(--cm-green); }
.lp-fb.no { color: var(--cm-red); }
.lp-fb b { color: var(--forest); }

/* match the pairs */
.lp-match { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-top: 1rem; }
.lp-match > div { display: grid; gap: .5rem; align-content: start; }
.lp-tile {
  min-height: 54px; padding: .55rem .7rem; border: 2px solid var(--sand); border-radius: 14px; background: #fff;
  font-weight: 600; color: var(--forest-2); overflow-wrap: anywhere; transition: border-color .15s, background .15s, opacity .3s, transform .1s;
}
.lp-tile.is-local { font-family: var(--font-head); font-size: 1.05rem; color: var(--gold-dk); }
.lp-tile:hover { border-color: var(--gold); }
.lp-tile.is-pick { border-color: var(--forest-2); background: var(--cream); transform: scale(1.02); }
.lp-tile.is-done { border-color: var(--cm-green); background: #e8f6f1; opacity: .5; pointer-events: none; }
.lp-tile.is-bad { border-color: var(--cm-red); animation: lpShake .3s; }

/* end of round */
.lp-done { text-align: center; padding: 1.5rem 1rem; }
.lp-done > i { font-size: 2.6rem; color: var(--gold); }
.lp-done h3 { font-family: var(--font-head); margin: .6rem 0 .3rem; }
.lp-done p { color: var(--muted, #6b6b6b); }

.lp-foot { margin-top: 1rem; }
.lp-bar { height: 6px; border-radius: 3px; background: var(--cream-2); overflow: hidden; }
.lp-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cm-green), var(--gold-lt)); transition: width .25s ease; }
.lp-meta { text-align: center; font-size: .84rem; color: var(--muted, #6b6b6b); margin: .5rem 0 0; min-height: 1.2em; }
.lp-note { margin: .8rem 0 0; font-size: .8rem; color: var(--muted, #6b6b6b); }
.lp-note i { color: var(--gold); }

.lp-toast {
  position: absolute; left: 50%; top: 1rem; transform: translateX(-50%); z-index: 5;
  padding: .55rem 1rem; border-radius: 999px; background: var(--forest-2); color: var(--gold-lt); font-weight: 700;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); animation: lpToast 2.4s ease forwards;
}
@keyframes lpToast { 0% { opacity: 0; transform: translate(-50%, -8px); } 10%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .lp-card[data-side="back"], .lp-opt.is-wrong, .lp-tile.is-bad, .lp-toast, .lp-skel { animation: none; }
}
