/* Sesh. Button colors come from the in-game mod menu
   (sesh_beta00.iwd: ui_mp/common/redux.inc); the background is the mod's
   main menu image (images/menu_background.iwi). */

@font-face {
  font-family: "Barlow Semi Condensed";
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/barlow-semi-condensed-400.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Semi Condensed";
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/barlow-semi-condensed-500.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Semi Condensed";
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/barlow-semi-condensed-600.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/barlow-400.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/barlow-500.woff2") format("woff2");
}

:root {
  --black: #000;
  --text: #e6e6e6;        /* button forecolor 0.9 */
  --white: #fff;
  --dim: #a6a6a6;         /* white at 0.65 */
  --faint: #7a7a7a;

  /* Mod menu fills (0.15 / 0.2 gray), made slightly see-through so the
     blurred background shows, like blurworld in game. */
  --opt: rgba(38, 38, 38, 0.78);
  --opt-focus: rgba(58, 58, 58, 0.9);
  --opt-border: rgba(255, 255, 255, 0.16);
  --opt-border-strong: rgba(255, 255, 255, 0.42);

  --glass: rgba(12, 12, 12, 0.62);
  --glass-solid: rgba(12, 12, 12, 0.94);
  --line: rgba(255, 255, 255, 0.12);
  --rule: rgba(255, 255, 255, 0.08);
  --blur: blur(18px);

  --dim-home: 0.38;
  --dim-page: 0.66;

  --opt-h: 46px;
  --gap: 4px;
  --menu-w: 300px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.85), 0 0 12px rgba(0, 0, 0, 0.55);

  --display: "Barlow Semi Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "Barlow", Arial, sans-serif;
  --mono: Consolas, "DejaVu Sans Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--black);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font: 400 16px/1.55 var(--body);
  overflow-x: hidden;
}

p, ul, ol, h1, h2, h3 { margin: 0; }
p { max-width: 64ch; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---- background ------------------------------------------------------ */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: #000;
}
/* The image sits on its own layer so it can drift slowly behind the dim. */
.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../img/menu-bg-1920.webp") center 30% / cover no-repeat;
  /* bg.js moves these; the defaults are the resting frame. */
  transform: scale(var(--bg-s, 1.08)) translate(var(--bg-x, 0), var(--bg-y, 0));
  will-change: transform;
}
.specks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
@media (prefers-reduced-motion: reduce) {
  .widget-bar { display: none !important; }
  .bg::after { transition: none; }
}
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #000;
  opacity: var(--dim-page);
  transition: opacity 0.6s ease;
}
body[data-route="home"] .bg::after { opacity: var(--dim-home); }

/* ---- type ------------------------------------------------------------ */

h1 {
  font: 600 clamp(36px, 4.4vw, 56px)/0.95 var(--display);
  letter-spacing: -0.01em;
  color: var(--white);
  margin-bottom: 14px;
}
h2 {
  font: 600 24px/1.1 var(--display);
  color: var(--white);
  margin-bottom: 14px;
}
h3 {
  font: 600 17px/1.2 var(--display);
  letter-spacing: 0.01em;
  color: var(--white);
  margin-bottom: 8px;
}

.intro { color: var(--dim); font-size: 17px; margin-bottom: 26px; }
.mono { font-family: var(--mono); font-size: 14.5px; }
.fine { font-size: 14px; color: var(--dim); }
.status.is-error { color: var(--white); }

/* ---- frame ----------------------------------------------------------- */

.frame {
  display: grid;
  grid-template-columns: var(--menu-w) minmax(0, 1fr);
  grid-template-rows: auto 1fr auto auto;
  grid-template-areas:
    "brand widget"
    "menu  page"
    "foot  page"
    ".     social";
  column-gap: 40px;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 40px;
}

.top { display: contents; }

.brand {
  grid-area: brand;
  align-self: end;
  display: block;
  width: 104px;
  margin-bottom: 24px;
  line-height: 0;
}
.brand img { width: 100%; height: auto; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5)); }
.brand:focus-visible { outline: 1px solid var(--dim); outline-offset: 6px; }
body[data-route="home"] .brand { width: 200px; margin-bottom: 28px; }

/* Mirrors the in-game widget: map, gametype, then the totals. */
.widget {
  grid-area: widget;
  justify-self: end;
  align-self: start;
  text-align: right;
  min-width: 0;
  min-height: 122px;
  text-shadow: var(--shadow);
}
.widget p { max-width: none; }
.widget-map {
  font: 600 38px/1 var(--display);
  color: var(--white);
}
.widget-mode { font-size: 14px; color: #d4d4d4; margin-top: 4px; }
.widget-line {
  font: 500 16px/1.35 var(--display);
  color: var(--white);
  font-variant-numeric: tabular-nums;
}
.widget-mode + .widget-line { margin-top: 10px; }
.widget-bar {
  display: block;
  width: 120px;
  height: 2px;
  margin: 10px 0 0 auto;
  background: rgba(255, 255, 255, 0.2);
}
.widget-bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--white);
}
.widget-bar.is-running > span { animation: widget-fill var(--cycle, 6000ms) linear forwards; }
.widget-bar.is-paused > span { animation-play-state: paused; }
@keyframes widget-fill { to { width: 100%; } }

.menu {
  grid-area: menu;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  align-self: start;
}

.page {
  grid-area: page;
  min-width: 0;
  padding-bottom: 24px;
}
.page:focus { outline: none; }

/* Sections sit on a frosted panel; home leaves the background clear. */
.view:not(#view-home) {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  padding: 36px 40px 40px;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .view:not(#view-home) { background: var(--glass-solid); }
}

.foot {
  grid-area: foot;
  align-self: end;
  position: sticky;
  bottom: 28px;
  padding-top: 24px;
}

/* ---- options (the mod menu button) ----------------------------------- */

.opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--opt-h);
  padding: 0 16px;
  background: var(--opt);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--opt-border);
  border-radius: 0;
  color: var(--text);
  font: 500 17px/1.2 var(--display);
  text-decoration: none;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
/* Mouse hover moves focus (app.js), so hover and focus look the same, as in
   game. The 2px left edge is the one addition to the mod's style. */
.opt:hover,
.opt:focus {
  background: var(--opt-focus);
  border-color: var(--opt-border-strong);
  color: var(--white);
  box-shadow: inset 2px 0 0 var(--white);
}
.menu .opt { font-size: 19px; font-weight: 600; letter-spacing: 0.03em; }
.opt-meta {
  font: 500 14px/1 var(--display);
  letter-spacing: 0;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.opt:hover .opt-meta, .opt:focus .opt-meta { color: var(--text); }
.menu .opt[aria-current="page"],
.picker .opt[aria-pressed="true"] {
  background: rgba(230, 230, 230, 0.94);
  border-color: var(--text);
  color: var(--black);
}
.menu .opt[aria-current="page"] .opt-meta { color: #4d4d4d; }
.menu .opt[aria-current="page"]:focus,
.picker .opt[aria-pressed="true"]:focus {
  box-shadow: inset 4px 0 0 var(--black);
}

.btn {
  display: inline-flex;
  justify-content: center;
  padding: 0 20px;
  white-space: nowrap;
}
.btn-wide { min-width: 240px; margin-top: 20px; width: fit-content; }

/* ---- home ------------------------------------------------------------ */

#view-home { align-self: end; }
.lede {
  font: 500 20px/1.35 var(--display);
  color: var(--white);
  text-shadow: var(--shadow);
}
.lede-title {
  font: 600 clamp(34px, 3.6vw, 46px)/1 var(--display);
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}
.keys { color: #d4d4d4; font-size: 14px; margin-top: 28px; text-shadow: var(--shadow); }
@media (hover: none) { .keys { display: none; } }

/* ---- servers --------------------------------------------------------- */

.servers {
  list-style: none;
  padding: 0;
  display: grid;
  border-top: 1px solid var(--line);
}
.server {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 170px auto;
  grid-template-areas: "dot name count addr" "dot where meter addr";
  align-items: center;
  gap: 2px 20px;
  padding: 16px 12px 16px 16px;
  border-bottom: 1px solid var(--line);
}
.server:hover,
.server:focus-within {
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 2px 0 0 var(--white);
}
.server-dot {
  grid-area: dot;
  align-self: start;
  margin-top: 7px;
  width: 10px;
  height: 10px;
  background: var(--white);
}
.server.is-offline .server-dot { background: transparent; border: 1px solid var(--faint); }
.server-name {
  grid-area: name;
  font: 600 20px/1.2 var(--display);
  color: var(--white);
  overflow-wrap: anywhere;
}
.server-where { grid-area: where; color: var(--dim); font-size: 15px; }
.server-count {
  grid-area: count;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font: 600 17px/1.2 var(--display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.server-state { font-weight: 500; color: var(--dim); }
.meter {
  grid-area: meter;
  height: 3px;
  background: rgba(255, 255, 255, 0.14);
  align-self: center;
}
.meter > span { display: block; height: 100%; background: var(--white); }
.server-addr {
  grid-area: addr;
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: flex-end;
}
.server-addr .opt { min-height: 40px; font-size: 16px; padding: 0 22px; font-weight: 600; letter-spacing: 0.02em; }
.connect[aria-disabled="true"] { color: var(--faint); cursor: default; }
.connect[aria-disabled="true"]:hover,
.connect[aria-disabled="true"]:focus { background: var(--opt); color: var(--faint); box-shadow: inset 2px 0 0 var(--faint); }
.server.is-offline .server-name,
.server.is-offline .server-count { color: var(--faint); }
.server.is-offline .server-state { color: var(--text); }
.server.is-offline .meter > span { background: transparent; }

.servers-empty { padding: 18px 0; color: var(--dim); border-bottom: 1px solid var(--line); }
#servers-updated { margin-top: 16px; }

/* ---- chat ------------------------------------------------------------ */

.picker {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  margin-bottom: 14px;
}
.picker .opt { font-size: 16px; min-height: 40px; max-width: 100%; white-space: normal; text-align: left; }
#chat-status { color: var(--dim); margin-bottom: 12px; font-size: 15px; }
#chat-status.is-error { color: var(--white); }

.chat-wrap { position: relative; }
.chat {
  list-style: none;
  margin: 0;
  padding: 10px 0;
  height: clamp(300px, calc(100dvh - 430px), 680px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line);
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  scrollbar-width: thin;
}
.chat:focus-visible { outline: 1px solid var(--dim); outline-offset: 2px; }
.chat li {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  padding: 4px 16px;
  line-height: 1.4;
}
.chat-time { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 13px; padding-top: 2px; }
.chat-body { overflow-wrap: anywhere; }
.chat-player { color: var(--white); font-weight: 500; }
.chat-event .chat-body { color: var(--faint); font-size: 14px; }
.chat-event .chat-player { color: var(--dim); font-weight: 400; }
.chat-empty { color: var(--dim); display: block !important; padding: 8px 16px !important; }

.jump {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  min-height: 38px;
  white-space: nowrap;
  background: rgba(230, 230, 230, 0.94);
  color: var(--black);
}
.jump:hover, .jump:focus { background: var(--white); color: var(--black); box-shadow: none; }

/* ---- vip ------------------------------------------------------------- */

.vip-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* The three steps are a real sequence, so they are numbered. */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 30px; }
.step { display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.step-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 600 22px/1.1 var(--display);
  color: var(--white);
  margin-bottom: 12px;
}
.step-num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--opt-border-strong);
  background: var(--opt);
  font: 600 16px/1 var(--display);
}
.step.is-done .step-num { background: var(--text); border-color: var(--text); color: var(--black); }
.step.is-locked .step-title { color: var(--faint); }
.step.is-locked .step-num { color: var(--faint); border-color: var(--opt-border); }
.step-locked { color: var(--faint); font-size: 15px; }
.step-body > p { margin-bottom: 8px; }
.step-body strong { color: var(--white); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

.guid-label { font: 500 14px/1.2 var(--display); color: var(--dim); margin-bottom: 6px; letter-spacing: 0.02em; }
.guid-input {
  width: 100%;
  min-height: 50px;
  font: 400 17px/1 var(--mono);
  letter-spacing: 0.04em;
  cursor: text;
  justify-content: flex-start;
}
.guid-input::placeholder { color: var(--faint); font-family: var(--body); letter-spacing: 0; opacity: 1; }
.guid-input[aria-invalid="true"] { border: 2px solid var(--white); }
#guid-help { margin-top: 8px; }
#guid-help + .fine { margin-top: 4px; }
.guid-error { color: var(--white); font-size: 15px; }
.guid-error:not(:empty) { margin-top: 6px; }
.guid-error:not(:empty)::before { content: "Not valid: "; font-weight: 500; }
.copyline {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 6px 6px 6px 16px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--opt-border-strong);
}
.copyline code { flex: 1 1 auto; color: var(--white); overflow-wrap: anywhere; font-size: 16px; }
.copyline .opt { min-height: 38px; }

/* Ko-fi's panel can't be restyled, so it sits in a menu-style window. */
.kofi-window { border: 1px solid var(--opt-border-strong); background: var(--glass-solid); }
.kofi-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--opt);
  border-bottom: 1px solid var(--opt-border-strong);
  font: 600 16px/1.2 var(--display);
  color: var(--white);
}
.kofi-domain { font: 400 13px/1 var(--mono); color: var(--dim); }
.kofi-body { position: relative; height: 712px; }
.kofi-body iframe {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  /* Matches Ko-fi's light page, so Chrome doesn't paint an opaque white
     backdrop and a blank (blocked) frame stays see-through. */
  color-scheme: light;
}
/* Sits behind the iframe: visible only while the panel is blank. */
.kofi-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  max-width: none;
  text-align: center;
  color: var(--dim);
  font-size: 15px;
}
.kofi-fallback {
  display: inline-block;
  margin-top: 12px;
  color: var(--text);
  font-size: 15px;
  text-underline-offset: 3px;
}
.kofi-fallback:hover, .kofi-fallback:focus-visible { color: var(--white); }

.vip-terms {
  margin-top: 30px;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.3);
}
.vip-terms ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.vip-terms li { position: relative; padding-left: 18px; font-size: 15px; color: var(--text); }
.vip-terms li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  background: var(--dim);
}
.vip-terms a { color: var(--white); text-underline-offset: 3px; }

.perks-wrap { border-left: 1px solid var(--line); padding-left: 40px; }
.perks { display: grid; gap: 22px; }
.perks ul { padding: 0; list-style: none; }
.perks li { padding: 2px 0; break-inside: avoid; color: var(--text); font-size: 15px; }

/* ---- back + toast ---------------------------------------------------- */

.back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 0;
  background: none;
  border: 0;
  color: var(--white);
  font: 500 17px/1 var(--display);
  cursor: pointer;
  text-shadow: var(--shadow);
}
.back:hover, .back:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
.back:focus-visible { outline: 1px solid var(--dim); outline-offset: 2px; }
/* Desktop keeps the menu on screen, so Back is only needed on phones. */
.foot { display: none; }

.social {
  grid-area: social;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 6px 0 6px 6px;
  color: var(--text);
  font: 500 15px/1 var(--display);
  text-decoration: none;
  text-shadow: var(--shadow);
}
.social svg { flex: none; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8)); }
.social:hover, .social:focus-visible { color: var(--white); text-decoration: underline; text-underline-offset: 4px; }
.social:focus-visible { outline: 1px solid var(--dim); outline-offset: 2px; }

/* REDUX_ANIMATE_TEXT box. */
.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  background: var(--glass-solid);
  border: 1px solid var(--opt-border-strong);
  color: var(--white);
  font: 500 16px/1.3 var(--display);
  overflow-wrap: anywhere;
}

.noscript { padding: 16px; color: var(--white); }

/* ---- medium ---------------------------------------------------------- */

@media (max-width: 1180px) {
  .server {
    grid-template-columns: 12px minmax(0, 1fr) 150px;
    grid-template-areas: "dot name count" "dot where meter" "dot addr addr";
  }
  .server-addr { justify-content: flex-start; margin-top: 10px; }
  .vip-grid { grid-template-columns: 1fr; }
  .perks-wrap { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 28px; }
}

/* ---- phone ----------------------------------------------------------- */

@media (max-width: 860px) {
  .bg::before { background-image: url("../img/menu-bg-1080.webp"); background-position: 58% 30%; }
  .frame {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto auto 1fr auto;
    grid-template-areas:
      "brand widget"
      "menu  menu"
      "foot  foot"
      "page  page"
      "social social";
    column-gap: 16px;
    padding: 16px 16px 24px;
  }
  .brand, body[data-route="home"] .brand { width: 80px; margin-bottom: 18px; align-self: start; }
  body[data-route="home"] .brand { width: 120px; }
  .widget { min-height: 100px; }
  .widget-bar { width: 80px; margin-top: 8px; }
  .widget-map { font-size: 24px; }
  .widget-mode { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .widget-line { font-size: 14px; }
  .widget-mode + .widget-line { margin-top: 6px; }

  /* Sections open like sub-menus: the menu gives way, Back sits on top. */
  .menu { margin-top: 14px; }
  body:not([data-route="home"]) .menu { display: none; }
  body[data-route="home"] .foot { display: none; }
  .foot { display: block; position: static; padding: 0 0 12px; }
  body[data-route="home"] .page { padding-top: 28px; }
  #view-home { align-self: start; }

  .view:not(#view-home) { padding: 24px 18px 28px; margin: 0 -16px; border-left: 0; border-right: 0; }
  .intro { font-size: 16px; margin-bottom: 20px; }
  .lede { font-size: 18px; }
  .lede-title { font-size: 32px; }

  .server {
    grid-template-columns: 10px minmax(0, 1fr) auto;
    grid-template-areas: "dot name count" "dot where where" "dot meter meter" "dot addr addr";
    gap: 4px 14px;
    padding: 16px 4px 16px 10px;
  }
  .server-dot { width: 8px; height: 8px; margin-top: 8px; }
  .server-count { justify-content: flex-end; }
  .meter { margin-top: 6px; }
  .server-addr { flex-wrap: wrap; }

  .chat { height: clamp(260px, 56dvh, 560px); }
  .chat li { grid-template-columns: 42px minmax(0, 1fr); gap: 8px; padding: 4px 12px; }
  .btn-wide { width: 100%; min-width: 0; }
  .copyline { flex-wrap: wrap; }
}
