:root {
  color-scheme: light;
  --ink: #17201f;
  --muted: #66706f;
  --line: #dbe3df;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --bg-a: #f6f4ef;
  --bg-b: #dcebe7;
  --bg-c: #f4dfd5;
  --accent: #136f63;
  --accent-dark: #0a4a43;
  --good: #12805c;
  --warn: #ad5d22;
  --bad: #a83434;
  --shadow: 0 16px 50px rgba(33, 46, 44, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.82), transparent 34rem),
    linear-gradient(145deg, var(--bg-a), var(--bg-b) 52%, var(--bg-c));
}

button {
  font: inherit;
}

.app-shell {
  width: min(100%, 720px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  align-content: start;
  gap: 16px;
}

.topbar,
.board-zone,
.clues-zone,
.win-panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 20px;
  border-radius: 8px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.1rem, 12vw, 4.2rem);
  line-height: 0.9;
}

h2 {
  font-size: 1.05rem;
  line-height: 1.25;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(70px, 1fr));
  gap: 8px;
}

.metric {
  min-width: 72px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.metric span,
.attempt-pill {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 3px;
  font-size: 1rem;
}

.board-zone,
.clues-zone,
.win-panel {
  padding: 18px;
  border-radius: 8px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.tool-buttons {
  display: flex;
  gap: 8px;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--panel-strong);
}

.guide-panel {
  display: grid;
  gap: 12px;
  margin: -2px 0 14px;
  padding: 14px;
  border: 1px solid rgba(19, 111, 99, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.guide-panel[hidden] {
  display: none;
}

.guide-panel strong {
  display: block;
  margin-bottom: 4px;
  line-height: 1.25;
}

.guide-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.guide-panel ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-panel li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--ink);
  line-height: 1.35;
}

.guide-panel li span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.guide-dismiss {
  width: 100%;
}

.slot-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.slot,
.token {
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 8px;
}

.slot {
  display: grid;
  place-items: center;
  border: 2px dashed #bcc9c4;
  background: rgba(255, 255, 255, 0.46);
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    background 160ms ease;
}

.slot.selected,
.slot.drag-over {
  border-color: var(--accent);
  background: rgba(19, 111, 99, 0.08);
  transform: translateY(-2px);
}

.slot > .token {
  width: 100%;
  height: 100%;
}

.feedback {
  min-height: 44px;
  margin: 14px 0 12px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.54);
  font-size: 0.94rem;
  line-height: 1.35;
}

.feedback.good {
  color: var(--good);
  border-color: rgba(18, 128, 92, 0.34);
}

.feedback.warn {
  color: var(--warn);
  border-color: rgba(173, 93, 34, 0.34);
}

.palette {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.token {
  display: grid;
  place-items: center;
  border: 1px solid rgba(23, 32, 31, 0.1);
  color: var(--token-ink);
  background: var(--token-bg);
  box-shadow: inset 0 -10px 16px rgba(0, 0, 0, 0.08);
  cursor: grab;
  transition:
    opacity 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.token:active {
  cursor: grabbing;
  transform: scale(0.96);
}

.token.used {
  opacity: 0.32;
}

.token.selected {
  outline: 3px solid rgba(19, 111, 99, 0.26);
  transform: translateY(-2px);
}

.token span {
  font-size: clamp(1.3rem, 8vw, 2.35rem);
  line-height: 1;
}

.actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.primary,
.secondary {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
}

.primary {
  color: #fff;
  background: var(--accent);
}

.primary:active,
.secondary:active,
.icon-button:active {
  transform: translateY(1px);
}

.secondary {
  color: var(--accent-dark);
  border-color: var(--line);
  background: var(--panel-strong);
}

.clue-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 22px;
}

.clue-list li {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  line-height: 1.35;
}

.clue-list li.revealed {
  border-color: rgba(19, 111, 99, 0.34);
  background: rgba(19, 111, 99, 0.08);
}

.attempt-pill {
  width: max-content;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.win-panel {
  border-color: rgba(18, 128, 92, 0.28);
}

.win-panel p:last-of-type {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.share-preview {
  overflow-x: auto;
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.62);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.publisher-mark {
  display: flex;
  justify-content: center;
  gap: 6px;
  color: rgba(23, 32, 31, 0.62);
  font-size: 0.8rem;
  font-weight: 700;
}

.publisher-mark a {
  color: var(--accent-dark);
  text-decoration: none;
}

.publisher-mark a:hover {
  text-decoration: underline;
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100%, 390px);
    padding: 12px;
    gap: 12px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    padding: 16px;
  }

  .status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: 3.2rem;
  }

  .slot-row,
  .palette {
    gap: 6px;
  }

  .board-zone,
  .clues-zone,
  .win-panel {
    padding: 14px;
  }

  .actions {
    grid-template-columns: 1fr;
  }
}
