:root {
  --bg: #16110d;
  --bg-2: #211912;
  --card: #2a1f17;
  --line: #3d2e22;
  --text: #f4e9d8;
  --muted: #b9a68f;
  --ember: #e8662f;
  --gold: #f4ad4c;
  --heat: 0; /* 0..1, set per level */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 Figtree, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* Fire glow behind everything, warmer as you go deeper */
.glow {
  position: fixed; inset: auto -20vw -40vh -20vw; height: 90vh; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 100%,
    rgba(232, 102, 47, calc(0.18 + var(--heat) * 0.35)) 0%,
    rgba(244, 173, 76, calc(0.05 + var(--heat) * 0.12)) 35%,
    transparent 70%);
  transition: background 1.2s ease;
  animation: breathe 5s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: .82; transform: scale(1.03); } }

.sparks { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.sparks i {
  position: absolute; bottom: -10px; width: 3px; height: 3px; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 6px 1px rgba(244, 173, 76, .8);
  animation: rise linear infinite; opacity: 0;
}
@keyframes rise {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: .9; }
  100% { transform: translate(var(--drift), -75vh); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .sparks { display: none; }
  .glow { animation: none; }
}

.view {
  position: relative; z-index: 1;
  max-width: 640px; margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  min-height: 100dvh;
}

/* Home */
.brand { text-align: center; padding: 28px 0 18px; }
.mark { width: 64px; height: 64px; filter: drop-shadow(0 0 18px rgba(232, 102, 47, .55)); }
h1, h2, .question {
  font-family: Fraunces, Georgia, serif;
  font-variation-settings: "SOFT" 100;
  font-weight: 600; letter-spacing: -.01em;
}
h1 { font-size: 2.6rem; margin: 4px 0 2px; }
h2 { font-size: 1.9rem; margin: 10px 0 4px; line-height: 1.15; }
.tag { color: var(--muted); margin: 0; font-size: 1.05rem; }

.decks { display: grid; gap: 12px; margin-top: 12px; }
.deck {
  text-align: left; border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  padding: 16px 18px; display: grid; gap: 4px; position: relative;
  transition: transform .15s ease, border-color .15s ease;
}
.deck:hover, .deck:focus-visible { border-color: var(--ember); transform: translateY(-1px); outline: none; }
.deck h3 { margin: 0; font: 600 1.3rem/1.2 Fraunces, Georgia, serif; font-variation-settings: "SOFT" 100; }
.deck p { margin: 0; color: var(--muted); font-size: .95rem; }
.deck .meta { font-size: .8rem; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.deck .badge {
  position: absolute; top: 14px; right: 14px; font-size: .72rem; font-weight: 600;
  background: rgba(232, 102, 47, .18); color: var(--gold); border: 1px solid rgba(232, 102, 47, .45);
  padding: 2px 8px; border-radius: 99px; letter-spacing: .04em;
}
.deck.seasonal { border-color: rgba(232, 102, 47, .5); }

.privacy { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 26px; }

/* Shared bits */
.back {
  background: none; border: 0; color: var(--muted); padding: 6px 0; font-size: .95rem;
}
.back:hover { color: var(--text); }
.sub { color: var(--muted); margin: 0 0 22px; }
.hint { color: var(--muted); font-size: .85rem; margin: 6px 0 0; }
.hint.center { text-align: center; min-height: 1.3em; }
.btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 14px 18px; font-weight: 600; transition: transform .1s ease, background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: linear-gradient(180deg, #f0793c, #d4521f); border-color: #f0793c; color: #fff8ee; }
.btn.primary:disabled { opacity: .4; cursor: default; }
.btn.ghost { background: transparent; }
.btn.small { padding: 10px 14px; font-size: .9rem; }
.btn.wide { width: 100%; margin-top: 26px; font-size: 1.05rem; }
.btn.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(232, 102, 47, .25), 0 0 24px rgba(232, 102, 47, .5); } }
.linkish { background: none; border: 0; color: var(--gold); display: block; margin: 18px auto 0; font-weight: 600; }

/* Setup */
.field-label { display: block; font-weight: 600; margin-bottom: 8px; }
.field-label span { color: var(--muted); font-weight: 400; }
.name-row { display: flex; gap: 8px; }
.name-row input {
  flex: 1; min-width: 0; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 16px;
}
.name-row input:focus { outline: 2px solid var(--ember); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 99px;
  padding: 6px 8px 6px 14px; display: inline-flex; align-items: center; gap: 6px;
}
.chip button { background: none; border: 0; color: var(--muted); font-size: 1.1rem; line-height: 1; padding: 0 4px; }
.toggle {
  display: flex; gap: 12px; align-items: flex-start; margin-top: 24px; padding: 14px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); font-size: .92rem; color: var(--muted);
}
.toggle b { color: var(--text); font-weight: 600; }
.toggle input { width: 20px; height: 20px; accent-color: var(--ember); margin-top: 2px; flex: none; }

/* Play */
.topbar { display: flex; align-items: center; gap: 10px; }
.deck-name { flex: 1; text-align: center; color: var(--muted); font-size: .9rem; font-weight: 600; letter-spacing: .04em; }
.icon-btn { background: none; border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; display: grid; place-items: center; color: var(--muted); }
.icon-btn svg { width: 18px; height: 18px; }

.meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 18px 0 8px; }
.meter button {
  background: none; border: 0; padding: 0; display: grid; gap: 6px; text-align: center;
  color: var(--muted); font-size: .78rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.meter .bar { height: 6px; border-radius: 99px; background: var(--line); transition: background .5s ease, box-shadow .5s ease; }
.meter .lit .bar { background: linear-gradient(90deg, var(--ember), var(--gold)); box-shadow: 0 0 10px rgba(232, 102, 47, .6); }
.meter .current { color: var(--gold); }

.card {
  min-height: 44vh; display: flex; flex-direction: column; justify-content: center;
  padding: 24px 6px;
}
.who {
  color: var(--gold); font-weight: 600; font-size: .9rem; letter-spacing: .08em; text-transform: uppercase;
  margin: 0 0 14px; min-height: 1.4em;
}
.question {
  font-size: clamp(1.7rem, 7vw, 2.6rem); line-height: 1.2; margin: 0; text-wrap: balance;
}
.card.enter .question, .card.enter .who { animation: fadeUp .5s ease both; }
.card.enter .question { animation-delay: .05s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.journal-box { margin: -10px 0 18px; }
.journal-box textarea {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 14px; font: inherit; font-size: 16px; resize: vertical;
}
.journal-box textarea:focus { outline: 2px solid var(--ember); outline-offset: 1px; }
.journal-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.saved { color: var(--gold); font-size: .85rem; }
#play.solo .card { min-height: 30vh; }

/* Journal history */
.entry { border-top: 1px solid var(--line); padding: 16px 0; }
.entry .date { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }
.entry h4 { margin: 4px 0 6px; font: 600 1.15rem/1.3 Fraunces, Georgia, serif; }
.entry p { margin: 0; white-space: pre-wrap; }
.entry .del { background: none; border: 0; color: var(--muted); font-size: .8rem; padding: 6px 0 0; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }

/* Big screen (TV / laptop on the coffee table) */
body.tv .view#play { max-width: 1200px; }
body.tv .question { font-size: clamp(2.4rem, 5.2vw, 5rem); }
body.tv .who { font-size: clamp(1rem, 1.6vw, 1.6rem); }
body.tv .card { min-height: 62vh; text-align: center; }
body.tv .controls { max-width: 520px; margin: 0 auto; }
body.tv .meter { max-width: 720px; margin-left: auto; margin-right: auto; }
