/* Hollowmere.
   ------------------------------------------------------------------
   Design brief: a game played around a table in a dim room, on phones,
   by people who are mostly looking at each other rather than at a
   screen. So: everything readable at a glance in low light, tap targets
   big enough for someone who isn't concentrating on their thumb, and no
   color that would light up a face.

   The whole palette lives in near-black with warm undertone plus one
   candle-amber accent. There is intentionally no light theme — a light
   screen at a seance table ruins the room, and the app forces its own
   colors rather than following the phone's.
*/

:root {
  --ink: #0a0807;
  --ink-2: #100d0b;
  --paper: #17130f;
  --paper-hi: #1f1912;
  --edge: #2e241b;
  --edge-hi: #45352a;

  --bone: #e9dfcb;
  --bone-dim: #9d907a;
  --bone-faint: #6a6053;

  --candle: #ffb84d;
  --candle-deep: #c9781f;
  --ember: #b0472a;
  --blood: #8c2f2f;
  --moss: #728059;
  --spirit: #8d7bb5;

  --radius: 14px;
  --tap: 56px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--sans);
  font-size: 16px;
  /* A game screen should never rubber-band or pull-to-refresh — both read
     as the app glitching mid-turn. */
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

body {
  /* 100dvh, not 100vh: on mobile Safari/Chrome the visual viewport shrinks
     when browser chrome shows, and 100vh would push the action bar under
     it — exactly the button people need most. */
  height: 100dvh;
  overflow: hidden;
}

#app { height: 100%; }

/* ---------------------------------------------------------------- ambience

   Three fixed layers behind the app: a warm radial "candle" that breathes,
   a static film grain, and a vignette. They live outside #app (see
   index.html) so re-rendering the view never restarts the animation.
*/

.ambience {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.ambience .glow {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(50% 40% at 50% 18%, rgba(255, 168, 61, 0.20), transparent 70%),
    radial-gradient(70% 60% at 50% 105%, rgba(176, 71, 42, 0.14), transparent 70%);
  animation: breathe 7s ease-in-out infinite;
}

.ambience .grain {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 3px 3px;
}

.ambience .vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 40%, transparent 45%, rgba(0, 0, 0, 0.75) 100%);
}

@keyframes breathe {
  0%, 100% { opacity: 0.85; transform: scale(1); }
  40%      { opacity: 1;    transform: scale(1.03); }
  70%      { opacity: 0.78; transform: scale(0.99); }
}

/* Flicker is atmosphere, not information — anyone who's asked for less
   motion loses nothing by having it held still. */
@media (prefers-reduced-motion: reduce) {
  .ambience .glow { animation: none; }
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ------------------------------------------------------------------ shell */

.screen {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  margin: 0 auto;
  padding-top: var(--safe-top);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px 8px;
  font-size: 13px;
  color: var(--bone-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar .code {
  font-family: var(--serif);
  font-size: 15px;
  letter-spacing: 0.28em;
  color: var(--candle);
  text-transform: none;
}

.topbar .power {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--candle);
  font-variant-numeric: tabular-nums;
}

.topbar .icon-btn {
  background: none;
  border: 1px solid var(--edge);
  color: var(--bone-dim);
  border-radius: 8px;
  width: 34px;
  height: 30px;
  font-size: 14px;
  line-height: 1;
}

/* The one scrolling region. Everything else is pinned. */
.body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px 20px;
}

.actions {
  flex: 0 0 auto;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  border-top: 1px solid var(--edge);
  background: linear-gradient(to top, rgba(10, 8, 7, 0.95), rgba(10, 8, 7, 0.6));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ------------------------------------------------------------- typography */

h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; }

h1 {
  font-size: 34px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: center;
  color: var(--bone);
  text-shadow: 0 0 24px rgba(255, 168, 61, 0.35);
}

h2 { font-size: 24px; letter-spacing: 0.04em; }
h3 { font-size: 18px; letter-spacing: 0.04em; color: var(--bone); }

.flavor {
  font-family: var(--serif);
  font-style: italic;
  color: var(--bone-dim);
  line-height: 1.55;
  margin: 6px 0 0;
}

.label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone-faint);
  margin: 18px 0 8px;
}

.muted { color: var(--bone-dim); }
.center { text-align: center; }

/* ---------------------------------------------------------------- surfaces */

.card {
  background: linear-gradient(160deg, var(--paper-hi), var(--paper));
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 200, 130, 0.05);
}

.card.lit {
  border-color: var(--candle-deep);
  box-shadow: 0 0 0 1px rgba(255, 184, 77, 0.18), 0 10px 30px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 200, 130, 0.12);
}

.card.spent { opacity: 0.55; }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.sigil {
  font-family: var(--serif);
  font-size: 22px;
  color: var(--candle-deep);
}

/* ---------------------------------------------------------------- controls */

button { font-family: inherit; }

.btn {
  display: block;
  width: 100%;
  min-height: var(--tap);
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--edge-hi);
  background: linear-gradient(170deg, #241c15, #171209);
  color: var(--bone);
  font-size: 17px;
  font-family: var(--serif);
  letter-spacing: 0.06em;
  text-align: left;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}

.btn:active { transform: translateY(1px); }

.btn.primary {
  border-color: var(--candle-deep);
  background: linear-gradient(170deg, #3a2609, #221605);
  color: var(--candle);
  text-align: center;
  box-shadow: 0 0 22px rgba(255, 184, 77, 0.16);
}

.btn.ghost {
  background: none;
  border-color: var(--edge);
  color: var(--bone-dim);
  min-height: 44px;
  font-size: 15px;
  text-align: center;
}

.btn.danger { border-color: var(--blood); color: #e6a3a3; }

.btn[disabled] { opacity: 0.35; box-shadow: none; }

.btn .btn-title { display: block; }
.btn .btn-sub {
  display: block;
  margin-top: 5px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--bone-dim);
  letter-spacing: 0;
}
.btn .btn-cost, .cost-hint {
  display: block;
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--candle-deep);
}

/* A read-only preview card (LocationPage's optionsPreview) — same shape as
   .btn's title/sub/cost stack, but never a button, since nothing is
   selectable until the room reaches Submitting. */
.card .card-head h3 { font-size: 17px; }

.field {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--edge-hi);
  background: #0e0b09;
  color: var(--bone);
  font-size: 17px;
  font-family: var(--sans);
}
.field::placeholder { color: var(--bone-faint); }
.field:focus { outline: none; border-color: var(--candle-deep); }

.field.code-field {
  text-align: center;
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  padding-left: 0.34em; /* offset the trailing letter-space so it reads centered */
}

/* Power dial: a range input restyled, plus a big readout, because the
   amount you secretly spend is the single most important number in the
   game and needs to be legible without looking closely. */
.dial { margin: 12px 0 4px; }
.dial-readout {
  font-family: var(--serif);
  font-size: 40px;
  color: var(--candle);
  text-align: center;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(255, 184, 77, 0.4);
}
.dial-readout small {
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--bone-faint);
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 40px;
  background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--candle-deep), var(--edge));
}
input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--candle-deep), var(--edge));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -13px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffd489, var(--candle-deep));
  box-shadow: 0 0 16px rgba(255, 184, 77, 0.6);
  border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: radial-gradient(circle at 35% 30%, #ffd489, var(--candle-deep));
  box-shadow: 0 0 16px rgba(255, 184, 77, 0.6);
}

/* ----------------------------------------------------------------- people */

.roster { display: flex; flex-direction: column; gap: 6px; }

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: rgba(23, 19, 15, 0.7);
  min-height: 48px;
}
.person.me { border-color: var(--candle-deep); }
.person.gone { opacity: 0.45; }
.person .who { flex: 1 1 auto; font-family: var(--serif); font-size: 17px; }
.person .tag {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--bone-faint);
}
.person .tag.done { color: var(--moss); }
.person .tag.waiting { color: var(--candle-deep); }

/* Selectable people (send-someone, pact target) */
.person.choosable { border-color: var(--edge-hi); }
.person.chosen {
  border-color: var(--candle);
  box-shadow: 0 0 18px rgba(255, 184, 77, 0.2) inset;
}

/* The planchette: marks whose turn it is, in the speaking order strip. */
.order {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 2px;
}
.seat {
  position: relative;
  padding: 6px 10px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  font-size: 13px;
  color: var(--bone-faint);
  white-space: nowrap;
}
.seat.acted { color: var(--bone-dim); border-color: var(--edge); opacity: 0.6; }
.seat.now {
  color: var(--ink);
  background: radial-gradient(circle at 40% 30%, #ffd489, var(--candle-deep));
  border-color: var(--candle);
  box-shadow: 0 0 20px rgba(255, 184, 77, 0.45);
}
.seat.now::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 8px;
  height: 8px;
  transform: translateX(-50%) rotate(45deg);
  background: var(--candle-deep);
}

/* --------------------------------------------------------------- location */

.places { display: flex; flex-direction: column; gap: 8px; }

.place {
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: rgba(23, 19, 15, 0.6);
}
.place.full { opacity: 0.45; pointer-events: none; }
.place.full .place-name { color: var(--bone-faint); }
.place.mine { border-color: var(--candle-deep); }
.place .place-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.place .place-name { font-family: var(--serif); font-size: 19px; }
.place .count {
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--bone-faint);
  font-variant-numeric: tabular-nums;
}
.place .occupants {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.pip {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--edge-hi);
  color: var(--bone-dim);
}
.pip.me { border-color: var(--candle-deep); color: var(--candle); }
.pip.empty { border-style: dashed; color: var(--bone-faint); }

/* ------------------------------------------------------------ the reading */

/* The private report. Set apart from everything else on the screen — it's
   the payoff, and it should feel like being handed a note. */
.reading {
  border-left: 2px solid var(--candle-deep);
  padding: 4px 0 4px 14px;
  margin: 10px 0;
}
.reading p {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  margin: 0 0 10px;
  color: var(--bone);
}
.reading p:last-child { margin-bottom: 0; }

.public-line {
  font-family: var(--serif);
  font-size: 18px;
  font-style: italic;
  line-height: 1.55;
  color: var(--candle);
  margin: 0;
}

.ledger { display: flex; flex-direction: column; gap: 8px; }
.ledger .entry {
  font-size: 14px;
  line-height: 1.5;
  color: var(--bone-dim);
  padding-left: 16px;
  position: relative;
}
.ledger .entry::before {
  content: "·";
  position: absolute;
  left: 4px;
  color: var(--candle-deep);
}
.ledger .entry .day {
  color: var(--bone-faint);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-right: 6px;
}

.chronicle .line {
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.55;
  color: var(--bone-dim);
  padding: 5px 0;
  border-bottom: 1px solid rgba(46, 36, 27, 0.6);
}
.chronicle .line:first-child { color: var(--bone); }
.chronicle .line:last-child { border-bottom: none; }

.items { display: flex; flex-wrap: wrap; gap: 6px; }
.item {
  border: 1px solid var(--edge-hi);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--candle);
}

/* -------------------------------------------------------------- transient */

.notice {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 50;
  max-width: 92vw;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--blood);
  background: #1a0d0d;
  color: #eec9c9;
  font-size: 14px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

.connection {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ember);
}

.waiting {
  text-align: center;
  padding: 28px 8px;
  color: var(--bone-dim);
  font-family: var(--serif);
  font-style: italic;
  font-size: 17px;
  line-height: 1.6;
}

/* The lone bit of motion that carries information: something is pending. */
.waiting .dots::after {
  content: "";
  animation: dots 1.8s steps(4, end) infinite;
}
@keyframes dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
}

.hint {
  font-size: 13px;
  line-height: 1.5;
  color: var(--bone-faint);
  border: 1px dashed var(--edge-hi);
  border-radius: 10px;
  padding: 10px 12px;
  margin-top: 14px;
}

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1 1 auto; }
