/* The game screen. Tokens and atmosphere come from base.css.
   Two voices: the machine speaks in pixels (VT323 / Silkscreen), the cellar
   and its notes in old print (IM Fell English / Nanum Myeongjo). */

:root {
  --cab: #3b1611;
  --cab-hi: #5a2219;
  --cab-lo: #1c0805;
  --metal: #2a2e2c;
  --metal-hi: #444a46;
  --metal-lo: #141716;
  --screen: #050a07;
  --ink: var(--bone);
  --ink-dim: var(--bone-dim);
  --red: var(--blood-hi);
  --gold: var(--tallow-hi);
  --violet: var(--bruise);
  --blue: var(--cold);
  --orange: var(--ember);
  --brass: var(--tallow);
  --brass-lo: #6b5228;
  --f-body: var(--f-machine);
  --f-head: var(--f-plate);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(ellipse 70% 50% at 50% -4%, #3a2414 0%, transparent 72%),
    repeating-linear-gradient(90deg, #0000 0 118px, #00000055 118px 121px),
    linear-gradient(#120d0a, var(--earth) 60%, #070504);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 20px;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, select, input { font-family: inherit; }
button, select { cursor: pointer; }
b { font-weight: normal; color: var(--ink); }
:focus-visible { outline: 2px solid var(--tallow); outline-offset: 2px; }

#app { max-width: 1240px; margin: 0 auto; padding: 10px 16px 40px; position: relative; z-index: 1; }

/* ---------- HUD ---------- */
.hud {
  position: sticky; top: 0; z-index: 30; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 8px 0 14px; margin-bottom: 2px;
  background: linear-gradient(#0d0907 60%, #0d090700);
}
.hud-box { background: #000a; border: 1px solid #2c2119; border-radius: 4px; padding: 4px 14px 6px; min-width: 130px; }
.hud-box .v { font-size: 40px; line-height: 1; white-space: nowrap; }
.hud-coins .v { color: var(--gold); text-shadow: 0 0 10px #e8c98a33; }
.hud-tix .v { color: var(--blue); text-align: right; text-shadow: 0 0 10px #6f9fc433; }
.hud-sub { font-size: 20px; color: var(--ink-dim); }
.hud-box .hl { font-family: var(--f-head); font-size: 12px; letter-spacing: 1px; color: var(--ink-dim); line-height: 1.4; }
.hud-box .hl small { font-family: var(--f-body); font-size: 15px; letter-spacing: 0; color: var(--bone-faint); }
.hud-tix .hl { text-align: right; }
html[lang="ko"] .hud-box .hl { font-size: 14px; }
.hud-box .v .art { height: .8em; vertical-align: -0.05em; }
.hud-sub:empty { display: none; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; position: relative; }
.icon-btn.menu-btn { display: none; }
.icon-btn .lbl { display: none; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.icon-btn {
  background: #0008; border: 1px solid #3a2c22; color: var(--ink-dim); border-radius: 3px; font-size: 16px; padding: 4px 10px;
  text-decoration: none; display: inline-flex; align-items: center; font-family: var(--f-body);
}
.icon-btn:hover { border-color: var(--brass-lo); color: var(--ink); }
.icon-btn.home { font-family: var(--f-tell); font-size: 15px; }
select.icon-btn { appearance: none; -webkit-appearance: none; padding: 4px 24px 4px 10px;
  background: #0008 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239a8c76'/%3E%3C/svg%3E") no-repeat right 8px center; }
select.icon-btn option { background: #15100c; color: var(--ink); }

/* ---------- room layout ---------- */
.room {
  display: grid; gap: 18px; align-items: start;
  grid-template-columns: 250px minmax(0, 1fr) 280px;
  grid-template-areas: "atm machine side";
  transition: transform 1.4s cubic-bezier(.5,0,.9,.4), opacity 1.4s, filter 1.4s;
}
.atm-col { grid-area: atm; }
.machine-col { grid-area: machine; position: relative; margin-right: 30px; }
.side-col { grid-area: side; display: flex; flex-direction: column; gap: 14px; }
body.falling .room { transform: translateY(-80vh) scale(.88) rotate(-1.5deg); opacity: 0; filter: blur(4px) brightness(.4); }
body.falling { overflow: hidden; }
body.falling .atmo .lamp { animation: none; opacity: 0; transition: opacity 1.2s .3s; }

/* ---------- ATM ---------- */
.atm {
  background: linear-gradient(180deg, var(--metal-hi), var(--metal) 12%, var(--metal) 88%, var(--metal-lo));
  border: 2px solid #0b0d0c; border-radius: 6px; padding: 12px;
  box-shadow: 0 14px 30px #000c, inset 0 1px 0 #ffffff14;
  position: relative;
}
/* rust and grime on the casing */
.atm::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(ellipse 30% 18% at 88% 6%, #5a2a1244, transparent 70%),
    radial-gradient(ellipse 22% 30% at 6% 92%, #4a22104d, transparent 70%);
}
.atm-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.atm-head .t { font-family: var(--f-head); font-size: 18px; color: #b9c0bb; letter-spacing: 3px; text-shadow: 0 1px 0 #000; }
.atm-head .led { width: 9px; height: 9px; border-radius: 50%; background: var(--phosphor); box-shadow: 0 0 8px var(--phosphor); }
.atm.warn .atm-head .led { background: var(--red); box-shadow: 0 0 10px var(--red); animation: blink .6s infinite; }
.atm.warn { animation: heartbeat 1.1s infinite; }
@keyframes heartbeat { 0%, 30%, 100% { transform: none; } 8% { transform: scale(1.012); } 18% { transform: scale(1.006); } }
@keyframes blink { 50% { opacity: .2; } }
.crt {
  background: var(--screen); border: 3px solid #050606; border-radius: 6px; padding: 10px;
  color: var(--phosphor); text-shadow: 0 0 6px #5dd88a44; position: relative; overflow: hidden;
  box-shadow: inset 0 0 24px #000;
}
.crt::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, #0000 0 2px, #0006 2px 3px); }
.crt .row2 { display: flex; justify-content: space-between; font-size: 20px; line-height: 1.15; }
.crt .row2 span:first-child { color: var(--phosphor-dim); }
.crt .dl { font-family: var(--f-head); font-size: 13px; letter-spacing: 1px; margin-bottom: 6px; color: var(--phosphor); }
.crt .quota { font-size: 38px; line-height: 1; color: var(--gold); text-shadow: 0 0 8px #e8c98a66; margin: 2px 0 6px; }
.crt .bar { height: 8px; background: #010a04; border: 1px solid #163220; margin: 8px 0 6px; }
.crt .bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width .4s; }
.crt .bar.ok i { background: var(--phosphor); }
.crt .due { font-size: 18px; }
.crt .due.warn { color: var(--red); text-shadow: 0 0 6px #d23a2688; animation: blink 1s infinite; }
.keypad { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.key {
  background: linear-gradient(#4b524e, #2a2f2c); color: #d8ddd9; border: 2px solid #0c0e0d; border-radius: 4px;
  font-family: var(--f-head); font-size: 14px; padding: 8px 4px; box-shadow: 0 3px 0 #090a09;
}
.key:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #090a09; }
.key:disabled { opacity: .4; cursor: not-allowed; }
.key.go { background: linear-gradient(#3c8a55, #1d4f2d); grid-column: 1 / -1; font-size: 16px; }
.atm-note { font-size: 16px; color: #aeb5b0; margin-top: 8px; line-height: 1.15; }
.slot-mouth { height: 8px; margin: 10px 18px 0; background: #030404; border-radius: 4px; box-shadow: inset 0 2px 3px #000; }

/* ---------- machine ---------- */
.machine {
  background:
    radial-gradient(ellipse 40% 22% at 18% 96%, #0006, transparent 70%),
    radial-gradient(ellipse 25% 14% at 90% 10%, #7a3a1a33, transparent 70%),
    linear-gradient(180deg, var(--cab-hi), var(--cab) 14%, var(--cab) 86%, var(--cab-lo));
  border-radius: 18px 18px 8px 8px; padding: 14px 18px 18px;
  border: 2px solid #120403;
  box-shadow: 0 0 90px #f3c77a10, 0 24px 60px #000e, inset 0 2px 0 #8a3a2a44, inset 0 -4px 0 #0006;
  position: relative;
}
.marquee {
  text-align: center; font-family: var(--f-tell);
  font-size: 34px; line-height: 1.1; color: var(--tallow-hi); letter-spacing: 3px;
  text-shadow: 0 0 14px #f3b45a77, 0 2px 0 #2a0c00;
  background: linear-gradient(#1a0805, #250c07); border: 1px solid #0d0302; border-radius: 6px;
  padding: 6px 10px 4px; margin-bottom: 10px;
}
html[lang="ko"] .marquee { font-weight: 800; font-size: 30px; }
/* a dying letter in the sign */
.marquee .dead { animation: neon 6.5s infinite; }
@keyframes neon {
  0%, 60%, 100% { opacity: 1; }
  61% { opacity: .15; text-shadow: none; } 62% { opacity: 1; } 63% { opacity: .1; text-shadow: none; } 66% { opacity: .2; text-shadow: none; } 67% { opacity: 1; }
}
.bulbs { display: flex; justify-content: center; gap: 10px; margin-top: 4px; }
.bulbs i { width: 7px; height: 7px; border-radius: 50%; background: #e9b35a; box-shadow: 0 0 6px #e9b35a; animation: bulb 1.7s infinite; }
.bulbs i:nth-child(2n) { animation-delay: .85s; }
.bulbs i:nth-child(3) { animation: none; background: #3a2412; box-shadow: none; } /* burned out */
.bulbs i:nth-child(7) { animation-duration: 3.1s; }
.machine.hot .bulbs i:not(:nth-child(3)) { animation-duration: .25s; }
@keyframes bulb { 50% { opacity: .25; box-shadow: none; } }

/* LED display above the reels */
.topdisp {
  display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: 8px;
  background: #030101; border: 2px solid #120403; border-radius: 4px; padding: 6px 12px; margin-bottom: 8px;
  box-shadow: inset 0 0 16px #000;
}
.td-curse { font-size: 26px; color: #d65bff; text-shadow: 0 0 8px #a34ad699; white-space: nowrap; justify-self: start; }
.td-curse.off { color: #4a3550; text-shadow: none; font-size: 18px; }
.td-main {
  text-align: center; font-size: 30px; line-height: 1.1; color: var(--orange); font-family: var(--f-head);
  text-shadow: 0 0 10px #d47a3499; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.td-main.win { color: var(--gold); text-shadow: 0 0 12px #e8c98a; }
.td-won { text-align: right; font-size: 16px; color: #a97a62; line-height: 1.05; white-space: nowrap; justify-self: end; }
.td-won b { display: block; font-size: 24px; color: var(--phosphor); text-shadow: 0 0 6px #5dd88a55; }

/* menu drawn on the machine's own screen */
.screen-menu {
  position: absolute; inset: 0; z-index: 4; display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; background: #000000ed; text-align: center; padding: 10px;
}
.screen-menu.open { display: flex; }
.screen-menu.compact { inset: auto 0 0 0; background: linear-gradient(#0000, #000000f2 30%); padding-top: 30px; }
.sm-title { font-family: var(--f-head); color: var(--orange); font-size: 26px; text-shadow: 0 0 10px #d47a3488; margin-bottom: 8px; }
.sm-opt { background: none; border: 0; color: #e0a273; font-size: 28px; padding: 4px 16px; border-radius: 3px; }
.sm-opt:hover:not(:disabled), .sm-opt:focus-visible { background: #d47a3422; color: #fff; outline: none; }
.sm-opt:hover:not(:disabled)::before, .sm-opt:focus-visible::before { content: '▸ '; }
.sm-opt:disabled { color: #5a3a2a; cursor: not-allowed; }
.sm-opt.red { color: var(--red); }
.sm-opt small { color: #a97a62; font-size: 21px; }
.sm-hint { color: var(--ink-dim); font-size: 18px; margin-top: 6px; }

/* red spin button */
.spin-row { display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap; }
.spin-btn {
  width: 150px; height: 74px; border-radius: 50% / 46%; border: 3px solid #2a0402;
  background: radial-gradient(ellipse at 50% 28%, #e0786a, #a3180c 55%, #4a0602);
  color: #f6e6dc; font-family: var(--f-head); font-size: 22px; text-shadow: 0 2px 0 #3a0402;
  box-shadow: 0 7px 0 #2a0402, 0 0 0 7px #161210, 0 0 0 9px #6b5228;
  transition: transform .06s, box-shadow .06s;
}
.spin-btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 2px 0 #2a0402, 0 0 0 7px #161210, 0 0 0 9px #6b5228; }
.spin-btn:disabled { filter: grayscale(.85) brightness(.45); cursor: not-allowed; }
.slot-count { font-size: 22px; color: var(--orange); background: #030101; border: 2px solid #120403; border-radius: 4px; padding: 2px 12px; text-shadow: 0 0 8px #d47a3466; }

.stats { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chip { background: #0008; border: 1px solid #1f0805; border-radius: 99px; padding: 1px 10px; font-size: 18px; color: var(--ink); white-space: nowrap; }
.chip i { font-style: normal; color: #b4957c; font-size: 15px; margin-right: 4px; }

.screen {
  background: var(--screen); border: 4px solid var(--brass-lo); outline: 2px solid #0d0402;
  border-radius: 8px; padding: 10px; position: relative; overflow: hidden;
}
.screen::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, #0000 0 2px, #0005 2px 3px);
  box-shadow: inset 0 0 50px #000;
}
.screen.flash::before { content: ''; position: absolute; inset: 0; background: #5a0f4a; mix-blend-mode: screen; animation: flash .9s; z-index: 3; pointer-events: none; }
@keyframes flash { from { opacity: .95; } to { opacity: 0; } }
#grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cell {
  aspect-ratio: 1; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 40%, #142219, #070e0a);
  border-radius: 6px; border: 1px solid #16281d;
  font-size: clamp(26px, 5.4vw, 54px);
  transition: transform .15s, box-shadow .15s, background .15s, opacity .15s, filter .15s;
  position: relative;
}
.cell > img.sym { width: 74%; height: 74%; image-rendering: pixelated; filter: drop-shadow(0 2px 0 #000a) brightness(.95); pointer-events: none; }
.cell.spin img.sym { filter: blur(1.5px) saturate(.5); opacity: .75; }
.cell.dim { opacity: .3; filter: grayscale(.6); }
.cell.hit {
  background: radial-gradient(circle at 50% 40%, #3e3a14, #171806);
  box-shadow: 0 0 0 2px var(--gold), 0 0 18px #e8c98a77;
  transform: scale(1.06); z-index: 2; opacity: 1; filter: none;
}
.cell.hit > img.sym { filter: drop-shadow(0 0 6px #e8c98a88); }
.cell.cursed { background: radial-gradient(circle, #3a0c34, #0c020a); box-shadow: 0 0 0 2px var(--violet), 0 0 22px #8a63c4; opacity: 1; filter: none; }
.cell.cursed > img.sym { filter: drop-shadow(0 0 8px #8a63c4); animation: twitch .25s steps(2) 3; }
@keyframes twitch { 50% { transform: translate(2px, -1px) skewX(-6deg); } }
.cell.land { animation: land .18s ease-out; }
.cell .cv {
  position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; font-style: normal;
  font-family: var(--f-head); font-size: clamp(11px, 1.5vw, 17px); color: var(--gold);
  text-shadow: 0 1px 0 #000, 0 0 6px #000, 0 0 6px #000; pointer-events: none; animation: cvIn .2s ease-out;
}
@keyframes cvIn { from { transform: translateY(6px); opacity: 0; } }

/* totem activation cards that slide in over the reels */
#totemPops { position: absolute; top: 8px; right: 8px; z-index: 5; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; pointer-events: none; }
.tpop {
  display: flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 99px;
  background: #0c0806ee; border: 1px solid #7a6a56; box-shadow: 0 4px 12px #000c, 0 0 12px #e8c98a33;
  animation: tpop 1.5s ease-out forwards; white-space: nowrap;
}
.tpop.r2 { border-color: var(--blue); } .tpop.r3 { border-color: var(--violet); } .tpop.r4 { border-color: var(--orange); }
.tpop .ti { font-size: 26px; line-height: 1; filter: drop-shadow(0 0 6px #e8c98a); }
.tpop .tn { font-family: var(--f-head); font-size: 12px; color: var(--gold); }
.tpop .tx { font-size: 20px; color: var(--phosphor); }
html[lang="ko"] .tpop .tn { font-size: 15px; }
@keyframes tpop {
  0% { transform: translateX(40px) scale(.8); opacity: 0; }
  12% { transform: translateX(0) scale(1.08); opacity: 1; }
  20% { transform: scale(1); }
  78% { opacity: 1; }
  100% { transform: translateY(-8px); opacity: 0; }
}
@keyframes land { 0% { transform: translateY(-12%); } 100% { transform: none; } }

#readout {
  margin-top: 10px; min-height: 62px;
  background: #030805; border: 1px solid #16281d; border-radius: 4px;
  color: var(--phosphor); padding: 6px 12px; text-shadow: 0 0 6px #5dd88a55;
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
#readout .msg { font-size: 21px; line-height: 1.1; }
#readout .big { font-size: 42px; color: var(--gold); text-shadow: 0 0 10px #e8c98a99; white-space: nowrap; }

#controls { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.btn {
  background: linear-gradient(#d2b071, var(--brass) 45%, var(--brass-lo));
  color: #1f1206; border: 1px solid #2a1a06; border-radius: 4px;
  padding: 10px 16px; font-size: 22px; font-family: var(--f-head); font-weight: 700;
  box-shadow: 0 4px 0 #2a1a06, inset 0 1px 0 #fff4;
  transition: transform .06s, box-shadow .06s, filter .1s;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #2a1a06; }
.btn:disabled { filter: grayscale(.8) brightness(.55); cursor: not-allowed; }
.btn.small { font-size: 14px; padding: 6px 10px; }
.btn.dark { background: linear-gradient(#3a2e26, #211913); color: var(--ink); border-color: #0c0705; box-shadow: 0 4px 0 #0c0705; }
.btn.red { background: linear-gradient(#c45a46, #8e1b14 50%, #4a0904); color: #f6e6dc; border-color: #2a0402; box-shadow: 0 4px 0 #2a0402; }
.btn.violet { background: linear-gradient(#a989dc, #5e3d9e 50%, #2c1856); color: #fff; border-color: #160a2c; box-shadow: 0 4px 0 #160a2c; }
.btn .sub { display: block; font-family: var(--f-body); font-size: 16px; font-weight: 400; }

/* physical lever */
.lever { position: absolute; right: -38px; top: 34%; width: 40px; height: 190px; cursor: pointer; }
.lever .base { position: absolute; left: 0; bottom: 0; width: 28px; height: 54px; border-radius: 0 8px 8px 0; background: linear-gradient(90deg, #1d201e, #4c5450, #1d201e); border: 2px solid #0a0b0a; }
.lever .arm { position: absolute; left: 14px; bottom: 24px; width: 10px; height: 150px; transform-origin: 50% 100%; transition: transform .25s cubic-bezier(.3,1.6,.5,1); }
.lever .arm::before { content: ''; position: absolute; left: 0; right: 0; top: 18px; bottom: 0; background: linear-gradient(90deg, #6a6a66, #c9c6bc, #6a6a66); border-radius: 4px; }
.lever .arm::after { content: ''; position: absolute; left: -11px; top: -8px; width: 32px; height: 32px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #d0705f, #8e1b14 60%, #3a0402); box-shadow: 0 4px 10px #000a; }
.lever.down .arm { transform: scaleY(-.55); transition: transform .12s ease-in; }
.lever.disabled { cursor: not-allowed; filter: grayscale(.6) brightness(.6); }

/* ---------- side ---------- */
.panel { background: linear-gradient(#18110d, #100b08); border: 1px solid #33261d; border-radius: 6px; padding: 12px; }
.panel h3 { margin: 0 0 8px; font-family: var(--f-head); font-size: 13px; color: var(--ink-dim); letter-spacing: 1px; display: flex; justify-content: space-between; align-items: center; font-weight: normal; }
.shelf-wood { background: linear-gradient(#2c1a10, #1a0f08); border: 1px solid #0d0603; border-radius: 4px; padding: 8px; box-shadow: inset 0 -3px 0 #0006; }
#shelf { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.slot {
  aspect-ratio: 1; border-radius: 6px; border: 2px dashed #3d281a;
  display: grid; place-items: center; font-size: 30px; position: relative;
  background: #0f0805; cursor: default;
}
.slot.filled { border-style: solid; cursor: pointer; background: radial-gradient(circle at 50% 35%, #3a2819, #140c07); }
.slot.filled:hover { transform: translateY(-2px); }
.slot.r1 { border-color: #6f6352; } .slot.r2 { border-color: var(--blue); }
.slot.r3 { border-color: var(--violet); box-shadow: 0 0 10px #8a63c444; }
.slot.r4 { border-color: var(--orange); box-shadow: 0 0 12px #d47a3466; }
.slot .badge { position: absolute; right: 2px; bottom: 0; font-size: 14px; color: var(--gold); text-shadow: 0 1px 0 #000; font-family: var(--f-body); }
.slot.pulse { animation: pulse .5s; }
@keyframes pulse { 50% { transform: scale(1.18); box-shadow: 0 0 18px var(--gold); } }

.radio-box { display: flex; align-items: center; gap: 10px; }
.radio-ic { font-size: 34px; filter: grayscale(.8) brightness(.6); }
.radio-box.ready .radio-ic { filter: none; animation: wobble .6s infinite; }
.radio-box.risky .radio-ic { filter: hue-rotate(-40deg) saturate(2); }
@keyframes wobble { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.radio-txt { flex: 1; font-size: 18px; color: var(--ink-dim); line-height: 1.1; }
.radio-box.ready .radio-txt { color: var(--gold); }
.radio-box.risky.ready .radio-txt { color: var(--red); }
.boons-list { font-size: 16px; color: var(--ink-dim); margin-top: 8px; line-height: 1.15; max-height: 80px; overflow-y: auto; }

#log { font-size: 17px; color: var(--ink-dim); max-height: 170px; overflow-y: auto; line-height: 1.15; }
#log div { padding: 1px 0; border-bottom: 1px solid #ffffff08; }
#log .g { color: var(--gold); } #log .r { color: var(--red); } #log .b { color: var(--blue); } #log .v { color: var(--violet); }
#log .w { font-family: var(--f-tell); font-style: italic; color: #b0675a; font-size: 15px; line-height: 1.35; padding: 3px 0; }
html[lang="ko"] #log .w { font-style: normal; font-size: 14px; }

/* fixed info box at the top of the screen (totem details) */
#info {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 60;
  width: min(560px, calc(100% - 32px)); display: none; text-align: center;
  background: #090605f4; border: 1px solid var(--brass-lo); border-radius: 4px; padding: 10px 16px 12px;
  box-shadow: 0 12px 30px #000;
}
#info.open { display: block; animation: cvIn .15s ease-out; }
#info .in { font-family: var(--f-tell); color: var(--tallow-hi); font-size: 24px; }
#info .ir { font-size: 16px; color: var(--ink-dim); }
#info .ir.r2 { color: var(--blue); } #info .ir.r3 { color: var(--violet); } #info .ir.r4 { color: var(--orange); }
#info .id { font-size: 22px; color: var(--ink); line-height: 1.15; margin-top: 4px; }
#info .io { display: flex; justify-content: center; gap: 10px; margin-top: 10px; }
.shop-shelf { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 12px 0 0; padding-top: 10px; border-top: 1px solid #33261d; font-size: 17px; color: var(--ink-dim); }
.own { width: 42px; height: 42px; font-size: 24px; border-radius: 6px; border: 2px solid #6f6352; background: radial-gradient(circle at 50% 35%, #3a2819, #140c07); }
.own.r2 { border-color: var(--blue); } .own.r3 { border-color: var(--violet); } .own.r4 { border-color: var(--orange); }

/* ---------- modal: notes and notices in the cellar ---------- */
#modal {
  position: fixed; inset: 0; background: #000d; display: none; z-index: 40;
  align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(2px) grayscale(.4);
}
#modal.open { display: flex; }
.sheet {
  background:
    radial-gradient(ellipse 60% 40% at 85% 0%, #3a281622, transparent 70%),
    radial-gradient(ellipse 40% 30% at 0% 100%, #00000055, transparent 70%),
    linear-gradient(#1c1510, #120d0a);
  border: 1px solid #4d3a28; border-top: 3px solid var(--brass-lo);
  border-radius: 4px; padding: 20px; width: min(780px, 100%); max-height: 92vh; overflow-y: auto;
  box-shadow: 0 30px 80px #000, 0 0 0 1px #000;
}
.sheet.risky { border-color: #6a1a10; border-top-color: var(--blood); background: linear-gradient(#22100d, #120807); }
.sheet h2 { margin: 0 0 6px; font-family: var(--f-tell); font-weight: normal; color: var(--tallow-hi); font-size: 32px; letter-spacing: 1px; line-height: 1.15; }
html[lang="ko"] .sheet h2 { font-weight: 800; font-size: 28px; }
.sheet.risky h2 { color: var(--red); }
.sheet p { margin: 6px 0 12px; color: var(--ink-dim); line-height: 1.15; }
.sheet p.tell, .sheet .help p { font-family: var(--f-tell); font-size: 18px; line-height: 1.5; color: #c8bba4; max-width: 66ch; }
html[lang="ko"] .sheet p.tell, html[lang="ko"] .sheet .help p { font-size: 16px; line-height: 1.7; }
.sheet .help p b { color: var(--bone); font-weight: 600; }
.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.offer {
  background: #0d0806; border: 1px solid #33261d; border-radius: 4px; padding: 10px;
  display: flex; flex-direction: column; gap: 6px; text-align: center;
}
.offer.r2 { border-color: #2c5a78; } .offer.r3 { border-color: #5e4590; } .offer.r4 { border-color: #9a5a22; box-shadow: 0 0 14px #d47a3426; }
.offer .ic { font-size: 44px; }
.offer .nm { font-family: var(--f-head); font-size: 12px; color: var(--gold); }
.offer .ds { font-size: 17px; color: var(--ink); line-height: 1.1; flex: 1; }
.offer .rar { font-size: 14px; color: var(--ink-dim); }
.offer .rar.r2 { color: var(--blue); } .offer .rar.r3 { color: var(--violet); } .offer .rar.r4 { color: var(--orange); }
.offer.sold { opacity: .3; }
.sheet .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: space-between; align-items: center; margin-top: 14px; }
.lang-pick { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.sheet h3 { font-family: var(--f-head); font-size: 13px; color: var(--ink-dim); font-weight: normal; margin: 14px 0 8px; }

.pat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pat { background: #0d0806; border: 1px solid #33261d; border-radius: 4px; padding: 8px; text-align: center; }
.pat .nm { font-family: var(--f-head); font-size: 12px; color: var(--gold); margin-bottom: 6px; }
.pat .val { font-size: 22px; margin-top: 4px; }
.mini { display: inline-grid; grid-template-columns: repeat(5, 12px); gap: 2px; }
.mini i { width: 12px; height: 12px; background: #261c15; border-radius: 2px; }
.mini i.on { background: var(--gold); box-shadow: 0 0 4px #e8c98a88; }
.sym-table { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; margin-bottom: 14px; }
.sym-table div { background: #0d0806; border: 1px solid #33261d; border-radius: 4px; padding: 4px; text-align: center; font-size: 17px; line-height: 1.1; }
.sym-table .e { font-size: 28px; display: block; }

.float {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  font-family: var(--f-head); font-weight: 700; font-size: 24px; color: var(--gold);
  text-shadow: 0 2px 0 #000, 0 0 10px #e8a030; pointer-events: none; z-index: 5; white-space: nowrap;
  animation: floatUp 1s ease-out forwards;
}
@keyframes floatUp { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -60px; } }
.shake { animation: shake .45s; }
@keyframes shake { 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }

/* ---------- leaderboard ---------- */
.period-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 10px; }
.period-tabs button { background: #0008; border: 1px solid #3a2c22; color: var(--ink-dim); border-radius: 3px; padding: 3px 12px; font-size: 18px; }
.period-tabs button.on { color: var(--gold); border-color: var(--brass-lo); background: #2a1d10; }
.ledger { width: 100%; border-collapse: collapse; font-size: 19px; }
.ledger th { font-family: var(--f-head); font-size: 12px; font-weight: normal; color: var(--ink-dim); text-align: left; padding: 4px 6px; border-bottom: 1px solid #4d3a28; }
.ledger td { padding: 4px 6px; border-bottom: 1px dashed #2c2119; vertical-align: top; }
.ledger td.n { text-align: right; white-space: nowrap; }
.ledger th.n { text-align: right; }
.ledger td.nm { font-family: var(--f-tell); font-size: 18px; color: var(--bone); overflow-wrap: anywhere; }
.ledger td.tt { font-size: 15px; letter-spacing: 1px; }
.ledger tr.me td { background: #2a1d1055; }
.ledger tr.me td.nm::after { content: attr(data-you); margin-left: 6px; font-family: var(--f-machine); font-size: 15px; color: var(--phosphor); }
.ledger tr.top1 td:first-child { color: var(--gold); }
.lb-status { color: var(--ink-dim); font-size: 18px; min-height: 22px; margin: 8px 0 0; }
.sign { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #4d3a28; }
.sign label { display: block; font-family: var(--f-tell); font-size: 19px; color: var(--bone); margin-bottom: 6px; }
.sign .f { display: flex; gap: 8px; flex-wrap: wrap; }
.sign input {
  flex: 1; min-width: 160px; background: #070504; border: 1px solid #4d3a28; color: var(--bone); border-radius: 3px;
  padding: 6px 10px; font-family: var(--f-tell); font-size: 19px;
}
.sign input:focus { outline: 2px solid var(--tallow); outline-offset: 1px; }
.sign .msg { min-height: 22px; font-size: 18px; color: var(--ink-dim); margin-top: 6px; }
.sign .msg.ok { color: var(--phosphor); } .sign .msg.err { color: var(--red); }
@media (max-width: 560px) { .ledger .hide-s { display: none; } }

/* Korean tweaks */
html[lang="ko"] .panel h3 { font-size: 13px; }
html[lang="ko"] .offer .nm, html[lang="ko"] .pat .nm { font-size: 15px; }
html[lang="ko"] .btn .sub { font-size: 17px; }
html[lang="ko"] .crt .dl { font-size: 15px; }
html[lang="ko"] #readout .msg, html[lang="ko"] .sheet p, html[lang="ko"] .offer .ds,
html[lang="ko"] #log, html[lang="ko"] .atm-note, html[lang="ko"] .radio-txt { word-break: keep-all; }

@media (max-width: 1080px) {
  .room { grid-template-columns: 230px minmax(0, 1fr); grid-template-areas: "atm machine" "side machine"; }
  .side-col { grid-row: 2; }
  .lever { display: none; }
  .machine-col { margin-right: 0; }
}
@media (max-width: 860px) {
  .room { grid-template-columns: 1fr; grid-template-areas: "machine" "atm" "side"; }
  .side-col { grid-row: auto; }
  .marquee { font-size: 26px; }
}
@media (max-width: 440px) {
  .hud-box { min-width: 0; padding: 3px 10px 4px; }
  .hud-box .v { font-size: 30px; }
  .topdisp { grid-template-columns: 1fr 1.4fr 1fr; padding: 5px 8px; }
  .td-main { font-size: 22px; }
  .td-curse { font-size: 20px; }
  .sm-opt { font-size: 23px; }
  .sm-opt small { font-size: 18px; }
  .spin-btn { width: 130px; height: 64px; font-size: 19px; }
  .machine { padding: 10px 10px 14px; }
  #grid { gap: 4px; }
}

/* symbol modifier badge (top-left of a reel cell) */
.cell .md {
  position: absolute; top: 3px; left: 5px; font-style: normal; line-height: 1;
  font-size: clamp(14px, 2.2vw, 24px); font-family: var(--f-body);
  text-shadow: 0 0 4px #000, 0 1px 0 #000, 0 0 8px currentColor;
}
.cell.spin .md { display: none; }

/* trait dot + charge badge on shelf slots */
.slot .tdot { position: absolute; left: 4px; top: 4px; width: 9px; height: 9px; border-radius: 50%; }
.slot .badge.full { color: var(--phosphor); text-shadow: 0 0 6px var(--phosphor); }
.slot.traited { box-shadow: 0 0 10px var(--tc, transparent); }

/* yellow POWER button for charge totems */
.power-btn {
  width: 78px; height: 74px; border-radius: 50%; border: 3px solid #2a1f00;
  background: radial-gradient(circle at 50% 30%, #f0e09a, #c09a10 55%, #4a3400);
  color: #201400; font-family: var(--f-head); font-size: 15px; line-height: 1.05;
  box-shadow: 0 6px 0 #2a1f00, 0 0 0 5px #161210; transition: transform .06s;
}
.power-btn b { display: block; font-size: 22px; color: #201400; }
.power-btn.ready { animation: glow 1s infinite; }
.power-btn:active:not(:disabled) { transform: translateY(4px); }
.power-btn:disabled { filter: grayscale(.85) brightness(.45); cursor: not-allowed; animation: none; }
@keyframes glow { 50% { box-shadow: 0 6px 0 #2a1f00, 0 0 0 5px #161210, 0 0 24px #e8c94a; } }

/* type / category / trait tags */
.tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 2px 0; }
.tag { font-size: 14px; line-height: 1.3; padding: 0 6px; border-radius: 3px; background: #261c15; color: var(--ink-dim); white-space: nowrap; }
.tag.kind { background: #33241a; color: #e2b98a; }
.tag.kind.charge { background: #332f10; color: #e8d24a; }
.tag.kind.instant { background: #142a33; color: var(--blue); }
.tag.kind.chance { background: #251633; color: #b596e6; }
.tag.bad { background: #331210; color: var(--red); }
.tag.trait { color: #100804; font-weight: bold; }
.offer.traited { box-shadow: 0 0 14px var(--tc); }
.mod-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-bottom: 14px; }
.mod-legend div { background: #0d0806; border: 1px solid #33261d; border-radius: 4px; padding: 4px 8px; font-size: 17px; line-height: 1.1; }
.mod-legend span { font-size: 22px; margin-right: 4px; }
html[lang="ko"] .tag { font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  .atm.warn, .marquee .dead, .bulbs i, .cell.cursed > img.sym { animation: none; }
}

/* pixel-art symbols inside text (src/art.js) */
img.art { height: 1.05em; width: auto; vertical-align: -0.18em; image-rendering: pixelated; }
.sym-table .e img.art { height: 34px; }

/* numbers in the cellar's notes are read off the machine: no old-style figures */
.sheet p.tell b, .sheet .rules b { font-family: var(--f-machine); font-size: 1.2em; line-height: 1; }

/* on the machine, once the curse can strike */
.curse-line {
  margin: -2px 0 8px; padding: 4px 10px; text-align: center;
  font-family: var(--f-body); font-size: 18px; line-height: 1.15; color: #c9a2ff;
  background: #0c0610; border: 1px solid #3a2350; border-radius: 4px;
  text-shadow: 0 0 8px #8a63c477;
  animation: curseLine 7s infinite;
}
.curse-line[hidden] { display: none; }
html[lang="ko"] .curse-line { word-break: keep-all; }
@keyframes curseLine { 0%, 88%, 100% { opacity: 1; } 89% { opacity: .35; } 90% { opacity: 1; } 92% { opacity: .5; } 93% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .curse-line { animation: none; } }
@media (max-width: 440px) { .hud-box .hl small { display: none; } }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  #app { padding: 0 10px calc(104px + env(safe-area-inset-bottom)); }

  /* one-row top bar: wallet, tickets, menu */
  .hud { align-items: stretch; gap: 6px; padding: 6px 0 8px; }
  .hud-coins { flex: 1; }
  .hud-box { min-width: 0; padding: 3px 10px 4px; }
  .hud-box .v { font-size: 30px; }
  .hud-box .hl small { display: none; }
  .hud-coins { display: grid; grid-template-columns: auto 1fr; align-items: end; column-gap: 10px; }
  .hud-coins .hl { grid-column: 1 / -1; }
  .hud-sub { font-size: 16px; white-space: nowrap; justify-self: end; padding-bottom: 3px; }
  .hud-right { flex-direction: row; align-items: stretch; }
  .icon-btn.menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 46px; font-size: 22px; color: var(--ink); }
  .tools {
    display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 32;
    flex-direction: column; gap: 4px; min-width: 220px; padding: 8px;
    background: #0d0907f8; border: 1px solid #4d3a28; border-radius: 6px; box-shadow: 0 16px 40px #000d;
  }
  .hud.menu-open .tools { display: flex; }
  .tools .icon-btn, .tools select.icon-btn { width: 100%; justify-content: flex-start; font-size: 19px; padding: 9px 12px; min-height: 44px; }
  .tools select.icon-btn { padding-right: 30px; }
  .tools .icon-btn .lbl { display: inline; margin-left: 12px; font-family: var(--f-tell); font-size: 17px; }
  html[lang="ko"] .tools .icon-btn .lbl { font-size: 15px; }

  /* the machine */
  .room { gap: 12px; }
  .machine { padding: 10px 10px 12px; border-radius: 12px 12px 6px 6px; }
  .marquee { font-size: 22px; padding: 4px 8px 3px; margin-bottom: 8px; }
  html[lang="ko"] .marquee { font-size: 21px; }
  .topdisp { grid-template-columns: auto 1fr auto; padding: 5px 8px; gap: 6px; }
  .td-main { font-size: 22px; }
  .td-curse { font-size: 19px; }
  .td-won { font-size: 13px; } .td-won b { font-size: 20px; }
  .curse-line { font-size: 15px; padding: 3px 8px; }
  .stats { margin-bottom: 6px; } .chip { font-size: 15px; }
  .screen { padding: 6px; border-width: 3px; }
  #grid { gap: 4px; }
  #readout { min-height: 46px; padding: 4px 10px; margin-top: 8px; }
  #readout .msg { font-size: 18px; } #readout .big { font-size: 30px; }
  .sm-title { font-size: 20px; } .sm-opt { font-size: 22px; padding: 6px 12px; } .sm-opt small { font-size: 17px; }

  /* spin and power stay under the thumb */
  #controls {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; margin: 0;
    padding: 18px 16px calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(#0d090700, #0d0907ee 28%, #0d0907);
  }
  .spin-row { gap: 14px; flex-wrap: nowrap; }
  .spin-btn { width: 168px; height: 64px; font-size: 21px; }
  .power-btn { width: 66px; height: 64px; font-size: 13px; }
  .power-btn b { font-size: 19px; }
  .slot-count { display: none; }

  /* a compact ATM right under the machine */
  .atm { padding: 10px; }
  .atm-head { margin-bottom: 6px; }
  .crt { padding: 8px 10px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; align-items: end; }
  .crt .dl, .crt .bar, .crt .due { grid-column: 1 / -1; }
  .crt .qrow { grid-column: 1; grid-row: 2; }
  .crt .quota { grid-column: 1; grid-row: 3; font-size: 30px; margin: 0; }
  .crt .row2 { font-size: 18px; }
  .crt .bar { margin: 6px 0 4px; }
  .keypad { grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 8px; }
  .key { padding: 10px 2px; min-height: 42px; }
  .atm-note { font-size: 15px; }
  .slot-mouth { display: none; }

  /* shelf in one or two short rows */
  #shelf { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 5px; }
  .slot { font-size: 24px; border-radius: 5px; }
  .slot .badge { font-size: 12px; }
  #log { max-height: 140px; }

  /* dialogs slide up from the bottom; their buttons stay in reach */
  #modal { padding: 0; align-items: flex-end; }
  .sheet {
    width: 100%; max-height: 92dvh; border-radius: 12px 12px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
    padding: 16px 14px 0; animation: sheetUp .22s ease-out;
  }
  .sheet .row {
    position: sticky; bottom: 0; z-index: 2; margin: 12px -14px 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: #120d0a; border-top: 1px solid #3a2c22; box-shadow: 0 -12px 20px #000a;
    flex-wrap: nowrap;
  }
  .sheet .row > :last-child { flex: 1 1 auto; }
  .sheet .row > span:empty { display: none; }
  .sheet .row > span:not(:empty) { flex: 1 1 50%; font-size: 15px !important; }
  .sheet .row > .btn:first-child:not(:last-child) { flex: 0 0 auto; }
  .sheet .row .btn { font-size: 15px; padding: 12px 10px; }
  .sheet .row .btn.small { font-size: 13px; }
  .sheet.risky .row { background: #120807; }
  .sheet h2 { font-size: 26px; }
  html[lang="ko"] .sheet h2 { font-size: 23px; }
  .sheet p.tell, .sheet .help p { font-size: 16.5px; line-height: 1.45; }
  .offers { grid-template-columns: 1fr 1fr; gap: 8px; }
  .offer { padding: 8px 6px; gap: 4px; }
  .offer .ic { font-size: 32px; line-height: 1.1; }
  .offer .ds { font-size: 15px; }
  .offer .btn.small { padding: 9px 6px; font-size: 15px; }
  .tags { gap: 3px; } .tag { font-size: 13px; padding: 0 4px; }
  .shop-shelf .own { width: 40px; height: 40px; }
  .btn { padding: 11px 14px; font-size: 18px; }
  .pat-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
  .sym-table { grid-template-columns: repeat(4, 1fr); }
  .mod-legend { grid-template-columns: 1fr; }
  #info { top: 6px; padding: 8px 12px 10px; }
  #info .id { font-size: 19px; }
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }
@media (max-width: 640px) and (prefers-reduced-motion: reduce) { .sheet { animation: none; } }
