/* Spelling Bee · tokens from /assets/base.css */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 260px); gap: 40px; align-items: start; margin: 8px 0 48px; }
@media (max-width: 640px) {
  .layout { grid-template-columns: 1fr; gap: 20px; }
  .side { order: -1; }
}

/* ---------- Message + entry ---------- */
.play { display: grid; justify-items: center; gap: 12px; }
.msg {
  min-height: 30px; margin: 0; padding: 5px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 500; white-space: pre;
  opacity: 0; transform: translateY(4px);
  transition: opacity .2s, transform .2s;
}
.msg.show { opacity: 1; transform: none; }
.msg.bad { background: var(--fg); color: var(--bg); }
.msg.good { background: var(--surface); border: 1px solid var(--line); }
.msg.pangram { background: var(--c-yellow); color: #111; border-color: transparent; }

.entry {
  display: flex; align-items: center; justify-content: center; flex-wrap: nowrap;
  min-height: 48px; max-width: 100%; overflow: hidden;
  font-size: 32px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.entry.long { font-size: 22px; }
.entry .c { color: color-mix(in oklch, var(--c-yellow) 55%, var(--fg)); }
.entry .x { color: var(--muted); }
.caret { width: 2px; height: 1.1em; margin-left: 2px; background: var(--c-yellow); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.entry.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

/* ---------- Hive (flat-topped hexagons) ---------- */
.hive {
  --w: clamp(76px, 24vw, 96px);
  --h: calc(var(--w) * 0.866);
  --gap: 1.07;
  position: relative;
  width: calc(var(--w) * 2.62);
  height: calc(var(--h) * 3.2);
  margin: 4px 0 8px;
  touch-action: manipulation;
  user-select: none;
}
.cell {
  position: absolute;
  left: calc(50% - var(--w) / 2);
  top: calc(50% - var(--h) / 2);
  width: var(--w);
  height: var(--h);
  padding: 0;
  border: 0;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  background: var(--line);
  color: var(--fg);
  font-size: calc(var(--w) * 0.3);
  font-weight: 600;
  cursor: pointer;
  transform: translate(calc(var(--x, 0) * var(--w) * 0.75 * var(--gap)), calc(var(--y, 0) * var(--h) * var(--gap)));
  transition: background-color .15s;
}
.cell span { display: inline-block; transition: opacity .16s, transform .16s; }
.cell:hover { background: var(--line-strong); }
.cell.center { background: var(--c-yellow); color: #111; }
.cell.center:hover { background: color-mix(in oklch, var(--c-yellow) 85%, #000); }
.cell:focus-visible { outline: none; background: var(--line-strong); }
.cell.center:focus-visible { background: color-mix(in oklch, var(--c-yellow) 80%, #000); }
.cell.tap span { animation: tap .2s; }
@keyframes tap { 50% { transform: scale(0.84); } }
.hive.mixing .cell:not(.center) span { opacity: 0; transform: scale(0.6); }

.controls { gap: 10px; }
.controls .btn { min-width: 92px; }
.controls .icon-btn { min-width: 0; width: 42px; height: 42px; padding: 0; display: grid; place-items: center; }
.controls .icon-btn svg { width: 18px; height: 18px; }

/* ---------- Score ---------- */
.side { display: grid; gap: 16px; }
.rank { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.rank b { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.rank span { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.track {
  position: relative; height: 28px; margin: 6px 12px 0;
  background: linear-gradient(var(--line), var(--line)) 0 50% / 100% 2px no-repeat;
}
.track i {
  position: absolute; left: var(--at); top: 50%;
  width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--line-strong);
}
.track i.on { background: var(--c-yellow); }
.track b {
  position: absolute; left: var(--at); top: 50%;
  min-width: 26px; height: 26px; padding: 0 6px; margin: -13px 0 0 -13px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--c-yellow); color: #111; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  transition: left .4s cubic-bezier(.16, 1, .3, 1);
}
.track.up b { animation: rankup .5s cubic-bezier(.34, 1.45, .64, 1); }
@keyframes rankup { 40% { transform: scale(1.35); } }
.next { margin: 0; color: var(--muted); font-size: 13px; }

/* ---------- Found words ---------- */
.found { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.found summary {
  display: flex; align-items: baseline; gap: 10px; padding: 12px 14px;
  cursor: pointer; list-style: none; font-size: 14px; font-weight: 500;
}
.found summary::-webkit-details-marker { display: none; }
.found summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .2s; }
.found[open] summary::after { transform: rotate(180deg); }
.peek { color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.found[open] .peek { display: none; }
.found ul {
  list-style: none; margin: 0; padding: 4px 14px 14px;
  columns: 2; column-gap: 16px; font-size: 14px;
  max-height: 340px; overflow: auto;
}
.found li { padding: 4px 0; border-bottom: 1px solid var(--line); break-inside: avoid; }
.found li.pangram { font-weight: 600; }
.found li.pangram::after { content: " ★"; color: color-mix(in oklch, var(--c-yellow) 70%, var(--fg)); }
.found li.missed { color: var(--muted); }
.found li.fresh { animation: fresh .6s; }
@keyframes fresh { from { background: color-mix(in oklch, var(--c-yellow) 45%, transparent); } }

.link { background: none; border: 0; padding: 0; justify-self: start; color: var(--muted); font-size: 13px; text-decoration: underline; cursor: pointer; }
.link:hover { color: var(--fg); }
