/* PhotoPieces - warm craft feel, not SaaS. Tokens below are panel-locked. */

:root {
  --bg: #FBF7F0; --surface: #FFFFFF; --ink: #23262B; --ink-muted: #6B7076;
  --primary: #E8622C; --primary-hover: #CF5322; --accent: #2E9E8F;
  --border: #E4DDD0; --success: #3FA34D; --error: #D64545;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fredoka", var(--font-body);
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --radius-sm: 6px; --radius-md: 12px; --radius-lg: 20px; --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(35,38,43,0.08); --shadow-md: 0 4px 12px rgba(35,38,43,0.12);
  --shadow-piece-drag: 0 8px 20px rgba(35,38,43,0.25);
  --z-base: 0; --z-piece: 10; --z-piece-dragging: 100; --z-tray: 200;
  --z-toolbar: 300; --z-modal: 900; --z-toast: 1000;
}

* { box-sizing: border-box; }

/* Guard: author display rules must never override the hidden attribute */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, .wordmark-name {
  font-family: var(--font-display);
}

button {
  font-family: inherit;
  font-size: inherit;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--ink);
  padding: var(--space-2) var(--space-4);
  z-index: var(--z-toast);
  border-radius: var(--radius-sm);
}
.skip-link:focus {
  left: var(--space-2);
  top: var(--space-2);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-display);
  border-radius: var(--radius-pill);
  padding: var(--space-3) var(--space-5);
  min-height: 44px;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-secondary {
  background: var(--surface);
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-secondary:hover { background: #FDEEE6; }
.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); color: var(--ink); }
.btn-big {
  font-size: 1.15rem;
  padding: var(--space-4) var(--space-6);
}
.btn-icon-text svg { width: 18px; height: 18px; }

/* ---------- Header / wordmark ---------- */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) 0;
}
/* v2.0 header nav (library link + basket) */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.header-link {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.header-link:hover { background: var(--surface); color: var(--primary); }
.basket-btn {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.basket-btn svg { width: 22px; height: 22px; }
.basket-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--ink);
}
.wordmark-mark {
  width: 30px;
  height: 30px;
  color: var(--primary);
}
.wordmark-name {
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.01em;
}
/* v2.2 phones: the rank chip + Feedback joined the header, so tighten it.
   "Puzzle library" becomes "Library"; if it still can't fit (tiny phones,
   or the basket is showing) the nav drops to its own row instead of
   pushing the page sideways. */
.header-link-short { display: none; }
@media (max-width: 420px) {
  .site-header { flex-wrap: wrap; gap: var(--space-2); }
  .header-nav { gap: 4px; margin-left: auto; }
  .header-link { padding: var(--space-2); }
  .header-link-full { display: none; }
  .header-link-short { display: inline; }
  .wordmark-mark { width: 26px; height: 26px; }
  .wordmark-name { font-size: 1.25rem; }
}

/* Surprise gift mode toggle (setup screen) */
.surprise-toggle {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-2);
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 44px;
  font-size: 0.95rem;
  line-height: 1.4;
}
.surprise-toggle input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--primary);
  flex: none;
  cursor: pointer;
}
.surprise-hint {
  margin: 0 0 var(--space-3);
  font-size: 13px;
  color: var(--ink-muted);
}

/* ---------- Landing ---------- */

.screen-landing {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-7);
}
/* Big screens (Neptune 2026-11-14): use the space at the sides. The headline and
   photo box stay a comfortable reading width in the middle; "Today's puzzle" and
   "Mystery puzzle" sit side by side; the library rows and sample pictures run
   the full width (same 1100px as the header). */
@media (min-width: 1024px) {
  .screen-landing {
    max-width: 1100px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--space-5);
  }
  .screen-landing > * { grid-column: 1 / -1; min-width: 0; }
  .screen-landing > .hero { width: 100%; max-width: 760px; justify-self: center; }
  .screen-landing > #dailyCard { grid-column: 1; }
  .screen-landing > #mysteryCard { grid-column: 2; }
  /* if one of the pair is missing, the other takes the whole row */
  .screen-landing > #dailyCard[hidden] + #mysteryCard,
  .screen-landing > #dailyCard:has(+ #mysteryCard[hidden]) { grid-column: 1 / -1; }
  /* The pair share one shape so they read as a set: picture on the left, the
     words on the right with the button straight under them. */
  .screen-landing > #dailyCard,
  .screen-landing > #mysteryCard {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: var(--space-5);
    row-gap: var(--space-3);
    align-content: center;
    align-items: center;
    padding: var(--space-5);
  }
  #dailyCard .daily-thumb { grid-row: 1 / span 2; width: 200px; height: 150px; }
  #dailyCard .daily-info { align-self: end; }
  #dailyCard #dailyPlay { justify-self: start; align-self: start; }
  #mysteryCard .mys-tile-deck { grid-row: 1 / span 2; }
  #mysteryCard .mys-tile-info { align-self: end; }
  #mysteryCard .mys-tile-actions { justify-self: start; align-self: start; margin-left: 0; }
}
.hero { text-align: center; }
.hero h1 {
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  font-weight: 700;
  margin: var(--space-5) 0 var(--space-2);
}
.subhead {
  color: var(--ink-muted);
  font-size: 1.1rem;
  margin: 0 0 var(--space-5);
}
.dropzone {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-4);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary);
  background: #FFF9F3;
}
.dropzone.dragover { border-style: solid; }
.dropzone-icon {
  width: 44px;
  height: 44px;
  color: var(--accent);
}
.dropzone-text {
  margin: var(--space-2) 0 var(--space-3);
  color: var(--ink-muted);
}
.drop-error {
  color: var(--error);
  font-weight: 600;
  margin: var(--space-3) 0 0;
}
.trust-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--ink-muted);
  font-size: 0.95rem;
  margin-top: var(--space-3);
}
.trust-lock {
  width: 18px;
  height: 18px;
  color: var(--accent);
  flex: none;
}

/* ---------- Cards (resume, daily) ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
  margin-top: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.card h2 {
  margin: 0 0 var(--space-1);
  font-size: 1.15rem;
}
.card p { margin: 0; color: var(--ink-muted); }
.card-actions {
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
  flex-wrap: wrap;
}
.daily-thumb {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  flex: none;
}
.daily-info { flex: 1 1 200px; }
.daily-streak {
  color: var(--accent);
  font-weight: 600;
  margin-top: var(--space-1);
}

/* ---------- Gallery ---------- */

.gallery-section { margin-top: var(--space-7); }
.gallery-section h2 {
  text-align: center;
  font-size: 1.3rem;
  margin-bottom: var(--space-4);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-3);
}
.gallery-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  text-align: left;
}
.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.gallery-item img {
  width: 100%;
  height: auto; /* the img has height="300": without this it stays 300px tall and crops to a strip */
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.gallery-item .gallery-title {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: 0.9rem;
  color: var(--ink-muted);
}

/* ---------- Setup ---------- */

.screen-setup {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-7);
}
.setup-title {
  text-align: center;
  font-size: 1.6rem;
}
.setup-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
@media (min-width: 720px) {
  .setup-layout { grid-template-columns: 1fr 1fr; align-items: start; }
}
.setup-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.setup-preview {
  max-width: 100%;
  max-height: 45vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  background: var(--surface);
}
.tier-heading {
  font-size: 1.15rem;
  margin: 0 0 var(--space-3);
}
.tier-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.tier-btn {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s ease, background-color 0.12s ease;
  min-height: 76px;
}
.tier-btn .tier-time {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.1rem;
}
.tier-btn .tier-count {
  display: block;
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin-top: var(--space-1);
}
.tier-btn[aria-pressed="true"] {
  border-color: var(--primary);
  background: #FDEEE6;
}
.setup-controls .btn { width: 100%; margin-bottom: var(--space-3); }
.print-cta-setup {
  margin-top: var(--space-4);
  text-align: center;
}
.print-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.print-link:hover { color: var(--primary); }
.honesty-line {
  color: var(--ink-muted);
  font-size: 0.85rem;
  margin: var(--space-1) 0 0;
}

/* ---------- Game ---------- */

.screen-game {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  z-index: var(--z-base);
}
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: var(--z-toolbar);
  flex-wrap: nowrap;
  overflow-x: auto;
}
.toolbar-wordmark {
  display: inline-flex;
  align-items: center;
  min-width: 44px;   /* touch target (QA iteration 2, D9) */
  min-height: 44px;
  justify-content: center;
  gap: var(--space-1);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: var(--space-1);
  flex: none;
}
.toolbar-wordmark svg {
  width: 22px;
  height: 22px;
  color: var(--primary);
}
.toolbar-name { font-size: 1rem; font-weight: 700; }
/* v2.0 secondary tools: inline on desktop, a "More" popover on phones */
.toolbar-more { display: contents; }
.toolbar-more-btn { display: none !important; }
@media (max-width: 600px) {
  .toolbar { position: relative; overflow: visible; }
  .toolbar-name { display: none; }
  .toolbar-more-btn { display: inline-flex !important; }
  .toolbar-more {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: var(--space-2);
    z-index: calc(var(--z-toolbar) + 1);
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: var(--space-2);
    max-width: 240px;
    padding: var(--space-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
  }
  .toolbar-more.open { display: flex; }
  /* Phones have no hover tooltips: the menu is a list, each tool named by its
     own (state-aware) title - "Hide timer", "Shuffle tray", "Restart"... */
  .toolbar-more {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 2px;
    max-width: min(280px, calc(100vw - 16px));
    min-width: 210px;
    padding: var(--space-1);
  }
  .toolbar-more .tool-btn {
    width: auto;
    height: 44px;
    justify-content: flex-start;
    gap: var(--space-3);
    padding: 0 var(--space-3);
    border-color: transparent;
  }
  .toolbar-more .tool-btn::after {
    content: attr(title);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--ink);
    white-space: nowrap;
  }
  .toolbar-more .tool-btn[aria-pressed="true"]::after { color: #fff; }
  .toolbar-more .tool-badge { position: static; order: 2; margin-left: auto; }
  .toolbar-more .tool-btn.is-off .tool-slash { right: auto; width: 24px; }
}
.hud-percent {
  font-weight: 700;
  font-family: var(--font-display);
  white-space: nowrap;
}
.hud-timer {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  white-space: nowrap;
}
.toolbar-spacer { flex: 1; }
.tool-btn {
  position: relative;
  width: 40px;
  height: 40px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-muted);
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.tool-btn:hover { color: var(--ink); background: var(--bg); }
.tool-btn[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.tool-btn svg { width: 22px; height: 22px; }
/* Surprise-mode guide switch: a diagonal slash when the guide is off */
.tool-slash { display: none; }
.tool-btn.is-off .tool-slash {
  display: block;
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transform: rotate(-45deg);
  pointer-events: none;
}
.tool-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  padding: 1px 4px;
  pointer-events: none;
}

.game-area {
  position: relative;
  flex: 1;
  min-height: 0;
}
/* v2.0: arena layer behind the transparent canvas (arena.js fills it) */
.arena-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
#gameCanvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.tray-handle {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 72px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  z-index: var(--z-tray);
  display: flex;
  align-items: center;
  justify-content: center;
}
.tray-handle-bar {
  width: 32px;
  height: 4px;
  border-radius: 2px;
  background: var(--ink-muted);
  display: block;
}

/* ---------- Slicing (skeleton grid) ---------- */

.slicing-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(251,247,240,0.9);
  z-index: var(--z-modal);
}
.slicing-box { text-align: center; }
.slicing-grid {
  display: grid;
  gap: 4px;
  width: min(60vw, 280px);
  margin: 0 auto var(--space-4);
}
.slicing-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--border);
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}
#slicingText {
  color: var(--ink-muted);
  font-family: var(--font-display);
  font-weight: 600;
}

/* ---------- Pause ---------- */

.pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(35,38,43,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
}
.pause-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  box-shadow: var(--shadow-md);
}
.pause-card h2 { margin-top: 0; }

/* ---------- Win ---------- */

/* v2.0: the results card docks over the EMPTY tray (right rail on desktop,
   bottom strip on phones) so the finished picture + confetti stay visible.
   The overlay itself is transparent and click-through; only the card is solid.
   app.js positionWin() sets --win-left/top/width/height from the tray rect. */
.win-overlay {
  position: absolute;
  inset: 0;
  display: block;
  background: none;
  pointer-events: none;
  z-index: var(--z-modal);
}
.win-card {
  position: absolute;
  left: var(--win-left, auto);
  top: var(--win-top, auto);
  right: auto;
  width: var(--win-width, min(360px, calc(100% - 32px)));
  max-height: var(--win-height, 70%);
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-4);
  overflow-y: auto;
  overscroll-behavior: contain;
  text-align: center;
  animation: pp-win-in 380ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
.win-overlay:not(.win-side):not(.win-bottom) .win-card { right: 16px; bottom: 16px; }
@keyframes pp-win-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}
.win-overlay.win-bottom .win-card { animation-name: pp-win-in-up; }
@keyframes pp-win-in-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
.win-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.win-title {
  margin: 0;
  color: var(--primary);
  font-size: 1.35rem;
  text-align: left;
  line-height: 1.2;
}
.win-toggle {
  flex: none;
  min-height: 36px;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.win-toggle:hover { color: var(--primary); border-color: var(--primary); }
.win-body { margin-top: var(--space-3); }
/* Collapsed: just a slim pill-shaped header, the picture is completely clear. */
.win-overlay.win-collapsed .win-body { display: none; }
.win-overlay.win-collapsed .win-card {
  height: auto;
  max-height: none;
  padding: var(--space-2) var(--space-3);
}
.win-overlay.win-collapsed .win-title { font-size: 1rem; }
/* Phones (bottom strip): compact two-column actions so more fits the tray. */
.win-overlay.win-bottom .win-card { padding: var(--space-3); }
.win-overlay.win-bottom .win-body { margin-top: var(--space-2); }
.win-overlay.win-bottom .win-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}
.win-overlay.win-bottom .win-actions > #winPrintCta,
.win-overlay.win-bottom .win-actions > .honesty-line,
.win-overlay.win-bottom .win-actions > .win-slot { grid-column: 1 / -1; }
.win-overlay.win-bottom .win-time { font-size: 1rem; margin-bottom: var(--space-1); }
.win-overlay.win-collapsed.win-bottom .win-card { top: auto; bottom: 8px; }
@media (prefers-reduced-motion: reduce) {
  .win-card { animation: none; }
}
.win-time {
  font-size: 1.1rem;
  margin: 0 0 var(--space-2);
}
.win-best { color: var(--success); font-weight: 600; margin: 0 0 var(--space-2); }
.win-streak { color: var(--accent); font-weight: 600; margin: 0 0 var(--space-2); }
.win-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.win-actions .honesty-line { margin: 0; }
.win-slot {
  color: var(--ink-muted);
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: var(--space-1);
}

/* Reserved ad container: desktop-only concept, intentionally hidden in v1. */
.below-board-slot { display: none; }

/* ---------- Footer ---------- */

.site-footer {
  text-align: center;
  padding: var(--space-6) var(--space-4);
  color: var(--ink-muted);
  border-top: 1px solid var(--border);
  margin-top: var(--space-6);
}
.site-footer nav {
  display: flex;
  justify-content: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}
.site-footer a {
  color: var(--ink-muted);
  text-decoration: none;
}
.site-footer a:hover { color: var(--ink); text-decoration: underline; }
.footer-note {
  font-size: 0.85rem;
  margin-top: var(--space-3);
}
body.in-game .site-footer,
body.in-game .site-header { display: none; }

/* ---------- Toast / modal ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: var(--z-toast);
  max-width: min(90vw, 420px);
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(35,38,43,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: var(--z-modal);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-5);
  width: min(380px, 100%);
  text-align: center;
}
.modal-actions {
  display: flex;
  gap: var(--space-3);
  justify-content: center;
  margin-top: var(--space-4);
}

.noscript-note {
  text-align: center;
  padding: var(--space-5);
  color: var(--error);
}

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
  .toolbar-name { display: none; }
  .hud-timer { font-size: 0.8rem; }
  .toolbar { gap: var(--space-1); padding: var(--space-1) var(--space-2); }
  .tier-list { grid-template-columns: 1fr; }
  .card { flex-direction: column; align-items: stretch; text-align: center; }
  .card-actions { margin-left: 0; justify-content: center; }
  .daily-thumb { margin: 0 auto; }
  .daily-info { flex: 0 1 auto; } /* its 200px basis is a WIDTH in the row layout; stacked it became a tall gap */
}

/* Phones: keep the footer's last line clear of the round help button */
@media (max-width: 600px) {
  .site-footer { padding-bottom: 5rem; }
}

/* Touch screens have nothing to drag from: just show the Choose Photo button */
@media (hover: none) and (pointer: coarse) {
  .dropzone-text { display: none; }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .slicing-cell { animation: none; opacity: 0.7; }
}
