/* v0.3: the battlefield, scenes, characters, dock, and the new screens.
   A fight fits the screen with no scrolling. Colour tokens are in styles.css. */
:root {
  --ico-cut: #0b100d;
  --hp: #6fd36a;
  --loss: #ef6f62;
  --cpu: #7fd3f0;
  --dock: #121915;
}
.ico { width: 1.15em; height: 1.15em; vertical-align: -0.2em; flex: none; }
.el-volt { color: var(--volt); } .el-heat { color: var(--heat); } .el-chill { color: var(--chill); } .el-corrosion { color: var(--corrosion); }
.dim { color: var(--muted); }
.small { font-size: 12px; }

body.in-battle { overflow: hidden; overscroll-behavior: none; }
body.in-battle #app { max-width: 560px; padding: 0; }
.battle {
  position: relative; height: 100dvh; min-height: 560px; display: flex; flex-direction: column; overflow: hidden;
  user-select: none; -webkit-user-select: none; touch-action: manipulation;
}

/* --- top bar */
.bbar { flex: none; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 8px 0 12px; background: var(--bbar, rgba(5, 8, 7, 0.55)); border-bottom: 1px solid rgba(255, 255, 255, 0.06); z-index: 3; font-size: 13px; }
.bb-where { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.bb-where strong { color: var(--ink); }
.bb-turn { font: 700 12px var(--mono); color: var(--crit); }
.bb-btns { display: flex; gap: 2px; }
.tb { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: var(--ink); }
.tb.on, .tb:hover { background: rgba(255, 255, 255, 0.08); }
.tb .ico { width: 20px; height: 20px; }

/* --- the field and its scenes */
.field { flex: 1; position: relative; min-height: 0; overflow: hidden; }
.field.shake { animation: fieldShake 0.3s; }
.scene-back { position: absolute; inset: 0; z-index: 0; }
.scene-back::before, .scene-back::after { content: ''; position: absolute; left: 0; right: 0; }
.scene-back::before { top: 0; bottom: 34%; }
.scene-back::after { bottom: 0; height: 34%; }
.scene-inbox .scene-back { background: linear-gradient(#1b1d3a, #262650 60%, #1a1834); }
.scene-inbox .scene-back::before {
  background:
    repeating-linear-gradient(90deg, transparent 0 34px, rgba(255, 255, 255, 0.05) 34px 36px),
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(255, 255, 255, 0.05) 22px 24px),
    radial-gradient(ellipse at 50% 0%, rgba(140, 150, 255, 0.25), transparent 60%);
}
.scene-inbox .scene-back::after { background: linear-gradient(#2c2a55, #15142b); border-top: 2px solid rgba(160, 160, 255, 0.2); }
.scene-network .scene-back { background: linear-gradient(#0f2a24, #123a30 60%, #0b1f1a); }
.scene-network .scene-back::before {
  background:
    repeating-linear-gradient(0deg, transparent 0 40px, rgba(120, 255, 190, 0.07) 40px 43px),
    radial-gradient(circle at 20% 30%, rgba(127, 255, 180, 0.35) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 18%, rgba(127, 255, 180, 0.35) 0 2px, transparent 3px),
    radial-gradient(circle at 85% 55%, rgba(127, 255, 180, 0.35) 0 2px, transparent 3px),
    radial-gradient(ellipse at 50% 0%, rgba(90, 220, 160, 0.2), transparent 60%);
  animation: blink 3s steps(2) infinite;
}
.scene-network .scene-back::after { background: linear-gradient(#173f34, #0a1d18); border-top: 2px solid rgba(120, 255, 190, 0.18); }
.scene-datacenter .scene-back { background: linear-gradient(#0d1620, #13202e 60%, #0a121a); }
.scene-datacenter .scene-back::before {
  background:
    radial-gradient(circle, rgba(111, 177, 239, 0.7) 0 1.5px, transparent 2px) 6px 8px / 40px 14px,
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 2px, rgba(20, 32, 46, 0.9) 2px 36px, transparent 36px 40px);
}
.scene-datacenter .scene-back::after { background: linear-gradient(#1a2a3a, #0a121a); border-top: 2px solid rgba(239, 111, 98, 0.25); }
.scene-datacenter .field::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 0%, rgba(239, 80, 70, 0.18), transparent 55%); animation: alarm 2.4s ease-in-out infinite; }

/* --- enemies */
.foes { position: absolute; left: 0; right: 0; top: 4%; z-index: 1; display: flex; justify-content: center; align-items: flex-start; gap: 2px; padding: 0 4px; }
.foe { position: relative; flex: 0 1 25%; max-width: 128px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px 2px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); }
.foe.target { background: rgba(242, 193, 78, 0.08); box-shadow: 0 0 0 1px rgba(242, 193, 78, 0.45) inset; }
.foe .sprite-wrap { position: relative; width: 84px; height: 84px; }
.foes.n1 .foe .sprite-wrap, .foes.n2 .foe .sprite-wrap { width: 112px; height: 112px; }
.foes.n3 .foe .sprite-wrap { width: 96px; height: 96px; }
.foe.boss .sprite-wrap, .foes .foe.boss .sprite-wrap { width: 150px; height: 150px; }
.foes.n1 .foe { max-width: 200px; flex-basis: 60%; }
/* A boss among minions: a wider column and smaller art, so nothing spills off screen or over a neighbour. */
.foes.n3 .foe.boss { flex: 0 0 38%; max-width: 150px; }
.foes.n3 .foe.boss .sprite-wrap { width: 120px; height: 120px; }
.foes.n4 .foe.boss { flex: 0 0 31%; max-width: 128px; }
.foes.n4 .foe.boss .sprite-wrap { width: 108px; height: 108px; }
.foes.n4:has(.boss) .foe:not(.boss) { flex: 0 1 23%; }
.foes.n4:has(.boss) .foe:not(.boss) .sprite-wrap { width: 72px; height: 72px; }
.ring { position: absolute; left: 8%; right: 8%; bottom: 0; height: 18%; border-radius: 50%; border: 2px solid var(--crit); background: rgba(242, 193, 78, 0.18); box-shadow: 0 0 14px rgba(242, 193, 78, 0.55); animation: ringPulse 1.4s ease-in-out infinite; }
.foe.target .foe-name { color: var(--crit); font-weight: 700; }
.foe.hidden .sprite-wrap { opacity: 0.45; filter: saturate(0.4); }
.foe.frozen .sprite-wrap { filter: hue-rotate(160deg) saturate(1.6) brightness(1.15); }
.foe.dying .sprite-wrap { animation: die 0.45s ease-in forwards; }
.foe-name { font-size: 11px; color: var(--muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foe-hp { display: flex; align-items: center; gap: 4px; width: 92%; }
.foe-hp .bar { height: 6px; min-width: 0; flex: 1; }
.bar.foehp .fill { background: var(--enemy); }
.hp-num { font: 700 11px var(--mono); }
.sh-num { display: inline-flex; align-items: center; gap: 1px; font: 700 11px var(--mono); color: var(--rare); }
.sh-num .ico { width: 12px; height: 12px; }
.statuses { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; min-height: 18px; }
.st { display: inline-flex; align-items: center; gap: 1px; padding: 1px 4px 1px 2px; border-radius: 6px; background: rgba(0, 0, 0, 0.45); font: 700 10px var(--mono); }
.st .ico { width: 12px; height: 12px; }
.st.dim { color: var(--muted); } .st.warn { color: var(--bad); }
.reticle { position: absolute; inset: -6px; display: grid; place-items: center; color: var(--crit); opacity: 0.55; pointer-events: none; animation: spin 6s linear infinite; }
.reticle .ico { width: 100%; height: 100%; }

.intent { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px 2px 3px; border-radius: 99px; background: rgba(0, 0, 0, 0.6); border: 1px solid rgba(255, 255, 255, 0.12); font: 800 13px var(--mono); animation: intentPulse 1.6s ease-in-out infinite; }
.intent.hurts { color: #ff8a7d; border-color: rgba(239, 111, 98, 0.6); }
.intent.other { color: #b8c7ff; }
.intent.off { opacity: 0.5; animation: none; }
.intent .ico { width: 16px; height: 16px; }
.order { display: grid; place-items: center; width: 15px; height: 15px; border-radius: 99px; background: rgba(255, 255, 255, 0.14); color: var(--ink); font: 700 9px var(--mono); }

/* --- you */
.hero { position: absolute; left: 8px; right: 8px; bottom: 6px; z-index: 1; display: flex; align-items: flex-end; gap: 6px; }
.hero .sprite-wrap { position: relative; flex: none; width: 118px; height: 118px; }
.bubble, .has-bubble::after { content: ''; position: absolute; inset: 2px 0 4px; border-radius: 50%; border: 2px solid rgba(111, 177, 239, 0.8); background: radial-gradient(circle, transparent 55%, rgba(111, 177, 239, 0.22)); box-shadow: 0 0 12px rgba(111, 177, 239, 0.4); animation: bubble 2s ease-in-out infinite; pointer-events: none; }
.hero-stats { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-bottom: 8px; }
.hero-line { display: flex; align-items: center; gap: 4px; font: 700 15px var(--mono); }
.hero-line .ico-hp { color: var(--bad); }
.hero-line .sh-num { font-size: 13px; margin-left: 6px; }
.hero-line .sh-num .ico { width: 14px; height: 14px; }
.hero-bar { position: relative; height: 10px; border-radius: 99px; background: rgba(0, 0, 0, 0.5); overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.1); }
.hero-bar .fill { position: absolute; inset: 0 auto 0 0; background: var(--hp); transition: width 0.25s ease; }
.hero-bar .loss { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(-45deg, var(--loss) 0 4px, rgba(239, 111, 98, 0.45) 4px 8px); animation: lossPulse 1.2s ease-in-out infinite; }
.forecast { font: 600 11px var(--mono); color: var(--muted); }
.forecast.hurt { color: #ffb0a6; }
.forecast.dead { color: var(--bad); font-weight: 800; animation: lethalBlink 0.8s steps(2) infinite; }
.forecast.safe { color: var(--good); }
.crit-badge { position: absolute; z-index: 2; right: 10px; bottom: 132px; display: flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 99px; background: rgba(242, 193, 78, 0.18); border: 1px solid var(--crit); color: var(--crit); font: 800 12px var(--mono); animation: critGlow 1.2s ease-in-out infinite; }
.lethal { position: absolute; z-index: 2; left: 10px; right: 10px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: rgba(60, 8, 8, 0.82); border: 1px solid var(--bad); color: #ffd0ca; font-size: 13px; pointer-events: none; animation: lethalIn 0.3s ease-out; }
.lethal .ico { width: 26px; height: 26px; color: var(--bad); }

/* --- floating numbers and banners */
.fx { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.float { position: absolute; transform: translate(-50%, 0); font: 900 20px var(--mono); color: #fff; text-shadow: 0 2px 0 #000, 0 0 6px rgba(0, 0, 0, 0.8); animation: floatUp 1.05s ease-out forwards; white-space: nowrap; }
.float.crit { color: var(--crit); font-size: 30px; }
.float.me { color: #ff7b6e; font-size: 24px; }
.float.dmg-sh, .float.blk, .float.shield { color: #8fc8ff; font-size: 16px; }
.float.heal { color: var(--good); }
.float.stk { font-size: 14px; }
.float.word { font-size: 14px; letter-spacing: 0.08em; }
.float.warn { color: var(--bad); }
.float.el-volt, .float.volt { color: var(--volt); } .float.el-heat, .float.burn { color: var(--heat); } .float.el-chill { color: var(--chill); } .float.el-corrosion { color: var(--corrosion); }
.float.thorns { color: #c9a6ff; }
.banner { position: absolute; z-index: 5; left: 50%; top: 44%; transform: translate(-50%, -50%); padding: 6px 18px; border-radius: 12px; background: rgba(0, 0, 0, 0.7); font: 900 22px var(--mono); letter-spacing: 0.06em; pointer-events: none; animation: bannerIn 0.9s ease-out forwards; white-space: nowrap; }
.banner.crit { color: var(--crit); border: 1px solid var(--crit); }
.banner.warn { color: var(--bad); font-size: 16px; }
.banner.main { color: var(--cpu); font-size: 16px; }
.busy { position: absolute; inset: 0; z-index: 9; }

/* --- character animations */
.sprite { width: 100%; height: 100%; display: block; overflow: visible; }
.sprite.idle { animation: bob 2.4s ease-in-out infinite; }
.foe:nth-child(2) .sprite.idle { animation-delay: -0.6s; } .foe:nth-child(3) .sprite.idle { animation-delay: -1.2s; } .foe:nth-child(4) .sprite.idle { animation-delay: -1.8s; }
.sprite-wrap.hit { animation: hit 0.38s; }
.sprite-wrap.hit-crit { animation: hitCrit 0.45s; }
.sprite-wrap.hurt { animation: hurt 0.4s; }
.sprite-wrap.blocked { animation: blocked 0.4s; }
.foe .sprite-wrap.lunge { animation: lungeDown 0.38s; }
.sprite-wrap.cast { animation: cast 0.36s; }
.sprite-wrap.glow { animation: glow 0.4s; }
.sprite-wrap.act { animation: act 0.38s; }
.sprite-wrap.fx-discharge { animation: discharge 0.5s; }
.sprite-wrap.fx-freeze { animation: freeze 0.5s; }
.sprite-wrap.fx-shock { animation: shock 0.5s; }
.sprite.down { transform: rotate(80deg) translate(20px, 10px); opacity: 0.6; }

/* --- dock */
.dock { flex: none; z-index: 3; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); background: var(--dock); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35); }
.dock-top { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.pips-cpu { display: flex; align-items: center; gap: 4px; color: var(--cpu); flex: none; }
.pips-cpu .ico { width: 20px; height: 20px; }
.pips-cpu .pip, .tile-cost .pip, .cost .pip { width: 11px; height: 11px; border-radius: 3px; background: rgba(127, 211, 240, 0.15); border: 1px solid rgba(127, 211, 240, 0.45); }
.pips-cpu .pip.on, .tile-cost .pip.on, .cost .pip.on { background: var(--cpu); box-shadow: 0 0 6px rgba(127, 211, 240, 0.6); }
.mainchip { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; height: 36px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font: 12px var(--mono); text-align: left; }
.mainchip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mainchip.runs { color: var(--cpu); border-color: rgba(127, 211, 240, 0.35); }
.mainchip.error { color: var(--bad); border-color: var(--bad); }
.end { flex: none; display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 14px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.end.danger { background: var(--bad); color: #fff; animation: lethalBlink 1s steps(2) infinite; }
.end .ico { width: 16px; height: 16px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px 6px; padding-top: 4px; }
.tiles.n7, .tiles.n8 { grid-template-columns: repeat(4, 1fr); }
.tile {
  position: relative; display: grid; grid-template-columns: 22px 1fr; grid-template-rows: auto auto; column-gap: 5px; align-items: center;
  min-height: 58px; padding: 6px 7px; border-radius: 12px; text-align: left;
  border: 1px solid var(--line); background: linear-gradient(var(--panel-2), var(--panel)); color: var(--ink);
}
.tile:hover:not(:disabled) { border-color: var(--accent); }
.tile:active:not(:disabled) { transform: scale(0.97); }
.tile.off { opacity: 0.45; }
.tile.patch { border-color: rgba(111, 177, 239, 0.5); }
.tile-ico { grid-row: span 2; display: grid; place-items: center; }
.tile-ico .ico { width: 22px; height: 22px; }
.tile .ico-attack, .tile .ico-crit, .tile .ico-multi { color: #ffb07a; }
.tile .ico-shield { color: var(--rare); }
.tile-name { font: 700 12.5px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.02em; }
.tile-cost { position: absolute; top: -7px; right: 6px; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 6px; background: var(--chip, #0e2a33); border: 1px solid var(--cpu); color: var(--cpu); font: 800 11px var(--mono); box-shadow: 0 0 6px rgba(127, 211, 240, 0.35); }
.tile.off .tile-cost { border-color: var(--line); color: var(--muted); box-shadow: none; }
.tile-text { font-size: 10.5px; line-height: 1.25; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-mods { position: absolute; bottom: 2px; right: 6px; font: 9px var(--mono); color: var(--crit); }

/* --- drawers, sheets, modals */
.drawer { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; max-height: 62%; display: flex; flex-direction: column; background: var(--sheet, rgba(12, 17, 15, 0.97)); border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5); animation: sheetUp 0.2s ease-out; }
.drawer-head { display: flex; align-items: center; gap: 6px; padding-bottom: 6px; }
.drawer-head strong { flex: 0 0 auto; }
.drawer-head .dim { flex: 1; font-size: 12px; }
.drawer .log { overflow-y: auto; margin: 0; flex: 1; }
.drawer.code .code { overflow-y: auto; }
.drawer .err { color: var(--bad); display: flex; gap: 6px; align-items: center; font-size: 13px; }
.sheet { position: absolute; z-index: 7; left: 0; right: 0; bottom: 0; max-height: 78%; overflow-y: auto; padding: 12px 14px calc(14px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 2px solid var(--crit); border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.6); animation: sheetUp 0.22s ease-out; }
.sheet .kicker { display: flex; align-items: center; gap: 4px; margin-top: 0; color: var(--crit); }
.sheet .puzzle-wrap { padding: 0; border: 0; background: none; }
.sheet .prompt { font-size: 17px; }
.modal { position: absolute; z-index: 8; inset: 0; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.55); animation: fadeIn 0.15s; }
.screen .modal { position: fixed; }
.card.info { position: relative; width: 100%; max-width: 440px; max-height: 88dvh; overflow-y: auto; margin: 0; padding: 16px; animation: popIn 0.2s ease-out; }
.card.info h2 { margin-top: 0; padding-right: 30px; }
.card.info h3 { font-size: 13px; margin: 12px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.tb.x { position: absolute; top: 8px; right: 8px; }
.info-head { display: flex; gap: 12px; align-items: center; }
.info-sprite { flex: none; width: 84px; height: 84px; }
.info-ico { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--panel-2); }
.info-ico .ico { width: 28px; height: 28px; }
.real { color: var(--muted); font-size: 14px; }
.pattern { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.pattern li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--panel-2); font-size: 14px; }
.pattern li.next { outline: 1px solid var(--crit); }
.pattern em { color: var(--crit); font-style: normal; font-size: 12px; margin-left: auto; }
.statlist { padding-left: 4px; list-style: none; font-size: 14px; display: grid; gap: 6px; }
.card.endcard { text-align: center; }
.card.endcard.won { border-color: var(--good); }
.card.endcard.lost { border-color: var(--bad); }
.card.endcard .result { display: flex; justify-content: center; align-items: center; gap: 6px; }
.tips ol { padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }
.lesson { position: absolute; z-index: 6; left: 10px; right: 10px; top: 50%; transform: translateY(-50%); padding: 12px 14px; border-radius: 14px; background: var(--sheet, rgba(14, 20, 17, 0.96)); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: popIn 0.2s ease-out; }
.lesson.good { border-color: var(--good); } .lesson.good strong { color: var(--good); }
.lesson.bad { border-color: var(--bad); } .lesson.bad strong { color: var(--bad); }
.lesson p { margin: 6px 0 0; }

/* --- map, rewards, setup, title, editor */
.hud .ico-hp { color: var(--bad); }
.hud .hp .ico { width: 16px; height: 16px; }
.track { display: flex; gap: 4px; align-items: center; }
.step-dot { width: 10px; height: 10px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); display: grid; place-items: center; }
.step-dot.done { background: var(--accent); border-color: var(--accent); }
.step-dot.now { border-color: var(--crit); box-shadow: 0 0 0 2px rgba(242, 193, 78, 0.3); }
.step-dot.boss { width: 18px; height: 18px; color: var(--enemy); background: transparent; border: 0; }
.step-dot.boss .ico { width: 16px; height: 16px; }
.hud .link.small { display: inline-flex; align-items: center; gap: 4px; }
.hud .link.small .ico { width: 14px; height: 14px; }
.door { flex-direction: row; align-items: center; gap: 12px; min-height: 88px; }
.door-ico { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--panel-2); }
.door-ico .ico { width: 24px; height: 24px; }
.door-fight .door-ico { color: #ffb07a; } .door-elite .door-ico { color: var(--epic); } .door-boss .door-ico { color: var(--enemy); } .door-cache .door-ico { color: var(--crit); } .door-rest .door-ico { color: var(--good); }
.door-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.door-body .door-title { font-size: 16px; }
.door-foes { flex: none; display: flex; padding-left: 10px; }
.door-foes .sprite { width: 42px; height: 42px; margin-left: -10px; }
.door-elite { border-color: color-mix(in srgb, var(--epic) 50%, var(--line)); }
.edit-main { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px dashed rgba(127, 211, 240, 0.5); background: rgba(127, 211, 240, 0.05); color: var(--cpu); text-align: left; }
.edit-main .ico { width: 22px; height: 22px; }
.place { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.place:hover { border-color: var(--accent); }

.reward-list { display: grid; gap: 10px; }
.reward { display: block; padding: 0; min-height: 0; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.reward-main { display: flex; gap: 12px; width: 100%; padding: 12px; border: 0; background: transparent; text-align: left; color: var(--ink); }
.reward-main:hover { background: rgba(255, 255, 255, 0.03); }
.reward-ico { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 12px; background: var(--panel-2); }
.reward-ico .ico { width: 26px; height: 26px; }
.reward-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.reward-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.reward-head .kind { display: inline-flex; align-items: center; gap: 3px; }
.reward-head .kind .ico { width: 13px; height: 13px; }
.reward-head .cost { display: inline-flex; align-items: center; gap: 2px; color: var(--cpu); }
.reward-head .cost .pip { width: 8px; height: 8px; }
.reward-name { font-weight: 800; font-size: 17px; overflow-wrap: anywhere; }
.reward-text { color: var(--muted); font-size: 14px; }
.reward.r-rare { border-color: var(--rare); } .r-rare .rar { color: var(--rare); }
.reward.r-epic { border-color: var(--epic); box-shadow: 0 0 18px rgba(196, 140, 240, 0.15); } .r-epic .rar { color: var(--epic); }
.k-function .reward-ico { color: #ffb07a; } .k-snippet .reward-ico { color: var(--cpu); } .k-event .reward-ico { color: var(--crit); } .k-aspect .reward-ico { color: var(--epic); } .k-hardware .reward-ico { color: var(--good); }
.reward-code { padding: 0 12px 10px; }
.reward-code summary { cursor: pointer; color: var(--muted); font: 12px var(--mono); }

.class-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.class-card { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.class-card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.cc-art { width: 64px; height: 64px; }
.cc-name { font-weight: 700; font-size: 12px; text-align: center; }
.cc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 6px; font: 600 10px var(--mono); color: var(--muted); }
.cc-stats .ico { width: 11px; height: 11px; }
.class-detail { margin: 10px 0 0; }
.setup .modes { flex-wrap: wrap; }
.setup h2 { margin-top: 14px; }
.title-art { position: relative; height: 130px; margin-bottom: 8px; }
.ta-hero { position: absolute; left: 50%; bottom: 0; width: 110px; height: 110px; transform: translateX(-90%); }
.ta-foe { position: absolute; right: 8%; top: 10px; width: 70px; height: 70px; opacity: 0.85; }
.ta-foe2 { position: absolute; left: 6%; top: 24px; width: 60px; height: 60px; opacity: 0.6; transform: scaleX(-1); }
.res-art { width: 96px; height: 96px; margin: 0 auto; }

.editor .back { justify-content: space-between; }
.ram { display: inline-flex; align-items: center; gap: 4px; font: 700 13px var(--mono); color: var(--cpu); }
.status { display: flex; align-items: flex-start; gap: 6px; padding: 8px 10px; border-radius: 10px; font-size: 13px; }
.status.good { background: rgba(159, 207, 116, 0.1); color: var(--good); }
.status.bad { background: rgba(239, 111, 98, 0.12); color: var(--bad); }
.editor-code { margin: 8px 0; padding: 6px 0; border-radius: 12px; background: var(--code-bg); border: 1px solid var(--line); font: 13px/1.5 var(--mono); }
.eline { display: flex; align-items: center; width: 100%; min-height: 34px; padding: 2px 8px; border: 0; background: transparent; color: var(--ink); text-align: left; font: inherit; }
.eline.head { min-height: 26px; color: var(--code-kw); }
.eline.sel { box-shadow: 2px 0 0 var(--crit) inset; }
/* The selection is the code itself (owner, 2026-11-15), not the row. */
.ctext { padding: 2px 6px; margin-left: -6px; border-radius: 6px; border: 1px solid transparent; }
.eline.sel .ctext { background: rgba(242, 193, 78, 0.18); border-color: var(--crit); color: var(--ink); }
.esel { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.esel code { color: var(--crit); }
.eline.bad { background: rgba(239, 111, 98, 0.15); }
.ln { width: 22px; flex: none; color: var(--code-com); font-size: 11px; }
.code-text { flex: 1; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.lcost { display: inline-flex; align-items: center; gap: 2px; font: 700 11px var(--mono); color: var(--cpu); }
.lcost .ico { width: 12px; height: 12px; }
.empty-main { padding: 6px 30px; margin: 0; }
.etools { display: flex; gap: 6px; }
.tool { flex: 1; height: 42px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.tool:disabled { opacity: 0.35; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-add { display: inline-flex; align-items: center; gap: 5px; min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 13px; }
.chip-add:hover { border-color: var(--accent); }
.chip-add.snip { border-style: dashed; color: var(--cpu); }
.ehelp { margin-top: 14px; font-size: 14px; color: var(--muted); }
.ehelp summary { cursor: pointer; color: var(--accent); }
.elements, .kinds { list-style: none; padding-left: 0; }
.elements li, .kinds li { margin-bottom: 8px; }

/* --- keyframes */
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes hit { 0% { transform: translateX(0); filter: brightness(2.2); } 25% { transform: translateX(6px); } 50% { transform: translateX(-5px); } 100% { transform: none; filter: none; } }
@keyframes hitCrit { 0% { transform: scale(1.18) rotate(-4deg); filter: brightness(2.8) sepia(1) hue-rotate(10deg); } 40% { transform: translateX(-8px) scale(0.95); } 100% { transform: none; filter: none; } }
@keyframes hurt { 0% { filter: brightness(2) sepia(1) hue-rotate(-40deg) saturate(4); transform: translateX(-6px); } 50% { transform: translateX(5px); } 100% { filter: none; transform: none; } }
@keyframes blocked { 0% { filter: drop-shadow(0 0 10px #6fb1ef) brightness(1.4); } 100% { filter: none; } }
@keyframes lungeDown { 0% { transform: none; } 40% { transform: translate(-6px, 26px) scale(1.08); } 100% { transform: none; } }
@keyframes cast { 0% { transform: none; } 40% { transform: translate(8px, -8px); filter: brightness(1.5) drop-shadow(0 0 8px #f2c14e); } 100% { transform: none; filter: none; } }
@keyframes glow { 0% { filter: drop-shadow(0 0 12px #6fb1ef) brightness(1.3); } 100% { filter: none; } }
@keyframes act { 0% { transform: scale(1); } 40% { transform: scale(1.12); filter: brightness(1.4); } 100% { transform: none; filter: none; } }
@keyframes discharge { 0%, 60% { filter: drop-shadow(0 0 14px #f5d547) brightness(2); } 100% { filter: none; } }
@keyframes freeze { 0% { filter: hue-rotate(160deg) brightness(1.8); } 100% { filter: none; } }
@keyframes shock { 0% { filter: drop-shadow(0 0 14px #f08a4b) brightness(2); transform: scale(1.1); } 100% { filter: none; transform: none; } }
@keyframes die { to { opacity: 0; transform: translateY(14px) scale(0.7) rotate(8deg); filter: grayscale(1); } }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 6px) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, -6px) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -46px) scale(1); } }
@keyframes bannerIn { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -70%); } }
@keyframes intentPulse { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes bubble { 0%, 100% { transform: scale(1); opacity: 0.9; } 50% { transform: scale(1.04); opacity: 0.7; } }
@keyframes lossPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes lethalBlink { 50% { opacity: 0.55; } }
@keyframes critGlow { 0%, 100% { box-shadow: 0 0 0 rgba(242, 193, 78, 0); } 50% { box-shadow: 0 0 14px rgba(242, 193, 78, 0.6); } }
@keyframes lethalIn { from { opacity: 0; } }
@keyframes fieldShake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }
@keyframes sheetUp { from { transform: translateY(30px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { transform: scale(0.94); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ringPulse { 0%, 100% { opacity: 0.9; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.08); } }
@keyframes blink { 50% { opacity: 0.75; } }
@keyframes alarm { 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  .sprite.idle, .intent, .reticle, .bubble, .scene-back::before, .field::after, .hero-bar .loss { animation: none !important; }
}

/* --- the floor's scene behind the map, rewards and rests */
body[data-scene='inbox'] { background: radial-gradient(ellipse at 50% -10%, rgba(140, 150, 255, 0.22), transparent 60%), linear-gradient(#171833, #0f1512 70%); background-attachment: fixed; }
body[data-scene='network'] { background: radial-gradient(ellipse at 50% -10%, rgba(90, 220, 160, 0.2), transparent 60%), linear-gradient(#0f2721, #0f1512 70%); background-attachment: fixed; }
body[data-scene='datacenter'] { background: radial-gradient(ellipse at 50% -10%, rgba(239, 80, 70, 0.16), transparent 60%), linear-gradient(#111b26, #0f1512 70%); background-attachment: fixed; }
body[data-scene] .hud, body[data-scene] .door, body[data-scene] .reward, body[data-scene] .place { backdrop-filter: blur(2px); }

/* --- 2026-11-15: new threats */
.intent.pierce { border-color: #ff5a4e; box-shadow: 0 0 6px rgba(255, 90, 78, 0.45); }
.intent .pierce-ico { width: 13px; height: 13px; margin-left: -1px; }
.spoofed { position: absolute; z-index: 2; left: 10px; right: 10px; top: calc(50% + 28px); display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 12px; background: rgba(30, 24, 60, 0.85); border: 1px solid #9d8cff; color: #ddd6ff; font-size: 12px; pointer-events: none; animation: lethalIn 0.3s ease-out; }
.spoofed .ico { flex: none; width: 20px; height: 20px; color: #b4a6ff; }
.card.endcard.floor-clear { border-color: var(--crit); animation: floorClear 0.6s ease-out; }
.card.endcard.floor-clear h2 { color: var(--crit); }
.next-floor { margin: 4px 0 10px; line-height: 1.45; }
@keyframes floorClear { from { transform: scale(0.85); opacity: 0; } 60% { transform: scale(1.04); opacity: 1; } to { transform: scale(1); } }

/* --- first-run pointers (2026-11-15) */
.coach { position: absolute; z-index: 30; max-width: 250px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--crit); background: var(--panel-solid, #1b1f12); color: var(--ink); font-size: 13px; line-height: 1.4; text-align: left; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5); animation: lethalIn 0.3s ease-out; }
.coach::after { content: ''; position: absolute; left: calc(var(--arrow, 50%) - 7px); width: 12px; height: 12px; background: var(--panel-solid, #1b1f12); border: 1px solid var(--crit); transform: rotate(45deg); }
.coach.below::after { top: -7px; border-right: 0; border-bottom: 0; }
.coach.above::after { bottom: -7px; border-left: 0; border-top: 0; }
.coach-skip { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.coached { outline: 2px solid var(--crit); outline-offset: 2px; border-radius: 12px; animation: coachPulse 1.2s ease-in-out infinite; }
@keyframes coachPulse { 50% { outline-color: rgba(242, 193, 78, 0.25); } }

/* --- the floor map as a directory tree (2026-11-15) */
.tree { margin: 2px 0 10px; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line, rgba(255, 255, 255, 0.12)); font: 12px/1.35 var(--mono); overflow: hidden; }
.prompt-line { margin: 0 0 4px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prompt-line .ps1 { color: var(--good); }
.prompt-line .cwd { color: #8fb8ff; }
.tree-rows { display: flex; flex-direction: column; }
.trow { display: flex; align-items: center; gap: 4px; min-height: 18px; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; white-space: nowrap; }
.tpre { white-space: pre; color: var(--muted); }
.tico { flex: none; width: 13px; height: 13px; }
.tname { flex: none; }
.tinfo { min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--muted); margin-left: 4px; }
.trow.troot .tname { color: #8fb8ff; font-weight: 700; }
.trow.done { opacity: 0.6; } .trow.done .tname::after { content: ' ✓'; color: var(--good); }
.trow.ahead { opacity: 0.55; }
.trow.opt { min-height: 30px; margin: 1px 0; border-radius: 8px; background: rgba(242, 193, 78, 0.12); box-shadow: inset 0 0 0 1px rgba(242, 193, 78, 0.5); cursor: pointer; }
.trow.opt .tname { color: var(--crit); font-weight: 700; }
.trow.opt .tinfo { color: var(--ink); }
.t-fight .tico { color: #ffb07a; } .t-elite .tico { color: var(--epic); } .t-boss .tico { color: var(--enemy); } .t-cache .tico { color: var(--crit); } .t-rest .tico { color: var(--good); }
.doors.n1 .door, .doors.n2 .door, .doors.n3 .door { min-height: 64px; padding-top: 8px; padding-bottom: 8px; }
/* Five classes (2026-11-15): one row of five, art a little smaller. */
.class-grid { grid-template-columns: repeat(5, 1fr); gap: 4px; }
.class-card { padding: 6px 2px; min-width: 0; }
.cc-art { width: 52px; height: 52px; }
.cc-name { font-size: 11px; line-height: 1.15; }
.cc-stats { grid-template-columns: 1fr; font-size: 10px; }

/* --- the floor map v2: rows of folders, lines, symlinks, infection (2026-11-15) */
.fmap-wrap { margin: 2px 0 8px; padding: 6px 8px 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line, rgba(255, 255, 255, 0.12)); }
.fmap-wrap .prompt-line { font: 12px/1.35 var(--mono); }
.fmap { position: relative; margin: 0 14px; }
.fmap-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fmap-lines path { fill: none; stroke: rgba(255, 255, 255, 0.28); stroke-width: 2; }
.fmap-lines path.sym { stroke-dasharray: 5 4; stroke: #8fb8ff; }
.fmap-lines path.walked { stroke: var(--good); stroke-width: 3; }
.fmap-lines path.next { stroke: var(--crit); stroke-width: 3; }
.fmap-lines path.gone { opacity: 0.25; }
.fmap-lines path.sick { stroke: #e0574f; opacity: 0.7; }
.fnode { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 0; border: 0; background: none; color: var(--ink); z-index: 1; }
.fdot { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--panel-solid, #1a2026); border: 2px solid rgba(255, 255, 255, 0.25); }
.fdot .ico { width: 16px; height: 16px; }
.flabel { font: 9px/1 var(--mono); color: var(--muted); max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(0, 0, 0, 0.55); padding: 1px 3px; border-radius: 4px; }
.fnode.t-fight .ico { color: #ffb07a; } .fnode.t-elite .ico { color: var(--epic); } .fnode.t-cache .ico { color: var(--crit); } .fnode.t-rest .ico { color: var(--good); } .fnode.t-event .ico { color: #8fb8ff; } .fnode.t-boss .ico { color: var(--enemy); }
.fnode.t-boss .fdot { width: 38px; height: 38px; border-color: var(--enemy); }
.fnode.done .fdot { border-color: var(--good); opacity: 0.75; }
.fnode.here .fdot { border-color: var(--good); box-shadow: 0 0 0 3px rgba(111, 207, 120, 0.3); }
.fnode.gone { opacity: 0.35; }
.fnode.opt { cursor: pointer; }
.fnode.opt .fdot { border-color: var(--crit); box-shadow: 0 0 10px rgba(242, 193, 78, 0.6); animation: coachPulse 1.2s ease-in-out infinite; outline: 2px solid transparent; }
.fnode.opt .flabel { color: var(--crit); font-weight: 700; }
.fnode.sick .fdot { background: #3a1214; border-color: #e0574f; }
.fnode.sick .ico { color: #ff7a6e; }
.fnode.fresh .fdot { animation: sickIn 0.9s ease-out 2; }
@keyframes sickIn { 0% { transform: scale(1); } 40% { transform: scale(1.35); box-shadow: 0 0 16px #e0574f; } 100% { transform: scale(1); } }
.fnode.troot .fdot { width: 26px; height: 26px; }
.fmap-key { display: flex; justify-content: space-between; gap: 8px; margin: 2px 0 0; font-size: 11px; color: var(--muted); }
.fmap-key span { display: inline-flex; align-items: center; gap: 4px; }
.k-sym { display: inline-block; width: 18px; border-top: 2px dashed #8fb8ff; }
.k-ico { width: 13px; height: 13px; color: #ff7a6e; }
.door-infected { border-color: #e0574f; }
.door-infected .door-ico { color: #ff7a6e; }
.door-event .door-ico { color: #8fb8ff; }
.card.inc h2 { font-size: 18px; word-break: break-all; }
.inc-choices { display: grid; gap: 8px; margin-top: 10px; }
.inc-result { padding: 8px 10px; border-left: 3px solid var(--crit); background: rgba(242, 193, 78, 0.08); border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { .fnode.opt .fdot, .fnode.fresh .fdot { animation: none; } }
/* Locked classes (2026-11-15): greyed, with what unlocks them. */
.class-card.locked { opacity: 0.55; filter: grayscale(0.9); }
.class-card .cc-art { position: relative; }
.cc-lock { position: absolute; right: -2px; bottom: -2px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); border: 1px solid var(--line); }
.cc-lock .ico { width: 12px; height: 12px; }
.cc-locked { font-size: 9px; line-height: 1.2; text-align: center; color: var(--crit); }
.ach-unlock { font-size: 12px; color: var(--crit); }
.ach-unlock .ico { width: 10px; height: 10px; }

/* --- bug bounty, the vendor, walking back (2026-11-15) */
.bounty { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; font: 700 14px var(--mono); color: var(--crit); white-space: nowrap; }
.bounty .ico { width: 15px; height: 15px; }
.reward.dear { opacity: 0.55; }
.price { margin-left: auto; font: 700 13px var(--mono); color: var(--crit); }
.shop-services { display: flex; gap: 8px; margin: 10px 0; }
.shop-services button { flex: 1; font-size: 13px; }
.shop-services .ico { width: 14px; height: 14px; vertical-align: -2px; }
.door-cleared { opacity: 0.8; }
.door-cleared .door-ico { color: var(--good); }
.door-shop .door-ico { color: var(--crit); }
.fnode.t-shop .ico { color: var(--crit); }
