/* the play page (index.html): the look of Soldat 1.7's own menus, like Soldat TV (spectate.css) */
@font-face {
  font-family: "Play";
  src: url("play-regular.ttf") format("truetype");
  font-display: swap;
}
:root {
  --bg: #313d4f;           /* the menu background */
  --panel: #3d4b61;        /* fields, lists, the raised tab */
  --deep: #2c3341;         /* the tab strip, list headers */
  --tab: #2d3342;          /* tabs that are not selected, check boxes */
  --row: #3c4b61;
  --row-alt: #303e54;
  --row-hover: #475a76;
  --line: #4a5a72;
  --text: #e9e9e9;
  --muted: #a3adbb;
  --dim: #6c7c92;
  --green: #3c8e37;        /* buttons, check marks, progress */
  --green-hi: #47a241;
  --green-lo: #377531;
  --green-text: #cfffce;
  --orange: #ff8728;       /* the outline of the selected server */
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 "Play", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 1px solid var(--orange); outline-offset: 1px; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--deep); }
::-webkit-scrollbar-thumb { background: var(--line); border: 3px solid var(--deep); }
* { scrollbar-color: var(--line) var(--deep); }

/* flat green, like Join Game and Start Game */
button { background: var(--green); border: 0; border-radius: 0; color: #f2f2f2; padding: 6px 18px; min-height: 30px; cursor: pointer; }
button:hover { background: var(--green-hi); }
button:active { background: var(--green-lo); }
button:disabled { opacity: .5; cursor: default; }
input, select { background: var(--panel); border: 1px solid transparent; border-radius: 0; padding: 6px 9px; }
input:hover { border-color: var(--line); }
input:focus { border-color: var(--line); outline: none; }
input::placeholder { color: var(--dim); }
input[type=range] { padding: 0; accent-color: var(--green); background: none; border: 0; width: 100%; }
/* the game's check boxes: dark squares with a green tick */
input[type=checkbox] { -webkit-appearance: none; appearance: none; flex: none; width: 15px; height: 15px; margin: 0; padding: 0;
  background: var(--tab); border: 1px solid var(--line); display: inline-grid; place-content: center; cursor: pointer; }
input[type=checkbox]::before { content: ""; width: 8px; height: 4px; margin-top: -2px; border: solid var(--green-hi);
  border-width: 0 0 2px 2px; transform: rotate(-45deg); visibility: hidden; }
input[type=checkbox]:checked::before { visibility: visible; }

#app { display: flex; flex-direction: column; height: 100%; }

/* ---------- header: the menu's tabs ---------- */
.tabs { display: flex; align-items: stretch; flex: none; }
.tab { display: inline-flex; align-items: center; padding: 0 16px; height: 34px; background: var(--tab); color: #7686a0;
  font-size: 16px; font-weight: 700; text-decoration: none; border-right: 2px solid var(--bg); white-space: nowrap; }
.tab:hover { color: var(--muted); }
.tab.active { background: var(--panel); color: var(--text); }
.tab.ext::after { content: "↗"; font-size: 11px; margin-left: 5px; font-weight: 400; }
.tab.logo { padding-left: 8px; }
.fill-tab { flex: 1; }
/* the way to Soldat TV, with its TV badge */
.tv-link { gap: 7px; color: var(--muted); }
.tv-link:hover { color: var(--text); }
.tv-link .logo-tv { font-size: 12px; letter-spacing: .1em; background: var(--green); color: #fff; padding: 3px 5px 2px 6px; }
.tv-link:hover .logo-tv { background: var(--green-hi); }
.account { display: flex; }
.account .who { color: var(--muted); }
.account button.tab { border: 0; font: inherit; cursor: pointer; }
/* like Soldat TV's "Live matches" box */
.signin { align-self: center; margin-right: 10px; background: var(--green-lo); color: var(--green-text); font-size: 13px;
  padding: 4px 12px; text-decoration: none; white-space: nowrap; }
.signin:hover { background: var(--green); color: #fff; }
.tag { align-self: center; margin-right: 10px; background: var(--green-lo); color: var(--green-text); font-size: 13px;
  padding: 4px 12px; white-space: nowrap; }
.logo { display: inline-flex; align-items: center; gap: 8px; line-height: 1; user-select: none; }
.logo-icon { width: 22px; height: 22px; border-radius: 3px; }
.logo-word { font-size: 17px; font-weight: 700; letter-spacing: .02em; }

/* ---------- layout ---------- */
main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; flex: 1; min-height: 0;
  width: 100%; max-width: 1480px; margin: 0 auto; padding: 18px 16px 10px; }
.panel h2 { margin: 0; font-size: 14px; font-weight: 400; color: var(--text); }
.side { display: flex; flex-direction: column; gap: 18px; min-height: 0; overflow: auto; scrollbar-gutter: stable; padding-right: 4px; }
.side > .panel, .side .stage { flex: none; }

/* ---------- server browser: Join Game ---------- */
#servers { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.panel-head { display: flex; align-items: center; gap: 14px; }
.panel-head #refresh { margin-left: auto; }
.summary { margin: 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.summary b { color: var(--text); font-weight: 400; }
.status { color: var(--muted); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.status.error { color: var(--orange); }
/* the segmented strip above the list: runs while the list is requested */
.strip { height: 9px; background: var(--deep); flex: none; }
.strip i { display: block; height: 100%; width: 0;
  background: repeating-linear-gradient(90deg, var(--green) 0 11px, transparent 11px 14px); }
.strip.loading i { width: 85%; transition: width 2.5s cubic-bezier(.2, .7, .3, 1); }
.strip.done i { width: 100%; transition: width .25s ease-out; }
.toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1; min-width: 200px; }
.check { display: inline-flex; gap: 7px; align-items: center; color: var(--text); white-space: nowrap; cursor: pointer; font-size: 13px; }
.table-wrap { flex: 1; overflow: auto; min-height: 140px; background: var(--panel); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 5px 10px; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 1; background: var(--deep); font-weight: 400; font-size: 13px; color: var(--muted);
  cursor: pointer; user-select: none; border-bottom: 1px solid var(--line); }
th:hover { color: var(--text); }
th.sorted { color: var(--text); }
th.sorted::after { content: " ▾"; color: var(--green-hi); }
th.sorted.asc::after { content: " ▴"; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name { max-width: 460px; overflow: hidden; text-overflow: ellipsis; }
tbody tr { cursor: pointer; background: var(--row); }
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr:hover { background: var(--row-hover); box-shadow: inset 0 0 0 1px var(--orange); }
tbody tr.sel { background: #1f5f9e; box-shadow: inset 0 0 0 1px var(--orange); }
tbody tr.empty-server { color: var(--muted); }
.server { display: flex; align-items: center; gap: 8px; min-width: 0; }
.server > span:not(.tag) { overflow: hidden; text-overflow: ellipsis; }
/* flags.png: 32x24 cells, 16 to a row (js/flags.js) */
.cflag { flex: none; width: 16px; height: 12px; background: url("flags.png") 0 0 / 256px 204px no-repeat;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }
.cflag:not([style]) { background: var(--deep); }
.server .tag { flex: none; margin: 0; padding: 0 5px; font-size: 11px; background: var(--deep); color: var(--muted); }
.players { display: inline-flex; align-items: center; gap: 8px; }
.meter { width: 42px; height: 4px; background: var(--deep); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--green); }
.empty { color: var(--muted); padding: 18px; margin: 0; }
.joinbar { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.joinbar label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.joinbar #address { width: 210px; }
.joinbar .actions { display: flex; gap: 8px; margin-left: auto; }
.joinbar #join { padding: 6px 30px; }
.hint { margin: 0; color: var(--muted); font-size: 12px; }
.hint b { color: var(--green-hi); }

/* ---------- soldier: Player ---------- */
/* stands on a piece of the selected server's map (its sky color and ground texture, set
   from the map file by main.js) */
#player { display: flex; flex-direction: column; gap: 10px; }
.stage { position: relative; height: 230px; overflow: hidden; background-color: #6f6539; cursor: crosshair; }
.stage::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 16%;
  background: #4a4335 var(--ground, none) 0 0 / var(--ground-size, 930px) repeat; border-top: 2px solid rgba(0, 0, 0, .35); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
/* the label, its value on the right, the control below */
.field { display: grid; grid-template-columns: 1fr auto; gap: 4px; font-size: 13px; color: var(--muted); }
.field input { grid-column: 1 / -1; }
.field output { color: var(--text); font-variant-numeric: tabular-nums; }
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.swatches label { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; }
.swatches input[type=color] { -webkit-appearance: none; appearance: none; width: 100%; height: 26px; padding: 0;
  border: 1px solid var(--line); background: var(--tab); cursor: pointer; }
.swatches input[type=color]:hover { border-color: var(--orange); }
.swatches input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.swatches input[type=color]::-webkit-color-swatch { border: none; border-radius: 0; }
.swatches input[type=color]::-moz-color-swatch { border: none; border-radius: 0; }
/* like the game's number boxes: a value between two small arrow buttons */
.cycler { display: grid; grid-template-columns: 56px 26px 1fr 26px; align-items: center; gap: 4px; }
.cycler span { color: var(--muted); font-size: 13px; }
.cycler output { text-align: center; background: var(--panel); padding: 3px 0; }
.cycler button { padding: 0; min-height: 26px; height: 26px; font-size: 16px; line-height: 1; background: var(--tab); color: var(--text); }
.cycler button:hover { background: var(--green); }

/* ---------- settings: Options ---------- */
#settings { display: flex; flex-direction: column; gap: 10px; }
details { color: var(--muted); font-size: 13px; background: var(--panel); padding: 7px 10px; }
details summary { cursor: pointer; color: var(--text); }
details summary:hover { color: #fff; }
details p { margin: 8px 0; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 10px 0 4px; align-items: center; }
.keys dt { color: var(--text); white-space: nowrap; }
.keys dd { margin: 0; }
kbd { display: inline-block; min-width: 1.7em; padding: 0 .35em; background: var(--tab); border: 1px solid var(--line);
  font: 12px/1.6 "Play", monospace; text-align: center; color: var(--text); }

footer { flex: none; color: var(--dim); font-size: 12px; text-align: center; padding: 10px 16px; background: var(--deep); }
footer a { color: var(--muted); }

/* ---------- game ---------- */
#game { position: fixed; inset: 0; background: #000; }
#canvas { width: 100%; height: 100%; object-fit: contain; display: block; outline: none; image-rendering: auto; cursor: none; }
#lock-hint { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); background: rgba(45, 54, 70, .92);
  border: 1px solid var(--line); padding: 8px 14px; color: #fff; font-size: 13px; pointer-events: none; }

/* ---------- loading ---------- */
#loading { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); }
#loading .box { width: min(360px, 84vw); text-align: center; }
#loading .logo { margin-bottom: 10px; }
#loading h1 { margin: 0 0 6px; color: var(--text); font-size: 15px; font-weight: 400; }
#loading .logo-icon { width: 30px; height: 30px; }
#loading .logo-word { font-size: 22px; }
#loading p { color: var(--muted); min-height: 1.4em; font-size: 13px; }
#loading .bar { height: 10px; background: var(--deep); overflow: hidden; }
#loading-bar { height: 100%; width: 0; transition: width .2s;
  background: repeating-linear-gradient(90deg, var(--green) 0 11px, transparent 11px 14px); }
#loading.error p { color: var(--orange); white-space: pre-wrap; }

@media (max-width: 980px) {
  #app { height: auto; min-height: 100%; }
  main { grid-template-columns: minmax(0, 1fr); }
  .side { overflow: visible; }
  .table-wrap { max-height: 60vh; }
}
@media (max-width: 560px) {
  main { padding: 14px 12px 10px; }
  .tab { padding: 0 12px; font-size: 15px; }
  .tab.ext, .tag { display: none; }
  .panel-head { flex-wrap: wrap; }
  .joinbar #address { width: 100%; }
  .joinbar label { flex: 1; }
  th:nth-child(2), td:nth-child(2), th:nth-child(3), td:nth-child(3) { display: none; }
  td.name { max-width: 0; width: 100%; }
  .joinbar .actions { margin-left: 0; width: 100%; }
  .joinbar .actions button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .strip i { transition: none !important; }
}
