:root {
  --bg: #fbf6e9;
  --panel: #f2e9d4;
  --ink: #2f2a24;
  --muted: #6b6255;
  --pink: #c2185b;       /* site pink, darkened for contrast on cream */
  --teal: #0f7f76;       /* site teal, darkened */
  --line: #ddd0b3;
  --btn: #ffffff;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#app { max-width: 560px; margin: 0 auto; padding: 12px 16px 32px; }

header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 { margin: 0; font-size: 24px; letter-spacing: .5px; color: var(--pink); }
.stats { display: flex; gap: 14px; }
.stat { text-align: center; min-width: 52px; }
.stat .lbl, .lbl { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.stat b { font-size: 20px; font-variant-numeric: tabular-nums; }

#progress { margin: 10px 0 6px; }
#bar { height: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
#fill { height: 100%; width: 0; background: linear-gradient(90deg, #2ec4b6, #ff5f9e); transition: width .35s ease; }
#barText { font-size: 13px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }

#palette { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
#palette .lbl { white-space: nowrap; }
#swatches { width: 300px; max-width: 100%; height: 30px; }

#boardWrap { position: relative; width: 100%; aspect-ratio: 1; }
#board {
  width: 100%; height: 100%; display: block; touch-action: none;
  border-radius: 14px; background: var(--panel); border: 1px solid var(--line);
  cursor: pointer;
}
#toast {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, .95); color: var(--ink);
  border: 2px solid var(--pink); border-radius: 14px; padding: 12px 18px;
  font-size: 17px; text-align: center; max-width: 86%;
  box-shadow: 0 8px 24px rgba(80, 60, 20, .18);
  pointer-events: none; transition: opacity .25s;
}
#toast b { display: block; font-size: 22px; color: var(--pink); margin-bottom: 2px; }
#toast.hidden { opacity: 0; }

#controls { display: flex; gap: 8px; margin-top: 12px; }
button {
  flex: 1; font: inherit; font-weight: 600; padding: 10px 8px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--btn); color: var(--ink); cursor: pointer;
}
button:hover { border-color: var(--teal); }
button.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
button.primary:hover { background: #0c6b63; }
button.warn { background: #fde4ec; border-color: var(--pink); color: var(--pink); }
#hintText { min-height: 22px; margin-top: 8px; font-size: 14px; color: var(--muted); text-align: center; }

#more { margin-top: 10px; }
.statrow { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 13px; color: var(--muted); }
.statrow b { color: var(--ink); font-variant-numeric: tabular-nums; }
details { margin-top: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
summary { cursor: pointer; font-weight: 600; }
details ul { margin: 8px 0 4px; padding-left: 20px; }
details li { margin: 4px 0; }
