@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800;900&family=DM+Sans:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  color-scheme: dark;
  --bg: #151713;
  --edge: #535d42;
  --cream: #eee9d5;
  --muted: #a1aa91;
  --lime: #c2eb72;
  --mono: 'Space Mono', monospace;
  --display: 'Barlow Condensed', Impact, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { background: var(--bg); color: var(--cream); font: 14px 'DM Sans', sans-serif; }
button, input { font: inherit; -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }
main, .game-shell, .viewport { position: absolute; inset: 0; }
.game-shell { isolation: isolate; }
.viewport { overflow: hidden; }
#game {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  outline: none;
}
.screen-vignette { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 70px #0005; }

/* The HUD floats over the game instead of reserving space around it. */
.game-top, .game-bottom {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 18px 24px;
  pointer-events: none;
  text-shadow: 0 2px 3px #000;
}
.game-top {
  display: grid;
  grid-template-columns: minmax(205px, 250px) minmax(0, 1fr);
  grid-template-areas: "health location" "health stats" "alarm alarm";
  gap: 4px 24px;
  align-items: start;
  top: 0;
  padding-top: max(18px, env(safe-area-inset-top));
  padding-right: 174px;
  background: linear-gradient(#10140ee0, transparent);
}
.game-bottom {
  bottom: 0;
  padding-bottom: max(18px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, #10140ef0);
}
.location { grid-area: location; display: flex; align-items: center; gap: 10px; }
.floor-tag { color: var(--lime); font: 700 20px var(--mono); }
.small-label { display: block; margin-bottom: 4px; color: var(--muted); font: 8px var(--mono); letter-spacing: 1px; }
.location strong { font-size: 14px; font-weight: 600; }
.run-stats { grid-area: stats; display: flex; align-items: center; gap: 20px; font: 13px var(--mono); }
.run-stats > div { display: flex; align-items: center; gap: 7px; }
.stat-icon { color: #e6c575; font-size: 20px; }
.stat-icon.beer { color: #d7a853; }
.stat-label { color: var(--muted); font-size: 8px; }
.player-hud { grid-area: health; display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
#portrait { flex: 0 0 auto; width: 32px; height: 32px; image-rendering: pixelated; }
.player-name { font: 700 10px var(--mono); letter-spacing: .7px; }
.player-name span { margin-left: 8px; color: var(--muted); font: 8px var(--mono); }
.health-readout { min-width: 0; }
.health-details { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 5px; }
.hearts { display: flex; flex-wrap: wrap; gap: 3px; max-width: 174px; }
.heart-icon { display: block; width: 26px; height: 23px; image-rendering: pixelated; filter: drop-shadow(0 2px 1px #000b); }
.heart-pieces { display: flex; align-items: center; gap: 4px; color: #f0ce88; font: 10px var(--mono); white-space: nowrap; }
.heart-pieces .heart-icon { width: 19px; height: 17px; }
.alarm { grid-area: alarm; margin-top: 4px; color: #b4c59b; font: 9px var(--mono); letter-spacing: .8px; }
.alarm.active { color: #ffb075; }
.equipment { display: flex; gap: 10px; }
.equip-slot {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 140px;
  height: 48px;
  padding: 6px 10px;
  border: 1px solid #69764a70;
  background: #182013b8;
}
.equip-slot kbd { position: absolute; top: -7px; right: 4px; background: #182013; padding: 1px 4px; font-size: 7px; }
.equip-slot strong { font-size: 11px; font-weight: 500; }
.equip-slot .small-label { font-size: 7px; }
.item-icon { width: 26px; color: #b6b697; font-size: 27px; text-align: center; }
.objective { margin-left: auto; min-width: 210px; }
.objective strong { font-size: 11px; font-weight: 500; }
.progress-track { height: 3px; margin-top: 8px; background: #39412c; }
.progress-track i { display: block; width: 0; height: 100%; background: var(--lime); transition: width .2s; }
.game-tools {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
  z-index: 5;
  display: flex;
  gap: 8px;
}
.icon-button { height: 34px; min-width: 34px; padding: 6px 10px; border: 1px solid #75865460; background: #151c12cc; color: var(--lime); }
.icon-button span { color: var(--muted); font: 9px var(--mono); }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 76px 24px;
  background: #0c120bbd;
}
.menu-card { width: min(100%, 430px); margin: auto 0; text-align: center; }
.menu-card h2 { margin: 0 0 20px; font: 800 clamp(48px, 7vw, 86px)/.95 var(--display); letter-spacing: .2px; }
.menu-card h2 em { color: var(--lime); font-style: normal; }
.menu-card p { color: #bdc5ad; font-size: 12px; line-height: 1.7; }
.menu-actions { display: flex; justify-content: center; gap: 9px; margin-top: 26px; }
.primary { display: flex; align-items: center; justify-content: center; gap: 25px; padding: 15px 18px; border: 0; background: var(--lime); color: #1b2410; box-shadow: 0 3px 0 #719246; font: 700 10px var(--mono); white-space: nowrap; }
.primary:hover { background: #d4fc8c; }
.primary span { font-size: 17px; }
.party-picker { display: flex; align-items: center; gap: 9px; border: 1px solid #515d3f; background: #20271ad9; }
.party-picker button { padding: 12px 9px; border: 0; background: none; color: var(--lime); }
.party-picker > span { font: 8px var(--mono); white-space: nowrap; }
.party-picker b { font-size: 13px; }
.text-button { padding: 0; border: 0; background: none; color: #bac8a0; font: 10px var(--mono); }
#online-toggle { margin-top: 22px; padding-bottom: 4px; border-bottom: 1px solid #687b444d; }
.online-panel { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.online-panel form { display: flex; gap: 8px; }
.online-panel input { width: 87px; padding: 8px; border: 1px solid #52613c; background: #171b13; color: var(--lime); font: 12px var(--mono); text-transform: uppercase; }
.secondary { padding: 8px; border: 1px solid #65754b; background: #29351e; font: 9px var(--mono); }
.online-panel p { flex-basis: 100%; margin: 0; font: 9px/1.7 var(--mono); }
kbd { padding: 4px 6px; border: 1px solid #4a503f; border-bottom-width: 2px; border-radius: 3px; color: #c3c9b3; font: 8px var(--mono); white-space: nowrap; }
.toast { position: absolute; left: 50%; bottom: 100px; z-index: 4; max-width: calc(100% - 32px); transform: translateX(-50%); padding: 10px 18px; border: 1px solid #9aab6070; background: #182012ed; color: #dae9ad; font: 10px/1.6 var(--mono); text-align: center; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.visible { opacity: 1; }
.eyebrow { color: var(--lime); font: 10px var(--mono); letter-spacing: 1.7px; }
dialog { width: calc(100% - 30px); max-width: 690px; max-height: calc(100dvh - 30px); overflow: auto; padding: 30px; border: 1px solid #596840; background: #1d2418; color: var(--cream); line-height: 1.7; }
dialog::backdrop { background: #050805c9; }
dialog h2 { font: 700 34px var(--display); }
dialog p { color: #b6c0a4; font-size: 12px; }
dialog table { width: 100%; border-collapse: collapse; font-size: 11px; }
td, th { padding: 9px 6px; border-bottom: 1px solid #3b482e; text-align: left; }
.dialog-close { float: right; border: 0; background: none; font-size: 25px; }

@media (max-width: 800px) {
  .game-top, .game-bottom { gap: 14px; padding-left: 12px; padding-right: 12px; }
  .game-top { padding-right: 156px; }
  .game-tools { right: 12px; gap: 6px; }
  .stat-label, .location .small-label { display: none; }
  .run-stats { gap: 12px; }
  .location strong { font-size: 11px; }
  .equipment { gap: 6px; }
  .equip-slot { min-width: 110px; padding: 6px; }
  .objective { min-width: 165px; }
  .objective strong { font-size: 10px; }
}
@media (max-width: 600px) {
  .game-top { grid-template-columns: minmax(0, 1fr); grid-template-areas: "health" "location" "stats" "alarm"; gap: 5px; padding-top: 14px; }
  .alarm { font-size: 7px; }
  .hearts { max-width: 147px; }
  .heart-icon { width: 22px; height: 20px; }
  .location { gap: 7px; }
  .floor-tag { font-size: 16px; }
  .run-stats { font-size: 11px; }
  .stat-icon { font-size: 16px; }
  .game-bottom { flex-wrap: wrap; gap: 12px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .player-hud { gap: 4px; }
  #portrait { width: 32px; height: 32px; }
  .player-name { font-size: 9px; }
  .player-name span { margin-left: 3px; }
  .equipment { flex: 1; }
  .equip-slot { min-width: 0; height: 43px; flex: 1; gap: 4px; }
  .equip-slot strong { font-size: 9px; }
  .item-icon { width: 18px; font-size: 20px; }
  .objective { display: flex; align-items: center; gap: 12px; width: 100%; margin: 0; }
  .objective .small-label { display: none; }
  .progress-track { flex: 1; margin: 0; }
  .overlay { padding: 76px 18px 120px; }
  .menu-card h2 { font-size: 58px; }
  .menu-actions { gap: 8px; }
  .primary { gap: 10px; padding: 13px 12px; font-size: 9px; }
  .party-picker { gap: 2px; }
  .party-picker button { padding: 12px 7px; }
  .toast { bottom: 113px; font-size: 9px; }
  dialog { padding: 20px; }
}
@media (max-height: 500px) and (min-width: 601px) {
  .game-top, .game-bottom { padding-top: 10px; padding-bottom: 10px; }
  .game-tools { top: 10px; }
  .overlay { padding: 65px 18px 85px; }
  .menu-card h2 { font-size: 40px; margin-bottom: 10px; }
  .menu-card p { margin: 8px 0; }
  .menu-actions { margin-top: 12px; }
  #online-toggle { margin-top: 12px; }
}
