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

:root {
  --bg: #101010;
  --panel: #171717;
  --panel2: #1d1d1d;
  --line: #333;
  --text: #f4f2ef;
  --muted: #8c8b89;
  --red: #fa3434;
  --red2: #bd2027;
  --green: #7bd6a4;
  --font-head: 'Barlow Condensed', Impact, sans-serif;
  --font-mono: 'DM Mono', monospace;
  --font-body: Inter, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 12% 5%, #2a1010 0, transparent 34%),
    var(--bg);
  font-size: 14px;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .045;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

.topbar,
main,
footer {
  position: relative;
  z-index: 1;
}

.topbar {
  height: 76px;
  border-bottom: 1px solid #292929;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(5vw, 22px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 1.5px;
  font-size: 13px;
}

.brand-mark {
  display: grid;
  place-items: center;
  background: var(--red);
  color: white;
  width: 34px;
  height: 34px;
  font: 900 25px var(--font-head);
  transform: skew(-7deg);
}

.muted {
  color: var(--muted);
}

.top-right,
.eyebrow,
.panel-kicker,
.panel-head,
.rule-line,
.map-overlay,
footer,
.code-box small,
.timer-box small,
.preview-stats small,
.end-stats small {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.3px;
}

.top-right {
  display: flex;
  gap: 9px;
  align-items: center;
  color: #b8b8b8;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px #fa34345a;
}

.screen {
  display: none;
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px max(4vw, 20px) 64px;
  min-height: calc(100vh - 130px);
}

.screen.active {
  display: block;
  animation: fade .25s ease;
}

@keyframes fade {
  from {
    opacity: .4;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.hero {
  padding: 48px 0 25px;
  max-width: 690px;
}

.eyebrow {
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 10px;
}

.line {
  display: inline-block;
  width: 25px;
  height: 2px;
  background: var(--red);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font: 900 clamp(68px, 10vw, 130px)/.82 var(--font-head);
  letter-spacing: -2px;
  margin: 30px 0 24px;
}

h1 em,
h2 em {
  color: var(--red);
  font-style: normal;
}

h2 {
  font: 800 clamp(43px, 6vw, 72px)/.9 var(--font-head);
  margin: 22px 0 14px;
  letter-spacing: -.6px;
}

h3 {
  font: 700 29px var(--font-head);
  margin: 7px 0;
}

.hero-copy {
  font-size: 15px;
  line-height: 1.8;
  color: #a7a6a4;
  max-width: 420px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 32px 0 54px;
}

.btn {
  border: 1px solid transparent;
  padding: 15px 18px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  font: 700 11px var(--font-mono);
  letter-spacing: 1px;
  cursor: pointer;
  transition: .18s;
}

.btn span {
  font-size: 18px;
}

.btn-red {
  background: var(--red);
  color: white;
}

.btn-red:hover {
  background: #ff4d4d;
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border-color: #494949;
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--red);
  color: #fff;
}

.full {
  width: 100%;
  margin-top: 12px;
}

.hero-foot {
  display: flex;
  gap: 40px;
  border-top: 1px solid #333;
  padding-top: 20px;
}

.hero-foot div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hero-foot strong {
  font: 700 26px var(--font-head);
  color: var(--red);
}

.hero-foot span {
  font: 10px var(--font-mono);
  letter-spacing: 1px;
  color: #999;
}

.side-panel,
.preview-panel,
.rules-panel,
.players-panel,
.form-panel,
.join-card,
.end-card {
  background: linear-gradient(145deg, #1a1a1a, #131313);
  border: 1px solid #303030;
  padding: 25px;
}

.side-panel {
  max-width: 430px;
  position: absolute;
  right: 4vw;
  top: 90px;
  width: 34%;
}

.panel-kicker {
  display: flex;
  justify-content: space-between;
  color: #9c9b99;
  margin-bottom: 26px;
}

.panel-kicker span {
  color: var(--red);
}

.rule {
  display: flex;
  gap: 18px;
  padding: 17px 0;
  border-bottom: 1px solid #303030;
}

.rule > b {
  font: 700 24px var(--font-head);
  color: var(--red);
}

.rule strong {
  font-size: 11px;
  letter-spacing: .8px;
}

.rule p {
  color: #999;
  font-size: 12px;
  line-height: 1.7;
  margin: 7px 0 0;
}

.safety-note {
  display: flex;
  gap: 12px;
  background: #261b1b;
  border: 1px solid #472323;
  padding: 12px;
  margin-top: 22px;
}

.safety-note span {
  color: var(--red);
  font-weight: 800;
}

.safety-note p {
  font-size: 11px;
  line-height: 1.6;
  color: #c7a7a7;
  margin: 0;
}

.section-head {
  margin-bottom: 30px;
}

.back {
  border: 0;
  background: none;
  color: #aaa;
  font: 10px var(--font-mono);
  letter-spacing: 1px;
  padding: 0 0 25px;
  cursor: pointer;
}

.section-head > p,
.join-card > p {
  color: #999;
  line-height: 1.7;
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, .7fr);
  gap: 20px;
  align-items: start;
}

.form-panel label,
.join-card > label {
  display: block;
  color: #bdbbb9;
  font: 10px var(--font-mono);
  letter-spacing: 1px;
  margin-bottom: 20px;
}

.form-panel input:not([type=radio]):not([type=checkbox]),
.form-panel select,
.join-card input {
  display: block;
  width: 100%;
  background: #101010;
  color: #f5f5f5;
  border: 1px solid #383838;
  padding: 14px;
  margin-top: 9px;
  font: 13px var(--font-body);
  outline: none;
  border-radius: 0;
}

.form-panel input:focus,
.form-panel select:focus,
.join-card input:focus {
  border-color: var(--red);
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.mode-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.mode-card {
  border: 1px solid #3b3b3b;
  padding: 14px !important;
  cursor: pointer;
  position: relative;
}

.mode-card.selected {
  border-color: var(--red);
  background: #281818;
}

.mode-card input {
  position: absolute;
  opacity: 0;
}

.mode-icon {
  display: block;
  color: var(--red);
  font-size: 23px;
  margin-bottom: 10px;
}

.mode-card b,
.mode-card small {
  display: block;
}

.mode-card b {
  font: 700 12px var(--font-mono);
}

.mode-card small {
  color: #999;
  font-size: 10px;
  margin-top: 7px;
  letter-spacing: 0;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid #303030;
}

.toggle-row b,
.toggle-row small {
  display: block;
}

.toggle-row b {
  font: 11px var(--font-mono);
  letter-spacing: .8px;
}

.toggle-row small {
  font: 11px var(--font-body);
  color: #888;
  line-height: 1.6;
  margin-top: 6px;
  max-width: 330px;
}

.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  margin: 0 !important;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #444;
  border-radius: 20px;
  cursor: pointer;
}

.switch span:before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  background: #ddd;
  border-radius: 50%;
  transition: .2s;
}

.switch input:checked + span {
  background: var(--red);
}

.switch input:checked + span:before {
  transform: translateX(16px);
}


/* ============================================================
   MAPS
============================================================ */

.preview-map,
.map-live {
  position: relative;
  overflow: hidden;
  background: #111719;
  border: 1px solid #283335;
  min-height: 290px;
}

.map-live {
  min-height: 360px;
}


/* Make sure Leaflet fills the REDLINE map containers */

#preview-map,
#game-map {
  width: 100%;
  min-height: 360px;
  z-index: 1;
}

#preview-map {
  min-height: 290px;
}


/* Leaflet zoom controls */

.leaflet-control-zoom a {
  background: #171717 !important;
  color: #f4f2ef !important;
  border-color: #333 !important;
}

.leaflet-control-zoom a:hover {
  background: #242424 !important;
  color: #fa3434 !important;
}


/* Leaflet popup styling */

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #171717;
  color: #f4f2ef;
}

.leaflet-popup-content {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .5px;
}


/* Small / subtle required map attribution */

.leaflet-control-attribution {
  background: rgba(10, 10, 10, .45) !important;
  color: rgba(255, 255, 255, .28) !important;
  font-size: 7px !important;
  padding: 1px 3px !important;
}

.leaflet-control-attribution a {
  color: rgba(255, 255, 255, .35) !important;
}

.leaflet-container {
  background: #111719;
  font-family: var(--font-body);
}


/* ============================================================
   PREVIEW
============================================================ */

.preview-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 15px;
}

.preview-stats div {
  background: #101010;
  padding: 12px 9px;
}

.preview-stats small,
.preview-stats b {
  display: block;
}

.preview-stats small {
  color: #777;
  font-size: 8px;
}

.preview-stats b {
  font: 700 12px var(--font-mono);
  margin-top: 9px;
}

.tiny {
  font-size: 10px;
  line-height: 1.6;
}


/* ============================================================
   JOIN
============================================================ */

.join-card {
  max-width: 480px;
  margin: 35px auto;
}

.join-card h2 {
  margin-top: 18px;
}

.code-input {
  text-transform: uppercase;
  font: 700 24px var(--font-mono) !important;
  letter-spacing: 8px;
}


/* ============================================================
   LOBBY
============================================================ */

.lobby-head,
.game-top {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 30px;
}

.lobby-head h2,
.game-top h2 {
  font-size: clamp(38px, 5vw, 58px);
}

.lobby-head p {
  color: #999;
}

.code-box {
  border: 1px solid #444;
  background: #181818;
  padding: 14px 18px;
  min-width: 150px;
}

.code-box small,
.code-box b {
  display: block;
}

.code-box small {
  color: #888;
}

.code-box b {
  font: 800 27px var(--font-mono);
  letter-spacing: 3px;
  margin: 7px 0;
}

.code-box button {
  border: 0;
  background: none;
  color: var(--red);
  padding: 0;
  font: 10px var(--font-mono);
  cursor: pointer;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  color: #999;
  border-bottom: 1px solid #333;
  padding-bottom: 16px;
  margin-bottom: 8px;
}

.panel-head b {
  color: #eee;
}

.panel-head b span {
  color: var(--red);
}

.player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid #292929;
}

.avatar {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  background: #2b2424;
  border: 1px solid #513030;
  color: var(--red);
  font: 700 17px var(--font-head);
}

.player-meta {
  flex: 1;
}

.player-meta b,
.player-meta small {
  display: block;
}

.player-meta b {
  font-size: 12px;
}

.player-meta small {
  color: #888;
  font-size: 10px;
  margin-top: 4px;
}

.host-tag {
  font: 9px var(--font-mono);
  color: var(--red);
}

.rule-line {
  display: flex;
  justify-content: space-between;
  padding: 15px 0;
  border-bottom: 1px solid #303030;
  color: #999;
}

.rule-line b {
  color: #f1f1f1;
  font-size: 10px;
}

.rules-panel .btn-outline {
  margin-top: 8px;
}


/* ============================================================
   GAME
============================================================ */

.headstart-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #291b0f;
  border: 1px solid #6d421c;
  color: #ffc078;
  font: 11px var(--font-mono);
  letter-spacing: 1px;
  margin-bottom: 18px;
}

.headstart-banner.visible {
  display: flex;
}

.headstart-banner b {
  font-size: 17px;
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 18px;
}

.ping-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: #191919;
  border: 1px solid #303030;
  padding: 20px;
  margin-top: 15px;
}

.ping-panel p {
  font-size: 12px;
  color: #999;
  margin-bottom: 0;
  line-height: 1.6;
}

.ping-actions {
  text-align: right;
  min-width: 180px;
}

.ping-actions .btn {
  width: 100%;
  justify-content: center;
  font-size: 10px;
}

.ping-actions small {
  display: block;
  color: #888;
  font-size: 9px;
  line-height: 1.5;
  margin-top: 9px;
}


/* ============================================================
   CAPTURE
============================================================ */

.capture-panel {
  margin-top: 15px;
  padding: 20px;
  background: #171717;
  border: 1px solid #303030;
}

.capture-panel .panel-head {
  margin-bottom: 12px;
}

.capture-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #2a2a2a;
}

.capture-row span {
  font-size: 12px;
}

.capture-row button {
  background: #2b1717;
  border: 1px solid #572626;
  color: #ff8989;
  padding: 8px 10px;
  font: 10px var(--font-mono);
  cursor: pointer;
}


/* ============================================================
   GAME SIDEBAR
============================================================ */

.game-sidebar {
  background: #171717;
  border: 1px solid #303030;
  padding: 20px;
  align-self: start;
}

.game-player-list .player-row {
  padding: 10px 0;
}

.game-player-list .avatar {
  width: 30px;
  height: 30px;
}

.role-pill {
  font: 9px var(--font-mono);
  padding: 5px 6px;
  background: #292020;
  color: #ff7777;
}

.role-pill.runner {
  background: #262626;
  color: #ccc;
}

.activity-title {
  margin-top: 28px;
  margin-bottom: 12px;
}

.activity-log {
  max-height: 220px;
  overflow: auto;
}

.activity-item {
  font-size: 10px;
  color: #aaa;
  line-height: 1.6;
  padding: 10px 0;
  border-bottom: 1px solid #2a2a2a;
}

.activity-item time {
  display: block;
  font: 9px var(--font-mono);
  color: #666;
  margin-bottom: 4px;
}


/* ============================================================
   TIMER
============================================================ */

.timer-box {
  border: 1px solid #493030;
  background: #1e1515;
  padding: 13px 18px;
  text-align: right;
}

.timer-box small {
  display: block;
  color: #999;
  font-size: 9px;
}

.timer-box b {
  font: 800 31px var(--font-mono);
  color: var(--red);
}


/* ============================================================
   END SCREEN
============================================================ */

.end-card {
  max-width: 600px;
  margin: 70px auto;
  text-align: center;
  padding: 45px;
}

.end-card h1 {
  font-size: clamp(65px, 10vw, 100px);
}

.end-card > p {
  color: #999;
}

.end-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 30px 0;
  gap: 8px;
}

.end-stats div {
  background: #101010;
  padding: 18px 8px;
}

.end-stats small,
.end-stats b {
  display: block;
}

.end-stats small {
  color: #777;
  font-size: 8px;
}

.end-stats b {
  font: 700 23px var(--font-head);
  margin-top: 9px;
}


/* ============================================================
   TOAST
============================================================ */

.toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translate(-50%, 20px);
  opacity: 0;
  background: #f4f2ef;
  color: #111;
  padding: 12px 18px;
  font: 11px var(--font-mono);
  z-index: 9999;
  transition: .2s;
  pointer-events: none;
  max-width: 90%;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}


/* ============================================================
   FOOTER
============================================================ */

footer {
  border-top: 1px solid #292929;
  padding: 20px max(5vw, 22px);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #777;
  font-size: 9px;
}


/* ============================================================
   TABLET
============================================================ */

@media (max-width: 1000px) {

  .side-panel {
    position: relative;
    top: auto;
    right: auto;
    width: 100%;
    max-width: none;
    margin-top: 25px;
  }

  .hero {
    padding-top: 15px;
  }

  .setup-grid {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    display: none;
  }

  .game-grid {
    grid-template-columns: 1fr 250px;
  }
}


/* ============================================================
   MOBILE
============================================================ */

@media (max-width: 700px) {

  .topbar {
    height: 62px;
    padding: 0 18px;
  }

  .brand {
    font-size: 11px;
  }

  .top-right {
    font-size: 8px;
  }

  .screen {
    padding: 28px 16px 42px;
    min-height: calc(100vh - 120px);
  }

  .hero {
    padding-top: 12px;
  }

  .hero h1 {
    font-size: clamp(68px, 18vw, 105px);
  }

  .hero-actions {
    margin-bottom: 35px;
  }

  .hero-foot {
    gap: 20px;
    justify-content: space-between;
  }

  .hero-foot span {
    font-size: 8px;
  }

  .side-panel {
    padding: 18px;
  }

  .two-cols {
    gap: 8px;
  }

  .form-panel {
    padding: 17px;
  }

  .lobby-head,
  .game-top {
    flex-direction: column;
  }

  .code-box {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .code-box small {
    grid-column: 1;
  }

  .code-box b {
    grid-column: 1;
  }

  .code-box button {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .lobby-grid,
  .game-grid {
    grid-template-columns: 1fr;
  }

  .rules-panel {
    order: -1;
  }

  .game-sidebar {
    order: 2;
  }

  .map-live,
  #game-map {
    min-height: 300px;
  }

  .ping-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .ping-actions {
    width: 100%;
    text-align: left;
  }

  .headstart-banner {
    gap: 10px;
    font-size: 9px;
  }

  .headstart-banner b {
    font-size: 15px;
  }

  .end-card {
    padding: 30px 18px;
    margin: 25px auto;
  }

  .end-stats div {
    padding: 13px 4px;
  }

  .end-stats small {
    font-size: 7px;
  }

  footer {
    flex-wrap: wrap;
    font-size: 8px;
  }

  footer span:nth-child(2) {
    display: none;
  }
}