/* Depths Live web demo. Colours are the game's GBC palette (DepthsLive/Art/Sprites.swift). */
@font-face { font-family: "Arcade"; src: url("fonts/PressStart2P-Regular.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "Jersey"; src: url("fonts/Jersey10-Regular.ttf") format("truetype"); font-display: block; }

:root {
  --ink: #181830; --navy: #283868; --slate: #687898; --grey: #b0b8c8; --ice: #d0e0f0;
  --white: #f8f8e8; --cream: #f8e8b8; --red: #e03838; --dark-red: #981830; --magenta: #d84090;
  --orange: #f89030; --rust: #c05820; --yellow: #f8d838; --ochre: #d8a020; --lime: #a8e048;
  --green: #40b048; --dark-green: #206838; --aqua: #58d8c8; --teal: #189088; --dark-teal: #105860;
  --sky: #68b8f8; --blue: #3070d8; --plum: #582870; --violet: #7848c0; --mauve: #9060a0;
  --u: 2px; /* one interface pixel */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--white); color: var(--ink); overflow: hidden; overscroll-behavior: none; }
body { font-family: "Jersey", system-ui, sans-serif; font-size: 19px; line-height: 1.05; -webkit-font-smoothing: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; }
.hidden { display: none !important; }

#app { position: relative; height: 100%; height: 100dvh; max-width: 520px; margin: 0 auto; background: var(--white);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 6px; padding: 4px 6px 6px;
  padding-top: max(4px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }

/* Sprites from the atlas: game.js sets the background. */
[data-spr], .spr { display: inline-block; flex: none; image-rendering: pixelated; image-rendering: crisp-edges; background-repeat: no-repeat; vertical-align: middle; font-style: normal; }

/* Panels, tags, chips, buttons */
.panel { background: var(--cream); border: var(--u) solid var(--ink); box-shadow: inset 0 0 0 var(--u) var(--teal); padding: 8px; }
.tag { font-family: "Arcade"; font-size: 8px; line-height: 16px; height: 16px; padding: 0 6px; color: var(--white); background: var(--navy); white-space: nowrap; border: 0; }
.tag.teal { background: var(--teal); } .tag.plum { background: var(--plum); cursor: pointer; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.tag.magenta { background: var(--magenta); }
.chip { display: inline-flex; align-items: center; gap: 3px; font-family: "Arcade"; font-size: 8px; white-space: nowrap; }
.chip b, .hp b, .xp b { font-weight: normal; }
.chip.gold b { color: var(--rust); } .chip.plum-t b { color: var(--plum); }
.grow { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 44px; padding: 4px 8px;
  font-family: "Arcade"; font-size: 8px; background: var(--white); border: var(--u) solid var(--ink);
  box-shadow: inset calc(-1 * var(--u)) calc(-1 * var(--u)) 0 var(--grey); cursor: pointer; position: relative; touch-action: manipulation; }
.btn:active:not(:disabled) { transform: translate(var(--u), var(--u)); box-shadow: none; }
.btn:disabled { color: var(--slate); background: var(--ice); cursor: default; }
.btn.go { background: var(--green); color: var(--white); }
.btn.hot { background: var(--yellow); }
.btn.danger { background: var(--red); color: var(--white); }
.btn.big { font-size: 16px; padding: 12px 20px; }
.btn.small { min-height: 32px; padding: 2px 8px; }
.btn.wide { width: 100%; }
.badge { position: absolute; top: -6px; right: -4px; font-style: normal; font-family: "Arcade"; font-size: 8px; line-height: 14px; padding: 0 4px; background: var(--green); color: var(--white); border: var(--u) solid var(--ink); }
.badge.red { background: var(--red); }

/* Title */
#title { justify-content: center; align-items: center; text-align: center; background: var(--white); }
.title-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; max-width: 420px; }
.tagline { font-size: 21px; margin: 0; color: var(--navy); }
.demo-note { font-family: "Arcade"; font-size: 8px; color: var(--plum); margin: 0; }
.how { font-size: 16px; color: var(--slate); margin: 0; }
.credit { font-family: "Arcade"; font-size: 8px; color: var(--slate); margin: 6px 0 0; }
#loading { font-family: "Arcade"; font-size: 8px; color: var(--teal); min-height: 44px; display: flex; align-items: center; }
#start { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

/* HUD */
#hud { display: flex; flex-direction: column; gap: 5px; padding: 7px 9px; flex: none; }
#hud .row { display: flex; align-items: center; gap: 7px; min-height: 16px; }
.hp, .xp, .air { display: flex; align-items: center; gap: 4px; font-family: "Arcade"; font-size: 8px; }
.hp { flex: 1; min-width: 0; }
.xp { flex: 1.4; min-width: 0; } .air { flex: 1; min-width: 0; }
.xp .lbl { color: var(--teal); } .xp b { color: var(--slate); }
.bar { flex: 1; min-width: 30px; height: 10px; background: var(--navy); border: var(--u) solid var(--ink); position: relative; }
.bar.thin { height: 8px; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); width: 100%; }
#xp-fill { background: var(--yellow); } #air-fill { background: var(--aqua); }
#twist-text { margin: 0; font-size: 15px; color: var(--navy); }

/* Map */
#mapwrap { position: relative; flex: 1; min-height: 120px; border: var(--u) solid var(--ink); background: var(--ink); overflow: hidden; touch-action: none; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; image-rendering: pixelated; }
.corner { position: absolute; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: transparent; border: 0; padding: 0; cursor: pointer; }
.corner i { background-color: var(--white); outline: var(--u) solid var(--ink); }
.corner.tl { top: 2px; left: 2px; } .corner.tr { top: 2px; right: 2px; }
#minimap { position: absolute; right: 8px; top: 48px; border: var(--u) solid var(--ink); background: var(--ink); image-rendering: pixelated; max-width: calc(100% - 16px); }
#map-bottom { position: absolute; left: 50px; right: 50px; bottom: 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
#room-hint, #notice { background: var(--navy); color: var(--white); border: var(--u) solid var(--ink); padding: 3px 8px; font-size: 15px; text-align: center; }
#room-hint b, #notice b { font-family: "Arcade"; font-size: 8px; color: var(--yellow); font-weight: normal; display: block; margin-bottom: 2px; }
#quests { position: absolute; left: 6px; bottom: 6px; display: flex; flex-direction: column; gap: 3px; pointer-events: none; max-width: 45%; }
#quests div { background: var(--cream); border: var(--u) solid var(--ink); padding: 2px 5px; font-size: 14px; }
#quests b { font-family: "Arcade"; font-size: 8px; font-weight: normal; color: var(--plum); display: block; }
#aim-banner { position: absolute; top: 6px; left: 52px; right: 52px; display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: var(--dark-teal); color: var(--white); border: var(--u) solid var(--ink); padding: 3px 6px; font-family: "Arcade"; font-size: 8px; }

/* Log */
#log { flex: none; padding: 5px 8px; height: calc(3 * 19px + 12px); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; cursor: pointer; font-size: 18px; }
#log p { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-host { color: var(--plum); } .t-good { color: var(--dark-green); } .t-bad { color: var(--dark-red); }
.t-info { color: var(--navy); } .t-loot { color: var(--rust); }

/* Belt, abilities, actions */
#belt, #abilities { flex: none; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; min-height: 44px; }
#belt:empty::before { content: "BELT EMPTY"; font-family: "Arcade"; font-size: 8px; color: var(--slate); align-self: center; padding-left: 4px; }
.slot { min-width: 52px; min-height: 44px; padding: 2px 6px; display: inline-flex; align-items: center; gap: 4px; background: var(--white);
  border: var(--u) solid var(--ink); font-family: "Arcade"; font-size: 8px; cursor: pointer; flex: none; touch-action: manipulation; }
.slot:disabled { background: var(--ice); color: var(--slate); }
.slot .cost { color: var(--teal); }
#actions { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
#actions .btn { flex-direction: column; gap: 2px; padding: 2px; }
#btn-descend.ready { background: var(--green); color: var(--white); animation: blink 1s steps(1) infinite; }

/* Overlay sheets */
#overlay { position: absolute; inset: 0; background: rgba(24, 24, 48, 0.62); display: flex; align-items: center; justify-content: center; padding: 10px; z-index: 10; }
#sheet { width: 100%; max-height: 100%; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; -webkit-overflow-scrolling: touch; }
#sheet h2 { font-family: "Arcade"; font-size: 16px; font-weight: normal; margin: 0; text-align: center; color: var(--ink); }
#sheet h3 { font-family: "Arcade"; font-size: 8px; font-weight: normal; margin: 6px 0 0; color: var(--teal); }
#sheet p { margin: 0; }
.card { display: flex; align-items: center; gap: 8px; background: var(--white); border: var(--u) solid var(--ink); padding: 6px; text-align: left; width: 100%; }
button.card { cursor: pointer; }
button.card:active { background: var(--ice); }
.card .txt { flex: 1; min-width: 0; }
.card .name { font-family: "Arcade"; font-size: 8px; line-height: 1.5; display: block; }
.card .sub { font-size: 16px; color: var(--navy); display: block; }
.card .warn { font-size: 15px; color: var(--dark-red); display: block; }
.card.sold { opacity: 0.5; }
.card .btns { display: flex; flex-direction: column; gap: 4px; }
.r-nameBrand .name { color: var(--green); } .r-premium .name { color: var(--teal); } .r-limited .name { color: var(--magenta); } .r-discontinued .name { color: var(--ochre); }
.upg { font-family: "Arcade"; font-size: 8px; color: var(--white); background: var(--green); padding: 1px 3px; }
.speaker { display: flex; align-items: center; gap: 10px; }
.speaker .name { display: block; font-family: "Arcade"; font-size: 8px; color: var(--plum); }
.lines p { font-size: 19px; margin-bottom: 6px !important; }
.row-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.row-btns .btn { flex: 1; }
.sheet-log p { font-size: 17px; margin: 0 0 4px !important; }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-family: "Arcade"; font-size: 8px; }
.stats span:nth-child(even) { text-align: right; }
.end-title { font-family: "Arcade"; font-size: 16px; text-align: center; line-height: 1.4; }
.end-title.win { color: var(--teal); } .end-title.lose { color: var(--dark-red); }
.cta { display: flex; flex-direction: column; gap: 6px; }
.cta a.btn { text-decoration: none; color: var(--ink); }
.cta .note { font-size: 15px; color: var(--slate); text-align: center; }
.purse { font-family: "Arcade"; font-size: 8px; color: var(--rust); text-align: center; }

/* Ending cutscene */
#cutscene { position: absolute; inset: 0; z-index: 20; background: var(--ink); color: var(--white); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; cursor: pointer; }
#cutscene .who { font-family: "Arcade"; font-size: 8px; color: var(--yellow); min-height: 8px; }
#cutscene .what { font-size: 22px; max-width: 420px; }
#cutscene .next { font-family: "Arcade"; font-size: 8px; color: var(--grey); animation: blink 1s steps(1) infinite; }
