/* coduo-web lobby, styled after the game's own menus: dark translucent
 * panels on a full-screen background, serif lettering, bevelled buttons.
 * The background image is the operator's (no game logos); without it a
 * gradient is used. */
:root {
  color-scheme: dark;
  --panel: rgba(14, 16, 19, .78); --panel-solid: #15181c; --line: rgba(255, 255, 255, .16);
  --bar: rgba(52, 64, 86, .55); --bar2: rgba(40, 48, 62, .85);
  --text: #e9e6dc; --muted: #a9a59a; --hi: #ffffff; --gold: #d8c27a; --red: #d0574a;
  --sel: rgba(120, 146, 190, .38);
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: #0c0d0c; }
body {
  margin: 0; min-height: 100vh; font: 16px/1.4 var(--serif); color: var(--text);
  background: radial-gradient(ellipse at 70% 0%, #5a4a2e 0%, #2a241a 45%, #0d0e0c 100%) fixed;
}
body.has-bg {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .35), rgba(0, 0, 0, .15) 30%, rgba(0, 0, 0, .55)),
    var(--bg-image) center / cover no-repeat fixed, #0c0d0c;
}
body.modal-open main, body.modal-open header { filter: blur(2px) brightness(.7); }

/* ---- top bar ----------------------------------------------------------------- */
/* Brand on the left, the corner controls on the right of the same row.
   Same width as main, so brand and buttons line up with the panels. */
header#top { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px;
  padding: 22px 18px 14px; max-width: 1700px; margin: 0 auto; }
.brand { grid-column: 1; justify-self: start; text-align: left; font: 700 36px/1.1 var(--serif); letter-spacing: .1em;
  text-transform: uppercase; color: var(--hi); text-shadow: 0 2px 4px #000; }
.brand span { display: block; margin-top: 5px; font: 400 18px var(--serif); letter-spacing: .25em; color: var(--muted); }
.corner { grid-column: 2; justify-self: end; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
@media (max-width: 1100px) {
  header#top { grid-template-columns: 1fr; justify-items: center; }
  .brand, .corner { grid-column: 1; justify-self: center; }
  .brand { text-align: center; }
}
.who { font: 21px var(--serif); text-shadow: 0 1px 2px #000; padding-right: 6px; }
a.mbtn { text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.discord .icon { width: 21px; height: 21px; color: #c9cdfb; }
/* Corner buttons 30 % larger than the small buttons elsewhere. */
.corner .mbtn.small { font-size: 18px; padding: 4px 13px; }
.discord:hover .icon { color: #fff; }
/* ---- footer: a panel across the whole main grid ------------------------------- */
#footer { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center;
  padding: 8px 16px; }
.build-tag { font: 12px/1.3 var(--sans); color: var(--muted); text-shadow: 0 1px 2px #000; }

/* ---- layout -------------------------------------------------------------------- */
main { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px;
  padding: 4px 18px 22px; max-width: 1700px; margin: 0 auto; align-items: stretch; }
#browser-check { grid-column: 1 / -1; }
@media (max-width: 1100px) { main { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); box-shadow: 0 8px 30px rgba(0, 0, 0, .55);
  padding: 14px 16px 14px; backdrop-filter: blur(2px); }
h2 { margin: 0 0 8px; font: 400 30px/1.1 var(--serif); color: var(--hi); text-shadow: 0 2px 3px #000; text-align: center; }
h3 { margin: 0 0 6px; font: 400 20px var(--serif); color: var(--hi); }
legend { font: 400 18px var(--serif); color: var(--hi); padding: 0; margin-bottom: 6px; }
.muted { color: var(--muted); font-size: 14px; }

/* ---- controls -------------------------------------------------------------------- */
.mbtn { font: 17px var(--serif); color: #dcdcdc; cursor: pointer; padding: 4px 16px;
  background: linear-gradient(180deg, #3a3f47, #23272d); border: 1px solid #5d636d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 2px #000; }
.mbtn:hover:not(:disabled) { color: var(--hi); border-color: #9aa2ae; background: linear-gradient(180deg, #4a5059, #2c3138); }
.mbtn:disabled { opacity: .45; cursor: default; }
.mbtn.primary { color: var(--hi); border-color: #8f97a3; }
.mbtn.small { font-size: 14px; padding: 3px 10px; }
.mbtn.tiny { font-size: 12px; padding: 1px 8px; }
.mbtn[aria-pressed=true] { background: linear-gradient(180deg, #6b7380, #454b55); color: var(--hi); }
input, select { font: 15px var(--serif); color: var(--text); background: rgba(8, 9, 11, .8);
  border: 1px solid #4b515a; padding: 4px 7px; }
input:focus, select:focus { outline: 1px solid #9aa2ae; }
label { display: flex; flex-direction: column; gap: 3px; font-size: 14px; color: var(--muted); }
label.check { display: inline-flex; flex-direction: row; align-items: center; gap: 4px; margin-right: 10px; color: var(--text); font-size: 15px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* ---- server browser ------------------------------------------------------------- */
.panel-top { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 10px; }
.info { flex: 1; }
.info h2 { text-align: left; margin-left: 8px; }
.info .row { display: flex; align-items: center; gap: 10px; background: linear-gradient(90deg, var(--bar), transparent);
  margin: 4px 0; padding: 3px 10px; font-size: 18px; }
.info .k { width: 120px; text-align: right; color: var(--text); }
.info .v { color: var(--hi); }
.refresh { font-size: 13px; color: var(--muted); padding: 2px 10px; }
.side-buttons { display: flex; flex-direction: column; gap: 6px; padding-top: 42px; min-width: 170px; }
#browser { display: flex; flex-direction: column; }
.table-wrap { flex: 1 1 auto; height: 0; min-height: 260px; overflow-y: auto; border: 1px solid var(--line);
  background: rgba(0, 0, 0, .35); }
table { width: 100%; border-collapse: collapse; font: 17px var(--serif); }
thead th { position: sticky; top: 0; background: var(--bar2); color: var(--hi); font-weight: 400; text-align: left;
  padding: 3px 8px; border-left: 1px solid var(--line); z-index: 1; }
tbody td { padding: 2px 8px; border-left: 1px solid rgba(255, 255, 255, .08); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: rgba(255, 255, 255, .06); }
tbody tr.selected { background: var(--sel); }
.c-lock { width: 34px; text-align: center; } .c-map { width: 22%; } .c-players { width: 12%; }
.c-type { width: 9%; } .c-ping { width: 8%; } .c-name { width: auto; }
td.c-lock { color: var(--hi); text-align: center; }
td.full { color: var(--red); }
#empty { text-align: center; color: var(--muted); padding: 24px 0; margin: 0; }
.server-info { display: flex; gap: 12px; margin-top: 10px; padding: 8px; border: 1px solid var(--line); background: rgba(0, 0, 0, .35); }
.server-info img { width: 200px; height: 112px; object-fit: cover; background: #000; }
.server-info img.layout { width: 150px; object-fit: contain; }
.si-text { display: flex; flex-direction: column; gap: 3px; }
.button-bar { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }

/* ---- host ------------------------------------------------------------------------- */
form#host { display: grid; gap: 12px; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 5px; }
.card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0; padding: 4px 4px 5px;
  font: 15px var(--serif); line-height: 1.15; }
.card b { font-weight: 700; letter-spacing: .06em; }
.card span { font-size: 11px; color: var(--muted); text-align: center; }
.card[aria-checked=true] { background: linear-gradient(180deg, #6b7380, #454b55); color: var(--hi); border-color: #c9ced6; }
.card[aria-checked=true] span { color: #e6e6e6; }
.card .uo { position: absolute; top: 1px; right: 4px; font-size: 9px; color: var(--gold); }
.map-view { display: grid; grid-template-columns: 1.6fr 1fr; gap: 6px; margin-bottom: 8px;
  height: clamp(140px, 22vh, 230px); }
.pane { position: relative; margin: 0; background: #000; border: 1px solid var(--line); overflow: hidden; }
.pane img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pane img.layout { object-fit: contain; }
.pane figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 8px 4px; font-size: 18px; color: var(--hi);
  text-shadow: 0 2px 3px #000; background: linear-gradient(transparent, rgba(0, 0, 0, .75)); }
.layout-pane figcaption { top: 0; bottom: auto; padding: 3px 8px 10px; font-size: 13px; background: linear-gradient(rgba(0, 0, 0, .7), transparent); }
.noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px;
  max-height: 252px; overflow-y: auto; padding-right: 2px; }
.map-card { position: relative; padding: 0; border: 1px solid #4b515a; background: #000; cursor: pointer;
  aspect-ratio: 16 / 9; overflow: hidden; }
.map-card img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: .85; }
.map-card span { position: absolute; left: 0; right: 0; bottom: 0; font: 13px var(--serif); color: var(--hi);
  padding: 8px 4px 2px; text-shadow: 0 1px 2px #000; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); text-align: left; }
.map-card:hover img { opacity: 1; }
.map-card[aria-checked=true] { outline: 2px solid #e6e9ee; outline-offset: -1px; }
.map-card[aria-checked=true] img { opacity: 1; }
.map-card.noimg span { position: static; display: flex; height: 100%; align-items: center; justify-content: center; background: none; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
.top-fields { grid-template-columns: 1fr 1fr; align-items: end; }
.top-fields details.advanced { grid-column: 1 / -1; padding: 4px 10px; }
details.advanced { border: 1px solid var(--line); padding: 6px 10px; background: rgba(0, 0, 0, .25); }
details.advanced summary { cursor: pointer; color: var(--text); }
details.advanced[open] summary { margin-bottom: 8px; }
details.advanced p { margin: 6px 0 0; }
.actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ---- dialogs ----------------------------------------------------------------------- */
dialog { background: rgba(16, 18, 21, .97); color: var(--text); border: 1px solid #6a707a; padding: 18px 22px 16px;
  box-shadow: 0 14px 50px #000; }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
#welcome { width: min(560px, 94vw); max-height: calc(100dvh - 24px); overflow: auto; padding: 24px 30px 22px; }
#welcome h3 { margin: 0 0 12px; font-size: 24px; }
#welcome p { margin: 0 0 14px; }
#welcome ul { margin: 0 0 16px; padding-left: 22px; }
#welcome li { margin-bottom: 10px; }
#welcome label.check.big { margin-top: 4px; }
fieldset.soldier { display: grid; gap: 4px; padding: 8px 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .3); }
fieldset.soldier label { font-size: 14px; color: var(--hi); flex-direction: row; gap: 8px; }
#name { font: 700 19px var(--serif); padding: 4px 8px; }
#volume { width: 100%; padding: 0; accent-color: #9aa2ae; }
/* Preview: same layout as the form, read only, filled from it. */
fieldset.preview-box { margin-top: 14px; }
fieldset.preview-box h4 { margin: 0 0 2px; font: 400 16px var(--serif); color: var(--muted);
  text-transform: uppercase; letter-spacing: .12em; }
.preview-name { font: 700 19px var(--serif); padding: 4px 8px; border: 1px solid var(--line);
  background: rgba(0, 0, 0, .35); min-height: 1.9em; }
.preview-name.empty { color: var(--muted); }
#welcome .hint { margin: 16px 0 0; font: 16px/1.45 var(--serif); color: var(--text); }
.error { margin: 0; font: 13px var(--sans); color: #f0a090; }
.steps { display: flex; gap: 6px; list-style: none; margin: 0 0 20px; padding: 0; counter-reset: step; }
.steps li { flex: 1; counter-increment: step; font: 12px var(--sans); color: var(--muted); padding: 4px 0 0;
  border-top: 3px solid #3a3f47; }
.steps li::before { content: counter(step) ". "; }
.steps li.active { color: var(--hi); border-top-color: #c9ced6; }
.steps li.done { color: var(--text); border-top-color: #7d8592; }
section.step p, section.step ul { margin: 0 0 10px; font-size: 15px; }
section.step ul { padding-left: 18px; }
section.step li { margin-bottom: 4px; }
label.check.big { display: flex; align-items: flex-start; gap: 8px; margin: 6px 0 0; font-size: 15px; color: var(--hi); cursor: pointer; }
label.check.big input { margin-top: 3px; width: 16px; height: 16px; }
fieldset.soldier.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 10px 0 0; }
#welcome menu { margin-top: 22px; }
#pw { min-width: 320px; }
#pw input { width: 100%; }

/* Browser check (lobby.js): shown only when something is missing. */
#browser-check { border-left: 4px solid var(--red); background: rgba(150, 40, 30, .35); padding: 10px 14px; }
#browser-check.minor { border-left-color: #d9a400; background: rgba(160, 120, 0, .3); }
#browser-check p { margin: 4px 0; }

/* id Tech 3 color codes (^0..^9). */
.c0 { color: #555; } .c1 { color: #ff3b2f; } .c2 { color: #3ee03e; } .c3 { color: #ffee3a; }
.c4 { color: #4a6bff; } .c5 { color: #3ad8ff; } .c6 { color: #ff4ad8; } .c7 { color: inherit; }
.c8 { color: #ff9a3a; } .c9 { color: #9a9a9a; }

@media (max-width: 700px) {
  .c-type, .c-ping { display: none; }
  .side-buttons { padding-top: 0; min-width: 0; }
  .panel-top { flex-direction: column; }
}
