* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; user-select: none; }
html, body { height: 100%; background: #0a0810; color: #eee; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; overflow: hidden; }
#app { height: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; background: #120e18; }

#top { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: #1c1526; border-bottom: 2px solid #2d2238; }
.stat { font-size: 22px; font-weight: 700; color: #ffd75e; display: flex; gap: 6px; align-items: center; }
.stat.small { font-size: 14px; color: #c9b8e0; font-weight: 500; }

#arena { position: relative; flex: 0 0 42%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: radial-gradient(ellipse at 50% 60%, #2b2140 0%, #120e18 75%); }
#floorInfo { position: absolute; top: 8px; left: 12px; }
#floorName { font-weight: 700; font-size: 16px; }
#killInfo { font-size: 13px; color: #aaa; }
#bossTimer { position: absolute; top: 10px; right: 12px; width: 110px; height: 18px; background: #331; border-radius: 9px; overflow: hidden; }
#bossTimerFill { height: 100%; width: 100%; background: #e04848; transition: width .1s linear; }
#bossTimerText { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 18px; font-weight: 700; }

#monsterWrap { position: relative; width: 170px; height: 170px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
#monster { font-size: 120px; line-height: 1; transition: transform .06s; filter: drop-shadow(0 6px 8px #000a); }
#monster.hit { transform: scale(.9) rotate(-4deg); }
#monster.boss { font-size: 150px; }
#monster.dying { animation: die .25s forwards; }
@keyframes die { to { transform: scale(0) rotate(40deg); opacity: 0; } }
#floaters { position: absolute; inset: 0; pointer-events: none; }
.float { position: absolute; font-weight: 800; color: #fff; text-shadow: 0 2px 0 #000; animation: up .8s forwards; white-space: nowrap; }
.float.tap { color: #ffd75e; font-size: 22px; }
.float.gold { color: #ffd75e; font-size: 16px; }
@keyframes up { to { transform: translateY(-60px); opacity: 0; } }

#monsterName { font-size: 15px; color: #ddd; }
#hpBar { position: relative; width: 70%; height: 20px; background: #300; border-radius: 10px; overflow: hidden; border: 1px solid #000; }
#hpFill { height: 100%; background: linear-gradient(#e44, #a22); transition: width .08s; }
#hpText { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 20px; font-weight: 700; }
#bossBtn { position: absolute; bottom: 8px; right: 12px; background: #a22; color: #fff; border: none; border-radius: 8px; padding: 8px 12px; font-weight: 700; font-size: 14px; }

#shop { flex: 1; display: flex; flex-direction: column; min-height: 0; background: #17111f; border-top: 2px solid #2d2238; }
#shopHead { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; font-weight: 700; color: #c9b8e0; }
#multBtn { background: #3a2c4d; color: #fff; border: none; border-radius: 6px; padding: 6px 14px; font-weight: 700; min-width: 64px; }
#heroList { flex: 1; overflow-y: auto; padding: 0 8px 12px; display: flex; flex-direction: column; gap: 6px; }

.hero { display: grid; grid-template-columns: 52px 1fr 96px; gap: 8px; align-items: center; background: #221a2d; border-radius: 10px; padding: 8px; border: 1px solid #2f2440; }
.hero.locked { opacity: .45; }
.hero .face { width: 52px; height: 52px; font-size: 34px; display: flex; align-items: center; justify-content: center; background: #2f2440; border-radius: 10px; position: relative; }
.hero .lvl { position: absolute; bottom: -4px; right: -4px; background: #ffd75e; color: #000; font-size: 11px; font-weight: 800; border-radius: 8px; padding: 1px 5px; }
.hero .name { font-weight: 700; font-size: 14px; }
.hero .info { font-size: 12px; color: #aaa; margin: 2px 0 4px; }
.hero .bar { height: 10px; background: #0d0a12; border-radius: 5px; overflow: hidden; }
.hero .bar div { height: 100%; width: 0; background: linear-gradient(90deg, #5aa0ff, #8cf); }
.hero .ms { font-size: 10px; color: #8a7aa0; margin-top: 3px; }
.hero button { height: 52px; border: none; border-radius: 8px; background: #3a7d32; color: #fff; font-weight: 700; font-size: 13px; line-height: 1.2; }
.hero button:disabled { background: #3a3346; color: #888; }
.hero button small { display: block; font-size: 11px; font-weight: 500; opacity: .85; }

#modal { position: fixed; inset: 0; background: #000b; display: flex; align-items: center; justify-content: center; z-index: 10; }
#modal .box { background: #221a2d; border: 2px solid #ffd75e; border-radius: 14px; padding: 22px; width: 80%; max-width: 340px; text-align: center; }
#modal h2 { margin-bottom: 10px; color: #ffd75e; }
#modal p { margin-bottom: 16px; line-height: 1.4; }
#modal button { background: #3a7d32; color: #fff; border: none; border-radius: 8px; padding: 10px 26px; font-weight: 700; font-size: 16px; }
.hidden { display: none !important; }
#monster img { width: 150px; height: 150px; image-rendering: pixelated; display: block; }
#monster.boss img { width: 180px; height: 180px; filter: drop-shadow(0 0 10px #c0306088); }
#floorRow { display: flex; align-items: center; gap: 6px; }
#floorRow button { background: #3a2c4d; color: #fff; border: none; border-radius: 6px; width: 30px; height: 28px; font-size: 13px; }
#floorRow button:disabled { opacity: .3; }
#mapBtn { background: #3a2c4d; color: #fff; border: none; border-radius: 8px; padding: 6px 10px; font-weight: 700; font-size: 13px; }
#map { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto;
  background: radial-gradient(ellipse at 50% 40%, #3b3020 0%, #1d160d 80%); }
#mapHead, #workshop > #mapHead { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; font-weight: 800; font-size: 18px; color: #ffd75e; }
#mapClose { background: #3a2c4d; color: #fff; border: none; border-radius: 8px; width: 36px; height: 36px; font-size: 16px; }
#mapSvg { flex: 1; width: 100%; }
#mapHint { text-align: center; padding: 10px; color: #c9b8a0; font-size: 13px; }
.seg { fill: none; stroke: #5a4a36; stroke-width: 2; stroke-dasharray: 2 2.5; stroke-linecap: round; }
.seg.open { stroke: #ffd75e; }
.node circle { fill: #2a2118; stroke: #5a4a36; stroke-width: 1.5; }
.node.open circle { fill: #4a3726; stroke: #ffd75e; cursor: pointer; }
.node.here circle { stroke: #7cf27c; stroke-width: 2; }
.node.pulse circle { animation: pulse 1s infinite; }
@keyframes pulse { 50% { stroke-width: 3.5; stroke: #fff; } }
.nicon { font-size: 11px; text-anchor: middle; }
.nlabel { font-size: 5px; text-anchor: middle; fill: #e8dcc0; font-weight: 700; }
.node.locked .nlabel { fill: #776; }
.walker { font-size: 10px; pointer-events: none; }

.hbtns { display: flex; gap: 6px; }
#wsBtn { background: #3a2c4d; color: #fff; border: none; border-radius: 8px; padding: 6px 10px; font-weight: 700; font-size: 13px; }
#top { gap: 6px; }

#workshop { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; background: #17111f; }
#wsBody { flex: 1; overflow-y: auto; padding: 0 12px 20px; }
#wsBody h3 { margin: 14px 0 8px; color: #c9b8e0; font-size: 15px; }
.rrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.rchip { background: #221a2d; border: 1px solid #2f2440; border-radius: 8px; padding: 4px 8px; font-size: 13px; font-weight: 700; }
.ggrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gbtn { background: #2f4a2a; color: #fff; border: none; border-radius: 8px; padding: 8px 2px; font-size: 18px; font-weight: 700; }
.gbtn[data-gather="ore"] { background: #4a3a2a; }
.gbtn small, .wcard button small { display: block; font-size: 10px; font-weight: 500; opacity: .85; margin-top: 2px; }
.gbtn:disabled { background: #2a2433; color: #777; font-size: 14px; }
.wcard { display: grid; grid-template-columns: 46px 1fr 86px; gap: 8px; align-items: center; background: #221a2d; border: 1px solid #2f2440; border-radius: 10px; padding: 8px; margin-bottom: 6px; }
.wcard.locked { opacity: .5; }
.wico { width: 46px; height: 46px; font-size: 28px; display: flex; align-items: center; justify-content: center; background: #2f2440; border-radius: 10px; position: relative; }
.wico .lvl { position: absolute; bottom: -4px; right: -4px; background: #ffd75e; color: #000; font-size: 11px; font-weight: 800; border-radius: 8px; padding: 1px 5px; }
.wsub { font-size: 12px; color: #aaa; margin-top: 2px; }
.wsub .on { color: #7cf27c; font-weight: 700; }
.wcard button { height: 46px; border: none; border-radius: 8px; background: #3a7d32; color: #fff; font-weight: 700; font-size: 13px; }
.wcard button:disabled { background: #3a3346; color: #888; }
.gdone { text-align: center; padding-top: 40px; }
.gdone .big { font-size: 44px; font-weight: 800; color: #ffd75e; margin-bottom: 8px; }
.gdone p { margin-bottom: 20px; color: #ccc; }
.gdone button { background: #3a7d32; color: #fff; border: none; border-radius: 8px; padding: 12px 22px; font-weight: 700; font-size: 15px; margin: 4px; }
.gdone button.alt { background: #3a2c4d; }

/* minigames (ported from World Ascended, PainNGain) */
.gg { display: grid; gap: 8px; --ma: #d9822b; --mi: #ffc58a; --hi: #c9a6ff; --ha: #4caf6a; }
.gg-stage { position: relative; margin: 0 auto; max-width: 100%; touch-action: manipulation; cursor: crosshair; }
.gg-stage img { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.hg .gg-stage img { transform-origin: 50% 85%; animation: hg-sway 4.5s ease-in-out infinite; }
@keyframes hg-sway { 50% { transform: rotate(1.2deg); } }
.gg-stage.shake img { animation: mg-shake .22s steps(4) 1; }
@keyframes mg-shake { 25% { transform: translate(-4px,2px) } 50% { transform: translate(3px,-2px) } 75% { transform: translate(-2px,-1px) } }
.gg-stage.breaking img { animation: mg-crumble .5s ease-out 1; }
@keyframes mg-crumble { 0% { transform: scale(1.06) } 40% { transform: scale(.94) translateY(4px) } }
.mg-wp, .hg-t { position: absolute; width: 56px; height: 56px; margin: -28px 0 0 -28px; border: 0; padding: 0; background: none; display: grid; place-items: center; }
.mg-wp i { display: block; width: calc(var(--d) * .7); height: calc(var(--d) * .7); transform: rotate(45deg); background: radial-gradient(circle, #fff6d8 0 25%, var(--mi) 26% 55%, var(--ma) 56%); box-shadow: 0 0 0 2px rgba(0,0,0,.55), 0 0 14px var(--mi); animation: mg-pulse 1.6s ease-in-out infinite; }
.mg-wp b { position: absolute; bottom: 4px; right: 6px; font-size: 11px; color: #fff; text-shadow: 0 1px 2px #000; }
@keyframes mg-pulse { 50% { box-shadow: 0 0 0 2px rgba(0,0,0,.55), 0 0 22px 4px var(--mi); } }
.mg-wp.part i { background: radial-gradient(circle, #fffbe0 0 22%, #ffe066 23% 55%, #d4a017 56%); }
.mg-wp.hit { pointer-events: none; }
.mg-wp.hit i { animation: none; background: radial-gradient(circle, #eafff0 0 22%, #7fe0a0 23% 55%, #2f9a5a 56%); }
.hg-t { opacity: 0; pointer-events: none; transition: opacity .25s; }
.hg-t i { display: block; width: var(--d); height: var(--d); border-radius: 50%; border: 2px solid #eaffd8; background: radial-gradient(circle, rgba(255,255,255,.35), rgba(127,224,120,.18) 60%, transparent 72%); box-shadow: 0 0 0 2px rgba(0,0,0,.45), 0 0 14px var(--hi); }
.hg-t.on { opacity: 1; pointer-events: auto; }
.hg-t.on i { animation: hg-pulse 1.4s ease-in-out infinite; }
@keyframes hg-pulse { 50% { transform: scale(1.12); box-shadow: 0 0 0 2px rgba(0,0,0,.45), 0 0 22px 4px var(--hi); } }
.gg-fx { position: absolute; pointer-events: none; }
.mg-flash { width: 60px; height: 60px; margin: -30px 0 0 -30px; border-radius: 50%; background: radial-gradient(circle, #fff 0 20%, var(--mi) 40%, transparent 70%); animation: g-flash .28s ease-out forwards; }
.hg-spark { width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: radial-gradient(circle, #fff 0 12%, rgba(201,166,255,.8) 30%, rgba(127,224,120,.4) 50%, transparent 70%); animation: g-flash .45s ease-out forwards; }
@keyframes g-flash { from { transform: scale(.3); opacity: 1 } to { transform: scale(1.4); opacity: 0 } }
.mg-chip, .hg-leaf { width: 7px; height: 7px; background: var(--c); box-shadow: 0 0 0 1px rgba(0,0,0,.5); animation: g-bit var(--t) cubic-bezier(.2,.6,.4,1) forwards; }
.hg-leaf { width: 6px; height: 4px; }
@keyframes g-bit { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0 } }
.gg-fail { width: 30px; height: 30px; margin: -15px 0 0 -15px; display: grid; place-items: center; animation: g-fail .9s ease-out forwards; }
.gg-fail i { position: absolute; inset: 4px; transform: rotate(45deg); background: radial-gradient(circle, #ffe0dc 0 22%, #ff6b5a 23% 55%, #c0291b 56%); box-shadow: 0 0 0 2px rgba(0,0,0,.6), 0 0 12px #ff4a3a; }
.gg-fail::after { content: "✕"; position: relative; font-size: 13px; font-weight: 700; color: #3a0904; }
@keyframes g-fail { 0% { transform: scale(.4) } 25% { transform: scale(1.1) } 70% { opacity: 1 } 100% { transform: scale(1); opacity: 0 } }
.gg-bar { height: 10px; border-radius: 999px; background: #0d0a12; border: 1px solid #2f2440; overflow: hidden; }
.gg-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--ma), var(--mi)); transition: width .25s; }
.hg .gg-bar span { background: linear-gradient(90deg, var(--ha), #b7f0a8); }
.gg-row { display: flex; justify-content: space-between; font-size: 13px; color: #aaa; }
.gg-msg { text-align: center; min-height: 1.4em; }

.gg-crop { overflow: hidden; display: flex; justify-content: center; align-items: flex-start; }
.gg-stage { flex: none; }
#wsClose { background: #3a2c4d; color: #fff; border: none; border-radius: 8px; width: 36px; height: 36px; font-size: 16px; }

.energy { float: right; font-size: 13px; color: #ffe066; font-weight: 700; }
p.energy { float: none; }
.gdone button:disabled { background: #3a3346; color: #888; }

/* boss wins: lunge, screen hit, DEFEATED stamp */
#monster.bossStrike { animation: bossStrike .9s ease-in forwards; z-index: 5; }
@keyframes bossStrike {
  0% { transform: scale(1); } 30% { transform: scale(.85) translateY(-10px) rotate(-6deg); }
  55% { transform: scale(2.3) translateY(30px); filter: drop-shadow(0 0 20px #f00); }
  70% { transform: scale(2.1) translateY(26px) rotate(3deg); } 100% { transform: scale(1.4) translateY(10px); opacity: .85; } }
#arena.struck { animation: struck .5s steps(6) 1; }
#arena.struck::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse, #ff000066, #8000 70%); animation: redflash 1.2s ease-out forwards; pointer-events: none; }
@keyframes struck { 20% { transform: translate(-10px, 6px); } 40% { transform: translate(9px, -5px); } 60% { transform: translate(-6px, 3px); } 80% { transform: translate(4px, -2px); } }
@keyframes redflash { from { opacity: 1; } to { opacity: .35; } }
.stamp { position: absolute; top: 38%; left: 50%; z-index: 6; transform: translate(-50%, -50%) rotate(-12deg); text-align: center;
  font-size: 46px; font-weight: 900; letter-spacing: 3px; color: #ff2a2a; border: 6px solid #ff2a2a; border-radius: 10px; padding: 4px 16px;
  background: #1a0505cc; text-shadow: 0 3px 0 #000; box-shadow: 0 0 30px #f008; animation: stamp .35s cubic-bezier(.2,1.6,.4,1) both; }
.stamp small { display: block; font-size: 13px; letter-spacing: 0; color: #ffd0d0; font-weight: 700; }
@keyframes stamp { from { transform: translate(-50%, -50%) rotate(-12deg) scale(3); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-12deg) scale(1); opacity: 1; } }
#monster .bossAnim { width: 180px; height: 180px; background-size: 900% 100%; background-position: 0 0; image-rendering: pixelated; filter: drop-shadow(0 0 10px #c0306088); }
.hero .face img { width: 52px; height: 52px; image-rendering: pixelated; border-radius: 10px; }
#settingsBtn { margin: 0 auto 14px; display: block; background: #2a2340; color: #cdf; border: 1px solid #567; border-radius: 8px; padding: 6px 14px; font-size: 12px; }

/* active potion icons: one per potion, ring drains, flashes in the last 30 s */
#buffs { position: absolute; left: 10px; top: 58px; display: flex; flex-direction: column; gap: 8px; z-index: 3; }
.buff { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.buff .bico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 22px;
  background: radial-gradient(circle, #2b2140 58%, transparent 60%), conic-gradient(#7cf27c var(--p), #333 0); box-shadow: 0 0 10px #7cf27c55; }
.buff span { font-size: 11px; font-weight: 800; color: #d8ffd0; text-shadow: 0 1px 2px #000; }
.buff.ending .bico { animation: buffEnd .6s ease-in-out infinite; }
@keyframes buffEnd { 50% { box-shadow: 0 0 14px #ff5a5a; filter: brightness(1.4); } }

/* ---- polish ---- */
#arena { background-size: cover; background-position: center; image-rendering: pixelated; }
#monster.hit img, #monster.hit .bossAnim { filter: brightness(2.2) drop-shadow(0 0 6px #fff); }
.float.crit { color: #ff5a3a; font-size: 28px; font-weight: 900; z-index: 4; }
.coin { position: fixed; z-index: 20; font-size: 16px; pointer-events: none; }
#gold.bump { animation: bump .2s; display: inline-block; }
@keyframes bump { 50% { transform: scale(1.25); } }
#tapHint { position: absolute; bottom: -6px; right: 0; font-size: 40px; pointer-events: none; animation: tapHint 1s ease-in-out infinite; z-index: 3; text-align: center; }
#tapHint span { display: block; font-size: 14px; font-weight: 900; color: #ffd75e; text-shadow: 0 2px 0 #000; }
@keyframes tapHint { 50% { transform: translate(-6px, -10px) scale(.9); } }
#tip { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); width: 86%; z-index: 7; background: #221a2dee; border: 2px solid #ffd75e;
  border-radius: 10px; padding: 8px 10px; font-size: 13px; font-weight: 700; text-align: center; box-shadow: 0 4px 16px #000a; }
#tip.show { animation: tipIn .35s cubic-bezier(.2,1.5,.4,1); }
@keyframes tipIn { from { transform: translateX(-50%) translateY(-20px); opacity: 0; } }
.glow { animation: glowPulse 1s ease-in-out infinite; }
@keyframes glowPulse { 50% { box-shadow: 0 0 0 3px #ffd75e, 0 0 18px #ffd75e; } }

/* ---- painted world map ---- */
#mapSvg { background: #0a0810; }
#mapSvg image { image-rendering: pixelated; }
.road { fill: none; stroke: #3b2a1a; stroke-width: 13; stroke-linecap: round; }
.roadTop { fill: none; stroke: #8a6a44; stroke-width: 9; stroke-linecap: round; }
.seg { fill: none; stroke: #00000055; stroke-width: 2; stroke-dasharray: 3 4; stroke-linecap: round; }
.seg.open { stroke: #ffd75e; }
.node .ring { fill: #0006; stroke: none; }
.node.here .ring { fill: #7cf27c55; stroke: #7cf27c; stroke-width: 1.5; }
.node.locked .lm { filter: grayscale(1) brightness(.45); }
.node.open { cursor: pointer; }
.node.pulse .lm { animation: lmPulse 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center bottom; }
@keyframes lmPulse { 50% { transform: scale(1.12); filter: drop-shadow(0 0 4px #ffd75e); } }
.lock { font-size: 16px; text-anchor: middle; }
.lbg { fill: #0a0810cc; }
.nlabel { font-size: 8px; text-anchor: middle; fill: #ffe9b0; font-weight: 800; }
.node.locked .nlabel { fill: #8a8070; }
.walker { pointer-events: none; }

/* ---- Party ---- */
.hbtns button { display: flex; flex-direction: column; align-items: center; padding: 4px 8px !important; font-size: 16px !important; line-height: 1.1; }
.hbtns button small { font-size: 10px; font-weight: 700; }
#party { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; background: #17111f; }
#partyBody { flex: 1; overflow-y: auto; padding: 0 12px 20px; }
#partyBody h3 { margin: 14px 0 8px; color: #c9b8e0; font-size: 15px; }
#partyClose { background: #3a2c4d; color: #fff; border: none; border-radius: 8px; width: 36px; height: 36px; font-size: 16px; }
#partyBtn { background: #3a2c4d; color: #fff; border: none; border-radius: 8px; font-weight: 700; }
.shards { background: #2a1f3d; border: 1px solid #b98cff; border-radius: 10px; padding: 10px; text-align: center; font-size: 18px; color: #e6d6ff; }
.shards small { display: block; font-size: 11px; color: #a99; margin-top: 2px; }
.wico img { width: 46px; height: 46px; image-rendering: pixelated; border-radius: 10px; }
.float.shard { color: #d8b8ff; font-size: 20px; font-weight: 900; }

.descend { margin-top: 10px; background: #1d1630; border: 1px solid #5a4a7a; border-radius: 10px; padding: 10px; }
.descend.ready { border-color: #ffd75e; box-shadow: 0 0 12px #ffd75e44; }
.dtitle { font-weight: 800; font-size: 16px; color: #ffd75e; margin-bottom: 4px; }
.dtitle small { float: right; font-size: 11px; color: #b9a; font-weight: 600; margin-top: 3px; }
#descendBtn { width: 100%; margin: 8px 0 4px; padding: 12px; border: none; border-radius: 8px; background: linear-gradient(#7a4ad0, #4a2a90); color: #fff; font-weight: 800; font-size: 15px; }
.wsub.locked { margin-top: 6px; color: #998; }

/* endless map + tier tint */
#mapScroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#mapScroll #mapSvg { width: 100%; height: auto; display: block; flex: none; }
#arena { --tint: none; }
#arena::before { content: ""; position: absolute; inset: 0; background: inherit; filter: var(--tint); z-index: 0; pointer-events: none; }
#monster img, #monster .bossAnim { filter: var(--tint); }
#arena > * { position: relative; z-index: 1; }
#arena > #floorInfo, #arena > #bossTimer, #arena > #bossBtn, #arena > #buffs, #arena > #tip, #arena > .stamp { position: absolute; }

/* ---- leaderboard ---- */
#ranks { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; background: #17111f; }
#ranksBody { flex: 1; overflow-y: auto; padding: 0 12px 20px; }
#ranksClose { background: #3a2c4d; color: #fff; border: none; border-radius: 8px; width: 36px; height: 36px; font-size: 16px; }
#ranksBtn { background: #3a2c4d; color: #fff; border: none; border-radius: 8px; font-weight: 700; }
.meCard { background: #2a1f3d; border: 1px solid #ffd75e; border-radius: 10px; padding: 10px; margin-bottom: 10px; font-size: 16px; }
#renameBtn { float: right; background: #3a2c4d; color: #fff; border: none; border-radius: 6px; padding: 3px 8px; font-size: 12px; }
.rlist { display: flex; flex-direction: column; gap: 4px; }
.rrowx { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; background: #221a2d; border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.rrowx.you { border: 1px solid #7cf27c; background: #22301f; }
.rpos { font-weight: 800; color: #c9b8e0; font-size: 15px; }
.rname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rbest { text-align: right; font-weight: 800; color: #ffd75e; }
.rbest small { display: block; font-size: 10px; color: #998; font-weight: 600; }
.hbtns { gap: 4px !important; }
.hbtns button { padding: 4px 6px !important; }

/* ---- mobile Firefox / dynamic toolbar fixes ---- */
html, body { height: 100%; height: 100dvh; overscroll-behavior: none; }
#app { height: 100%; height: var(--vh, 100dvh); }
#map, #workshop, #party, #ranks { height: var(--vh, 100dvh); bottom: auto; }
#heroList, #wsBody, #partyBody, #ranksBody, #mapScroll { touch-action: pan-y; overscroll-behavior: contain; min-height: 0; }
#monsterWrap, .gg-stage { touch-action: manipulation; }

/* Firefox Android font inflation / system font scaling: keep text at the sizes the layout was built for */
html, body { -moz-text-size-adjust: none; -webkit-text-size-adjust: none; text-size-adjust: none; }
#top .stat.small { white-space: nowrap; }
.hbtns { flex-shrink: 0; }

/* narrow screens / zoomed phones: keep everything inside the width */
#app, #top, #shop, #heroList, .hero, .hero > div { min-width: 0; }
#top { flex-wrap: nowrap; }
#top .stat { font-size: 18px; }
@media (max-width: 380px) {
  .hbtns button small { display: none; }
  .hbtns button { font-size: 18px !important; padding: 6px !important; }
  #top { padding: 8px; }
  .hero { grid-template-columns: 44px 1fr 84px; gap: 6px; padding: 6px; }
  .hero .face, .hero .face img { width: 44px; height: 44px; }
  .hero .name { font-size: 13px; } .hero .info { font-size: 11px; } .hero .ms { display: none; }
  #floorName { font-size: 14px; }
}

/* short screens / zoomed browsers: monster scales with the arena instead of spilling over the hero list */
#arena { overflow: hidden; min-height: 0; }
#monsterWrap { width: min(170px, calc(var(--vh, 100dvh) * 0.24)); height: min(170px, calc(var(--vh, 100dvh) * 0.24)); }
#monster img { width: min(150px, calc(var(--vh, 100dvh) * 0.21)); height: min(150px, calc(var(--vh, 100dvh) * 0.21)); }
#monster.boss img, #monster .bossAnim { width: min(180px, calc(var(--vh, 100dvh) * 0.25)); height: min(180px, calc(var(--vh, 100dvh) * 0.25)); }
@media (max-height: 560px) {
  #arena { gap: 2px; }
  #monsterName { font-size: 12px; }
  #hpBar { height: 14px; } #hpText { font-size: 10px; line-height: 14px; }
  #floorInfo { top: 4px; } #floorName { font-size: 12px; } #killInfo { font-size: 10px; }
  #floorRow button { width: 24px; height: 22px; }
  #top { padding: 4px 8px; } #top .stat { font-size: 15px; } .stat .ico { font-size: 14px; }
  .hbtns button { font-size: 14px !important; padding: 3px 5px !important; }
  #shopHead { padding: 4px 10px; font-size: 13px; } #multBtn { padding: 3px 10px; }
  #tapHint { font-size: 26px; } #tapHint span { font-size: 10px; }
}

/* very narrow: shrink header so all 4 buttons fit */
@media (max-width: 300px) {
  #top { gap: 4px; padding: 4px 6px; }
  #top .stat { font-size: 14px; gap: 3px; } .stat .ico { font-size: 13px; }
  #top .stat.small { font-size: 10px; }
  .hbtns { gap: 3px !important; }
  .hbtns button { font-size: 13px !important; padding: 3px 4px !important; min-width: 0; }
  .hero { grid-template-columns: 40px 1fr 72px; }
  .hero .face, .hero .face img { width: 40px; height: 40px; }
  .hero button { font-size: 11px; height: 44px; }
}

/* header: gold with dmg/s stacked underneath, buttons share the rest and can shrink */
.money { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.money .stat { line-height: 1.1; white-space: nowrap; }
.money .stat.small { font-size: 11px !important; margin-top: 1px; }
.hbtns { flex: 0 1 auto; min-width: 0; display: flex; }
.hbtns button { flex: 0 1 auto; min-width: 30px; }

/* world map trail: stepping stones instead of a road */
.road, .roadTop { display: none; }
.stoneShadow { fill: none; stroke: #1a140c; stroke-width: 8.5; stroke-linecap: round; stroke-dasharray: 0.1 11; transform: translateY(1px); }
.stone { fill: none; stroke: #8c8478; stroke-width: 6.5; stroke-linecap: round; stroke-dasharray: 0.1 11; }
.stone.open { stroke: #e8c87a; }
.stoneShadow:not(.open), .stone:not(.open) { opacity: .55; }
.seg, .seg.open { stroke: none; }

/* floor map stones */
.fstone .fs-sh { fill: #0b0805; }
.fstone .fs { fill: #5a544c; stroke: #2a241c; stroke-width: 1; }
.fstone.done .fs { fill: #e8c87a; stroke: #6a4a1a; }
.fstone.front .fs { fill: #fff3c0; stroke: #ffd75e; stroke-width: 1.5; }
.fstone.dim { opacity: .55; }
.fstone.boss .fs { fill: #6a2a2a; stroke: #200; }
.fstone.boss.done .fs { fill: #c0503a; stroke: #3a0a00; }
.fstone.here .fs { stroke: #7cf27c; stroke-width: 2; }
.fstone.done, .fstone.front { cursor: pointer; }
.fs-skull { font-size: 7px; text-anchor: middle; pointer-events: none; }
.fs-num { font-size: 6px; fill: #e8dcc0; font-weight: 800; paint-order: stroke; stroke: #000; stroke-width: 1.5px; }
.surface { font-size: 9px; text-anchor: middle; fill: #ffe9b0; font-weight: 800; paint-order: stroke; stroke: #000; stroke-width: 2px; }
.seg { fill: none; stroke: none; }

/* cut-away floor map */
.chframe { fill: none; stroke: #0d0a08; stroke-width: 3; }
.chamber.open { cursor: pointer; }
.chamber.pulse .chframe { animation: chPulse 1s ease-in-out infinite; }
@keyframes chPulse { 50% { stroke: #ffd75e; stroke-width: 4; } }
.chbg { image-rendering: pixelated; }
.ledge { fill: #00000088; }
.step { fill: #6b6258; stroke: #1c1712; stroke-width: .6; }
.stepTop { fill: #9a9082; }
.ftile .ft { fill: #3d362f; stroke: #15110d; stroke-width: .8; }
.ftile.done .ft { fill: #c9a55a; stroke: #4a3410; }
.ftile.front .ft { fill: #fff0b8; stroke: #ffd75e; }
.ftile.boss .ft { fill: #6a2a2a; } .ftile.boss.done .ft { fill: #c0503a; }
.ftile.here .ft { stroke: #7cf27c; stroke-width: 1.6; }
.ftile.dim { opacity: .5; }
.ftile.done, .ftile.front { cursor: pointer; }
.ftn { font-size: 6px; font-weight: 900; text-anchor: middle; fill: #1a120a; pointer-events: none; }
.ftile.dim .ftn { fill: #a99; }

.nlabel.left, .surface.left { text-anchor: start; }
/* character sheet + forge */
.sheet { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.gs { position: relative; aspect-ratio: 1; min-width: 0; padding: 2px; background: #221a2d; border: 2px solid #3a3050; border-radius: 10px; color: #c9b8e0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.gs img { width: 70%; height: auto; image-rendering: auto; }
.gs small { font-size: 9px; line-height: 1; margin-top: 1px; }
.gs .lvl { position: absolute; top: 2px; right: 2px; background: #ffd75e; color: #000; font-size: 9px; font-weight: 800; border-radius: 6px; padding: 0 3px; }
.gs.empty img, .wico img.ghost { opacity: .18; filter: grayscale(1); }
.gs.off img { opacity: .45; }
.gs.t1 { border-color: #b8733a; } .gs.t2 { border-color: #9aa3ad; } .gs.t3 { border-color: #6fc3ff; } .gs.t4 { border-color: #ffd75e; box-shadow: 0 0 6px #ffd75e88; }
.gs.sel { outline: 2px solid #fff; }
.gdetail { background: #221a2d; border: 1px solid #2f2440; border-radius: 10px; padding: 8px; margin-top: 6px; font-size: 13px; }
.gbtns { display: flex; gap: 6px; margin-top: 6px; }
.gbtns button { flex: 1; height: 42px; border: none; border-radius: 8px; background: #3a7d32; color: #fff; font-weight: 700; font-size: 12px; }
.gbtns button.alt { background: #4a3d63; }
.gbtns button:disabled { background: #3a3346; color: #888; }
.gbtns button small { display: block; font-size: 10px; font-weight: 500; }
.gtotal { font-size: 11px; color: #d8ffd0; margin-top: 6px; }
.on { color: #8f8; }
.refund { background: #2d2a1a; border: 1px solid #6b5a20; border-radius: 8px; padding: 6px 8px; font-size: 12px; margin-bottom: 6px; }
.wico.gslot img, .wcard .wico img { object-fit: contain; }
.buff .bico img { width: 32px; height: 32px; image-rendering: pixelated; }
#buffs { gap: 3px 4px; flex-wrap: wrap; max-height: calc(100% - 70px); align-content: flex-start; }
.buff .bico { width: 36px; height: 36px; }
.buff .bico img { width: 28px; height: 28px; }
.buff span { font-size: 10px; }
.wcard button[data-forge] { padding: 0 4px; min-width: 0; font-size: 12px; }
#buffs { display: grid; grid-template-columns: repeat(3, auto); max-height: none; gap: 2px 4px; }
.buff .bico { width: 30px; height: 30px; }
.buff .bico img { width: 24px; height: 24px; }
.wcard { grid-template-columns: 46px minmax(0, 1fr) 76px; }

@media (max-width: 300px) {
  #wsBody, #partyBody { padding: 0 6px 16px; }
  .wcard { grid-template-columns: 36px minmax(0, 1fr) 62px; gap: 5px; padding: 5px; }
  .wico, .wico img { width: 36px; height: 36px; font-size: 22px; }
  .wcard b { font-size: 12px; } .wcard .wsub { font-size: 10px; }
  .wcard button { font-size: 11px; height: 42px; padding: 0 3px; }
  #wsBody h3 small { display: block; font-size: 10px; }
}
#buffs { grid-template-columns: repeat(5, auto); }
#buffs .buff .bico { width: 28px; height: 28px; }
#buffs .buff .bico img { width: 22px; height: 22px; }
#buffs .buff span { font-size: 9px; }

/* ---- 🛒 Shop (gold-only gacha parody; real-money section can sit beside "Gold Shop" later) ---- */
#store { position: fixed; inset: 0; z-index: 8; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; background: #17111f; height: var(--vh, 100dvh); }
#storeBody { flex: 1; overflow-y: auto; padding: 0 10px 16px; touch-action: pan-y; overscroll-behavior: contain; min-height: 0; }
#storeClose, #storeBtn { background: #3a2c4d; color: #fff; border: none; border-radius: 8px; font-weight: 700; }
#storeClose { width: 36px; height: 36px; font-size: 16px; }
.stsec { font-weight: 800; color: #ffd75e; font-size: 13px; border-bottom: 1px solid #3a2c4d; padding-bottom: 3px; margin-bottom: 5px; }
.sttop { display: flex; gap: 6px; align-items: center; font-size: 11px; }
.vip { background: linear-gradient(#ffe27a, #c9921b); color: #3a2400; font-weight: 900; border-radius: 6px; padding: 1px 5px; font-size: 10px; box-shadow: 0 0 6px #ffd75e88; }
.limit { color: #ff6a6a; font-weight: 800; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .55; } }
.ticker { margin: 5px 0; background: #0d0a12; border-radius: 6px; font-size: 10px; color: #9fe3a0; padding: 3px 6px; white-space: nowrap; overflow: hidden; }
.stgold { text-align: center; font-size: 17px; font-weight: 800; color: #ffd75e; }
.stgold small { display: block; font-size: 9px; color: #8a7aa0; font-weight: 500; }
.sttabs { display: flex; gap: 6px; margin: 6px 0; }
.sttabs button { flex: 1; background: #2a2136; color: #bbb; border: 1px solid #3a2c4d; border-radius: 8px; padding: 6px 0; font-weight: 700; font-size: 13px; }
.sttabs button.on { background: #5a3f86; color: #fff; border-color: #b98cff; }
.crate.big { font-size: 54px; text-align: center; animation: bob 1.6s ease-in-out infinite; filter: drop-shadow(0 0 10px #ffd75e66); }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-3deg); } }
.ctr { text-align: center; margin: 4px 0; }
.bundle { position: relative; display: grid; grid-template-columns: 1fr 84px; gap: 6px; align-items: center; background: #221a2d; border: 1px solid #2f2440; border-radius: 10px; padding: 8px; margin: 8px 0 6px; }
.bundle b { font-size: 13px; }
.bundle button { height: 42px; border: none; border-radius: 8px; background: #b8711a; color: #fff; font-weight: 800; font-size: 13px; }
.bundle button small { display: block; font-size: 10px; font-weight: 600; }
.bundle button:disabled { background: #3a3346; color: #888; }
.ribbon { position: absolute; top: -8px; left: 6px; background: #e0243c; color: #fff; font-size: 9px; font-weight: 900; padding: 1px 6px; border-radius: 4px; transform: rotate(-4deg); animation: blink .8s infinite; }
.pity { text-align: center; font-size: 11px; color: #c9b8e0; margin: 6px 0; } .pity small { color: #8a7aa0; }
.fine { text-align: center; font-size: 10px; color: #8a7aa0; margin-top: 8px; }
.fine button { background: none; border: none; color: #b98cff; text-decoration: underline; font-size: 10px; }
.odds { width: 100%; font-size: 12px; margin: 4px 0; border-collapse: collapse; } .odds td { padding: 1px 3px; border-bottom: 1px solid #3a2c4d; }
.oddsx { font-size: 10px; color: #c9b8e0; text-align: left; line-height: 1.35; margin-bottom: 4px; }
#modal .box { max-height: 92%; overflow-y: auto; padding: 14px; }
/* scratch card */
.scard { background: linear-gradient(135deg, #3d6b2f, #1f4a1f); border: 3px dashed #ffd75e; border-radius: 12px; padding: 10px; margin: 6px 0; text-align: center; min-height: 110px; }
.sclogo { font-size: 22px; font-weight: 900; color: #ffd75e; padding-top: 14px; } .sclogo small { font-size: 10px; color: #dfe; }
.scells { display: flex; gap: 8px; justify-content: center; touch-action: none; }
.scell { position: relative; width: 52px; height: 52px; background: #f4efe0; border-radius: 8px; font-size: 32px; display: flex; align-items: center; justify-content: center; }
.scell i { position: absolute; inset: 0; border-radius: 8px; background: repeating-linear-gradient(45deg, #b0b0b8, #b0b0b8 4px, #8d8d96 4px, #8d8d96 8px); color: #555; font-style: normal; font-weight: 900; font-size: 22px; display: flex; align-items: center; justify-content: center; transition: opacity .25s; }
.scell canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 8px; transition: opacity .35s; }
.scell.open canvas { opacity: 0; pointer-events: none; }
.sres { font-size: 12px; margin-top: 8px; color: #fff; } .sres button { margin-top: 5px; background: #b8711a; color: #fff; border: none; border-radius: 8px; padding: 5px 16px; font-weight: 800; }
.scard.win { animation: glow 0.6s infinite alternate; } .scard.w-jackpot { animation: glow 0.3s infinite alternate, shake .4s infinite; }
@keyframes glow { to { box-shadow: 0 0 22px #ffd75e; } }
/* crate reveal */
#reveal { position: absolute; inset: 0; z-index: 9; background: #000d; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; }
.rcrate { font-size: 80px; } .rtxt { color: #ccc; font-size: 12px; }
.shake { animation: shake .3s infinite; }
.r-epic .shake, .r-legendary .shake { animation: shake .12s infinite; filter: drop-shadow(0 0 16px #ffd75e); }
@keyframes shake { 0%,100% { transform: rotate(0) } 25% { transform: rotate(-8deg) translateX(-3px) } 75% { transform: rotate(8deg) translateX(3px) } }
.rays { position: absolute; width: 600px; height: 600px; background: repeating-conic-gradient(var(--rc, #fff3) 0 10deg, transparent 10deg 20deg); animation: spin 8s linear infinite; }
.r-common { --rc: #9a9aa633 } .r-uncommon { --rc: #4fd26a44 } .r-rare { --rc: #4f9dff55 } .r-epic { --rc: #b46bff66 } .r-legendary { --rc: #ffc53188 }
@keyframes spin { to { transform: rotate(360deg); } }
.rbox { position: relative; width: 92%; max-height: 90%; overflow-y: auto; background: #221a2d; border-radius: 12px; padding: 10px; text-align: center; animation: pop .35s; }
.r-legendary .rbox { border: 2px solid #ffc531; box-shadow: 0 0 24px #ffc531; } .r-epic .rbox { border: 2px solid #b46bff; box-shadow: 0 0 18px #b46bff; }
@keyframes pop { from { transform: scale(.3); } 70% { transform: scale(1.08); } }
.rname { font-size: 20px; font-weight: 900; text-shadow: 0 0 8px currentColor; margin-bottom: 6px; }
.rlist { text-align: left; }
.ritem { display: grid; grid-template-columns: 34px 1fr; gap: 6px; align-items: center; border-left: 3px solid var(--c); background: #17111f; border-radius: 6px; padding: 4px; margin-bottom: 4px; font-size: 12px; }
.rico { font-size: 24px; text-align: center; } .rico img { width: 32px; height: 32px; image-rendering: pixelated; }
#rOk { margin-top: 6px; background: #3a7d32; color: #fff; border: none; border-radius: 8px; padding: 7px 24px; font-weight: 800; }
.vip { white-space: nowrap; }
@media (max-width: 300px) {
  .hbtns { gap: 2px !important; }
  .hbtns button { font-size: 12px !important; padding: 3px 3px !important; min-width: 24px; }
  .money { flex: 1 1 0; }
}

/* ---- ☁️ Cloud save ---- */
#cloud { position: fixed; inset: 0; z-index: 9; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; background: #17111f; height: var(--vh, 100dvh); }
#cloudBody { overflow-y: auto; padding: 0 10px 16px; }
.cbox { background: #221a2d; border: 1px solid #3c2f4f; border-radius: 8px; padding: 8px; margin-bottom: 8px; }
.crow { display: flex; gap: 6px; margin-top: 6px; }
.crow button { flex: 1; background: #3a2d52; color: #fff; border: 1px solid #6a5a8a; border-radius: 8px; padding: 7px 4px; font-size: 12px; }
.crow button:disabled { opacity: .4; }
.crow input { flex: 2; min-width: 0; background: #120e18; color: #fff; border: 1px solid #6a5a8a; border-radius: 8px; padding: 6px; font-size: 14px; }
.tcode { font: bold 18px monospace; color: #ffd75e; text-align: center; letter-spacing: 1px; margin-top: 6px; user-select: all; }
#cloudBtn { margin: 0 auto 8px; display: block; background: #2a2340; color: #cdf; border: 1px solid #567; border-radius: 8px; padding: 6px 14px; font-size: 12px; }

/* ---- buff timers: two corner blocks (3 rows x 2), never over the name / HP bar ---- */
#arena > #buffs { position: absolute; display: flex; justify-content: space-between; left: 6px; right: 6px; top: 50px; max-height: none; pointer-events: none; }
#buffs .bcol { display: grid; grid-auto-flow: column; grid-template-rows: repeat(3, auto); gap: 1px 3px; align-content: start; pointer-events: auto; }
#buffs .bcol:empty { display: none; }
#buffs .buff { position: relative; gap: 0; }
#buffs .buff span { margin-top: -3px; line-height: 10px; }
#arena > #buffs#buffs { top: 41px; flex-direction: row; display: flex; }
#buffs .buff .bico { width: 24px; height: 24px; }
#buffs .buff .bico img { width: 19px; height: 19px; }
#buffs .buff span { position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%); margin: 0; font-size: 8px; line-height: 9px; padding: 0 1px; background: #000a; border-radius: 3px; pointer-events: none; }

/* ---------- title screen ---------- */
#title { position: fixed; inset: 0; z-index: 20; height: var(--vh, 100dvh); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
  background: radial-gradient(ellipse at 50% 45%, #3a1a5c 0%, #1a0d2b 60%, #0b0612 100%); }
#title .tart { position: absolute; inset: 0; background: url(art/title_portrait.webp) center 40% / cover no-repeat; }
@media (min-aspect-ratio: 4/5) { #title .tart { background-image: url(art/title_wide.webp); background-size: contain; background-position: center 30%; } }
#title .tbar { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; z-index: 2; }
#title .tbar button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid #8a6ab8; background: #1a0d2bcc; font-size: 17px; padding: 0; }
#title .tbottom { position: relative; z-index: 2; text-align: center; padding: 40px 10px 10px; background: linear-gradient(transparent, #0b0612ee 45%); }
#tWelcome { color: #e8dcff; font-size: 13px; line-height: 1.35; margin-bottom: 10px; text-shadow: 0 1px 3px #000; }
#tWelcome:empty { display: none; }
#tWelcome b { color: #ffd65a; }
#tGo { font-weight: bold; font-size: 20px; font-family: inherit; color: #fff; padding: 12px 30px; border-radius: 12px; border: 2px solid #ffcf4a;
  background: linear-gradient(#c2410c, #7c1d06); box-shadow: 0 0 18px #ff8a3a88; text-shadow: 0 2px 0 #000; animation: tPulse 1.4s ease-in-out infinite; }
@keyframes tPulse { 0%, 100% { transform: scale(1); box-shadow: 0 0 12px #ff8a3a66; } 50% { transform: scale(1.07); box-shadow: 0 0 26px #ffb03acc; } }
.tfoot { color: #9a8ab8; font-size: 10px; margin-top: 10px; }
@media (max-height: 420px) { #tGo { font-size: 16px; padding: 8px 22px; } #title .tbottom { padding-top: 24px; } #tWelcome { font-size: 11px; margin-bottom: 6px; } .tfoot { margin-top: 6px; } }

/* ---------- settings ---------- */
#settings { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; background: #17111f; height: var(--vh, 100dvh); }
#settingsBody { flex: 1; overflow-y: auto; padding: 8px; }
#settingsBody .setcard { background: #221a2e; border: 1px solid #3a2f4d; border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; }
#settingsBody h3 { margin: 0 0 6px; font-size: 14px; color: #e8dcff; }
.setrow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0; font-size: 13px; color: #ddd; }
.setrow label { white-space: nowrap; }
.setrow input[type=range] { flex: 1 1 100px; min-width: 90px; max-width: 160px; }
.setbtn { display: inline-block; background: #2a2340; color: #cdf; border: 1px solid #567; border-radius: 8px; padding: 6px 14px; font-size: 13px; text-decoration: none; }
.setbtn.red { color: #f99; border-color: #844; background: #2a1518; }
.credits { font-size: 12px; color: #bbb; line-height: 1.5; margin: 0 0 8px; }
