/* ============================================================================
   WordSeek — cute pastel "panda" theme
   Performance notes:
     - No JS animation libraries; all motion is CSS transform/opacity/filter.
     - Only 4 blurred blobs + 3 toy shapes as ambient (no particle canvas).
     - Confetti is on-demand only. Small DOM, one webfont family.
   Sections:
     1. Tokens   2. Reset/base   3. Background   4. Layout   5. Top bar
     6. Hero + panda mascot   7. Cards   8. Input   9. Results
     10. Side panel   11. Footer   12. Toasts   13. Modal
     14. Keyframes   15. Responsive   16. Reduced motion
   ========================================================================== */

/* ------------------------------------------------------------------ */
/* 1. Design tokens                                                    */
/* ------------------------------------------------------------------ */
:root {
  /* Pastel surfaces */
  --bg-1: #f5f2ff;
  --bg-2: #fef4fb;
  --card: rgba(255, 255, 255, 0.72);
  --card-solid: #ffffff;

  /* Ink */
  --ink: #3b3550;
  --ink-soft: #6d6685;
  --muted: #9a94ad;
  --faint: #bcb7cd;

  /* Pastel accents */
  --lav: #a78bfa;
  --sky: #7cc7ff;
  --mint: #5ee0b0;
  --peach: #ffb59e;
  --pink: #ff9ec4;
  --sun: #ffd76a;
  --panda: #2f2b3a;

  /* Signature gradient */
  --grad: linear-gradient(120deg, #7cc7ff, #a78bfa 48%, #ff9ec4);
  --grad-mint: linear-gradient(120deg, #5ee0b0, #7cc7ff);

  /* Borders */
  --line: rgba(120, 100, 180, 0.14);
  --line-soft: rgba(255, 255, 255, 0.85);

  /* Soft "clay" shadows */
  --clay: 0 18px 40px -18px rgba(120, 95, 190, 0.4), 0 2px 8px rgba(120, 95, 190, 0.08);
  --clay-lg: 0 30px 70px -26px rgba(120, 95, 190, 0.5), 0 4px 14px rgba(120, 95, 190, 0.1);
  --inset-hi: inset 0 2px 0 rgba(255, 255, 255, 0.9);

  /* Motion */
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);   /* overshoot / bouncy */
  --ease: cubic-bezier(0.22, 0.7, 0.28, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --radius: 26px;
  --radius-sm: 16px;
  --maxw: 1160px;
}

/* ------------------------------------------------------------------ */
/* 2. Reset / base                                                     */
/* ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(1100px 700px at 12% -8%, #eae4ff, transparent 60%),
    radial-gradient(1000px 700px at 100% 0%, #dff3ff, transparent 55%),
    radial-gradient(900px 800px at 50% 120%, #ffe9f5, transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
  font-family: "Fredoka", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, textarea, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(167, 139, 250, 0.28); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 21px; padding: 0 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink-soft);
  font: 600 11px/1 "Fredoka", monospace;
  box-shadow: 0 1px 2px rgba(120, 95, 190, 0.08);
}

:focus-visible { outline: 3px solid rgba(124, 199, 255, 0.7); outline-offset: 3px; border-radius: 10px; }

/* ------------------------------------------------------------------ */
/* 3. Background (pastel blobs + toy shapes)                           */
/* ------------------------------------------------------------------ */
.bg { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }

.blob {
  position: absolute; border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}
.blob-lav   { width: 44vw; max-width: 560px; aspect-ratio: 1; background: #c3b0ff; top: -8%; left: -6%;  animation: float1 20s var(--ease) infinite alternate; }
.blob-sky   { width: 38vw; max-width: 480px; aspect-ratio: 1; background: #a9dcff; top: 8%;  right: -8%; animation: float2 24s var(--ease) infinite alternate; }
.blob-mint  { width: 34vw; max-width: 430px; aspect-ratio: 1; background: #b6f2da; bottom: -12%; left: 18%; opacity: 0.5; animation: float3 26s var(--ease) infinite alternate; }
.blob-peach { width: 26vw; max-width: 330px; aspect-ratio: 1; background: #ffd3c4; bottom: 6%; right: 14%; opacity: 0.45; animation: float1 22s var(--ease) infinite alternate-reverse; }

/* Small floating toy shapes — pure CSS, GPU transforms */
.toy { position: absolute; opacity: 0.5; will-change: transform; }
.toy-1 { top: 22%; left: 8%;  width: 26px; height: 26px; border-radius: 9px; background: var(--grad); transform: rotate(12deg); animation: bob 7s var(--ease) infinite; }
.toy-2 { top: 62%; right: 10%; width: 20px; height: 20px; border-radius: 50%; background: linear-gradient(140deg, #ffd76a, #ffb59e); animation: bob 9s var(--ease) infinite 1s; }
.toy-3 { top: 40%; right: 26%; width: 16px; height: 16px; border-radius: 6px; background: linear-gradient(140deg, #5ee0b0, #7cc7ff); transform: rotate(-14deg); animation: bob 8s var(--ease) infinite 0.5s; }

.confetti { position: fixed; inset: 0; z-index: 60; width: 100%; height: 100%; pointer-events: none; }

/* ------------------------------------------------------------------ */
/* 4. Layout                                                           */
/* ------------------------------------------------------------------ */
.page {
  width: min(var(--maxw), 100% - 40px);
  margin: 0 auto;
  padding: 24px 0 40px;
  display: flex; flex-direction: column; gap: 30px;
  min-height: 100dvh;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

/* ------------------------------------------------------------------ */
/* 5. Top bar                                                          */
/* ------------------------------------------------------------------ */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  animation: drop-in 0.6s var(--ease-out) both;
}
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 15px;
  display: grid; place-items: center;
  background: linear-gradient(150deg, #fff, #f2ecff);
  box-shadow: var(--clay), var(--inset-hi);
  border: 1px solid var(--line-soft);
  transition: transform 0.4s var(--bounce);
}
.brand-panda { width: 34px; height: 34px; display: block; }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand-sub  { font-size: 11.5px; color: var(--muted); letter-spacing: 0.02em; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.live-badge, .chip-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 15px;
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: var(--card);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--clay);
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
}
.live-badge i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--mint); box-shadow: 0 0 0 4px rgba(94, 224, 176, 0.22);
  animation: pulse-dot 1.8s ease-in-out infinite;
}
.chip-btn { cursor: pointer; transition: transform 0.3s var(--bounce), box-shadow 0.3s var(--ease); }
.chip-btn kbd { height: 19px; }
.chip-btn:hover { transform: translateY(-2px); box-shadow: var(--clay-lg); }
.chip-btn:active { transform: translateY(0) scale(0.97); }

/* ------------------------------------------------------------------ */
/* 6. Hero + panda mascot                                              */
/* ------------------------------------------------------------------ */
.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 26px;
  animation: rise 0.75s 0.05s var(--ease-out) both;
}
.hero-copy { max-width: 620px; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 15px; border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line-soft);
  box-shadow: var(--clay);
  color: var(--ink-soft);
  font-size: 12.5px; font-weight: 600;
}
.hero-title {
  margin: 20px 0 0;
  font-size: clamp(38px, 6vw, 66px);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.wiggle-text {
  display: inline-block;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: wiggle 6s var(--ease) infinite;
  transform-origin: 10% 90%;
}
.hero-sub {
  margin: 20px 0 0; max-width: 560px;
  color: var(--ink-soft);
  font-size: clamp(15px, 1.7vw, 18px);
  line-height: 1.6; font-weight: 400;
}
.hero-stats { margin-top: 26px; display: flex; gap: 26px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat b { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.stat small { color: var(--muted); font-size: 12.5px; }

/* --- Mascot --- */
.mascot {
  position: relative;
  width: clamp(210px, 26vw, 280px);
  flex: none;
}
.mascot-svg { width: 100%; height: auto; display: block; overflow: visible; }

.mascot-bubble {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  padding: 9px 15px; border-radius: 16px 16px 16px 4px;
  background: #fff; border: 1px solid var(--line-soft);
  box-shadow: var(--clay);
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  white-space: nowrap; z-index: 2;
  animation: bubble-in 0.5s var(--bounce) both;
}
.mascot-bubble::after {
  content: ""; position: absolute; left: 22px; bottom: -7px;
  width: 12px; height: 12px; background: #fff;
  border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft);
  transform: rotate(45deg);
}

/* pieces */
.m-shadow { fill: rgba(120, 95, 190, 0.18); animation: shadow-breathe 4s var(--ease) infinite; }
.m-pedestal { fill: #e7dffb; }
.m-pedestal-top { fill: #f3eeff; }
.m-panda { transform-box: fill-box; transform-origin: center; animation: float-panda 4s var(--ease) infinite; }
.m-eyes { transform-box: fill-box; transform-origin: center; animation: blink 5.5s infinite; }
.m-eyes-happy, .m-mouth-happy, .m-mouth-sad, .m-sparkles { opacity: 0; }

/* Expression states (toggled via data-state on #heroPanda) */
.mascot[data-state="thinking"] .m-panda { animation: think-tilt 2.2s var(--ease) infinite; }
.mascot[data-state="happy"] .m-eyes,
.mascot[data-state="happy"] .m-mouth { opacity: 0; }
.mascot[data-state="happy"] .m-eyes-happy,
.mascot[data-state="happy"] .m-mouth-happy,
.mascot[data-state="happy"] .m-sparkles { opacity: 1; }
.mascot[data-state="happy"] .m-panda { animation: happy-bounce 0.7s var(--bounce); }
.mascot[data-state="happy"] .m-sparkles { animation: sparkle 0.9s var(--ease); }
.mascot[data-state="sad"] .m-mouth { opacity: 0; }
.mascot[data-state="sad"] .m-mouth-sad { opacity: 1; }
.mascot[data-state="sad"] .m-panda { animation: shake 0.5s var(--ease); }

/* ------------------------------------------------------------------ */
/* 7. Cards                                                            */
/* ------------------------------------------------------------------ */
.card {
  position: relative;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line-soft);
  backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: var(--clay-lg), var(--inset-hi);
}
.solver { padding: 26px; animation: rise 0.8s 0.12s var(--ease-out) both; }
.panel  { padding: 20px; animation: rise 0.8s 0.2s var(--ease-out) both; }

.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.section-eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--lav); text-transform: lowercase;
}
.card-title { margin: 5px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }

.mode-badge {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 15px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line-soft);
  box-shadow: var(--clay);
  color: var(--lav); font-size: 13px; font-weight: 600;
  transition: transform 0.3s var(--bounce);
}
.mode-badge .mode-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.mode-badge.mode-4 { color: var(--pink); }
.mode-badge.mode-5 { color: var(--lav); }
.mode-badge.pop { animation: badge-pop 0.45s var(--bounce); }

/* ------------------------------------------------------------------ */
/* 8. Input                                                            */
/* ------------------------------------------------------------------ */
.input-wrap {
  margin-top: 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.85);
  border: 2px solid var(--line);
  box-shadow: inset 0 2px 6px rgba(120, 95, 190, 0.06);
  overflow: hidden;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.3s var(--bounce);
}
.input-wrap:focus-within {
  border-color: var(--sky);
  box-shadow: 0 0 0 5px rgba(124, 199, 255, 0.18), var(--clay);
  transform: translateY(-2px);
}
textarea {
  display: block; width: 100%; min-height: 190px;
  resize: vertical; border: 0; outline: 0;
  padding: 18px 20px;
  background: transparent;
  color: var(--ink);
  caret-color: var(--lav);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px; line-height: 1.7;
}
textarea::placeholder { color: var(--faint); }

.input-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 0 12px 0 18px;
  border-top: 1px solid var(--line);
  background: rgba(245, 242, 255, 0.6);
}
.input-hint { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.input-hint kbd { height: 18px; }

.soft-btn {
  border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 14px; background: #fff; color: var(--ink-soft);
  cursor: pointer; font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 6px rgba(120, 95, 190, 0.08);
  transition: transform 0.25s var(--bounce), box-shadow 0.25s var(--ease), color 0.2s;
}
.soft-btn:hover { transform: translateY(-2px); box-shadow: var(--clay); color: var(--ink); }
.soft-btn:active { transform: translateY(0) scale(0.96); }

/* ------------------------------------------------------------------ */
/* 9. Results                                                          */
/* ------------------------------------------------------------------ */
.results-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 22px 2px 15px;
}
.status-wrap { display: flex; align-items: center; gap: 10px; }
.status-text { color: var(--ink-soft); font-size: 14px; font-weight: 500; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); transition: all 0.3s var(--ease); }
.status-dot.active  { background: var(--mint); box-shadow: 0 0 0 4px rgba(94, 224, 176, 0.22); }
.status-dot.loading { background: var(--sky);  box-shadow: 0 0 0 4px rgba(124, 199, 255, 0.22); animation: pulse-dot 1s infinite; }
.status-dot.error   { background: var(--peach);box-shadow: 0 0 0 4px rgba(255, 181, 158, 0.28); }
.hint-inline { color: var(--muted); font-size: 12.5px; }

/* Skeleton */
.skeleton { display: none; }
.skeleton.show { display: block; animation: fade 0.3s var(--ease) both; }
.sk-hero { height: 116px; border-radius: 20px; margin-bottom: 12px; }
.sk-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.sk-grid span { height: 78px; border-radius: 16px; }
.shimmer { position: relative; background: rgba(167, 139, 250, 0.1); overflow: hidden; }
.shimmer::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.75) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: shimmer-slide 1.4s ease-in-out infinite;
}

/* Best guess */
.best-wrap { margin-bottom: 14px; }
.best-card {
  position: relative; overflow: hidden;
  border-radius: 22px; padding: 20px 22px;
  background: linear-gradient(140deg, #fff, #f4efff 60%, #ffeef7);
  border: 1px solid var(--line-soft);
  box-shadow: var(--clay-lg), var(--inset-hi);
  cursor: pointer;
  transition: transform 0.3s var(--bounce), box-shadow 0.3s var(--ease);
  animation: pop-in 0.55s var(--bounce) both;
}
.best-card:hover { transform: translateY(-4px) rotate(-0.4deg); box-shadow: var(--clay-lg); }
.best-badge {
  font-size: 24px; line-height: 1; pointer-events: none;
  transform-origin: 50% 10%;
  animation: badge-swing 3s var(--ease) infinite;
}
.best-meta { display: flex; align-items: center; gap: 10px; }
.best-tag { font-size: 12.5px; font-weight: 600; color: var(--lav); text-transform: lowercase; letter-spacing: 0.02em; }
.best-word {
  display: block; margin: 8px 0 14px;
  font-size: clamp(46px, 9vw, 72px); font-weight: 700;
  letter-spacing: 0.02em; text-transform: uppercase;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.best-foot { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.best-copy-hint { color: var(--ink-soft); font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.confidence { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.confidence-track { position: relative; flex: 1; height: 9px; min-width: 60px; border-radius: 999px; background: rgba(167, 139, 250, 0.16); overflow: hidden; }
.confidence-fill { position: absolute; inset: 0; width: 0; border-radius: 999px; background: var(--grad); transition: width 0.8s var(--bounce); }
.confidence-pct { font-size: 13px; font-weight: 600; color: var(--ink-soft); min-width: 42px; text-align: right; }

/* Favorite star */
.fav-btn {
  display: inline-grid; place-items: center; margin-left: auto;
  width: 32px; height: 32px; border-radius: 11px;
  border: 1px solid var(--line); background: #fff; color: var(--faint);
  cursor: pointer; box-shadow: 0 2px 5px rgba(120, 95, 190, 0.08);
  transition: transform 0.25s var(--bounce), color 0.2s, border-color 0.2s;
}
.fav-btn .star { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.fav-btn:hover { color: var(--sun); border-color: #ffe39a; transform: scale(1.12) rotate(6deg); }
.fav-btn.is-fav { color: var(--sun); border-color: #ffe39a; background: #fff9e8; }
.fav-btn.is-fav .star { fill: var(--sun); }
.fav-btn.burst { animation: star-burst 0.5s var(--bounce); }

/* Ranked guesses */
.guesses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.guesses:empty { display: none; }
.guess {
  position: relative; overflow: hidden;
  min-height: 84px;
  display: flex; flex-direction: column; justify-content: center; gap: 9px;
  padding: 14px 15px;
  border-radius: 18px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(160deg, #ffffff, #faf7ff);
  box-shadow: var(--clay), var(--inset-hi);
  cursor: pointer; text-align: left;
  transition: transform 0.25s var(--bounce), box-shadow 0.25s var(--ease);
  animation: pop-in 0.5s var(--bounce) both;
  will-change: transform;
}
.guess:hover { transform: translateY(-5px) rotate(-0.5deg); box-shadow: var(--clay-lg); }
.guess:active { transform: translateY(-1px) scale(0.98); }
.guess-top { display: flex; align-items: center; gap: 8px; }
.guess-rank {
  display: inline-grid; place-items: center;
  min-width: 24px; height: 22px; padding: 0 7px;
  border-radius: 8px; background: rgba(167, 139, 250, 0.14);
  color: var(--lav); font-size: 12px; font-weight: 600;
}
.guess-word { font-size: 22px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink); }
.guess .fav-btn { width: 26px; height: 26px; border-radius: 8px; }
.guess .fav-btn .star { width: 13px; height: 13px; }
.guess-bar { height: 6px; border-radius: 999px; background: rgba(167, 139, 250, 0.14); overflow: hidden; }
.guess-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--grad-mint); transition: width 0.7s var(--bounce); }
.guess.copied { border-color: var(--mint); box-shadow: 0 0 0 4px rgba(94, 224, 176, 0.2), var(--clay); }
.best-card.copied { animation: copy-pop 0.5s var(--bounce); }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; min-height: 190px; padding: 24px;
  border: 2px dashed var(--line); border-radius: 20px; text-align: center;
}
.empty-state.hidden { display: none; }
.empty-panda { width: 64px; height: 64px; animation: bob 4s var(--ease) infinite; }
.empty-panda .brand-panda { width: 100%; height: 100%; }
.empty-title { margin: 0; font-size: 15.5px; font-weight: 600; color: var(--ink-soft); }
.empty-sub { margin: 0; font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------------ */
/* 10. Side panel                                                      */
/* ------------------------------------------------------------------ */
.panel-tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 5px; border-radius: 15px;
  background: rgba(167, 139, 250, 0.1);
}
.tab {
  position: relative; z-index: 1; height: 36px; border: 0; border-radius: 11px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 14px; font-weight: 600; transition: color 0.25s var(--ease);
}
.tab.active { color: var(--ink); }
.tab-indicator {
  position: absolute; top: 5px; left: 5px;
  width: calc(50% - 7px); height: 36px; border-radius: 11px;
  background: #fff; box-shadow: var(--clay);
  transition: transform 0.4s var(--bounce);
}
.tab-indicator.right { transform: translateX(calc(100% + 4px)); }

.panel-view { margin-top: 16px; }
.panel-view[hidden] { display: none; }
.panel-list { display: flex; flex-direction: column; gap: 9px; max-height: 430px; overflow-y: auto; padding-right: 2px; }
.panel-list::-webkit-scrollbar { width: 8px; }
.panel-list::-webkit-scrollbar-thumb { background: rgba(167, 139, 250, 0.28); border-radius: 999px; }
.panel-list:empty { display: none; }

.hist-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px; border-radius: 15px;
  border: 1px solid var(--line-soft); background: #fff;
  box-shadow: 0 3px 10px rgba(120, 95, 190, 0.06);
  cursor: pointer; text-align: left;
  transition: transform 0.25s var(--bounce), box-shadow 0.25s var(--ease);
  animation: fade 0.35s var(--ease) both;
}
.hist-item:hover { transform: translateX(3px) translateY(-1px); box-shadow: var(--clay); }
.hist-avatar {
  flex: none; width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center;
  font-size: 16px; font-weight: 700; text-transform: uppercase; color: #fff;
  background: var(--grad);
}
.hist-body { min-width: 0; flex: 1; }
.hist-word { font-size: 15px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; }
.hist-meta { margin-top: 3px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.hist-tag { padding: 1px 7px; border-radius: 7px; font-size: 11px; font-weight: 600; background: rgba(167, 139, 250, 0.16); color: var(--lav); }
.hist-tag.m4 { background: rgba(255, 158, 196, 0.18); color: #e77aa6; }

.fav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px 9px 14px; border-radius: 15px;
  border: 1px solid var(--line-soft); background: #fff;
  box-shadow: 0 3px 10px rgba(120, 95, 190, 0.06);
  animation: fade 0.35s var(--ease) both;
  transition: transform 0.2s var(--bounce);
}
.fav-item:hover { transform: translateX(2px); }
.fav-word {
  flex: 1; min-width: 0; border: 0; background: none; text-align: left; cursor: pointer;
  font-size: 17px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink);
}
.fav-remove {
  flex: none; width: 28px; height: 28px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  cursor: pointer; font-size: 14px; line-height: 1;
  transition: transform 0.2s var(--bounce), color 0.2s;
}
.fav-remove:hover { color: var(--pink); transform: scale(1.1) rotate(90deg); }

.panel-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 34px 14px; }
.panel-empty[hidden] { display: none; }
.panel-empty-icon { font-size: 34px; animation: bob 3.5s var(--ease) infinite; }
.panel-empty p { margin: 0; font-size: 14.5px; font-weight: 600; color: var(--ink-soft); }
.panel-empty small { color: var(--muted); font-size: 12.5px; max-width: 220px; line-height: 1.5; }
.panel-clear { margin: 14px auto 0; display: block; }
.panel-clear[hidden] { display: none; }

/* ------------------------------------------------------------------ */
/* 11. Footer                                                          */
/* ------------------------------------------------------------------ */
.site-footer { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--muted); font-size: 13px; }
.footer-dot { width: 4px; height: 4px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------------ */
/* 12. Toasts                                                          */
/* ------------------------------------------------------------------ */
.toast-stack {
  position: fixed; left: 50%; bottom: 26px; z-index: 80;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  pointer-events: none;
}
.toast {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 17px 11px 14px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line-soft);
  box-shadow: var(--clay-lg);
  color: var(--ink); font-size: 13.5px; font-weight: 600;
  transform: translateY(16px) scale(0.9); opacity: 0;
  animation: toast-in 0.4s var(--bounce) forwards;
}
.toast.out { animation: toast-out 0.3s var(--ease) forwards; }
.toast .toast-icon { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 50%; font-size: 12px; font-weight: 700; }
.toast.success .toast-icon { background: rgba(94, 224, 176, 0.2); color: #1eb381; }
.toast.info .toast-icon { background: rgba(124, 199, 255, 0.22); color: #3a97e8; }
.toast.error .toast-icon { background: rgba(255, 158, 196, 0.22); color: #e77aa6; }
.toast b { font-weight: 700; letter-spacing: 0.03em; }

/* ------------------------------------------------------------------ */
/* 13. Modal                                                           */
/* ------------------------------------------------------------------ */
.modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(120, 100, 180, 0.24);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade 0.3s var(--ease) both;
}
.modal-card { position: relative; width: min(420px, 100%); padding: 24px; background: var(--card-solid); animation: pop-in 0.45s var(--bounce) both; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 19px; font-weight: 700; }
.modal-close { width: 34px; padding: 0; }
.shortcut-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.shortcut-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
  font-size: 14px; color: var(--ink-soft);
}
.shortcut-list li:last-child { border-bottom: 0; }
.shortcut-list .keys { display: inline-flex; gap: 5px; }

/* ------------------------------------------------------------------ */
/* 14. Keyframes                                                       */
/* ------------------------------------------------------------------ */
@keyframes rise      { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes drop-in   { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes fade      { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in    { 0% { opacity: 0; transform: translateY(14px) scale(0.94); } 100% { opacity: 1; transform: none; } }
@keyframes pulse-dot { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.75); opacity: 0.6; } }
@keyframes shimmer-slide { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }
@keyframes wiggle    { 0%, 100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }
@keyframes badge-pop { 0% { transform: scale(0.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes badge-swing { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@keyframes star-burst { 0% { transform: scale(1); } 45% { transform: scale(1.4) rotate(12deg); } 100% { transform: scale(1); } }
@keyframes copy-pop  { 0% { box-shadow: 0 0 0 0 rgba(94, 224, 176, 0.5), var(--clay-lg); } 100% { box-shadow: 0 0 0 16px rgba(94, 224, 176, 0), var(--clay-lg); } }
@keyframes toast-in  { to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes toast-out { to { transform: translateY(10px) scale(0.9); opacity: 0; } }

/* background motion */
@keyframes float1 { from { transform: translate(0, 0) scale(1); } to { transform: translate(40px, 40px) scale(1.12); } }
@keyframes float2 { from { transform: translate(0, 0) scale(1); } to { transform: translate(-50px, 30px) scale(1.08); } }
@keyframes float3 { from { transform: translate(0, 0) scale(1); } to { transform: translate(36px, -40px) scale(1.1); } }
@keyframes bob    { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-10px) rotate(6deg); } }

/* mascot motion */
@keyframes float-panda   { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes shadow-breathe{ 0%, 100% { transform: scale(1); opacity: 0.18; } 50% { transform: scale(0.86); opacity: 0.12; } }
@keyframes blink         { 0%, 92%, 100% { transform: scaleY(1); } 96% { transform: scaleY(0.1); } }
@keyframes think-tilt    { 0%, 100% { transform: rotate(-4deg) translateY(0); } 50% { transform: rotate(4deg) translateY(-6px); } }
@keyframes happy-bounce  { 0% { transform: translateY(0); } 30% { transform: translateY(-16px) scale(1.04); } 60% { transform: translateY(0) scale(0.98); } 100% { transform: translateY(0); } }
@keyframes shake         { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px) rotate(-2deg); } 75% { transform: translateX(6px) rotate(2deg); } }
@keyframes sparkle       { 0% { opacity: 0; transform: scale(0.6); } 40% { opacity: 1; transform: scale(1.1); } 100% { opacity: 0; transform: scale(1); } }
@keyframes bubble-in     { 0% { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.85); } 100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); } }

/* ------------------------------------------------------------------ */
/* 15. Responsive                                                      */
/* ------------------------------------------------------------------ */
@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .panel { order: 2; }
  .panel-list { max-height: 340px; }
}
@media (max-width: 780px) {
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .hero-copy { order: 2; }
  .mascot { order: 1; width: clamp(190px, 52vw, 240px); }
  .hero-stats { justify-content: center; }
  .eyebrow { margin: 0 auto; }
}
@media (max-width: 720px) {
  .page { width: min(100% - 26px, var(--maxw)); gap: 24px; }
  .brand-sub { display: none; }
  .live-badge { display: none; }
  .solver { padding: 18px; }
  .guesses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sk-grid { grid-template-columns: repeat(2, 1fr); }
  .hint-inline { display: none; }
}
@media (max-width: 420px) {
  .page { width: min(100% - 18px, var(--maxw)); }
  .card-title { font-size: 19px; }
  textarea { min-height: 170px; font-size: 14px; }
  .best-foot { flex-direction: column; align-items: stretch; gap: 12px; }
  .best-copy-hint { justify-content: flex-end; }
}

/* ------------------------------------------------------------------ */
/* 16. Reduced motion                                                  */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .blob, .toy, .m-panda, .m-eyes { animation: none !important; }
}
