:root {
  --bg: #f4efe7;
  --bg-deep: #ece5d8;
  --board-a: #dcead8;
  --snake-a: #8fa3e0;
  --snake-b: #b3a7e6;
  --fruit: #ef9486;
  --fruit-leaf: #88b884;
  --ink: #6f665b;
  --ink-soft: #a99e8f;
  --card: #fffdf8;
  --overlay-bg: rgba(244, 239, 231, .82);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: radial-gradient(ellipse at 50% 0%, var(--bg) 60%, var(--bg-deep) 100%);
  font-family: 'Quicksand', 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  transition: background .4s ease;
}
#game { touch-action: none; }

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(94vw, 660px);
}
.brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 2px;
  color: var(--ink-soft);
  text-transform: lowercase;
}
.spacer { flex: 1; }
.chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--card);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.chip svg { display: block; }
.chip .label { font-weight: 600; letter-spacing: 1px; }
.chip.hidden { display: none; }
button.icon-btn {
  background: var(--card);
  border: none;
  border-radius: 999px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--ink-soft);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  transition: transform .12s ease;
}
button.icon-btn:hover { transform: scale(1.08); }

.stage {
  position: relative;
  border-radius: 22px;
  box-shadow: 0 14px 40px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.06);
}
canvas {
  display: block;
  border-radius: 22px;
  background: var(--board-a);
}

.overlay {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--overlay-bg);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease, visibility 0s linear .35s;
  text-align: center;
  padding: 14px;
  overflow-y: auto;
}
.overlay#menu { gap: 10px; }
.overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .35s ease;
}
.overlay h1 { font-size: 26px; }
.overlay, .tab-panel { scrollbar-width: thin; scrollbar-color: var(--ink-soft) transparent; }
.overlay::-webkit-scrollbar, .tab-panel::-webkit-scrollbar { width: 5px; }
.overlay::-webkit-scrollbar-thumb, .tab-panel::-webkit-scrollbar-thumb {
  background: var(--ink-soft);
  border-radius: 999px;
}
.overlay::-webkit-scrollbar-track, .tab-panel::-webkit-scrollbar-track { background: transparent; }
/* center content when it fits, scroll cleanly from the top when it doesn't */
.overlay { justify-content: flex-start; }
.overlay::before, .overlay::after { content: ''; margin: auto; flex-shrink: 0; }
.overlay > * { flex-shrink: 0; }
.overlay h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--ink);
  text-transform: lowercase;
}
.overlay h2 { font-size: 24px; font-weight: 700; letter-spacing: 2px; }
.overlay p { color: var(--ink-soft); font-weight: 600; font-size: 13px; }
.overlay .big-score { font-size: 42px; font-weight: 700; color: var(--snake-a); line-height: 1.1; }
.overlay .sub { font-size: 13px; }
.note {
  background: var(--card);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--snake-a);
  letter-spacing: 1px;
}
.note.hidden { display: none; }

.tabs {
  display: flex;
  gap: 4px;
  background: var(--card);
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.tab {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
}
.tab.active { background: var(--snake-a); color: #fff; }
/* fixed height so the tab bar never shifts; content centers when it fits
   and scrolls inside when it doesn't */
.tab-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  height: 280px;
  overflow-y: auto;
  justify-content: flex-start;
  width: 100%;
}
.tab-panel::before, .tab-panel::after { content: ''; margin: auto; flex-shrink: 0; }
.tab-panel > * { flex-shrink: 0; }

.tip {
  position: absolute;
  background: var(--card);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0,0,0,.16);
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 9px));
  transition: opacity .1s ease;
  z-index: 30;
}
.tip.show { opacity: 1; }
.play-btn.daily { background: var(--card); color: var(--snake-a); box-shadow: 0 3px 10px rgba(0,0,0,.10); }

.stat-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.stat-chip {
  background: var(--card);
  border-radius: 12px;
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.07);
}
.stat-chip b { font-size: 15px; color: var(--ink); }
.stat-chip span { font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--ink-soft); text-transform: uppercase; }
.stat-list { display: flex; flex-direction: column; gap: 4px; width: min(86%, 330px); }
.stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.stat-row.done { opacity: .75; }
.stat-row .swatch { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.stat-name { color: var(--ink); min-width: 64px; text-align: left; }
.bar { flex: 1; height: 7px; background: var(--bg-deep); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--snake-a), var(--snake-b)); border-radius: 999px; }
.bar-num { font-size: 11px; color: var(--ink-soft); min-width: 44px; text-align: right; }
.check { color: var(--snake-a); margin-left: auto; }
.save-hint { font-size: 11px; color: var(--ink-soft); max-width: 280px; margin: -2px auto 2px; line-height: 1.4; }

/* one label style everywhere — option rows, sliders, stats sections */
.label {
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  color: var(--ink-soft); text-transform: uppercase;
}
.opt-row { display: flex; flex-direction: column; gap: 5px; align-items: center; }
.pills { display: flex; gap: 5px; align-items: center; }
.pill {
  border: none;
  background: var(--card);
  color: var(--ink-soft);
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.08);
  transition: all .15s ease;
}
.pill:hover { transform: translateY(-1px); }
.pill.active { background: var(--snake-a); color: #fff; }

.pill.dot {
  width: 26px; height: 26px;
  padding: 0;
  border-radius: 50%;
}
.pill.dot.active {
  box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--ink-soft);
}
.pill.locked {
  opacity: .35;
  filter: saturate(.4);
  cursor: help;
}
#wardrobePreview {
  border-radius: 16px;
  background: var(--board-a);
  box-shadow: inset 0 2px 6px rgba(0,0,0,.06);
}
/* the wardrobe's own little tab row: one cosmetic category in view at a time */
.wardrobe-tabs {
  background: var(--card);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.wardrobe-tabs .pill {
  background: transparent;
  box-shadow: none;
  font-size: 11px;
  letter-spacing: 1px;
  padding: 5px 11px;
}
.wardrobe-tabs .pill.active { background: var(--snake-a); }

.now-playing {
  position: fixed;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .5px;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(0,0,0,.15);
  z-index: 15;
  opacity: .93;
  transition: opacity .3s ease, transform .15s ease;
}
.now-playing:hover { transform: translateY(-2px); }
.now-playing .np-note { color: var(--snake-a); font-size: 14px; }
.now-playing a { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.np-svc { line-height: 0; opacity: .75; transition: opacity .15s ease, transform .15s ease; }
.np-svc:hover { opacity: 1; transform: scale(1.15); }
body.cinema .now-playing { opacity: 0; visibility: hidden; }

#gardenBack {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 6;
}
.garden-wrap { cursor: pointer; }
.garden-wrap:hover .garden-label { color: var(--ink); }
.pill.locked:hover { transform: none; }
.pills { flex-wrap: wrap; justify-content: center; }

.sliders { display: flex; gap: 22px; }
.slider-box { display: flex; flex-direction: column; gap: 4px; align-items: center; }
input[type=range] {
  width: 110px;
  accent-color: var(--snake-a);
  cursor: pointer;
}

.play-btn {
  border: none;
  background: linear-gradient(135deg, var(--snake-a), var(--snake-b));
  color: #fff;
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 12px 42px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  transition: transform .15s ease, box-shadow .15s ease;
  text-transform: lowercase;
}
.play-btn:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 9px 24px rgba(0,0,0,.24); }
.play-btn.small { font-size: 14px; padding: 10px 30px; }
.ghost-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 7px 16px;
  cursor: pointer;
}
.ghost-btn:hover { color: var(--ink); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hidden { display: none !important; }

.toast {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--card);
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease, visibility 0s linear .3s;
  z-index: 20;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  transition: opacity .3s ease, transform .3s ease;
}

.garden-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.garden-wrap canvas { display: block; }
.garden-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--ink-soft);
  text-transform: lowercase;
}

body.cinema .topbar,
body.cinema .hint,
body.cinema .garden-wrap {
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s ease, visibility 0s linear .3s;
}

.hint {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: .5px;
  transition: opacity .3s ease;
}
.hint kbd {
  font-family: inherit;
  background: var(--card);
  border-radius: 6px;
  padding: 2px 7px;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
