/* Dungeon Dive — torchlit stone */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; overflow: hidden;
  background: #05060f;
  color: #efe6d8;
  font-family: "Segoe UI", system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#gameCanvas {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none;
}

/* ── HUD ─────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-variant-numeric: tabular-nums; }
.hud-top {
  position: absolute; top: calc(10px + env(safe-area-inset-top));
  left: calc(10px + env(safe-area-inset-left)); right: calc(10px + env(safe-area-inset-right));
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
}
.hud-panel {
  background: rgba(12, 10, 18, .72); border: 1px solid rgba(255, 160, 90, .22);
  border-radius: 12px; padding: 6px 12px; min-width: 96px;
  backdrop-filter: blur(6px);
}
.hud-center { text-align: center; }
.hud-right { text-align: center; padding: 6px; min-width: 0; }
.hud-row { display: flex; align-items: center; gap: 8px; }
.hud-counters { margin-top: 4px; font-size: 13px; color: #f0d9a8; gap: 12px; }
.hud-gold { color: #ffd166; }
.hud-keys { color: #cbd5e1; }
.hud-ammo { color: #ffb08a; letter-spacing: 2px; font-size: 12px; }
.hud-ammo.reloading { color: #8b8fa3; }
.hud-ability { color: #8b8fa3; font-size: 12px; letter-spacing: .06em; }
.hud-ability.ready { color: #fff1b8; text-shadow: 0 0 8px rgba(255, 241, 184, .7); }
.hearts { display: flex; gap: 2px; flex-wrap: wrap; max-width: 260px; }
.hearts canvas { width: 18px; height: 16px; image-rendering: pixelated; }
.class-icon { width: 22px; height: 22px; border-radius: 50%; display: inline-block;
  box-shadow: 0 0 10px currentColor; background: currentColor; }
.tr-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #b58a5c; }
.tr-value { font-size: 22px; font-weight: 800; color: #ffb060; line-height: 1.1;
  text-shadow: 0 0 12px rgba(255, 176, 96, .5); }
.tr-sub { font-size: 11px; color: #cfb28a; }
#minimap { display: block; width: 96px; height: 96px; image-rendering: pixelated; }

/* Eight chips is ~700 px in one row: unwrapped and centred it bled off both
   edges of a phone, and the second row has to clear the gear button. */
.hud-party { position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(84px + env(safe-area-inset-top)); display: flex; gap: 6px;
  flex-wrap: wrap; justify-content: center;
  max-width: min(92vw, 760px); pointer-events: none; }
.party-chip { background: rgba(12, 10, 18, .7); border: 1px solid rgba(255,160,90,.2);
  border-radius: 8px; padding: 3px 8px; font-size: 11px; color: #e6d7c0;
  max-width: 108px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.party-chip.me { box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.party-chip .bar { height: 4px; background: #2a1c1c; border-radius: 2px; margin-top: 3px; overflow: hidden; }
.party-chip .bar > i { display: block; height: 100%; background: #ff5c7a; }
.party-chip.down { color: #ff8a8a; }

.item-banner {
  position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%);
  background: rgba(20, 14, 10, .85); border: 1px solid rgba(255, 190, 110, .45);
  border-radius: 12px; padding: 8px 18px; text-align: center; min-width: 220px;
  box-shadow: 0 0 30px rgba(255, 150, 60, .25);
  animation: banner-in .25s ease-out;
}
.item-banner b { display: block; color: #ffd166; font-size: 16px; letter-spacing: .06em; }
.item-banner span { color: #e8d4b8; font-size: 12.5px; }
@keyframes banner-in { from { opacity: 0; transform: translateX(-50%) translateY(12px); } to { opacity: 1; transform: translateX(-50%); } }
.hud-toast {
  position: absolute; left: 50%; bottom: 30%; transform: translateX(-50%);
  color: #ff9a8a; font-weight: 700; font-size: 14px; letter-spacing: .06em;
  text-shadow: 0 2px 8px #000;
}
.boss-bar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(60px + env(safe-area-inset-bottom)); width: min(520px, 80vw); }
.boss-name { text-align: center; font-size: 12px; letter-spacing: .2em; color: #ffb3a3; margin-bottom: 4px; }
.boss-track { height: 10px; background: #1a0d0d; border: 1px solid #6b2f2f; border-radius: 6px; overflow: hidden; }
#bossFill { height: 100%; width: 100%; background: linear-gradient(90deg, #ff3c5a, #ff9a3c); }

.floor-card {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
  animation: card-fade 1.1s ease-out forwards;
}
.floor-num { font-size: clamp(34px, 8vw, 64px); font-weight: 900; letter-spacing: .2em; color: #ffd8a8;
  text-shadow: 0 0 30px rgba(255, 160, 80, .7), 0 2px 0 #000; }
.floor-theme { font-size: clamp(14px, 3vw, 20px); letter-spacing: .3em; color: #d9b98a; text-transform: uppercase; }
@keyframes card-fade { 0% { opacity: 0; transform: scale(.9); } 15% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* gear panel with the audio strip */
.hud-gear { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  pointer-events: auto; z-index: 6; }
@media (max-width: 899px) {
  .hud-gear { top: calc(92px + env(safe-area-inset-top)); }
  /* Below the gear and hard against the left edge: a wrapped eight-chip bar
     is three rows tall on a phone and would otherwise sit on top of it. */
  .hud-party { left: 6px; transform: none; justify-content: flex-start;
    max-width: calc(100vw - 12px);
    top: calc(126px + env(safe-area-inset-top)); }
}
.hud-gear summary { list-style: none; cursor: pointer; width: 30px; height: 30px; border-radius: 50%;
  background: rgba(12, 10, 18, .7); border: 1px solid rgba(255,160,90,.25); color: #e6d7c0;
  display: flex; align-items: center; justify-content: center; font-size: 15px; margin: 0 auto; }
.hud-gear summary::-webkit-details-marker { display: none; }
.hud-gear[open] summary { background: rgba(255,160,90,.35); }
#hudAudio { margin-top: 6px; background: rgba(12, 10, 18, .85); border: 1px solid rgba(255,160,90,.25);
  border-radius: 12px; padding: 4px 10px; }
@media (min-width: 900px) and (orientation: landscape) {
  .hud-gear { top: auto; bottom: calc(6px + env(safe-area-inset-bottom)); }
  .hud-gear summary { display: none; }
  #hudAudio { margin-top: 0; }
}

/* touch layer: floating twin sticks + buttons */
#touchLayer { position: absolute; inset: 0; pointer-events: none; }
.stick { position: absolute; width: 112px; height: 112px; margin: -56px 0 0 -56px; display: none; pointer-events: none; }
.stick-base { position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255, 200, 140, .35);
  background: rgba(30, 22, 18, .35); }
.stick-knob { position: absolute; width: 52px; height: 52px; left: 30px; top: 30px; border-radius: 50%;
  background: rgba(255, 200, 140, .6); box-shadow: 0 0 14px rgba(255, 170, 90, .5); }
.touch-buttons { position: absolute; right: calc(16px + env(safe-area-inset-right)); bottom: calc(24px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: 64px 64px; grid-auto-rows: 64px; gap: 12px; pointer-events: auto; align-items: end; justify-items: end; }
.tbtn { width: 64px; height: 64px; border-radius: 50%; border: 1px solid rgba(255,200,140,.5);
  background: rgba(30, 22, 18, .55); color: #ffe7c8; font-weight: 800; font-size: 11px; letter-spacing: .06em;
  touch-action: manipulation; backdrop-filter: blur(3px); }
.tbtn:active { background: rgba(255, 170, 90, .5); }
.tbtn-dodge { width: 76px; height: 76px; font-size: 12px; border-color: #ffb347; color: #ffe0a3;
  box-shadow: 0 0 18px rgba(255, 170, 70, .35); }
.tbtn-use { border-color: #7dff7a; color: #d6ffd4; }
/* Left of the button grid, clear of it: 152px is DODGE (76) + gap (12) +
   ITEM (64), the width of the widest row. */
.tbtn-revive { position: absolute; pointer-events: auto;
  right: calc(16px + 152px + 14px + env(safe-area-inset-right));
  bottom: calc(30px + env(safe-area-inset-bottom));
  width: 76px; height: 76px; font-size: 11px;
  border-color: #7dff7a; color: #d6ffd4;
  box-shadow: 0 0 20px rgba(125, 255, 122, .45);
  animation: revive-pulse 1.1s ease-in-out infinite; }
@keyframes revive-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(125, 255, 122, .3); }
  50%      { box-shadow: 0 0 26px rgba(125, 255, 122, .65); }
}

/* ── overlays / lobby card ───────────────────────────────────────── */
#lobbyOverlay {
  position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; z-index: 10; overflow-y: auto;
  background: radial-gradient(1200px 700px at 50% 30%, rgba(90, 40, 20, .45) 0%, rgba(5, 6, 15, .88) 70%);
}
.card {
  width: min(480px, 94vw); padding: 22px 22px 14px;
  background: rgba(18, 12, 12, .9); border: 1px solid rgba(255, 160, 90, .25);
  border-radius: 18px; box-shadow: 0 12px 48px rgba(0, 0, 0, .6),
    inset 0 1px 0 rgba(255, 255, 255, .06);
  text-align: center; backdrop-filter: blur(10px);
}
.ember-title {
  margin: 4px 0 6px; font-size: clamp(30px, 7vw, 44px); font-weight: 900;
  letter-spacing: .08em; color: #ffb060;
  text-shadow: 0 0 22px rgba(255, 150, 60, .55), 0 0 2px #fff;
}
.ember-title span { color: #ff5c7a; text-shadow: 0 0 22px rgba(255, 92, 122, .6), 0 0 2px #fff; margin-left: .25em; }
.tagline { margin: 0 0 14px; color: #d9b98a; font-size: 14px; }
.instructions { margin: 14px 0 4px; font-size: 12.5px; color: #b89a78; display: grid; gap: 4px; }
.muted { color: #9c8468; }

input#nameInput, #seedInput {
  width: 100%; padding: 11px 14px; border-radius: 10px; font-size: 15px;
  border: 1px solid #5a3a2a; background: #170f0d; color: #f4e6d2;
  outline: none; margin-bottom: 10px;
}
#seedInput { width: auto; flex: 1; margin: 0; padding: 6px 10px; font-size: 13px; }
.seg-btn { background: #3a2418; color: #ffd8a8; border: 1px solid #6b3f2a; border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer; }

button.primary {
  width: 100%; padding: 12px; border: 0; border-radius: 10px;
  font-size: 16px; font-weight: 800; letter-spacing: .04em;
  background: linear-gradient(180deg, #ffc57a, #e0702a); color: #1c0a04;
  cursor: pointer; box-shadow: 0 6px 22px rgba(255, 150, 60, .3);
}
button.primary:active { filter: brightness(.9); }

.squad-count { color: #ffb060; font-weight: 700; margin-bottom: 8px; }
.player-list { max-height: 232px; overflow-y: auto; margin-bottom: 10px; }
.player-row {
  padding: 4px 8px; border-radius: 8px; background: #221512;
  margin-bottom: 4px; font-size: 14px; display: flex; justify-content: space-between; align-items: center;
}
.player-row .pr-cls { font-size: 11px; color: #d9b98a; letter-spacing: .08em; text-transform: uppercase; }

.class-picker { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 8px 0; }
.class-card { background: #1d1310; border: 1px solid #4a2e22; border-radius: 10px; padding: 8px 4px 6px;
  color: #e8d4b8; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.class-card b { font-size: 12.5px; }
.class-card small { font-size: 9px; color: #b08a66; line-height: 1.2; }
.class-card .cc-icon { width: 40px; height: 40px; display: block; }
.class-card .cc-icon canvas { width: 40px; height: 40px; }
.class-card.on { border-color: #ffb060; background: #3a2416; box-shadow: 0 0 14px rgba(255, 176, 96, .3); }
@media (max-width: 520px) { .class-picker { grid-template-columns: repeat(3, 1fr); } }

.settings { text-align: left; margin: 6px 0 10px; padding: 8px 10px;
  background: #170f0d; border: 1px solid #3f2a20; border-radius: 10px; }
.settings-row { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.settings-label { width: 64px; font-size: 12px; color: #b58a5c; letter-spacing: .08em; text-transform: uppercase; }
.seg { display: flex; gap: 4px; flex-wrap: wrap; }
.seg button {
  background: #2a1a14; color: #e0c4a0; border: 1px solid #4a2e22;
  border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer;
}
.seg button.on { background: #ffb060; color: #1c0a04; border-color: #ffb060; font-weight: 700; }
.settings.locked .seg button, .settings.locked #seedInput, .settings.locked #seedBtn { opacity: .55; pointer-events: none; }
.settings.locked .seg button.on { opacity: 1; }
.mode-hint { margin: 4px 0 0; font-size: 12px; color: #b08a66; }

.briefing { text-align: left; margin: 10px 0; font-size: 13px; color: #d9b98a; }
.briefing ul { margin: 6px 0 0 18px; padding: 0; }

.leaderboard {
  text-align: left; margin-top: 12px; padding: 10px 12px;
  background: #170f0d; border-radius: 10px; border: 1px solid #3f2a20;
}
.lb-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.lb-tabs button { background: transparent; color: #9c8468; border: 0; padding: 2px 8px;
  font-size: 12.5px; cursor: pointer; border-radius: 6px; }
.lb-tabs button.on { color: #ffb060; background: rgba(255, 176, 96, .12); }
.lb-row { display: grid; grid-template-columns: 22px 1fr 60px 52px 56px; gap: 6px; font-size: 12.5px;
  padding: 2px 0; color: #e0c4a0; align-items: center; }
.lb-row.lb-head { color: #9c8468; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; }
.lb-rank { color: #9c8468; }
.lb-cls { font-size: 10px; color: #b08a66; text-transform: uppercase; letter-spacing: .06em; }
.lb-depth { color: #ffb060; font-weight: 700; }
.lb-num { text-align: right; }

.load-bar { height: 10px; border-radius: 6px; background: #170f0d; overflow: hidden; border: 1px solid #3f2a20; margin: 12px 0 6px; }
#loadBar { height: 100%; width: 0; background: linear-gradient(90deg, #ff9a3c, #ffd166); transition: width .15s; }
.peers { min-height: 16px; font-size: 12px; }

.countdown { font-size: 84px; font-weight: 900; color: #ffb060; text-shadow: 0 0 30px rgba(255, 150, 60, .6); }

.back-link { display: inline-block; margin-top: 12px; color: #9c8468; font-size: 13px; }
.spectator-flag {
  position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%); z-index: 9; padding: 4px 12px;
  background: rgba(12, 10, 18, .85); border: 1px solid #4a2e22;
  border-radius: 999px; font-size: 12px; letter-spacing: .1em; color: #e0c4a0;
}

/* audio strips */
.audio-controls {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  justify-content: center; padding: 4px 0;
}
.audio-controls button {
  background: #2a1a14; color: #e0c4a0; border: 1px solid #4a2e22;
  border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer;
}
.audio-controls input[type="range"] { width: 86px; accent-color: #ffb060; }
/* web/style.css pins .volume-slider position:fixed top:12px — undo it (CLAUDE.md item 5). */
.volume-slider { position: static !important; top: auto !important; }

/* results: the wide stats table */
.card.results-wide { width: min(780px, 96vw); }
#resultTable { overflow-x: auto; scrollbar-width: thin; scrollbar-color: #ffb060 rgba(255, 255, 255, .12); }
#resultTable::-webkit-scrollbar { height: 6px; }
#resultTable::-webkit-scrollbar-thumb { background: rgba(255, 176, 96, .6); border-radius: 3px; }
#resultTable .fs-table { width: max-content; min-width: 100%; font-size: .86rem; }
#resultTable .fs-table th, #resultTable .fs-table td { padding: 6px 9px; }
@media (max-width: 560px) {
  #resultTable .fs-table { font-size: .78rem; }
  .hud-panel { padding: 4px 8px; min-width: 0; }
  .tr-value { font-size: 18px; }
  #minimap { width: 64px; height: 64px; }
  .hearts canvas { width: 14px; height: 12px; }
}
