/* style.css — Spelling Hive */
:root{
  --bg: #1a1206;
  --bg2: #241a0a;
  --panel: rgba(40, 28, 10, 0.72);
  --panel-border: rgba(255, 200, 80, 0.18);
  --honey: #f6b21a;
  --honey-2: #f5911e;
  --amber: #d97f1e;
  --cream: #fdf3d8;
  --muted: #c9b287;
  --text: #fbeec6;
  --good: #6fcf6a;
  --bad: #ef6b5b;
  --shadow: 0 10px 30px rgba(0,0,0,0.45);
  color-scheme: dark;
}
html[data-theme="light"]{
  --bg: #fbf3da;
  --bg2: #f5e7bf;
  --panel: rgba(255, 252, 240, 0.85);
  --panel-border: rgba(120, 80, 10, 0.18);
  --text: #3a280a;
  --muted: #7a5c22;
  --cream: #3a280a;
  --shadow: 0 10px 30px rgba(120, 80, 10, 0.18);
  color-scheme: light;
}
@media (prefers-color-scheme: light){
  html:not([data-theme="dark"]){
    --bg: #fbf3da;
    --bg2: #f5e7bf;
    --panel: rgba(255, 252, 240, 0.85);
    --panel-border: rgba(120, 80, 10, 0.18);
    --text: #3a280a;
    --muted: #7a5c22;
    --cream: #3a280a;
    --shadow: 0 10px 30px rgba(120, 80, 10, 0.18);
    color-scheme: light;
  }
}

*{ box-sizing: border-box; }
html, body{
  margin:0; padding:0; height:100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  overflow: hidden;
}
body{
  background:
    radial-gradient(1100px 700px at 85% -10%, rgba(246,178,26,0.16), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(217,127,30,0.18), transparent 60%),
    linear-gradient(160deg, var(--bg), var(--bg2));
}

#app{
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 18px;
  gap: 12px;
}

/* Top bar */
.topbar{
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.brand{ display:flex; align-items:center; gap:12px; }
.brand-bee{ width: 44px; height: 44px; filter: drop-shadow(0 3px 5px rgba(0,0,0,0.4)); animation: hover 3s ease-in-out infinite; }
@keyframes hover{ 0%,100%{ transform: translateY(0) rotate(-2deg);} 50%{ transform: translateY(-5px) rotate(2deg);} }
.brand h1{
  margin:0; font-size: 22px; letter-spacing: 0.04em;
  color: var(--cream); font-weight: 800;
  text-shadow: 0 2px 0 rgba(0,0,0,0.35);
}
.tag{ margin:2px 0 0; font-size: 12px; color: var(--muted); }

.stats{ display:flex; gap:10px; }
.stat{
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 6px 12px; min-width: 56px; text-align:center;
  box-shadow: var(--shadow);
}
.stat-num{ display:block; font-size: 20px; font-weight: 800; color: var(--honey); line-height:1.1; }
.stat-label{ display:block; font-size: 10px; text-transform: uppercase; letter-spacing:0.12em; color: var(--muted); }

/* Stage */
.stage{
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 14px;
  overflow: hidden;
}
@media (max-width: 820px){
  .stage{ grid-template-columns: 1fr; grid-template-rows: auto 1fr; overflow: auto; }
  #app{ overflow: hidden; }
}

/* Hive */
.hive-wrap{
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 14px;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  min-height: 0;
}
.hive{
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  align-content: center;
  justify-items: center;
}
.hex{
  width: 100%;
  aspect-ratio: 1 / 1.1547;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(160deg, rgba(255,210,90,0.10), rgba(120,80,10,0.18));
  border: 0;
  position: relative;
  transition: background 0.4s ease, transform 0.4s ease;
}
.hex-inner{
  position:absolute; inset: 3px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: rgba(20,12,4,0.35);
  display:flex; align-items:center; justify-content:center;
  transition: background 0.4s ease;
}
.hex.filled{
  background: linear-gradient(160deg, #ffd866, #f6b21a 55%, #d97f1e);
  animation: pop 0.45s cubic-bezier(.2,1.4,.4,1);
}
.hex.filled .hex-inner{ background: linear-gradient(160deg, #ffe9a8, #f6b21a); }
@keyframes pop{ 0%{ transform: scale(0.4); } 60%{ transform: scale(1.12);} 100%{ transform: scale(1);} }
.bee{ width: 78%; height: 78%; }
.hex.filled .bee{ animation: wiggle 2.6s ease-in-out infinite; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.35)); }
@keyframes wiggle{ 0%,100%{ transform: rotate(-4deg);} 50%{ transform: rotate(4deg);} }
.hive-caption{
  text-align:center; margin: 10px 0 2px;
  font-size: 13px; color: var(--muted); min-height: 18px;
}

/* Panel */
.panel{
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 16px;
  display: flex; flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
  min-height: 0;
  overflow: auto;
}
.hidden{ display: none !important; }

/* Attempts */
.attempts{ display:flex; gap:8px; justify-content:center; }
.drop{
  width: 16px; height: 20px;
  background: radial-gradient(circle at 35% 30%, #ffe39a, var(--honey) 60%, var(--amber));
  clip-path: polygon(50% 0, 100% 38%, 80% 100%, 20% 100%, 0 38%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
  transition: opacity 0.3s, filter 0.3s, transform 0.3s;
}
.drop.used{ opacity: 0.25; filter: grayscale(0.9); transform: translateY(2px); }

/* Word controls */
.word-controls{ display:flex; gap:8px; flex-wrap: wrap; }
.speak-btn{
  display:inline-flex; align-items:center; gap:8px;
  border: none; cursor: pointer;
  font-family: inherit; font-weight: 700;
  padding: 11px 16px; border-radius: 12px;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s;
  font-size: 14px;
}
.speak-btn svg{ width: 18px; height: 18px; }
.speak-btn.primary{
  background: linear-gradient(160deg, var(--honey), var(--honey-2));
  color: #2a1d0a;
  box-shadow: 0 6px 14px rgba(246,178,26,0.35);
  flex: 1; justify-content: center;
}
.speak-btn.primary:hover{ transform: translateY(-1px); box-shadow: 0 9px 18px rgba(246,178,26,0.45); }
.speak-btn.primary:active{ transform: translateY(0); }
.speak-btn.ghost{
  background: rgba(255,210,90,0.10);
  color: var(--cream);
  border: 1px solid var(--panel-border);
}
.speak-btn.ghost:hover{ background: rgba(255,210,90,0.18); }

/* Clue card */
.card{
  background: rgba(0,0,0,0.18);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px 14px;
}
html[data-theme="light"] .card{ background: rgba(120,80,10,0.06); }
.clue-label{
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--honey); font-weight: 800; margin-bottom: 6px;
}
.clue-text{ margin:0; font-size: 15px; line-height: 1.5; color: var(--text); }
.clue-meta{ margin-top: 8px; display:flex; gap:8px; }
.clue-meta .pos, .clue-meta .len{
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: rgba(246,178,26,0.16); color: var(--cream);
  border: 1px solid var(--panel-border);
}

/* Spell form */
.spell-form{ display:flex; gap:8px; }
.spell-input{
  flex:1; min-width: 0;
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 20px; letter-spacing: 0.06em;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(0,0,0,0.28);
  border: 1px solid var(--panel-border);
  color: var(--cream);
  outline: none;
  transition: border 0.2s, box-shadow 0.2s;
}
html[data-theme="light"] .spell-input{ background: rgba(255,255,255,0.7); color: var(--text); }
.spell-input:focus{ border-color: var(--honey); box-shadow: 0 0 0 3px rgba(246,178,26,0.22); }
.submit-btn{
  background: linear-gradient(160deg, #6fcf6a, #4 caf50);
  background: linear-gradient(160deg, #6fcf6a, #46a846);
  color: #08260a; border: none; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 14px;
  padding: 12px 18px; border-radius: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 6px 14px rgba(70,168,70,0.3);
}
.submit-btn:hover{ transform: translateY(-1px); }
.submit-btn:active{ transform: translateY(0); }

/* Feedback */
.feedback{ min-height: 20px; font-size: 13px; font-weight: 600; }
.feedback.wrong{ color: var(--bad); }
.feedback.good{ color: var(--good); }

.hint-row{ display:flex; gap:8px; align-items:center; justify-content:center; color: var(--muted); font-size: 12px; margin-top: auto; }
.dot{ opacity: 0.6; }
.link-btn{
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-family: inherit; font-size: 12px;
  text-decoration: underline; padding: 4px;
}
.link-btn:hover{ color: var(--cream); }

/* Reveal */
.reveal{ text-align:center; align-items:center; justify-content:center; }
.reveal-icon{ width: 64px; height: 64px; }
.reveal-icon svg{ width:100%; height:100%; }
.reveal h2{ margin: 4px 0 2px; font-size: 26px; color: var(--cream); }
.reveal.missed h2{ color: #ffb4a8; }
.reveal-sub{ margin:0; color: var(--muted); font-size: 13px; }
.reveal-word{
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 40px; font-weight: 800; letter-spacing: 0.06em;
  color: var(--honey);
  margin: 12px 0 6px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.3);
}
.reveal.missed .reveal-word{ color: #ff9d8f; }
.reveal-def{ margin:0 0 14px; color: var(--text); font-size: 15px; line-height: 1.5; max-width: 420px; }
.next-btn{
  background: linear-gradient(160deg, var(--honey), var(--honey-2));
  color: #2a1d0a; border: none; cursor: pointer;
  font-family: inherit; font-weight: 800; font-size: 15px;
  padding: 13px 26px; border-radius: 12px;
  box-shadow: 0 6px 14px rgba(246,178,26,0.35);
  transition: transform 0.15s;
}
.next-btn:hover{ transform: translateY(-1px); }

/* Footer */
.foot{
  text-align:center; font-size: 11px; color: var(--muted);
  padding: 2px 0 4px;
}
.foot b{ color: var(--cream); }

/* Small screens */
@media (max-width: 480px){
  .brand h1{ font-size: 18px; }
  .stat{ padding: 5px 9px; min-width: 48px; }
  .stat-num{ font-size: 16px; }
  .hive{ grid-template-columns: repeat(4, 1fr); }
  .reveal-word{ font-size: 30px; }
  .spell-input{ font-size: 18px; }
  .word-controls{ flex-direction: column; }
  .speak-btn.ghost{ justify-content:center; }
}
