/* Anagram Quiz — Oboe-style tile game. Reuses the Quiz Whiz theme vars
   (--bg, --card, --ink, --muted, --deep, --lime, --green, --red, --line,
   --chip, --track, --shadow) so it matches light + dark automatically. */
.ana-wrap { max-width: 640px; margin: 0 auto; width: 100%; min-width: 0; }
.ana-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 28px;
  box-shadow: var(--shadow); padding: 22px 20px 20px; min-width: 0;
}
.ana-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.ana-head h2 { font-size: 1.35rem; font-weight: 1000; letter-spacing: -.02em; margin: 0; flex: 1; min-width: 0; }
.ana-head .icon-btn { flex: none; }
.ana-sub { color: var(--muted); font-weight: 700; font-size: .92rem; margin: 0 0 14px; line-height: 1.5; }

/* ---------- category filter chips ---------- */
.ana-filter { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.ana-chip {
  appearance: none; font-family: var(--font); font-weight: 900; font-size: .85rem;
  background: var(--chip); color: var(--ink); border: 2px solid transparent;
  padding: 9px 14px; border-radius: 999px; cursor: pointer;
  transition: transform .12s var(--ease-spring, cubic-bezier(.34,1.56,.64,1)), border-color .15s, background .15s;
}
.ana-chip:hover { transform: translateY(-1px); }
.ana-chip:active { transform: scale(.95); }
.ana-chip[aria-pressed="true"] { background: var(--deep); color: var(--deep-ink); border-color: transparent; }

/* ---------- top row: round / progress / score / streak ---------- */
.ana-top { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; }
.ana-top .round-label { font-size: .92rem; }
.ana-top .progress { flex: 1; min-width: 0; }
.ana-streak {
  font-weight: 1000; font-size: .95rem; white-space: nowrap;
  background: var(--chip); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 12px; box-shadow: var(--shadow-sm);
}
.ana-streak.hot { background: #fff3e0; border-color: #ffb74d; color: #e65100; animation: flame .5s var(--ease-spring, cubic-bezier(.34,1.56,.64,1)); }
[data-theme="dark"] .ana-streak.hot { background: #3a2a12; border-color: #8a5a1d; color: #ffb74d; }
@keyframes flame { 0% { transform: scale(1); } 40% { transform: scale(1.18) rotate(-3deg); } 100% { transform: scale(1); } }

/* ---------- clue line ---------- */
.ana-clue { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.ana-cat {
  font-size: .72rem; font-weight: 1000; letter-spacing: .14em; text-transform: uppercase;
  color: var(--deep-ink); background: var(--deep);
  padding: 7px 14px; border-radius: 999px;
}
.ana-len { color: var(--muted); font-weight: 800; font-size: .9rem; }
.ana-hint-clue { color: var(--muted); font-weight: 700; font-size: .9rem; text-align: center; margin: -8px 0 14px; line-height: 1.5; }

/* ---------- answer slots ---------- */
.ana-slots { display: flex; flex-wrap: wrap; gap: 10px 16px; justify-content: center; margin: 6px 0 18px; min-height: 52px; }
.ana-word { display: flex; gap: 5px; }
.ana-slot {
  width: var(--slot, 44px); height: var(--slot, 44px);
  border-radius: 13px; border: 2px dashed var(--line);
  background: var(--chip); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--slot, 44px) * .5); font-weight: 1000; text-transform: uppercase;
  cursor: default; user-select: none; -webkit-user-select: none;
  transition: transform .12s ease, background .15s, border-color .15s;
}
.ana-slot.filled {
  border-style: solid; border-color: var(--acc, var(--green));
  background: var(--card); box-shadow: var(--shadow-sm);
  cursor: pointer; animation: slotpop .18s var(--ease-spring, cubic-bezier(.34,1.56,.64,1));
}
.ana-slot.filled:active { transform: scale(.92); }
.ana-slot.locked { border-color: var(--lime); background: color-mix(in srgb, var(--lime) 18%, var(--card)); cursor: default; }
.ana-slots.sz-md { --slot: 38px; }
.ana-slots.sz-sm { --slot: 31px; }
.ana-slots.sz-sm .ana-slot { border-radius: 10px; }
.ana-slots.solved .ana-slot {
  background: var(--green-bg); border-color: var(--green); color: var(--green);
  animation: tileflip .5s var(--ease-out, cubic-bezier(.22,1,.36,1)) both;
}
.ana-slots.solved .ana-slot:nth-child(2) { animation-delay: .04s; }
.ana-slots.solved .ana-slot:nth-child(3) { animation-delay: .08s; }
.ana-slots.solved .ana-slot:nth-child(4) { animation-delay: .12s; }
.ana-slots.solved .ana-slot:nth-child(5) { animation-delay: .16s; }
.ana-slots.solved .ana-slot:nth-child(6) { animation-delay: .2s; }
.ana-slots.solved .ana-slot:nth-child(n+7) { animation-delay: .24s; }
.ana-slots.shake { animation: shake .35s ease; }
@keyframes slotpop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes tileflip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg) scale(1.06); } 100% { transform: rotateX(0); } }

/* ---------- letter tray ---------- */
.ana-tray { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 16px; min-height: 52px; }
.ana-tile {
  width: var(--slot, 44px); height: var(--slot, 44px);
  border-radius: 13px; border: 2px solid var(--line);
  background: var(--deep); color: var(--deep-ink);
  font-family: var(--font); font-size: calc(var(--slot, 44px) * .5); font-weight: 1000;
  text-transform: uppercase; cursor: pointer;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--deep) 55%, #000 20%);
  transition: transform .12s var(--ease-spring, cubic-bezier(.34,1.56,.64,1)), box-shadow .12s, opacity .15s;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.ana-tile:hover { transform: translateY(-2px); }
.ana-tile:active { transform: translateY(2px) scale(.96); box-shadow: 0 1px 0 color-mix(in srgb, var(--deep) 55%, #000 20%); }
.ana-tile.used { opacity: 0; pointer-events: none; transform: scale(.6); }
.ana-tray.sz-md { --slot: 38px; }
.ana-tray.sz-sm { --slot: 31px; }
.ana-tray.sz-sm .ana-tile { border-radius: 10px; box-shadow: 0 3px 0 color-mix(in srgb, var(--deep) 55%, #000 20%); }
.ana-tile.deal { animation: tilein .35s var(--ease-out, cubic-bezier(.22,1,.36,1)) both; }
.ana-tile.deal:nth-child(2) { animation-delay: .03s; }
.ana-tile.deal:nth-child(3) { animation-delay: .06s; }
.ana-tile.deal:nth-child(4) { animation-delay: .09s; }
.ana-tile.deal:nth-child(5) { animation-delay: .12s; }
.ana-tile.deal:nth-child(6) { animation-delay: .15s; }
.ana-tile.deal:nth-child(n+7) { animation-delay: .18s; }
@keyframes tilein { from { opacity: 0; transform: translateY(14px) scale(.85); } to { opacity: 1; transform: none; } }

/* ---------- action buttons ---------- */
.ana-actions { display: flex; gap: 10px; margin-bottom: 4px; }
.ana-actions .btn { padding: 13px 10px; font-size: .95rem; }
.ana-actions .btn.hint-btn { background: var(--chip); border: 2px solid var(--line); }
.ana-points { text-align: center; font-weight: 1000; font-size: 1.05rem; color: var(--green); min-height: 1.4em; margin: 6px 0 2px; animation: slotpop .3s var(--ease-spring, cubic-bezier(.34,1.56,.64,1)); }
.ana-points:empty { display: none; }

/* ---------- fact reveal ---------- */
.ana-fact {
  margin-top: 14px; background: var(--chip); border-radius: 20px; padding: 18px;
  border-left: 5px solid var(--lime); animation: factin .45s var(--ease-out, cubic-bezier(.22,1,.36,1));
}
.ana-fact .fact-title { font-size: 1.08rem; font-weight: 1000; margin-bottom: 5px; }
.ana-fact .fact-text { line-height: 1.6; margin: 0 0 12px; font-size: .96rem; font-weight: 600; }
.ana-fact .btn { margin-top: 2px; }

/* ---------- results ---------- */
.ana-results { text-align: center; }
.ana-results h2 { font-size: 1.7rem; font-weight: 1000; letter-spacing: -.02em; margin: .3em 0 .1em; }
.ana-score-big { font-size: 3.8rem; font-weight: 1000; letter-spacing: -.04em; line-height: 1; color: var(--green); margin: .1em 0 .2em; }
.ana-score-big small { font-size: 1.2rem; color: var(--muted); font-weight: 800; }
.ana-rounds { text-align: left; margin: 16px 0; display: grid; gap: 7px; }
.ana-round-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
  background: var(--chip); border: 1px solid var(--line); border-radius: 13px; padding: 9px 12px;
  font-size: .9rem; font-weight: 800;
}
.ana-round-row .rw-word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ana-round-row .rw-word small { color: var(--muted); font-weight: 700; }
.ana-round-row .rw-time { color: var(--muted); font-weight: 700; white-space: nowrap; }
.ana-round-row .rw-pts { font-weight: 1000; color: var(--green); white-space: nowrap; }
.ana-round-row .rw-pts.zero { color: var(--muted); }
.ana-results .menu { display: grid; gap: 10px; margin-top: 6px; }

/* ---------- standalone page chrome ---------- */
.ana-page { max-width: 720px; margin: 0 auto; padding: 14px 16px 30px; }
.ana-brand { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.ana-brand .logo { cursor: default; }
.ana-brand .logo-icon { width: 34px; height: 34px; }
.ana-back { font-weight: 800; font-size: .9rem; color: var(--muted); text-decoration: none; }
.ana-back:hover { color: var(--ink); }

/* ---------- standalone fallbacks (in the quiz app these come from styles.css) ---------- */
.progress { flex: 1; height: 12px; background: var(--track); border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: linear-gradient(90deg, #9ed62a, var(--lime));
  transition: width .35s ease;
}
.score-pill {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-weight: 1000; font-size: .95rem; box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.score-pill.bump { animation: bump .35s cubic-bezier(.34,1.56,.64,1); }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
.round-label { font-weight: 1000; font-size: .98rem; white-space: nowrap; letter-spacing: -.01em; }
.results-emoji { font-size: 4rem; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.results-msg { color: var(--muted); line-height: 1.6; margin: 0 auto 1.3em; max-width: 34ch; font-weight: 700; }
.best { color: var(--muted); margin: 14px 0; font-weight: 800; }
.best b { color: var(--ink); }
body.standalone #ana-home-top, body.standalone #ana-home-btn { display: none; }

/* ---------- phone ---------- */
@media (max-width: 480px) {
  .ana-card { padding: 18px 14px 16px; border-radius: 22px; }
  .ana-slots.sz-lg { --slot: 40px; }
  .ana-slots.sz-md { --slot: 34px; }
  .ana-slots.sz-sm { --slot: 27px; }
  .ana-tray.sz-lg { --slot: 40px; }
  .ana-tray.sz-md { --slot: 34px; }
  .ana-tray.sz-sm { --slot: 27px; }
  .ana-actions .btn { padding: 12px 8px; font-size: .88rem; }
  .ana-score-big { font-size: 3.2rem; }
  .ana-page { padding: 10px 12px 24px; }
}
