/* Queens: a cozy rose page, the quilt in the middle, the clock above it. The title screen and the sheets are
   shared/mainmenu.js (menu.css, loaded after this); only their colors are set here (--sg-*). */
:root {
  --bg: #f7e4e8; --bg-hi: #fff5f3; --ink: #4a2c33; --ink-soft: #7d5a62; --line: rgba(74, 44, 51, 0.18);
  --accent: #b5476f; --accent-dark: #8f2f55; --sheet: #fff8f6; --card: #fffaf8; --gold: #e2a93b;
  --bad: #d42f3c; --good: #3e9a72;
  --board: 360px;
  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;
  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;
}

/* ---- top bar ---- */
.bar { width: 100%; max-width: 520px; 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.72); box-shadow: inset 0 1px 0 #fff, 0 2px 0 rgba(74, 44, 51, 0.13); 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); }
.head { text-align: center; min-width: 0; }
.name { margin: 0; font-weight: 800; font-size: 22px; line-height: 1.1; color: var(--accent-dark); }
.sub { margin: 0; font-weight: 700; font-size: 15px; line-height: 1.2; color: var(--ink-soft); white-space: nowrap; }
.sub .tag { display: inline-block; margin-left: 6px; padding: 1px 8px 0; border-radius: 999px; background: #e3d3f4; color: #5c2f7a; font-size: 13px; }

/* ---- the clock and the cat count ---- */
.status { width: 100%; max-width: var(--board); display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 8px 0 6px; min-height: 36px; }
.clock {
  margin: 0; display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px 2px 10px; border-radius: 999px;
  background: #fff; box-shadow: inset 0 -2px 0 rgba(74, 44, 51, 0.1), 0 2px 6px -3px rgba(74, 44, 51, 0.35);
  font-weight: 800; font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums;
}
.clock svg { width: 20px; height: 20px; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; margin-top: -2px; }
.clock.stopped { color: var(--good); }
.clock.stopped svg { stroke: var(--good); }
.clock[hidden] { display: inline-flex; visibility: hidden; }
.count { margin: 0; font-weight: 800; font-size: 16px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.count.full { color: var(--accent-dark); }

/* ---- the quilt ---- */
.stage { flex: 1 1 auto; min-height: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: min(2.5vh, 20px) 0 max(12px, 2.5vh); }
/* the quilt sits up under the clock, the hint under it, and Undo / Clear rest at the thumb end */
.hint { order: 1; } .done { order: 2; } .controls { order: 3; }
.board { flex: none; }
.hint { max-width: var(--board); margin: 8px 0 0; text-align: center; font-weight: 700; font-size: 15px; line-height: 1.3; color: var(--ink-soft); }
.hint[hidden] { display: none; }
.board {
  width: var(--board); height: var(--board); position: relative; touch-action: none; cursor: pointer;
  filter: drop-shadow(0 8px 14px rgba(74, 44, 51, 0.22));
}
.board svg { display: block; width: 100%; height: 100%; }
.board use { transform-box: fill-box; transform-origin: center; }
.board .pop { animation: pop 0.2s ease-out; }
.board .fade { animation: fade 0.16s ease-out; }
.board .shake { animation: shake 0.36s ease-in-out; }
.board .wave { animation: wave 0.6s ease-in-out both; }
.app.paused .board { filter: blur(9px) saturate(0.7); }
@keyframes pop { 0% { transform: scale(0.55); } 70% { transform: scale(1.08); } 100% { transform: none; } }
@keyframes fade { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px) rotate(-6deg); } 75% { transform: translateX(6px) rotate(6deg); } }
@keyframes wave { 0%, 100% { transform: none; } 40% { transform: translateY(-18px) scale(1.08); } 70% { transform: translateY(0) scale(1.04, 0.96); } }

/* ---- under the quilt ---- */
.controls { display: flex; gap: 10px; margin-top: auto; padding-top: 12px; }
.controls[hidden] { display: none; }
.pill {
  min-height: 48px; min-width: 96px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 18px 2px;
  border: 0; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 800; font-size: 17px; cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(74, 44, 51, 0.12), 0 2px 0 rgba(74, 44, 51, 0.12); -webkit-tap-highlight-color: transparent;
}
.pill svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; margin-top: -2px; }
.pill:active { transform: translateY(2px); box-shadow: inset 0 -1px 0 rgba(74, 44, 51, 0.12); }
.pill:disabled { opacity: 0.45; cursor: default; }
.pill.primary { background: var(--accent); color: #fff; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18), 0 2px 0 rgba(74, 44, 51, 0.15); }
.done { width: 100%; max-width: var(--board); margin-top: 8px; text-align: center; }
.done-title { margin: 0; font-weight: 800; font-size: 24px; line-height: 1.15; color: var(--accent-dark); }
.done-next { margin: 0 0 8px; font-weight: 700; font-size: 15px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.done-row { display: flex; gap: 8px; justify-content: center; }
.done-row .pill { min-width: 0; flex: 1; padding: 4px 10px 2px; }
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 120px); z-index: 5; margin: 0; padding: 8px 16px 6px;
  border-radius: 14px; background: var(--ink); color: #fff; font-weight: 800; font-size: 16px; white-space: nowrap;
  transform: translate(-50%, -6px); opacity: 0; transition: opacity 0.18s, transform 0.18s; pointer-events: none;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---- sheets (stats, archive, collection, results) ---- */
.qn-nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 6px; }
.qn-nums.two { grid-template-columns: repeat(2, 1fr); }
.qn-num { text-align: center; }
.qn-num b { display: block; font-size: 28px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.qn-num span { display: block; font-size: 13px; font-weight: 700; line-height: 1.15; color: var(--ink-soft); }
.qn-h { margin: 10px 0 4px; font-weight: 800; font-size: 17px; }
.qn-note { margin: 6px 0 0; font-weight: 700; font-size: 15px; line-height: 1.35; color: var(--ink-soft); }
.qn-fresh { margin: 0 0 6px; font-weight: 800; font-size: 15px; line-height: 1.3; color: var(--accent-dark); }
.qn-next { margin: 10px 0 0; text-align: center; font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; }
.qn-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; }
.qn-week { display: grid; gap: 4px; }
.qn-wd { display: grid; grid-template-columns: 74px 1fr auto; align-items: center; gap: 8px; padding: 6px 12px 4px; border-radius: 12px; background: rgba(255, 255, 255, 0.7); font-weight: 700; font-size: 15px; }
.qn-wd b { font-weight: 800; }
.qn-wd small { color: var(--ink-soft); font-size: 13px; }
.qn-wd .t { font-variant-numeric: tabular-nums; text-align: right; }
.qn-wd.today { box-shadow: inset 0 0 0 2px var(--accent); }
.qn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.qn-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;
}
.qn-day small { display: block; font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.qn-day .chip { flex: none; padding: 3px 10px 1px; border-radius: 999px; font-size: 14px; background: rgba(74, 44, 51, 0.08); font-variant-numeric: tabular-nums; }
.qn-day .chip.win { background: var(--good); color: #fff; }
.qn-day .chip.go { background: var(--accent); color: #fff; }
.qn-day:disabled { cursor: default; background: rgba(255, 255, 255, 0.5); }
.qn-more { min-height: 48px; border: 0; border-radius: 14px; background: rgba(74, 44, 51, 0.09); font-weight: 800; font-size: 16px; cursor: pointer; }
.qn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.qn-pick {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 100px; padding: 6px 4px 4px;
  border: 2px solid transparent; border-radius: 16px; background: rgba(255, 255, 255, 0.72); cursor: pointer;
}
.qn-pick svg { display: block; }
.qn-pick small { font-weight: 700; font-size: 12px; line-height: 1.1; color: var(--ink-soft); text-align: center; }
.qn-pick[aria-pressed="true"] { border-color: var(--accent); background: #fff; }
.qn-pick.locked { cursor: default; background: rgba(74, 44, 51, 0.06); }
.qn-pick.locked .q { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 50%; border: 2px dashed rgba(74, 44, 51, 0.3); font-weight: 800; font-size: 24px; color: rgba(74, 44, 51, 0.4); }
.qn-stamps { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.qn-ach { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.qn-ach li { display: flex; gap: 10px; align-items: center; padding: 8px 12px 6px; border-radius: 14px; background: rgba(255, 255, 255, 0.72); font-weight: 700; font-size: 15px; line-height: 1.25; }
.qn-ach li b { display: block; font-size: 16px; }
.qn-ach li.no { opacity: 0.55; }
.qn-ach .medal { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #f4c44e; color: #6b4a0c; font-weight: 800; }
.qn-ach li.no .medal { background: rgba(74, 44, 51, 0.14); color: transparent; }
.qn-how-art { display: flex; justify-content: center; margin: 2px 0 4px; }
.qn-how-art svg { width: 190px; height: 190px; }
.qn-how-row { display: flex; gap: 10px; align-items: center; }
.qn-how-row svg { flex: none; }

/* ---- 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(74, 44, 51, 0.16);
}
#mm .qn-title-art { width: 157px; height: 150px; }
#mm .qn-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) {
  .board .pop, .board .fade, .board .wave { animation: none; }
  .board .shake { animation: none; }
  .toast { transition: none; }
}
