:root {
  /* Mootsmog cream / teal / gold / coral — matches site-theme.css */
  --bg: #fdf0d5;
  --bg-deep: #f5e4c4;
  --panel: #fffbf3;
  --panel-2: #f8eedc;
  --text: #2c2416;
  --muted: #7a6a52;
  --accent: #249d8f;
  --accent-2: #1a7a6f;
  --gold: #e9c46a;
  --gold-2: #f4d27a;
  --coral: #e76f51;
  --border: rgba(36, 157, 143, 0.28);
  --border-strong: rgba(26, 122, 111, 0.45);
  --ok: #249d8f;
  --danger: #e76f51;
  --cell: #ffffff;
  --blocked: #c5c1b8;
  --grid-line: #2c2416;
  --path: #e9c46a;
  --radius: 22px;
  --shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 10px 30px rgba(36, 157, 143, 0.1),
    0 2px 8px rgba(44, 36, 22, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100dvh;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  line-height: 1.4;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(900px 520px at 12% -8%, rgba(233, 196, 106, 0.28) 0%, transparent 55%),
    radial-gradient(800px 480px at 92% 6%, rgba(36, 157, 143, 0.16) 0%, transparent 50%),
    linear-gradient(180deg, #fff8ea 0%, var(--bg) 40%, var(--bg-deep) 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-attachment: fixed;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 12px 20px;
}

header.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 8px;
}

.nav-home {
  display: inline-block;
  margin-bottom: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.nav-home:hover {
  color: var(--coral);
}

header.hero h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  letter-spacing: -0.02em;
  font-weight: 750;
}

header.hero .sub {
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(233, 196, 106, 0.45), rgba(36, 157, 143, 0.12));
  border: 2px solid #2c2416;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 3px 3px 0 var(--coral);
}

.layout {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 320px);
  gap: 16px;
  align-items: start;
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel);
  border: 3px solid #2c2416;
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 #2c2416;
  padding: 14px;
}

.stats-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.stat-chip {
  background: var(--panel-2);
  border: 2px solid #2c2416;
  border-radius: 12px;
  padding: 8px 12px;
  min-width: 72px;
}

.stat-chip .label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-chip .value {
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.hint-bar {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 10px;
  min-height: 1.3em;
}

.progress {
  height: 4px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  border-radius: 999px;
  transition: width 0.15s ease;
}

.board-frame {
  position: relative;
  display: flex;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  border-radius: 4px;
  border: 3px solid #2c2416;
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
}

.board-frame svg {
  display: block;
  width: auto;
  height: min(52vh, 520px);
  max-width: 100%;
}

.board-frame.wrong {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.clue {
  margin: 10px 8px 2px;
  text-align: center;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(1.05rem, 2.4vw, 1.45rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  min-height: 1.6em;
}

.clue .ellipsis {
  font-weight: 400;
  opacity: 0.55;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

button {
  appearance: none;
  border: 2px solid #2c2416;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.08s ease;
}

button:hover {
  background: #f3e2bf;
}

button:active {
  transform: scale(0.97);
}

button.primary {
  background: var(--accent);
  border-color: #2c2416;
  color: #fff;
}

button.primary:hover {
  background: var(--accent-2);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.status {
  margin-top: 10px;
  min-height: 1.4em;
  font-size: 0.9rem;
  color: var(--muted);
}

.status.ok {
  color: var(--ok);
}

.status.bad {
  color: var(--danger);
}

.side-panel h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.howto {
  margin: 0 0 14px;
  padding-left: 1.2em;
  color: var(--muted);
  font-size: 0.9rem;
}

.howto li {
  margin-bottom: 8px;
}

.howto strong {
  color: var(--text);
}

.side-meta {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.55;
  margin-bottom: 12px;
}

.side-meta strong {
  color: var(--text);
}

.footnote {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
  opacity: 0.9;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(44, 36, 22, 0.45);
}

.modal-card {
  position: relative;
  background: var(--panel);
  border: 3px solid #2c2416;
  border-radius: var(--radius);
  box-shadow: 8px 8px 0 var(--coral);
  padding: 22px 22px 18px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.modal-card h2 {
  margin: 0 0 8px;
  font-size: 1.45rem;
}

.win-headline {
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--accent-2);
}

.win-stats {
  color: var(--muted);
  margin: 0 0 16px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
