/* Glaze Dash — warm daytime, plum night. */
@font-face {
  font-family: 'Recoleta';
  src: url('/glaze-game/assets/recoleta-regular.woff') format('woff');
  font-display: swap;
  unicode-range: U+0020-00BF; /* ASCII only — broken accent glyphs in this woff */
}

:root {
  --plum: #4a1942;
  --plum-deep: #2a1226;
  --gold: #d4a843;
  --gold-soft: #e8c876;
  --cream: #fbf6ec;
  --linen: #e8ddd0;
  --ink: #2d1928;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: 'DM Sans', -apple-system, system-ui, sans-serif;
  background: #e2c69e;
  color: var(--ink);
  user-select: none;
  overflow: hidden;
}
body.night { background: #170d18; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

#stage-wrap { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  pointer-events: none;
}
#hud button { pointer-events: auto; }
.hud-left, .hud-right { display: flex; align-items: center; gap: 10px; }
.hud-stat {
  background: rgba(42, 18, 38, .85); color: var(--cream);
  border-radius: 12px; padding: 5px 12px; font-weight: 700; font-size: 15px;
  display: flex; flex-direction: column; align-items: center; line-height: 1.1; min-width: 56px;
}
.hud-stat.gold { color: var(--gold-soft); }
.hud-label { font-size: 9px; letter-spacing: .12em; opacity: .7; font-weight: 600; }
.hud-center { flex: 1; max-width: 340px; }
#hudGoalWrap {
  position: relative; height: 26px; background: rgba(42,18,38,.85);
  border-radius: 999px; overflow: hidden; border: 1px solid rgba(212,168,67,.4);
}
#hudGoalBar {
  position: absolute; inset: 0; width: 0%;
  background: linear-gradient(90deg, #b98a2e, var(--gold));
  transition: width .25s ease;
}
#hudGoalBar.met { background: linear-gradient(90deg, #4e9e5c, #7ddb8a); }
#hudGoalText {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--cream); font-weight: 800; font-size: 13px; text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
#btnPause {
  width: 38px; height: 38px; border-radius: 12px; border: 0;
  background: rgba(42,18,38,.85); color: var(--cream); font-weight: 800; font-size: 15px;
}

/* ---------- overlays ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(23, 10, 20, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 18px;
}
.card {
  width: min(560px, 94vw); max-height: calc(100dvh - 40px); overflow-y: auto;
  background: linear-gradient(180deg, #fffdf7, #f6ecd9);
  border: 1px solid rgba(212,168,67,.5);
  border-radius: 26px; padding: 26px 24px calc(24px + env(safe-area-inset-bottom));
  text-align: center; box-shadow: 0 30px 80px rgba(0,0,0,.45);
  animation: cardIn .3s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(26px) scale(.96); } }
body.night .card { background: linear-gradient(180deg, #241329, #1a0e1e); color: var(--linen); border-color: rgba(232,200,118,.35); }

.logo { width: 84px; height: 84px; border-radius: 50%; margin-bottom: 8px; box-shadow: 0 10px 30px rgba(212,168,67,.4); }
.title { font-family: 'Recoleta', Georgia, serif; font-size: 44px; color: var(--plum); line-height: 1; margin-bottom: 8px; }
body.night .title { color: var(--gold-soft); }
.subtitle { color: #7a6455; margin-bottom: 22px; line-height: 1.5; }
body.night .subtitle { color: #b7a795; }

.big-btn {
  display: block; width: 100%; margin: 8px 0; padding: 15px 20px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: var(--ink); font-size: 17px; font-weight: 800;
  box-shadow: 0 6px 20px rgba(180,130,40,.4);
  transition: transform .08s ease;
}
.big-btn:active { transform: scale(.97); }
.big-btn.ghost {
  background: transparent; border: 2px solid rgba(74,25,66,.35); color: var(--plum);
  box-shadow: none;
}
body.night .big-btn.ghost { border-color: rgba(232,200,118,.4); color: var(--gold-soft); }
.tiny { font-size: 12.5px; color: #8a7767; margin-top: 10px; }
.order-link { display: block; color: var(--plum); margin-top: 14px; font-weight: 600; }
body.night .order-link { color: var(--gold-soft); }

/* story */
.chapter-eyebrow { font-size: 11px; letter-spacing: .3em; color: #a5854a; font-weight: 700; margin-bottom: 6px; }
.chapter-title { font-family: 'Recoleta', Georgia, serif; font-size: 30px; color: var(--plum); margin-bottom: 14px; }
body.night .chapter-title { color: var(--gold-soft); }
#storyArt { width: 100%; height: auto; border-radius: 16px; margin-bottom: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.story-text { text-align: left; line-height: 1.65; font-size: 15.5px; min-height: 100px; color: #4d3b30; margin-bottom: 12px; }
body.night .story-text { color: #cdbfae; }
.story-goal {
  background: rgba(212,168,67,.16); border: 1px dashed rgba(165,133,74,.6);
  border-radius: 12px; padding: 10px 14px; font-weight: 700; font-size: 14px;
  color: #7a5a1e; margin-bottom: 16px;
}
body.night .story-goal { color: var(--gold-soft); }

/* tally */
.tally-card h2 { font-family: 'Recoleta', Georgia, serif; font-size: 28px; color: var(--plum); margin-bottom: 6px; }
body.night .tally-card h2 { color: var(--gold-soft); }
.stars { font-size: 40px; letter-spacing: .1em; margin: 4px 0 10px; color: #c9b28a; }
.stars .lit { color: var(--gold); text-shadow: 0 0 18px rgba(212,168,67,.7); }
.tally-rows { margin: 6px 0 12px; }
.trow {
  display: flex; justify-content: space-between; padding: 8px 6px;
  border-bottom: 1px solid rgba(120,90,60,.15); font-size: 14.5px;
}
body.night .trow { border-color: rgba(232,221,208,.12); }
.story-outro { font-style: italic; color: #6d5646; line-height: 1.5; margin-bottom: 12px; font-size: 14px; }
body.night .story-outro { color: #b7a795; }
.tally-actions { display: flex; gap: 10px; }
.tally-actions .big-btn { flex: 1; }

/* shop */
.shop-card h2 { font-family: 'Recoleta', Georgia, serif; font-size: 26px; color: var(--plum); }
body.night .shop-card h2 { color: var(--gold-soft); }
.shop-coins { font-weight: 800; color: #7a5a1e; margin: 8px 0 12px; }
body.night .shop-coins { color: var(--gold-soft); }
.shop-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  text-align: left; padding: 12px 10px; border-bottom: 1px solid rgba(120,90,60,.15);
}
.shop-item p { font-size: 12.5px; color: #8a7767; margin-top: 2px; }
.shop-item button {
  border: 0; border-radius: 999px; padding: 9px 18px; font-weight: 800; font-size: 14px;
  background: var(--gold); color: var(--ink); cursor: pointer; min-width: 84px;
}
.shop-item button:disabled { background: rgba(120,90,60,.2); color: rgba(80,60,40,.5); }
.shop-item.owned button { background: rgba(125,219,138,.3); color: #2e5e37; }
body.night .shop-item { border-color: rgba(232,221,208,.12); }
body.night .shop-item p { color: #a5947f; }

#toasts { position: absolute; inset: 0; pointer-events: none; }

@media (max-width: 420px) {
  .title { font-size: 36px; }
  .chapter-title { font-size: 24px; }
  .story-text { font-size: 14.5px; }
}
