/* THE SUNDAY DRAW — casino-noir horror */

:root {
  --ink: #060906;
  --felt: #0c1610;
  --felt-deep: #122b1c;
  --green: #1e4d2b;
  --gold: #d8b45a;
  --gold-dim: #8a7335;
  --bone: #cfc9b8;
  --red: #a8362e;
  --void: #2a0e12;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(ellipse at 50% -10%, #14241a 0%, var(--ink) 65%);
  color: var(--bone);
  font-family: Georgia, 'Times New Roman', serif;
}

.hidden { display: none !important; }

.num { font-variant-numeric: tabular-nums; font-size: 1.5rem; letter-spacing: 0.05em; }
.gold { color: var(--gold); text-shadow: 0 0 12px rgba(216, 180, 90, 0.35); }
.red { color: var(--red); }
.label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  color: var(--gold-dim);
  text-transform: uppercase;
}
.sub { display: block; font-size: 0.78rem; color: #8c8775; font-style: italic; }

/* ---------- atmosphere overlays ---------- */

#candle {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  background: radial-gradient(ellipse at 50% 12%, rgba(255, 186, 92, 0.10), transparent 55%);
  animation: candleflick 4.2s infinite;
  mix-blend-mode: screen;
}
@keyframes candleflick {
  0%, 100% { opacity: 0.85; transform: translateX(0); }
  7%  { opacity: 0.6; }
  13% { opacity: 0.95; transform: translateX(3px); }
  29% { opacity: 0.7; }
  41% { opacity: 1; transform: translateX(-2px); }
  53% { opacity: 0.65; }
  68% { opacity: 0.9; }
  81% { opacity: 0.55; transform: translateX(2px); }
  92% { opacity: 0.85; }
}

#grain {
  position: fixed; inset: -10%; z-index: 51; pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.22) 0px, rgba(0,0,0,0.22) 1px, transparent 1px, transparent 3px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.012) 0 2px, transparent 2px 7px),
    repeating-linear-gradient(35deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 5px);
  animation: grainjit 0.45s steps(3) infinite;
  opacity: 0.8;
}
@keyframes grainjit {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-9px, 6px); }
  66% { transform: translate(7px, -8px); }
  100% { transform: translate(0, 0); }
}

/* ---------- shared bar ---------- */

#shared-bar {
  display: flex; justify-content: center; gap: 3rem;
  padding: 0.7rem 1rem 0.5rem;
  border-bottom: 1px solid rgba(216, 180, 90, 0.25);
  background: linear-gradient(180deg, rgba(18, 43, 28, 0.6), rgba(6, 9, 6, 0.2));
  text-align: center;
}
.bar-cell { min-width: 10rem; }
#pot-value { font-size: 2rem; }
.pot-cell.rumbling #pot-value { animation: potshake 0.5s; }
@keyframes potshake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-2px, 1px) scale(1.04); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-1px, -1px) scale(1.02); }
  80% { transform: translate(1px, 1px); }
}

/* ---------- layout ---------- */

#app { max-width: 880px; margin: 0 auto; padding: 1.2rem 1rem 4rem; }
.screen { text-align: center; }

h1 {
  font-size: 3rem; letter-spacing: 0.18em; color: var(--gold);
  text-shadow: 0 0 24px rgba(216, 180, 90, 0.3);
  margin: 3rem 0 0.5rem;
}
.tagline { color: #8c8775; font-style: italic; margin-bottom: 3rem; }

button {
  font-family: inherit; cursor: pointer;
  background: var(--felt-deep); color: var(--bone);
  border: 1px solid var(--gold-dim);
  padding: 0.55rem 1.2rem; font-size: 0.95rem;
  letter-spacing: 0.12em;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
}
button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 0 14px rgba(216, 180, 90, 0.25); }
button:disabled { opacity: 0.35; cursor: default; }
.big { font-size: 1.1rem; padding: 0.9rem 2.2rem; }
.gold-btn { border-color: var(--gold); color: var(--gold); }
.red-btn { border-color: var(--red); color: #d4837d; margin-top: 1.4rem; }
.dim-btn { border-color: #444; color: #8c8775; font-style: italic; margin-top: 1rem; }

/* ---------- HUD ---------- */

#hud {
  display: flex; justify-content: center; gap: 2.4rem;
  padding: 0.6rem 0 1rem; border-bottom: 1px dashed rgba(216, 180, 90, 0.18);
  margin-bottom: 1.2rem;
}
.relics-cell { max-width: 18rem; }
.relic-chip {
  display: inline-block; margin: 0.1rem 0.15rem; padding: 0.05rem 0.45rem;
  border: 1px solid var(--gold-dim); border-radius: 2px;
  font-size: 0.72rem; color: var(--gold); font-style: normal;
}

/* ---------- kiosk ---------- */

.kiosk-title { letter-spacing: 0.3em; font-size: 1rem; color: var(--gold-dim); }
#kiosk {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem;
}
.offer {
  width: 9.5rem; padding: 0.8rem 0.5rem;
  background: linear-gradient(165deg, var(--felt-deep), var(--felt));
  border: 1px solid rgba(216, 180, 90, 0.35);
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
}
.offer.sold { opacity: 0.25; }
.offer .offer-name { display: block; font-size: 0.9rem; color: var(--bone); letter-spacing: 0.08em; }
.offer .offer-price { display: block; font-size: 1.3rem; color: var(--gold); margin: 0.1rem 0; }
.offer .sub { display: block; line-height: 1.3; }
.offer button { margin-top: 0.45rem; }

/* ---------- play area / scratch grid ---------- */

#play-area {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(4, 6, 4, 0.88);
  display: flex; align-items: center; justify-content: center;
}
.ticket-panel {
  background: linear-gradient(170deg, #15291c, #0a120c);
  border: 1px solid var(--gold-dim);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
  padding: 1.4rem 2rem 1.6rem; text-align: center;
  min-width: 21rem;
}
.ticket-panel h3 { margin: 0 0 0.2rem; color: var(--gold); letter-spacing: 0.2em; font-size: 1rem; }
.ticket-value { font-size: 1.6rem; color: var(--gold); min-height: 2.2rem; }

.grid3 {
  display: grid; grid-template-columns: repeat(3, 4.6rem); gap: 0.45rem;
  justify-content: center; margin: 0.9rem 0;
}
.cell {
  width: 4.6rem; height: 4.6rem; font-size: 1.7rem;
  background:
    repeating-linear-gradient(45deg, #2c2417 0 6px, #241d12 6px 12px);
  border: 1px solid #4a3d22; color: transparent;
  position: relative;
  transition: background 0.15s;
}
.cell:not(.revealed):hover { box-shadow: inset 0 0 18px rgba(216, 180, 90, 0.3); }
.cell.revealed {
  background: #0b130d; color: var(--bone); cursor: default;
  animation: cellpop 0.28s ease-out;
}
@keyframes cellpop {
  0% { transform: scale(0.4) rotate(-6deg); }
  70% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
.cell.is-mult { color: var(--gold); text-shadow: 0 0 10px rgba(216,180,90,0.5); }
.cell.is-void { background: var(--void); color: var(--red); }
.cell.shake { animation: cellshake 0.45s ease-in-out; }
@keyframes cellshake {
  0%, 100% { transform: translate(0); }
  15% { transform: translate(-6px, 2px) rotate(-3deg); }
  30% { transform: translate(6px, -3px) rotate(3deg); }
  45% { transform: translate(-5px, -2px); }
  60% { transform: translate(5px, 2px) rotate(-2deg); }
  75% { transform: translate(-3px, 1px); }
}
.cell.peeked::after {
  content: attr(data-peek);
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: rgba(216, 180, 90, 0.55); font-size: 1.2rem;
}
.cell.ashed { background: #1c1a14; color: #6b6353; }

.ticket-panel.dead { animation: panelflash 0.5s; border-color: var(--red); }
@keyframes panelflash {
  0% { box-shadow: 0 0 0 rgba(168, 54, 46, 0); }
  30% { box-shadow: 0 0 80px rgba(168, 54, 46, 0.7); }
  100% { box-shadow: 0 0 60px rgba(0, 0, 0, 0.9); }
}
.dead-stamp {
  color: var(--red); font-size: 1.5rem; letter-spacing: 0.4em;
  transform: rotate(-8deg); margin: 0.4rem 0;
}

.ticket-actions { display: flex; gap: 0.7rem; justify-content: center; margin-top: 0.6rem; }

/* ---------- number slip ---------- */

.numgrid {
  display: grid; grid-template-columns: repeat(4, 3.4rem); gap: 0.4rem;
  justify-content: center; margin: 0.9rem 0;
}
.numbtn { width: 3.4rem; height: 3rem; font-size: 1.1rem; }
.numbtn.picked { background: var(--green); border-color: var(--gold); color: var(--gold); }
.numbtn.drawn { background: var(--gold-dim); color: var(--ink); animation: cellpop 0.3s; }
.numbtn.hit { background: var(--gold); color: var(--ink); animation: cellpop 0.4s; }

/* ---------- between nights / relics ---------- */

.house-line {
  font-style: italic; font-size: 1.25rem; color: var(--bone);
  max-width: 34rem; margin: 2.5rem auto 1.5rem;
  text-shadow: 0 0 14px rgba(0, 0, 0, 0.8);
}
#relic-offer { display: flex; justify-content: center; gap: 0.9rem; flex-wrap: wrap; }
.relic-card {
  width: 12rem; padding: 1rem 0.8rem;
  background: linear-gradient(170deg, #1a1408, #0e0b05);
  border: 1px solid var(--gold-dim); text-align: center;
}
.relic-card:hover { border-color: var(--gold); box-shadow: 0 0 18px rgba(216, 180, 90, 0.3); }
.relic-card .relic-name { display: block; color: var(--gold); letter-spacing: 0.1em; margin-bottom: 0.4rem; }
.relic-card .relic-desc { display: block; font-size: 0.78rem; color: #9a937e; font-style: italic; }

/* ---------- end screen ---------- */

#screen-end h2 { font-size: 2.2rem; letter-spacing: 0.2em; color: var(--gold); margin-top: 3rem; }
#screen-end h2.busted { color: var(--red); }
#score-box { margin: 1.2rem 0; }
#handle {
  background: var(--ink); color: var(--gold); border: 1px solid var(--gold-dim);
  font-family: inherit; padding: 0.55rem 0.8rem; font-size: 1rem; letter-spacing: 0.1em;
  margin-right: 0.5rem;
}
#leaderboard {
  display: inline-block; text-align: left; margin: 0.4rem auto 1.4rem;
  color: #9a937e; font-size: 0.9rem; min-width: 16rem;
}
#leaderboard .lb-score { color: var(--gold); float: right; margin-left: 2rem; }

@media (max-width: 600px) {
  #shared-bar { gap: 1rem; } .bar-cell { min-width: 0; }
  #hud { gap: 1rem; flex-wrap: wrap; }
}

/* ---------- THE DRAW ceremony ---------- */
#screen-draw { text-align: center; }
.draw-pot {
  font-size: 72px; letter-spacing: 2px; margin: 18px 0 6px;
  text-shadow: 0 0 24px rgba(212, 175, 55, .35);
}
.gilded-line {
  margin: 6px auto; max-width: 420px; display: flex; justify-content: space-between;
  gap: 12px; padding: 4px 10px; border-bottom: 1px solid rgba(212, 175, 55, .15);
  animation: gildIn .4s ease-out;
}
@keyframes gildIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#draw-engraved { margin: 22px 0 8px; animation: gildIn .6s ease-out; }
.draw-winner { font-size: 44px; letter-spacing: 4px; margin-top: 6px; }
#draw-you { margin-top: 18px; }
#marble-wrap { margin-top: 28px; }
#marble { list-style: none; padding: 0; max-width: 360px; margin: 8px auto; }
#marble li {
  display: flex; justify-content: space-between; padding: 3px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06); letter-spacing: 2px;
}

/* ---------- title-screen house rules (engraved parlor placards) ---------- */
.rules-row {
  display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap;
  margin: 1.8rem auto 1.4rem; max-width: 46rem;
}
.rule-card {
  width: 13.5rem; padding: 1.05rem 0.9rem 1.15rem;
  background: linear-gradient(170deg, var(--felt-deep), var(--felt));
  border: 1px solid var(--gold-dim);
  box-shadow:
    inset 0 0 0 3px rgba(6, 9, 6, 0.9),
    inset 0 0 0 4px rgba(216, 180, 90, 0.28),
    0 10px 32px rgba(0, 0, 0, 0.55);
  text-align: center;
  opacity: 0; animation: ruleIn 0.7s ease-out forwards;
}
.rule-card:nth-child(2) { animation-delay: 0.25s; }
.rule-card:nth-child(3), .rule-card:nth-child(4) { animation-delay: 0.5s; }
@keyframes ruleIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.rule-no { display: block; font-size: 0.78rem; color: var(--gold-dim); letter-spacing: 0.25em; }
.rule-title { margin: 0.15rem 0 0.75rem; color: var(--gold); letter-spacing: 0.3em; font-size: 0.95rem; font-weight: 600; }
.rule-text { font-size: 0.82rem; line-height: 1.55; color: #a9a28d; margin: 0.85rem 0 0; }
.rule-text b { color: var(--gold); font-weight: 600; }

.grid-demo { display: grid; grid-template-columns: repeat(3, 1.7rem); gap: 0.25rem; justify-content: center; }
.demo-cell {
  width: 1.7rem; height: 1.7rem;
  background: repeating-linear-gradient(45deg, #2c2417 0 4px, #241d12 4px 8px);
  border: 1px solid #4a3d22;
  display: flex; align-items: center; justify-content: center; font-size: 0.95rem;
}
.demo-cell.revealed { background: #0b130d; color: var(--bone); }
.demo-cell.void-cell {
  background: var(--void); color: #e0524a; font-size: 1.15rem;
  text-shadow: 0 0 8px rgba(224, 82, 74, 0.6);
}

.cuts-demo { display: flex; gap: 0.6rem; justify-content: center; align-items: flex-end; min-height: 3.65rem; }
.cut-token {
  border: 1px solid var(--gold-dim); color: var(--gold);
  padding: 0.25rem 0.5rem; font-variant-numeric: tabular-nums;
}
.cut-token.mid { font-size: 1.15rem; }
.cut-token.high { font-size: 1.35rem; color: var(--red); border-color: var(--red); }

.pot-demo { min-height: 3.65rem; display: flex; flex-direction: column; justify-content: center; }
.pot-demo-label { font-size: 0.6rem; letter-spacing: 0.28em; color: var(--gold-dim); }
.pot-demo-num { color: var(--gold); font-size: 1.4rem; font-variant-numeric: tabular-nums; text-shadow: 0 0 14px rgba(216, 180, 90, 0.4); }

.relics-demo { min-height: 3.65rem; display: flex; align-items: center; justify-content: center; gap: 0.3rem; flex-wrap: wrap; }

.next-draw { color: var(--gold-dim); letter-spacing: 0.18em; font-size: 0.78rem; margin: 0 0 1.3rem; }

.mute-btn {
  position: fixed; top: 0.6rem; right: 0.8rem; z-index: 60;
  border-color: #3a3526; color: #8c8775; background: rgba(6, 9, 6, 0.65);
  font-size: 0.7rem; padding: 0.25rem 0.6rem; letter-spacing: 0.15em; font-style: italic;
}

/* ---------- void eulogy + pot hero ---------- */
.void-eulogy { margin-top: 0.3rem; color: #a8645e; }
#pot-value { animation: potglow 5s ease-in-out infinite; }
@keyframes potglow {
  0%, 100% { text-shadow: 0 0 12px rgba(216, 180, 90, 0.35); }
  50% { text-shadow: 0 0 26px rgba(216, 180, 90, 0.65); }
}

/* ---------- mobile ---------- */
@media (max-width: 600px) {
  h1 { font-size: 1.9rem; letter-spacing: 0.12em; margin-top: 1.6rem; }
  .tagline { margin-bottom: 1.6rem; }
  #shared-bar { gap: 0.6rem; flex-wrap: wrap; padding: 0.5rem 0.4rem 0.4rem; }
  .bar-cell { min-width: 0; flex: 1 1 30%; }
  #pot-value { font-size: 1.4rem; }
  .num { font-size: 1.05rem; }
  .rules-row { gap: 0.7rem; margin-top: 1.1rem; }
  .rule-card { width: 100%; max-width: 22rem; padding: 0.85rem 0.8rem 0.95rem; }
  .grid-demo, .cuts-demo, .pot-demo, .relics-demo { min-height: 0; }
  .mute-btn { top: auto; bottom: 0.6rem; right: 0.6rem; }
  #hud { gap: 1rem; flex-wrap: wrap; }
  .ticket-panel { min-width: 0; width: calc(100vw - 1.6rem); padding: 1rem 0.8rem 1.2rem; }
  .grid3 { grid-template-columns: repeat(3, minmax(4.2rem, 1fr)); width: 100%; }
  .cell { width: 100%; height: 4.2rem; }
  .draw-pot { font-size: 13vw; }
  .draw-winner { font-size: 8vw; }
  .numgrid { grid-template-columns: repeat(4, 1fr) !important; width: 100%; }
}

/* ---------- bone dice ---------- */
.dice-row { display: flex; gap: 1.1rem; justify-content: center; margin: 1.1rem 0 0.5rem; }
.die {
  font-size: 3.6rem; width: 5.2rem; height: 5.2rem; line-height: 1; padding: 0;
  background: #0b130d; border: 1px solid var(--gold-dim); color: var(--bone);
}
.die:hover:not(:disabled) { box-shadow: inset 0 0 18px rgba(216, 180, 90, 0.3); color: var(--gold); }
.dead .die { color: var(--red); border-color: var(--red); }

/* ---------- feedback box ---------- */
#feedback-box { margin: 1.2rem auto 0; max-width: 26rem; }
#feedback-text {
  width: 100%; font-family: inherit; font-style: italic; font-size: 0.85rem;
  background: rgba(11, 19, 13, 0.8); color: var(--bone);
  border: 1px solid #3a3526; padding: 0.5rem; resize: none;
}
#feedback-box .dim-btn { margin-top: 0.3rem; font-size: 0.75rem; }

/* ---------- wax tabs ---------- */
.tab-ladder { display: flex; flex-direction: column; gap: 0.35rem; margin: 1rem auto 0.5rem; max-width: 15rem; }
.tab-rung {
  padding: 0.55rem 0.5rem; letter-spacing: 0.18em; font-style: italic;
  background: repeating-linear-gradient(90deg, #2c2417 0 8px, #241d12 8px 16px);
  border: 1px solid #4a3d22; color: #9a937e;
}
.tab-rung:hover:not(:disabled) { box-shadow: inset 0 0 16px rgba(216, 180, 90, 0.3); color: var(--gold); }
.tab-rung.pulled { background: #0b130d; color: var(--gold); font-style: normal; }
.tab-rung.snake { background: var(--void); color: var(--red); border-color: var(--red); font-style: normal; }
.tab-rung.sealed { background: #11200f; color: var(--gold); border-color: var(--gold-dim); font-style: normal; }
.crow-whisper { color: var(--gold); margin-top: 0.15rem; }

/* ---------- THE VAULT ---------- */
#screen-vault .sub { margin-bottom: 0.6rem; }
#vault-shards { margin: 0.4rem 0 1.2rem; }
#vault-items { display: flex; flex-direction: column; gap: 0.7rem; max-width: 34rem; margin: 0 auto 1.4rem; }
.vault-item {
  display: flex; align-items: center; gap: 1rem; text-align: left;
  border: 1px solid var(--gold-dim); padding: 0.7rem 1rem;
  background: linear-gradient(170deg, var(--felt-deep), var(--felt));
  box-shadow: inset 0 0 0 3px rgba(6, 9, 6, 0.9), inset 0 0 0 4px rgba(216, 180, 90, 0.22);
}
.vault-item .vault-name { color: var(--gold); letter-spacing: 0.08em; min-width: 11rem; }
.vault-item .sub { flex: 1; }
.vault-item.owned { border-color: var(--gold); }
.vault-item button { white-space: nowrap; }

/* lit candles by the Pot */
.candle-row { display: flex; flex-wrap: wrap; gap: 0.8rem; justify-content: center; margin: -0.4rem 0 1rem; }
.lit-candle {
  font-size: 0.8rem; font-style: italic; color: var(--gold);
  text-shadow: 0 0 10px rgba(255, 186, 92, 0.5);
  animation: candleflick 4.2s infinite;
}

/* ---------- vault themes ---------- */
body.theme-ember {
  --felt: #160e08; --felt-deep: #2b1a10; --gold: #e0985a; --gold-dim: #8a5c35; --green: #4d2b1e;
  background: radial-gradient(ellipse at 50% -10%, #241a14 0%, #090606 65%);
}
body.theme-ember #candle { background: radial-gradient(ellipse at 50% 12%, rgba(255, 140, 60, 0.14), transparent 55%); }
body.theme-violet {
  --felt: #100c16; --felt-deep: #1d142b; --gold: #b08ad8; --gold-dim: #5e4a73; --green: #2b1e4d;
  background: radial-gradient(ellipse at 50% -10%, #1a1424 0%, #060609 65%);
}
body.theme-violet #candle { background: radial-gradient(ellipse at 50% 12%, rgba(186, 140, 255, 0.10), transparent 55%); }

/* ---------- share card ---------- */
.share-card { max-width: min(100%, 26rem); display: block; margin: 1rem auto 0.2rem; border: 1px solid var(--gold-dim); }
.share-btn { display: inline-block; text-decoration: none; }

/* ================= THE LONG GALLERY ================= */

.gallery-btn {
  display: block; margin: 0.8rem auto 0;
  border-color: #4a3d22; color: var(--bone); letter-spacing: 0.22em;
  background: linear-gradient(180deg, #0b0f0a, #060906);
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.8);
}
.gallery-btn:hover:not(:disabled) { border-color: var(--gold-dim); color: var(--gold); }

#screen-gallery { position: relative; }

/* the corridor: darkness with a throat at the end */
#gal-corridor {
  position: relative; margin: 0.6rem auto 0.2rem; max-width: 40rem;
  padding: 2.2rem 1.2rem 1.6rem;
  background:
    radial-gradient(ellipse at 50% 118%, rgba(255, 186, 92, 0.07), transparent 55%),
    radial-gradient(ellipse at 50% 30%, #0b0d0a 0%, #040504 70%);
  border: 1px solid #1c1a12;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.95), 0 0 40px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}
.gal-depth { /* the corridor narrowing away between the doors */
  position: absolute; left: 50%; top: 8%; width: 22%; height: 70%;
  transform: translateX(-50%) perspective(220px) rotateX(18deg);
  background:
    linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.85) 55%),
    repeating-linear-gradient(180deg, rgba(216,180,90,0.025) 0 2px, transparent 2px 14px);
  filter: blur(1px);
  pointer-events: none;
}

/* header: carved numeral + the House's lantern */
.gal-top { display: flex; justify-content: center; align-items: center; gap: 2.6rem; margin-top: 0.8rem; }
.gal-numeral {
  display: block; font-size: 2.6rem; letter-spacing: 0.22em; color: #3f3724;
  text-shadow: 0 1px 0 rgba(216, 180, 90, 0.18), 0 -1px 2px rgba(0, 0, 0, 0.9);
}
#gal-lantern { position: relative; width: 2.6rem; height: 3.4rem; }
.gal-lantern-cage {
  position: absolute; inset: 0.3rem 0.5rem 0;
  border: 1px solid #4a3d22; border-radius: 30% 30% 12% 12%;
  background: linear-gradient(180deg, rgba(20, 16, 8, 0.4), rgba(4, 4, 3, 0.9));
  display: flex; align-items: flex-end; justify-content: center;
  overflow: hidden;
}
.gal-lantern-ring { position: absolute; top: -0.25rem; left: 50%; width: 0.9rem; height: 0.5rem; transform: translateX(-50%); border: 1px solid #4a3d22; border-bottom: none; border-radius: 50% 50% 0 0; }
#gal-flame {
  width: 0.65rem; height: 24%;
  background: linear-gradient(180deg, #ffd98a 0%, #f0a23c 55%, #8a4a1a 100%);
  border-radius: 50% 50% 35% 35%;
  box-shadow: 0 0 14px rgba(255, 186, 92, 0.8), 0 0 34px rgba(255, 150, 60, 0.35);
  transition: height 0.9s ease;
  animation: galflame 2.8s infinite;
  margin-bottom: 2px;
}
@keyframes galflame {
  0%, 100% { transform: scaleX(1) translateX(0); opacity: 0.95; }
  18% { transform: scaleX(0.86) translateX(0.5px); opacity: 0.8; }
  37% { transform: scaleX(1.06) translateX(-0.5px); }
  54% { opacity: 0.7; }
  71% { transform: scaleX(0.92); opacity: 1; }
  88% { transform: scaleX(1.03) translateX(0.5px); opacity: 0.85; }
}

.gal-house-line { margin: 0.9rem auto 0.4rem; font-size: 1.02rem; min-height: 2.4rem; max-width: 30rem; }

/* the two doors */
#gal-doors { display: flex; justify-content: center; gap: 14%; position: relative; }
.gal-door {
  position: relative; width: 11rem; height: 19rem; padding: 0;
  background: transparent; border: none; cursor: pointer;
  transition: transform 0.25s ease;
}
.gal-door:hover:not(:disabled) { transform: translateY(-3px); }
.gal-door:disabled { cursor: default; opacity: 0.85; }
.gal-door-panel {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(216, 180, 90, 0.05), transparent 18%),
    repeating-linear-gradient(92deg, #171208 0 9px, #120e07 9px 18px, #1a140a 18px 26px),
    linear-gradient(180deg, #15100a, #0a0805);
  border: 1px solid #2c2417; border-top: 3px solid #3a2f1a;
  box-shadow:
    inset 0 0 36px rgba(0, 0, 0, 0.85),
    inset 0 0 0 1px rgba(216, 180, 90, 0.05),
    0 14px 30px rgba(0, 0, 0, 0.8);
}
/* lantern flicker washing over the panels */
.gal-door-panel::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 120%, rgba(255, 186, 92, 0.13), transparent 60%);
  mix-blend-mode: screen;
  animation: candleflick 4.2s infinite;
}
.gal-door-handle {
  position: absolute; right: 0.8rem; top: 52%; width: 0.5rem; height: 0.5rem;
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, #b39346, #4a3d22 70%);
  box-shadow: 0 0 6px rgba(216, 180, 90, 0.35);
}
.gal-door:hover:not(:disabled) .gal-door-panel { border-color: #4a3d22; }
.gal-door.gal-chosen .gal-door-panel { border-color: var(--gold-dim); box-shadow: inset 0 0 36px rgba(0,0,0,.85), 0 0 24px rgba(216,180,90,0.18); }

/* candle-smoke pooled at the lintel — layered, drifting, never countable */
.gal-smoke {
  position: absolute; left: -6%; right: -6%; top: -7%; height: 52%;
  opacity: var(--smoke, 0); pointer-events: none; z-index: 3;
  background:
    radial-gradient(ellipse 70% 42% at 30% 18%, rgba(190, 185, 170, 0.30), transparent 70%),
    radial-gradient(ellipse 85% 50% at 65% 8%, rgba(150, 145, 130, 0.26), transparent 72%),
    radial-gradient(ellipse 55% 32% at 50% 30%, rgba(120, 115, 100, 0.20), transparent 75%),
    radial-gradient(ellipse 95% 60% at 50% 0%, rgba(80, 78, 70, 0.30), transparent 80%);
  filter: blur(7px);
  animation: galsmoke 11s ease-in-out infinite alternate;
}
@keyframes galsmoke {
  0% { transform: translateX(-3%) scaleY(1); }
  50% { transform: translateX(2%) scaleY(1.08) translateY(2%); }
  100% { transform: translateX(4%) scaleY(0.96); }
}

/* footprints: smeared wear-marks on the floor before the door */
.gal-prints {
  position: absolute; left: 4%; right: 4%; bottom: -4%; height: 30%;
  opacity: var(--prints, 0); pointer-events: none; z-index: 2;
  background:
    radial-gradient(ellipse 14% 26% at 30% 78%, rgba(207, 201, 184, 0.5), transparent 75%),
    radial-gradient(ellipse 13% 24% at 48% 60%, rgba(207, 201, 184, 0.42), transparent 75%),
    radial-gradient(ellipse 14% 26% at 64% 80%, rgba(207, 201, 184, 0.46), transparent 75%),
    radial-gradient(ellipse 12% 22% at 78% 56%, rgba(207, 201, 184, 0.36), transparent 75%),
    radial-gradient(ellipse 16% 28% at 40% 40%, rgba(207, 201, 184, 0.30), transparent 78%),
    radial-gradient(ellipse 60% 50% at 50% 85%, rgba(180, 172, 150, 0.22), transparent 80%);
  filter: blur(3px);
}

/* corpses: folded body silhouettes at the doorframe */
.gal-corpses { position: absolute; left: 0; right: 0; bottom: 0; height: 34%; pointer-events: none; z-index: 4; }
.gal-corpse {
  position: absolute; bottom: 2%; width: 52%; height: 58%;
  left: 6%;
  background: #020302;
  clip-path: polygon(8% 96%, 2% 78%, 14% 60%, 30% 56%, 34% 38%, 46% 26%, 62% 28%, 68% 44%, 60% 58%, 78% 66%, 92% 82%, 96% 96%);
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.9));
  opacity: 0.92;
}
.gal-corpse + .gal-corpse { left: auto; right: 4%; transform: scaleX(-1); bottom: 0; }
/* old corpses render as bone-dust: visibly less reliable */
.gal-corpse.old {
  background:
    radial-gradient(ellipse at 40% 60%, rgba(207, 201, 184, 0.38), transparent 70%),
    radial-gradient(ellipse at 65% 40%, rgba(207, 201, 184, 0.22), transparent 70%);
  clip-path: polygon(6% 96%, 2% 76%, 16% 58%, 32% 54%, 36% 36%, 48% 24%, 64% 26%, 70% 42%, 62% 56%, 80% 64%, 94% 80%, 98% 96%);
  opacity: 0.5; filter: blur(2px);
}

.gal-actions { margin-top: 1.1rem; }
#btn-gal-bank { letter-spacing: 0.1em; }
.gal-plaque { margin-top: 0.8rem; letter-spacing: 0.06em; }

/* turn-back confirm: the only place oil/tier are numbers */
#gal-confirm h2, #gal-exit h2 { font-size: 1.8rem; letter-spacing: 0.24em; color: var(--gold); margin-top: 3.2rem; }
#gal-confirm-numbers { font-variant-numeric: tabular-nums; letter-spacing: 0.12em; }
#btn-gal-stay { display: block; margin: 0.9rem auto 0; }
#btn-gal-leave { display: block; margin: 1.4rem auto 0; }

/* death: the screen snaps black */
#gal-death {
  position: fixed; inset: 0; z-index: 45;
  background: #000;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.7rem; padding: 1rem;
  animation: galsnap 0.18s steps(2) both;
}
@keyframes galsnap { from { opacity: 0; } to { opacity: 1; } }
.teeth-stamp {
  color: var(--red); font-size: 2.6rem; letter-spacing: 0.5em; text-indent: 0.5em;
  transform: rotate(-7deg);
  text-shadow: 0 0 22px rgba(168, 54, 46, 0.6);
  animation: teethstamp 0.5s cubic-bezier(0.2, 2.4, 0.4, 1) 0.15s both;
}
@keyframes teethstamp {
  0% { transform: rotate(-7deg) scale(2.6); opacity: 0; }
  100% { transform: rotate(-7deg) scale(1); opacity: 1; }
}
.gal-sweep { color: #a8645e; }
#gal-death .red-btn { margin-top: 1.6rem; }

/* mobile pass: doors stack tall and thumb-sized */
@media (max-width: 600px) {
  #gal-corridor { padding: 1.4rem 0.7rem 1.1rem; }
  .gal-depth { display: none; }
  #gal-doors { flex-direction: column; align-items: center; gap: 1rem; }
  .gal-door { width: min(100%, 19rem); height: 10.5rem; }
  .gal-door-handle { top: 46%; }
  .gal-smoke { height: 60%; top: -10%; }
  .gal-corpse { width: 34%; height: 72%; }
  .gal-numeral { font-size: 2rem; }
  .gal-top { gap: 1.6rem; }
  .teeth-stamp { font-size: 1.7rem; }
}

/* ---------- edicts / marker / pawn drawer ---------- */
.edict-line {
  color: var(--gold); font-size: 0.82rem; font-style: italic;
  letter-spacing: 0.06em; margin: 0.2rem 0 1rem;
  text-shadow: 0 0 10px rgba(216, 180, 90, 0.25);
}
.edict-line.small { font-size: 0.74rem; color: var(--gold-dim); margin: 0 0 0.8rem; }
#screen-marker h2 { color: var(--red); letter-spacing: 0.2em; }
#marker-terms { max-width: 26rem; margin: 0.6rem auto 1.4rem; }
.offer.pawn-offer { border-color: var(--gold); box-shadow: inset 0 0 14px rgba(216, 180, 90, 0.18); }
.offer.pawn-offer .offer-name { color: var(--gold); }

.die.unrolled { color: #5a5346; font-style: normal; }
.die.unrolled:hover:not(:disabled) { color: var(--gold); }

/* Kiosk rows: cap width so 7 offers break 4+3 (and 8 break 4+4) instead of 5+2.
   Flex centering makes the short row symmetric — a deliberate pyramid, not a remainder. */
#kiosk { max-width: 41rem; margin: 0 auto; }

/* ---------- the doors (room unlock chain) ---------- */
#doors { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; margin-top: 0.4rem; }
.locked-door {
  border: 1px dashed #3a3526; padding: 0.5rem 1.6rem; text-align: center;
  color: #6b6353; letter-spacing: 0.15em; max-width: 22rem;
}
.locked-door .locked-name { display: block; font-size: 0.95rem; filter: blur(0.6px); opacity: 0.7; }
.locked-door .sub { font-style: italic; }
.unlock-toast {
  color: var(--gold); font-style: italic; letter-spacing: 0.08em;
  text-shadow: 0 0 14px rgba(216, 180, 90, 0.4); animation: gildIn 0.6s ease-out;
}
.gallery-btn { border-color: var(--gold-dim); color: var(--bone); display: block; margin: 0.4rem auto; }

/* ---------- THE LOCK-IN ---------- */
.lockin-btn {
  display: block; margin: 0.6rem auto 0; letter-spacing: 0.28em;
  color: var(--gold); border: 1px solid #6e5a28;
  background: linear-gradient(180deg, rgba(28, 22, 12, 0.9), rgba(10, 8, 5, 0.95));
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.6);
}
.lockin-btn:hover:not(:disabled) { border-color: var(--gold); box-shadow: inset 0 0 18px rgba(216, 180, 90, 0.12); }
.lockin-door-sub {
  display: block; font-style: italic; font-size: 0.68rem; letter-spacing: 0.08em;
  color: #8c8775; margin-top: 0.25rem; text-transform: none;
}

#screen-lockin h2 { letter-spacing: 0.3em; }
.li-sub { letter-spacing: 0.1em; font-style: italic; margin-top: -0.4rem; }

.li-ladder { max-width: 34rem; margin: 1.2rem auto 0.8rem; display: flex; flex-direction: column; gap: 0.45rem; }
.li-slab {
  display: flex; align-items: center; gap: 0.9rem; text-align: left;
  padding: 0.6rem 1rem; border: 1px solid #2a2417;
  background: rgba(10, 12, 9, 0.7); opacity: 0.45;
  transition: opacity 0.4s, border-color 0.4s;
}
.li-slab.lit { opacity: 1; border-color: var(--gold-dim); box-shadow: inset 0 0 16px rgba(216, 180, 90, 0.1); }
.li-slab.passed { opacity: 0.9; border-color: #3d5a3a; }
.li-slab.fell { opacity: 1; border-color: #6e2a24; box-shadow: inset 0 0 16px rgba(168, 54, 46, 0.12); }
.li-no { font-size: 1.05rem; color: var(--gold-dim); width: 1.6rem; flex: none; }
.li-slab-main { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.li-room { letter-spacing: 0.18em; font-size: 0.85rem; color: var(--bone); }
.li-bar { font-style: italic; font-size: 0.72rem; color: #8c8775; }
.li-stamp { font-size: 0.66rem; letter-spacing: 0.22em; flex: none; }
.li-slab.passed .li-stamp { color: #7da876; text-shadow: 0 0 8px rgba(125, 168, 118, 0.4); }
.li-slab.fell .li-stamp { color: var(--red); text-shadow: 0 0 8px rgba(168, 54, 46, 0.4); }

.li-verdict { letter-spacing: 0.3em; margin: 1rem 0 0.2rem; font-size: 1.1rem; }
.li-verdict.li-clear { color: var(--gold); text-shadow: 0 0 22px rgba(216, 180, 90, 0.35); }
.li-verdict.li-fellv { color: var(--red); }
.li-pay b { color: var(--gold); }
.li-actions { margin-top: 1.1rem; display: flex; flex-direction: column; gap: 0.5rem; align-items: center; }
.li-scored-line { max-width: 30rem; margin: 0.4rem auto 0; }

/* explainer demos */
.li-demo-doors { display: flex; gap: 0.35rem; justify-content: center; margin: 0.7rem 0; }
.li-demo-doors i {
  width: 1rem; height: 1.7rem; border: 1px solid #6e5a28;
  background: #0c0907; animation: liDoorLight 6s infinite;
}
.li-demo-doors i:nth-child(2) { animation-delay: 1.1s; }
.li-demo-doors i:nth-child(3) { animation-delay: 2.2s; }
.li-demo-doors i:nth-child(4) { animation-delay: 3.3s; }
.li-demo-doors i:nth-child(5) { animation-delay: 4.4s; }
@keyframes liDoorLight {
  0%, 100% { background: #0c0907; box-shadow: none; }
  9%, 16% { background: #3a2f14; box-shadow: 0 0 10px rgba(216, 180, 90, 0.35); }
  24% { background: #0c0907; box-shadow: none; }
}
.li-demo-bolt { position: relative; height: 1.7rem; width: 7rem; margin: 0.8rem auto; }
.li-bolt-hasp { position: absolute; right: 0.4rem; top: 0.25rem; width: 1.5rem; height: 1.15rem; border: 2px solid #6e5a28; }
.li-bolt-bar { position: absolute; left: 0; top: 0.62rem; width: 4rem; height: 0.45rem; background: var(--gold-dim); animation: liBolt 2.8s infinite; }
@keyframes liBolt {
  0%, 30% { transform: translateX(0); }
  48%, 100% { transform: translateX(2.1rem); }
}
.li-demo-ladder { display: flex; gap: 0.45rem; justify-content: center; align-items: flex-end; margin: 0.7rem 0; }
.li-demo-ladder i, .li-demo-ladder b {
  display: flex; align-items: flex-end; justify-content: center;
  width: 1.5rem; border: 1px solid #3a3526; color: #8c8775;
  font-style: normal; font-size: 0.7rem; padding-bottom: 0.15rem;
}
.li-demo-ladder i:nth-child(1) { height: 1rem; }
.li-demo-ladder i:nth-child(2) { height: 1.4rem; }
.li-demo-ladder i:nth-child(3) { height: 1.8rem; }
.li-demo-ladder i:nth-child(4) { height: 2.2rem; }
.li-demo-ladder b {
  height: 2.7rem; border-color: var(--gold-dim); color: var(--gold);
  text-shadow: 0 0 8px rgba(216, 180, 90, 0.5); animation: liTopRung 3s infinite;
}
@keyframes liTopRung {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 12px rgba(216, 180, 90, 0.3), inset 0 0 8px rgba(216, 180, 90, 0.15); }
}

@media (max-width: 600px) {
  .li-slab { padding: 0.5rem 0.7rem; gap: 0.55rem; }
  .li-room { font-size: 0.76rem; letter-spacing: 0.12em; }
  .li-bar { font-size: 0.66rem; }
  .li-stamp { font-size: 0.58rem; letter-spacing: 0.14em; }
}
