* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0d1c; color: #f4f0e0;
  font-family: "Lucida Console", "Courier New", monospace; font-size: 14px; user-select: none; }
#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; image-rendering: pixelated; touch-action: none; }
#labels, #pops, #ui { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.layer { position: absolute; inset: 0; pointer-events: none; }
.layer > * { pointer-events: auto; }

.panel { background: linear-gradient(#1b2350ee, #0e1230ee); border: 3px solid #d8c070; border-radius: 6px;
  box-shadow: 0 0 0 2px #000, 4px 4px 0 #0008; padding: 10px 12px; text-shadow: 1px 1px 0 #000; }
h1, h2, h3 { margin: 0 0 8px; font-weight: bold; letter-spacing: 1px; }
h2 { font-size: 18px; color: #ffe08a; }
h3 { font-size: 14px; color: #ffe08a; }
p { margin: 4px 0; line-height: 1.45; }
.dim { color: #a8acc8; }
.bad { color: #ff8a7a; }
.good { color: #9fe89a; }
.gold { color: #ffd860; }

button { font: inherit; color: #f4f0e0; background: #2a3470; border: 2px solid #d8c070; border-radius: 4px;
  padding: 6px 10px; cursor: pointer; text-shadow: 1px 1px 0 #000; text-align: left; }
button:hover:not(:disabled) { background: #4a58b0; border-color: #fff0b0; }
button:disabled { opacity: 0.45; cursor: default; }
button.big { font-size: 16px; padding: 10px 18px; text-align: center; }
button.sel { background: #7a5a18; border-color: #fff0b0; }
.col { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

.bar { display: inline-block; width: 70px; height: 8px; background: #000a; border: 1px solid #000; vertical-align: middle; }
.bar i { display: block; height: 100%; }
.bar.hp i { background: #58d058; } .bar.mp i { background: #58a0f0; } .bar.xp i { background: #e0c040; }
.bar.doom { width: 220px; height: 12px; } .bar.doom i { background: linear-gradient(90deg, #a030c0, #ff3030); }
.bar.foe i { background: #e05050; }

/* lobby */
.layer-lobby, .layer-intro, .layer-over { display: flex; align-items: center; justify-content: center; background: #05061299; }
.layer-lobby.clear { background: none; }
.menu { width: min(760px, 94vw); max-height: 94vh; overflow: auto; }
.title { text-align: center; }
.title h1 { font-size: clamp(34px, 7vw, 68px); color: #ffe08a; text-shadow: 4px 4px 0 #6a1818, 6px 6px 0 #000; margin-bottom: 4px; }
.title h1 span { color: #ff6a5a; }
.title .sub { color: #dfe4ff; margin-bottom: 22px; font-size: 16px; text-shadow: 2px 2px 0 #000; }
.title .col { width: 300px; margin: 0 auto; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 12px; }
.cards button { display: block; height: 100%; }
.cards b { display: block; color: #ffe08a; font-size: 15px; margin-bottom: 4px; }
.cards small { display: block; color: #cfd3ee; line-height: 1.35; font-size: 12px; }
.code { font-size: 44px; letter-spacing: 10px; color: #ffe08a; text-align: center; margin: 10px 0; user-select: text; }
input.codein { font: inherit; font-size: 28px; letter-spacing: 8px; width: 220px; text-align: center; text-transform: uppercase;
  background: #0a0c20; color: #ffe08a; border: 2px solid #d8c070; border-radius: 4px; padding: 6px; }
.story p { font-size: 15px; margin: 8px 0; }
@media (max-width: 640px) { .cards { grid-template-columns: 1fr; } }

/* hud */
.tl { position: absolute; left: 10px; top: 10px; }
.tr { position: absolute; right: 10px; top: 10px; text-align: right; }
.tc { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); text-align: center; white-space: nowrap; }
.bl { position: absolute; left: 10px; bottom: 10px; max-width: 46vw; }
.bc { position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); text-align: center; white-space: nowrap; }
.br { position: absolute; right: 10px; bottom: 10px; }
.side { position: absolute; right: 10px; top: 118px; width: 290px; }
.log p { margin: 2px 0; font-size: 12px; color: #dfe4ff; }
.unit { display: grid; grid-template-columns: 120px auto; gap: 2px 8px; align-items: center; padding: 2px 4px; border: 1px solid transparent; border-radius: 3px; }
.unit.act { border-color: #ffe040; background: #ffe04022; }
.unit.dead { opacity: 0.4; }
.unit.pickable { cursor: pointer; border-color: #fff; background: #ffffff22; }
.unit.pickable:hover { background: #ffffff55; }
.unit small { color: #cfd3ee; }
.st { color: #ffb060; font-size: 11px; }
.hint { font-size: 11px; color: #cfd3ee; margin-top: 6px; }
.prompt button { font-size: 16px; padding: 8px 16px; }
.modal { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(430px, 92vw); }
.modal button { width: 100%; }

/* battle */
.btop { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); min-width: 320px; text-align: center; }
.bbot { position: absolute; left: 10px; right: 10px; bottom: 10px; min-height: 136px; display: grid; grid-template-columns: 1.1fr 1fr 1.1fr; gap: 8px; }
.cmds { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.cmds button small { color: #9fc8ff; float: right; }
.toast { position: absolute; left: 50%; top: 24%; transform: translateX(-50%); font-size: 17px; text-align: center; max-width: 80vw; }

/* world labels and damage numbers */
.lbl { position: absolute; transform: translate(-50%, -100%); font-size: 11px; padding: 1px 5px; white-space: nowrap;
  background: #000a; border: 1px solid #fff6; border-radius: 3px; text-shadow: 1px 1px 0 #000; }
.lbl.vil { border-color: #ff5a5a; color: #ffb0a0; } .lbl.hero { border-color: #6aa0ff; color: #b8d4ff; }
.lbl.me { border-color: #ffe040; color: #ffe040; } .lbl.warn { border-color: #ff9a30; color: #ffc880; }
.pop { position: absolute; transform: translate(-50%, -50%); font-size: 26px; font-weight: bold; text-shadow: 2px 2px 0 #000, -1px -1px 0 #000;
  animation: rise 0.95s ease-out forwards; }
.pop.dmg { color: #ff5a4a; } .pop.heal { color: #7af07a; } .pop.mp { color: #7ab8ff; font-size: 18px; } .pop.stat { color: #ffc050; font-size: 15px; }
@keyframes rise { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -60px; } }

.snd { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); }
.snd button { font-size: 11px; padding: 3px 7px; opacity: 0.8; }

/* speech bubbles, the hero's map, region names */
.lbl.bub { background: #fffdf0; color: #1a1a2a; border: 2px solid #1a1a2a; border-radius: 10px; padding: 3px 9px; font-size: 13px; text-shadow: none;
  width: max-content; max-width: 240px; white-space: normal; text-align: center; margin-top: -8px; z-index: 5; }
.lbl.bub::after { content: ''; position: absolute; left: 50%; bottom: -8px; margin-left: -6px; border: 6px solid transparent; border-top-color: #1a1a2a; border-bottom: 0; }
#mini { position: fixed; right: 10px; bottom: 52px; width: 176px; height: 176px; border: 3px solid #d8c070; border-radius: 6px; box-shadow: 0 0 0 2px #000;
  image-rendering: pixelated; pointer-events: none; }
#mini.big { right: auto; bottom: auto; left: 50%; top: 50%; width: min(82vh, 82vw); height: min(82vh, 82vw); transform: translate(-50%, -50%); }
.region { position: absolute; left: 50%; top: 17%; transform: translateX(-50%); font-size: 26px; color: #ffe08a; letter-spacing: 3px; white-space: nowrap;
  text-shadow: 3px 3px 0 #000; pointer-events: none; animation: regionin 0.7s ease-out; }
@keyframes regionin { from { opacity: 0; letter-spacing: 9px; } to { opacity: 1; letter-spacing: 3px; } }
