/* Cat Tracks: a fresh meadow page, letter stones on a ground that changes with the unlocks, trails along found words.
   The title screen and the sheets are shared/mainmenu.js (menu.css, loaded after this); only their colors are set here. */
:root {
  --bg: #eef4e6; --bg-hi: #fbfdf6; --ink: #34402c; --ink-soft: #66735c; --line: rgba(52, 64, 44, 0.18);
  --accent: #3f8f6b; --accent-dark: #2b6c50; --sheet: #fbfdf7; --card: #fffefa;
  --theme: #79b8e0; --theme-ink: #2f6f9c; --span: #f2c14e; --span-ink: #a8741a; --trace: #c7a6e6; --trace-ink: #6f4aa0;
  --cell: 56px;
  color-scheme: light;
}
* { box-sizing: border-box; }
* { touch-action: manipulation; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Baloo 2", ui-rounded, system-ui, sans-serif; color: var(--ink);
  background: radial-gradient(ellipse 110% 60% at 50% 0%, var(--bg-hi), transparent 70%), var(--bg);
  overflow: hidden; overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
.app {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: calc(var(--sg-corner-top) - 2px) 10px calc(env(safe-area-inset-bottom, 0px) + 10px);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.app > * { width: 100%; max-width: 480px; }

/* ---- top bar ---- */
.bar { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; gap: 8px; }
.icon-btn {
  width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 16px;
  background: rgba(255, 255, 255, 0.8); box-shadow: 0 2px 0 rgba(52, 64, 44, 0.12); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { transform: scale(0.94); }
.sub { margin: 0; text-align: center; font-weight: 800; font-size: 17px; line-height: 1.2; color: var(--ink-soft); min-width: 0; }
.sub b { color: var(--ink); font-size: 19px; }
.sub .tag { display: inline-block; margin-left: 6px; padding: 1px 8px 0; border-radius: 999px; background: #e3d6f5; color: #4d2f80; font-size: 13px; }

/* ---- the clue ---- */
.clue { text-align: center; padding: 6px 12px 4px; border-radius: 18px; background: #fff; box-shadow: 0 2px 0 rgba(52, 64, 44, 0.1); }
.clue-head { margin: 0; font-weight: 800; font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); }
.clue-text { margin: 0; font-weight: 800; font-size: 22px; line-height: 1.15; }
.status { margin: 0; text-align: center; font-weight: 700; font-size: 15px; color: var(--ink-soft); }
.status b { color: var(--ink); }
.word { margin: 0; min-height: 34px; text-align: center; font-weight: 800; font-size: 26px; line-height: 34px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--trace-ink); }
.word.shake { animation: shake 0.42s ease-in-out; }

/* ---- the grid ---- */
.stage { flex: 1; min-height: 0; display: flex; align-items: flex-start; justify-content: center; padding-top: 4px; }
.board {
  position: relative; width: calc(var(--cell) * 6 + 16px); height: calc(var(--cell) * 8 + 16px); padding: 8px; border-radius: 24px;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.6), 0 8px 22px -14px rgba(52, 64, 44, 0.6);
  touch-action: none;
}
.trails { position: absolute; left: 8px; top: 8px; width: calc(var(--cell) * 6); height: calc(var(--cell) * 8); overflow: visible; pointer-events: none; }
.cells { position: relative; display: grid; grid-template-columns: repeat(6, var(--cell)); grid-template-rows: repeat(8, var(--cell)); }
.cell {
  display: grid; place-items: center; width: var(--cell); height: var(--cell); padding: 0; border: 0; background: transparent; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cell span {
  display: grid; place-items: center; width: calc(var(--cell) * 0.84); height: calc(var(--cell) * 0.84); padding-top: 3px; border-radius: 50%;
  background: #fffaf1; box-shadow: 0 2px 0 rgba(52, 64, 44, 0.16); font-weight: 800; font-size: calc(var(--cell) * 0.52); line-height: 1;
  color: #3f3226; transition: background 0.15s, transform 0.1s;
}
.cell.on span { background: var(--trace); color: #fff; transform: scale(1.06); }
.cell.theme span { background: var(--theme); color: #fff; }
.cell.span span { background: var(--span); color: #4a3200; }
.cell.outline span { box-shadow: 0 0 0 3px var(--accent-dark), 0 2px 0 rgba(52, 64, 44, 0.16); animation: glow 1.6s ease-in-out infinite; }
.cell:focus-visible span { outline: 3px solid var(--accent-dark); outline-offset: 2px; }

/* ---- the hint button and meter ---- */
.controls { flex: none; display: flex; justify-content: center; padding-top: 2px; }
.hint {
  min-width: 210px; min-height: 56px; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; align-items: center;
  justify-content: center; column-gap: 10px; padding: 5px 18px 3px; border: 2px solid rgba(52, 64, 44, 0.2); border-radius: 999px;
  background: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.hint-label { font-weight: 800; font-size: 18px; }
.meter { display: flex; gap: 4px; }
.meter i { width: 18px; height: 10px; border-radius: 5px; background: rgba(52, 64, 44, 0.14); }
.meter i.on { background: var(--accent); }
.hint-sub { grid-column: 1 / -1; font-weight: 700; font-size: 13px; color: var(--ink-soft); line-height: 1.1; }
.hint.ready { background: var(--accent); border-color: var(--accent); color: #fff; }
.hint.ready .hint-sub { color: #e6f4ec; }
.hint.ready .meter i { background: rgba(255, 255, 255, 0.35); }
.hint.ready .meter i.on { background: #fff; }
.hint:active { transform: scale(0.97); }

/* ---- messages ---- */
.toast {
  position: fixed; left: 50%; top: 40%; z-index: 5; width: auto; margin: 0; max-width: calc(100% - 32px);
  padding: 9px 16px 7px; border-radius: 14px; background: var(--ink); color: #fff; font-weight: 800; font-size: 17px; line-height: 1.2;
  text-align: center; transform: translate(-50%, -8px); opacity: 0; pointer-events: none; transition: opacity 0.15s, transform 0.15s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.theme { background: var(--theme-ink); }
.toast.span { background: linear-gradient(90deg, #c58a1c, #e3a72f); }
.toast.good { background: var(--accent-dark); }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(5px); } }
@keyframes glow { 50% { box-shadow: 0 0 0 5px rgba(43, 108, 80, 0.45), 0 2px 0 rgba(52, 64, 44, 0.16); } }

/* ---- sheets (results, stats, archive, trails and grounds) ---- */
.ct-result { text-align: center; }
.ct-result .big { margin: 0; font-weight: 800; font-size: 28px; line-height: 1.1; color: var(--accent-dark); }
.ct-result .line { margin: 2px 0 0; font-weight: 700; font-size: 16px; color: var(--ink-soft); }
.ct-marks { margin: 10px 0 4px; font-size: 26px; line-height: 1.3; letter-spacing: 2px; }
.ct-words { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0 2px; }
.ct-words span { padding: 3px 10px 1px; border-radius: 999px; background: var(--theme); color: #fff; font-weight: 800; font-size: 15px; }
.ct-words span.span { background: var(--span); color: #4a3200; }
.ct-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 6px; }
.ct-num { text-align: center; }
.ct-num b { display: block; font-size: 28px; line-height: 1.05; }
.ct-num span { display: block; font-size: 13px; font-weight: 700; line-height: 1.15; color: var(--ink-soft); }
.ct-h { margin: 10px 0 4px; font-weight: 800; font-size: 17px; }
.ct-note { margin: 6px 0 0; font-weight: 700; font-size: 15px; line-height: 1.35; color: var(--ink-soft); }
.ct-next { margin: 10px 0 0; text-align: center; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.ct-share { width: 100%; min-height: 50px; margin-top: 8px; border: 0; border-radius: 16px; background: var(--accent); color: #fff; font-weight: 800; font-size: 18px; cursor: pointer; }
.ct-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ct-day {
  width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 14px 4px;
  border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: left; cursor: pointer; font-weight: 800; font-size: 16px;
}
.ct-day small { display: block; font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.ct-day .chip { flex: none; padding: 3px 10px 1px; border-radius: 999px; font-size: 14px; background: rgba(52, 64, 44, 0.08); }
.ct-day .chip.good { background: var(--accent); color: #fff; }
.ct-more { min-height: 48px; width: 100%; margin-top: 8px; border: 0; border-radius: 14px; background: rgba(52, 64, 44, 0.09); font-weight: 800; font-size: 16px; cursor: pointer; }
.ct-ach { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ct-ach li { display: flex; gap: 10px; align-items: center; padding: 8px 12px 6px; border-radius: 14px; background: rgba(255, 255, 255, 0.8); font-weight: 700; font-size: 15px; line-height: 1.25; }
.ct-ach li b { display: block; font-size: 16px; }
.ct-ach li.no { opacity: 0.55; }
.ct-ach .medal { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #f4c44e; color: #6b4a0c; font-weight: 800; }
.ct-ach li.no .medal { background: rgba(52, 64, 44, 0.14); color: transparent; }
.ct-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ct-pick {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 112px; padding: 6px 4px 4px; border: 2px solid transparent;
  border-radius: 16px; background: rgba(255, 255, 255, 0.8); cursor: pointer; font-weight: 700; font-size: 13px; line-height: 1.1; text-align: center;
}
.ct-pick .swatch { width: 80px; height: 72px; border-radius: 14px; display: block; overflow: hidden; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.6); }
.ct-pick .swatch svg { width: 100%; height: 100%; display: block; }
.ct-pick[aria-pressed="true"] { border-color: var(--accent); background: #fff; }
.ct-pick.locked { cursor: default; background: rgba(52, 64, 44, 0.06); color: var(--ink-soft); }
.ct-pick.locked .q { width: 60px; height: 60px; margin: 6px 0; display: grid; place-items: center; border-radius: 50%; border: 2px dashed rgba(52, 64, 44, 0.3); font-weight: 800; font-size: 26px; color: rgba(52, 64, 44, 0.4); }
.ct-gold { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.ct-demo { display: block; width: 220px; height: auto; margin: 2px auto 0; }

/* ---- the title screen's colors (the layout is shared/mainmenu.js) ---- */
#mm {
  --sg-bg: radial-gradient(ellipse 100% 70% at 50% 25%, var(--bg-hi), transparent 75%), var(--bg);
  --sg-ink: var(--ink); --sg-ink-soft: var(--ink-soft);
  --sg-title: var(--accent-dark); --sg-title-shadow: 0 2px 0 #fff;
  --sg-accent: var(--accent); --sg-accent-ink: #fff;
  --sg-card: #fff; --sg-card-ink: var(--ink); --sg-line: rgba(52, 64, 44, 0.16);
}
#mm .ct-title-art { width: 272px; height: 150px; }
#mm .ct-title-art svg { display: block; width: 100%; height: 100%; }
.sg-sheet { --sg-sheet-bg: var(--sheet); --sg-sheet-ink: var(--ink); --sg-accent: var(--accent); --sg-accent-ink: #fff; --sg-ink-soft: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
  .word.shake { animation: none; color: #b8384f; }
  .cell span, .toast { transition: none; }
  .cell.on span { transform: none; }
  .cell.outline span { animation: none; }
}

/* the speed score's i bubble (its working stays out of sight until asked: the disclosure rule) */
.ct-result .big.ct-speed { display: flex; align-items: center; justify-content: center; gap: 2px; font-variant-numeric: tabular-nums; }
.ct-i { width: 44px; height: 44px; margin: -6px -10px -6px 0; padding: 0; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.ct-i i { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ink-soft); color: var(--ink-soft); font: italic 800 15px/20px Georgia, serif; text-align: center; }
.ct-i:focus-visible { outline: 3px solid var(--accent); outline-offset: -4px; border-radius: 10px; }
.ct-pop { margin: 6px auto 0; max-width: 300px; padding: 8px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: 15px; line-height: 1.35; color: var(--ink); }
.ct-pop[hidden] { display: none; }
.ct-clock { font-variant-numeric: tabular-nums; }
