:root {
  /* Mootsmog cream-teal - matches hub / Path Memory / One Stroke light theme */
  --bg: #FDF0D5;
  --bg-deep: #F5E4C4;
  --panel: #ffffff;
  --panel-2: #F7EBD0;
  --text: #2C2416;
  --muted: #7A6A52;
  --accent: #249D8F;
  --accent-2: #1A7A6F;
  --gold: #E9C46A;
  --coral: #E76F51;
  --border: rgba(36, 157, 143, 0.35);
  --border-strong: rgba(26, 122, 111, 0.42);
  --ok: #249D8F;
  --danger: #E76F51;
  --warn: #c4882a;
  --grid-line: #2C2416;
  --cell: #eef6f7;
  --board-bg: #FFF8EB;
  --mark: #3a4a55;
  --flower: #2C2416;
  --conflict: rgba(231, 111, 81, 0.35);
  --radius: 16px;
  --shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 10px 30px rgba(36, 157, 143, 0.12),
    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 {
  margin: 0;
  padding: 0;
  min-height: 100%;
  min-height: 100dvh;
  background-color: var(--bg-deep);
}

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);
  /* Page paper from /shared/notebook-bg.css */
}

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

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

.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(--accent-2);
}

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(36, 157, 143, 0.16), rgba(26, 122, 111, 0.08));
  border: 1px solid rgba(36, 157, 143, 0.35);
  color: var(--accent-2);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

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

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

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

.stat-chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  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(--accent), var(--ok));
  border-radius: 999px;
  transition: width 0.15s ease;
}

.board-frame {
  position: relative;
  width: 100%;
  max-width: min(100%, 520px);
  margin: 0 auto;
  aspect-ratio: 1;
  background: var(--board-bg);
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  touch-action: manipulation;
  cursor: pointer;
}

.board-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
}

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

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

button:hover {
  background: #fff;
  border-color: var(--border-strong);
  box-shadow: 0 4px 12px rgba(36, 157, 143, 0.12);
}

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

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: var(--accent);
  color: #fff;
}

button.primary:hover {
  filter: brightness(1.05);
}

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

/* Anchor styled as toolbar/modal button (not a bare hyperlink) */
a.btn-link,
a.btn-link:link,
a.btn-link:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.08s ease,
    box-shadow 0.12s ease;
}

a.btn-link:hover {
  background: #fff;
  border-color: var(--border-strong);
  box-shadow: 0 4px 12px rgba(36, 157, 143, 0.12);
  color: var(--text);
  text-decoration: none;
}

a.btn-link:active {
  transform: scale(0.97);
  color: var(--text);
  text-decoration: 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(--coral, 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: 20px;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 40, 48, 0.45);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
  box-shadow: var(--shadow);
  text-align: center;
}

.modal-card h2 {
  margin: 0 0 8px;
  color: var(--ok);
}

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

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

/* Puzzle info box under How to play (matches One Stroke) */
.side-meta {
  background: var(--panel-2, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.88rem;
  color: var(--muted, #5a6a72);
  margin: 0 0 12px;
}
.side-meta dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  margin: 0;
}
.side-meta dt {
  color: var(--muted, #5a6a72);
  font-weight: 500;
}
.side-meta dd {
  margin: 0;
  color: var(--text, #1a2a30);
  font-weight: 600;
}


/* PALETTE-RICH OVERRIDES */
button.primary,
.btn-primary,
#btn-check.primary {
  background: linear-gradient(180deg, #3DB5A3 0%, var(--accent) 55%, var(--accent-2) 100%) !important;
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  color: #fff !important;
  box-shadow: 0 6px 16px rgba(36, 157, 143, 0.28);
}
button.primary:hover,
.btn-primary:hover {
  filter: brightness(1.05);
}
#btn-share-x,
#btn-share-x-win,
#btn-share,
.btn-x-share {
  background: linear-gradient(180deg, var(--gold) 0%, #D4A84A 100%) !important;
  border-color: color-mix(in srgb, var(--gold) 60%, #8a6a20) !important;
  color: #2C2416 !important;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(233, 196, 106, 0.35);
}
.status.bad,
.bad {
  color: var(--coral, #E76F51) !important;
}
.status.ok,
.ok {
  color: var(--accent) !important;
}
.progress > span,
.progress-bar,
#progress-bar,
#question-timer-fill {
  background: linear-gradient(90deg, var(--accent), var(--gold)) !important;
}
.hero .badge,
.badge {
  color: var(--accent-2);
  border-color: color-mix(in srgb, var(--gold) 45%, var(--border));
  background: color-mix(in srgb, var(--gold) 18%, var(--panel));
}
a.nav-home {
  color: var(--accent-2);
}
a.nav-home:hover {
  color: var(--coral);
}


/* CORAL-EMPHASIS */
button:not(.primary):not(.btn-primary):hover {
  border-color: #E76F51 !important;
  color: #C9543A !important;
}
#btn-clear,
#btn-skip,
#btn-reset,
button[id*="clear"],
button[id*="reset"],
button[id*="skip"] {
  border-color: color-mix(in srgb, #E76F51 40%, var(--border)) !important;
  color: #C9543A !important;
}
#btn-clear:hover,
#btn-reset:hover,
#btn-skip:hover {
  background: color-mix(in srgb, #E76F51 14%, var(--panel)) !important;
}
.cell.wrong,
.wrong,
.is-wrong,
[data-wrong="1"] {
  background: #F8C4B4 !important;
  box-shadow: inset 0 0 0 2px #E76F51 !important;
}
.timer,
#timer,
.stat-chip .value {
  color: #C9543A;
}
.clue-current,
.hint-bar {
  border-left: 3px solid #E76F51;
}
.modal-actions #btn-close-modal,
#btn-close-modal,
#btn-close-win {
  border-color: color-mix(in srgb, #E76F51 45%, var(--border)) !important;
  color: #C9543A !important;
}
a.btn-link {
  border-color: color-mix(in srgb, #E76F51 35%, var(--border)) !important;
  color: #C9543A !important;
}
a.btn-link:hover {
  background: color-mix(in srgb, #E76F51 12%, #FFFBF3) !important;
}
