/* Lasso Loop — sunny ranch, saddle-leather UI */

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

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

/* ── HUD ─────────────────────────────────────────────────────────── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.hud-top {
  position: absolute; top: calc(10px + env(safe-area-inset-top));
  left: 10px; right: 10px;
  display: flex; justify-content: space-between; gap: 8px;
}
.hud-panel {
  background: rgba(58, 34, 18, .82); border: 2px solid #c98b4a;
  border-radius: 12px; padding: 7px 14px; min-width: 116px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, .25);
}
.hud-timer { text-align: right; margin-left: auto; }
.ll-label { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: #f3c98c; }
.ll-value { font-size: 26px; font-weight: 900; color: #fff; line-height: 1.1; }
.ll-sub { font-size: 11px; color: #f0d6ae; margin-top: 2px; }
.rope-bar {
  height: 6px; margin-top: 5px; border-radius: 3px;
  background: rgba(255, 255, 255, .15); overflow: hidden;
}
#ropeFill {
  height: 100%; width: 0; border-radius: 3px;
  background: linear-gradient(90deg, #e9c27a, #c98b4a);
}
#ropeFill.tight { background: linear-gradient(90deg, #ff9d3d, #ff4f3d); }

.hud-board {
  position: absolute; top: calc(92px + env(safe-area-inset-top)); left: 10px;
  display: flex; flex-direction: column; gap: 4px; width: 170px;
}
.hb-row {
  display: grid; grid-template-columns: 12px 1fr auto; align-items: center;
  gap: 7px; font-size: 12px; padding: 3px 8px; border-radius: 8px;
  background: rgba(58, 34, 18, .7); color: #fff1dc;
}
.hb-row .hb-dot { width: 10px; height: 10px; border-radius: 50%; }
.hb-row .hb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-row .hb-name .hb-title { display: block; font-size: 9.5px; opacity: .75; }
.hb-row.me { outline: 2px solid #ffd27a; }
.hb-row.dead { opacity: .5; }
.hb-row .hb-pts { font-weight: 800; font-variant-numeric: tabular-nums; }

.hud-toast {
  position: absolute; top: calc(92px + env(safe-area-inset-top)); right: 10px;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-end;
  max-width: 58vw;
}
.toast {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: rgba(58, 34, 18, .86); color: #fff1dc;
  border: 1px solid #c98b4a;
  animation: toast-in .18s ease-out, toast-out .4s ease-in 2.8s forwards;
}
@keyframes toast-in { from { transform: translateX(16px); opacity: 0; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-6px); } }

.hud-center {
  position: absolute; left: 50%; top: 34%; transform: translate(-50%, -50%);
  text-align: center; pointer-events: none;
}
.hud-center .big {
  font-size: clamp(28px, 7vw, 48px); font-weight: 900; color: #fff4d6;
  text-shadow: 0 3px 0 #7a3f12, 0 0 20px rgba(0, 0, 0, .35);
  letter-spacing: .04em;
}
.hud-center .small { font-size: 14px; color: #fff1dc; margin-top: 4px;
  text-shadow: 0 1px 2px rgba(0,0,0,.6); }

#minimap {
  position: absolute; right: calc(10px + env(safe-area-inset-right));
  bottom: calc(52px + env(safe-area-inset-bottom));
  width: 150px; height: 100px; border-radius: 8px;
  border: 2px solid #c98b4a; background: #4d6b2b;
}

/* ── overlays / lobby card ───────────────────────────────────────── */
#lobbyOverlay {
  position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; z-index: 10; overflow-y: auto; padding: 16px 0;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(255, 214, 140, .55), transparent 60%),
    linear-gradient(180deg, #8fc3e8 0%, #cfe6c0 38%, #6f9a3d 60%, #4d6b2b 100%);
}
.card {
  width: min(440px, calc(100vw - 32px)); padding: 20px 20px 14px; margin: auto;
  background: #fff4e0; color: #3b2412;
  border: 3px solid #8a4f22; border-radius: 16px;
  box-shadow: 0 8px 0 #5c3314, 0 20px 50px rgba(0, 0, 0, .35);
  text-align: center;
}
.ranch-title {
  margin: 2px 0 6px; font-size: clamp(32px, 8vw, 46px); font-weight: 900;
  letter-spacing: .05em; color: #8a3f12;
  text-shadow: 0 3px 0 #f3c98c;
}
.ranch-title.small { font-size: clamp(22px, 5.5vw, 30px); }
.title-accent { margin-left: .2em; color: #d9822b; }
.tagline { margin: 0 0 12px; color: #6b4526; font-size: 14px; }
.instructions {
  margin: 12px 0 4px; font-size: 12.5px; color: #7a5534;
  display: grid; gap: 4px;
}
.muted { color: #8a6a4a; }

input#nameInput {
  width: 100%; padding: 11px 14px; border-radius: 10px; font-size: 15px;
  border: 2px solid #c98b4a; background: #fffaf0; color: #3b2412;
  outline: none; margin-bottom: 10px;
}

button.primary {
  width: 100%; padding: 12px; border: 0; border-radius: 10px;
  font-size: 16px; font-weight: 800; letter-spacing: .04em;
  background: linear-gradient(180deg, #e8833a, #c25a1c); color: #fff;
  cursor: pointer; box-shadow: 0 4px 0 #7a3410;
}
button.primary:active { transform: translateY(2px); box-shadow: 0 2px 0 #7a3410; }
button.ghost {
  margin-top: 8px; padding: 8px 14px; border-radius: 10px; cursor: pointer;
  background: transparent; border: 2px solid #c98b4a; color: #8a4f22; font-weight: 700;
}

.squad-count { color: #b35d16; font-weight: 800; margin-bottom: 8px; }
.player-list { max-height: 130px; overflow-y: auto; margin-bottom: 10px; }
.player-row {
  padding: 5px 8px; border-radius: 8px; background: #f3dfbd;
  margin-bottom: 4px; font-size: 14px; color: #3b2412;
}
.briefing { text-align: left; margin: 10px 0; font-size: 13px; color: #5c3a1e; }
.briefing ul { margin: 6px 0 0 18px; padding: 0; }

.leaderboard { margin-top: 12px; text-align: left; }
.lb-panel, .lb-card {
  --lb-panel: #3b2412;
  --lb-text: #fff1dc;
  --lb-dim: rgba(255, 241, 220, .65);
  --lb-accent: #ffc24a;
  --lb-edge: #8a4f22;
}

.peers { min-height: 16px; font-size: 12px; }
.countdown {
  font-size: 84px; font-weight: 900; color: #c25a1c;
  text-shadow: 0 4px 0 #f3c98c;
}

.back-link { display: inline-block; margin-top: 12px; color: #8a4f22; font-size: 13px; }
.spectator-flag {
  position: fixed; top: calc(70px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%); z-index: 9; padding: 4px 12px;
  background: rgba(58, 34, 18, .86); border: 1px solid #c98b4a;
  border-radius: 999px; font-size: 12px; letter-spacing: .1em; color: #fff1dc;
}

/* audio strip in the HUD: pinned bottom-centre so it never covers play. */
#hudAudio {
  position: absolute; left: 0; right: 0;
  bottom: calc(4px + env(safe-area-inset-bottom));
  transform: none; pointer-events: auto;
}
.audio-controls {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  justify-content: center; padding: 4px 0;
}
.audio-controls button {
  background: #5c3314; color: #fff1dc; border: 1px solid #c98b4a;
  border-radius: 8px; padding: 5px 10px; font-size: 12px; cursor: pointer;
}
.audio-controls input[type="range"] { width: 86px; accent-color: #d9822b; }
/* web/style.css pins .volume-slider position:fixed top:12px — undo it here
   or every slider lands in the corner of the screen (CLAUDE.md item 5). */
.volume-slider { position: static !important; top: auto !important; }

/* lobby chat on the leather palette */
#lobbyChat { --chat-bg: #3b2412; }
#lobbyChat .mps-chat { background: #4a2e18; border-color: #8a4f22; }

/* ── results ─────────────────────────────────────────────────────── */
.card.results-wide { width: min(760px, calc(100vw - 32px)); }
#resultTable { overflow-x: auto; }
#resultTable .fs-table { width: max-content; min-width: 100%; font-size: .86rem; }
#resultTable .fs-table th, #resultTable .fs-table td { padding: 6px 9px; }
#resultsPane { --fs-bg: #3b2412; }
@media (max-width: 560px) {
  #resultTable .fs-table { font-size: .78rem; }
  .hud-board { width: 128px; top: calc(86px + env(safe-area-inset-top)); }
  .hud-board .hb-row:nth-child(n+5) { display: none; }
  #minimap { width: 105px; height: 70px; }
  .hud-panel { padding: 6px 10px; min-width: 96px; }
  .ll-value { font-size: 22px; }
}

/* the HUD audio strip stays a compact pill, bottom-centre */
#hudAudio {
  left: 50%; right: auto; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 140px);
}
#hudAudio .mps-audio { flex-wrap: nowrap; }
#hudAudio .mps-audio-slider { width: 80px; flex: 0 0 80px; }
@media (max-width: 560px) {
  #hudAudio { left: 10px; transform: none; max-width: calc(100vw - 130px); }
  #hudAudio .mps-audio-slider { width: 52px; flex-basis: 52px; }
}

/* results + awards: dark leather panel so the shared table reads */
#resultTable, #resultAwards {
  --fs-panel: #3b2412;
  --fs-text: #fff1dc;
  --fs-dim: rgba(255, 241, 220, .65);
  --fs-accent: #ffc24a;
  --fs-edge: #8a4f22;
}
#resultTable { background: #3b2412; border-radius: 10px; padding: 4px; }
