/* Lance's app: the sprite fills the screen; everything else floats on top of it.
   Colours match the sprites' night-blue background so the edges blend in. */
:root {
  --night: #232842;
  --ink: #f2f4ff;
  --dim: #a9b0d6;
  --btn: #1f3a7a;           /* darkish blue */
  --btn-hi: #2a4c9c;
  --btn-edge: #142852;
  --glass: rgba(18, 22, 44, 0.58);
  --glass-edge: rgba(255, 255, 255, 0.12);
  --hp-good: #4fd37a;
  --hp-mid: #ffd35a;
  --hp-low: #ef4f6a;
  --gold: #ffd35a;
  --shadow: 0 8px 18px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.35);
  --pixel: "Silkscreen", ui-monospace, monospace;
  --top: max(12px, env(safe-area-inset-top));
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ink); }
body {
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
h1, h2 { font-family: var(--pixel); font-weight: 400; letter-spacing: 0.04em; margin: 0; }
h1 { font-size: 20px; }
h2 { font-size: 13px; }
[hidden] { display: none !important; }
.dim { color: var(--dim); font-size: 13px; margin: 6px 0 0; }

/* --- the sprite ----------------------------------------------------------------------- */
.stage { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
.stage svg { width: 100%; height: 100%; display: block; }
body.admin-mode .stage { filter: brightness(0.45) blur(2px); }
body.admin-mode .hud, body.admin-mode .mood-line { display: none; }

/* --- buttons: dark blue, floating ------------------------------------------------------- */
.btn {
  font: inherit; color: var(--ink); cursor: pointer;
  background: linear-gradient(180deg, var(--btn-hi), var(--btn));
  border: 1px solid var(--btn-edge); border-radius: 12px;
  padding: 10px 14px; min-height: 44px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:active { transform: translateY(2px); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-round { width: 56px; height: 56px; border-radius: 18px; padding: 0; font-size: 26px; position: relative; }
.btn-small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn-wide { width: 100%; margin-top: 10px; font-weight: 600; }
.btn.on { background: linear-gradient(180deg, #3f6fd6, #2a54b0); border-color: #6f97ff; }
.btn-corner { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20; }
.badge {
  position: absolute; right: -6px; bottom: -6px; font: 11px var(--pixel);
  background: var(--gold); color: #3a2a00; border-radius: 8px; padding: 2px 5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* --- HUD ------------------------------------------------------------------------------ */
.hud {
  position: fixed; top: var(--top); left: 16px; right: 16px; z-index: 10;
  display: flex; align-items: flex-start; gap: 12px;
}
.health {
  flex: 1; max-width: 360px; padding: 8px 10px 10px; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--glass-edge);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); box-shadow: var(--shadow);
}
.health-label { display: flex; justify-content: space-between; font: 12px var(--pixel); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.health-bar {
  height: 16px; margin-top: 4px; padding: 2px;
  background: rgba(0, 0, 0, 0.45); border: 2px solid #0d1024; border-radius: 4px;
  box-shadow: var(--shadow);
}
.health-bar.big { height: 22px; margin-top: 10px; }
.health-fill {
  height: 100%; width: 0; border-radius: 2px; background: var(--hp-good);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), inset 0 2px 0 rgba(255, 255, 255, 0.25);
  transition: width 0.6s ease, background-color 0.6s ease;
}
.health-fill.mid { background: var(--hp-mid); }
.health-fill.low { background: var(--hp-low); }
.points { margin-top: 6px; font: 13px var(--pixel); color: var(--gold); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5); }
.mood-line {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 5;
  font: 12px var(--pixel); color: var(--ink); margin: 0; padding: 6px 12px; border-radius: 12px; white-space: nowrap;
  background: var(--glass); border: 1px solid var(--glass-edge); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.mood-line:empty { display: none; }
.banner {
  position: fixed; top: calc(var(--top) + 96px); left: 16px; right: 16px; z-index: 9; margin: 0;
  text-align: center; font-size: 13px; padding: 6px 10px; border-radius: 10px;
  background: var(--glass); border: 1px solid var(--glass-edge); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}

/* --- translucent sheets (bingo, to-do) -------------------------------------------------- */
.sheet {
  position: fixed; z-index: 15; left: 12px; right: 12px; top: calc(var(--top) + 92px);
  max-width: 440px; margin: 0 auto; padding: 14px;
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 18px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  animation: drop-in 0.18s ease-out;
}
.sheet-low { top: auto; bottom: calc(16px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-note { margin: 10px 0 0; text-align: center; font-size: 13px; }
@keyframes drop-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.bingo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.square {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-size: 30px; padding: 6px;
}
.square small { font-size: 11px; color: var(--dim); font-family: var(--pixel); text-align: center; line-height: 1.1; }
.square.done { background: linear-gradient(180deg, #2f7a52, #23603f); border-color: #164a2f; }
.square.done small { color: #d8ffe6; }
.square.line { outline: 2px solid var(--gold); outline-offset: 1px; }

textarea, input {
  width: 100%; font: inherit; color: var(--ink); background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-edge); border-radius: 10px; padding: 10px; user-select: text;
}
textarea { resize: none; }
input { min-height: 44px; }

/* --- ADMIN page ---------------------------------------------------------------------- */
.admin {
  position: fixed; inset: 0; z-index: 12; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--top) + 4px) 16px calc(24px + env(safe-area-inset-bottom));
}
.admin-head { display: flex; align-items: center; justify-content: space-between; max-width: 560px; margin: 0 auto 12px; }
.card {
  max-width: 560px; margin: 0 auto 14px; padding: 14px;
  background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 16px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); box-shadow: var(--shadow);
}
.card h2 { margin-bottom: 4px; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.row > * { flex: 1; }
.row.wrap { flex-wrap: wrap; }
.row.wrap > * { flex: 1 1 30%; }
.review { padding: 10px 0; border-top: 1px solid var(--glass-edge); }
.review:first-child { border-top: 0; }
.review select { width: 100%; margin-top: 8px; min-height: 40px; font: inherit; color: var(--ink); background: rgba(0, 0, 0, 0.35); border: 1px solid var(--glass-edge); border-radius: 10px; }
.mini-grid { display: grid; grid-template-columns: repeat(3, 44px); gap: 6px; margin-top: 10px; }
.mini-grid span { height: 44px; display: flex; align-items: center; justify-content: center; font-size: 22px; border-radius: 10px; background: rgba(0, 0, 0, 0.3); }
.mini-grid span.done { background: #2f7a52; }
.history { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.history li { display: flex; gap: 8px; padding: 5px 0; border-top: 1px solid var(--glass-edge); }
.history .amt { font-family: var(--pixel); min-width: 48px; text-align: right; }
.history .amt.plus { color: var(--hp-good); }
.history .amt.minus { color: var(--hp-low); }
.history .why { flex: 1; color: var(--dim); }

/* --- cheer, toast, errors ------------------------------------------------------------- */
.cheer {
  position: fixed; left: 0; right: 0; top: 38%; z-index: 30; text-align: center; pointer-events: none;
  font: 22px var(--pixel); color: var(--gold); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.6), 0 0 18px rgba(255, 211, 90, 0.6);
  white-space: pre-line;
  animation: cheer 2.4s ease-out forwards;
}
@keyframes cheer {
  0% { opacity: 0; transform: translateY(20px) scale(0.8); }
  15% { opacity: 1; transform: translateY(0) scale(1.08); }
  70% { opacity: 1; transform: translateY(-10px) scale(1); }
  100% { opacity: 0; transform: translateY(-40px); }
}
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 40;
  max-width: 440px; margin: 0 auto; padding: 12px 14px; border-radius: 12px; text-align: center; font-size: 14px;
  background: rgba(10, 12, 28, 0.88); border: 1px solid var(--glass-edge); box-shadow: var(--shadow);
}
.error {
  position: fixed; left: 16px; right: 16px; top: 45%; z-index: 50; margin: 0; text-align: center;
  font: 13px var(--pixel); color: var(--ink); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.6);
}

@media (prefers-reduced-motion: reduce) {
  .sheet, .cheer { animation: none; }
  .health-fill { transition: none; }
}
