@font-face {
  font-family: Vazirmatn;
  src: url(/fonts/Vazirmatn-wght.woff2) format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --sand: #d9c59d;      /* dust2 wall */
  --sand-2: #e7d8b8;    /* sunlit stone */
  --umber: #2a231b;     /* ink / shadow */
  --crate: #6b4a2b;     /* wooden crate */
  --ct: #1f4e79;        /* counter-terrorist blue: actions */
  --t: #a8461a;         /* terrorist rust: danger */
  --live: #2f6b2c;      /* server online */
  --line: rgba(42, 35, 27, .22);
  --step: clamp(1rem, .95rem + .25vw, 1.125rem);
  font-family: Vazirmatn, Tahoma, sans-serif;
  font-size: var(--step);
  line-height: 1.75;
  color: var(--umber);
  background: var(--sand);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: min(68rem, 100% - 2rem); margin-inline: auto; padding-block: 2rem 4rem; outline: none; }
a { color: var(--ct); }
:focus-visible { outline: 3px solid var(--ct); outline-offset: 3px; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.6rem); font-weight: 850; letter-spacing: -.01em; }
h2 { font-size: 1.35rem; font-weight: 800; }
p { max-width: 38em; }
bdi { unicode-bidi: isolate; }
.num { font-feature-settings: "tnum"; }
.skip { position: absolute; inset-inline-start: -999px; }
.skip:focus { inset-inline-start: 1rem; top: 1rem; background: var(--sand-2); padding: .5rem 1rem; z-index: 9; }

/* header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: .75rem max(1rem, (100% - 68rem) / 2);
  background: var(--umber); color: var(--sand-2);
}
.brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; font-weight: 900; font-size: 1.2rem; }
.brand svg { width: 1.6rem; height: 1.6rem; color: var(--sand); }
.top nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.top nav a { color: var(--sand-2); text-decoration: none; padding: .35rem .8rem; border-radius: 2px; }
.top nav a:hover { background: rgba(231, 216, 184, .12); }
.top nav a[aria-current="page"] { background: var(--sand); color: var(--umber); font-weight: 700; }

/* the crate: live server hero */
.crate {
  position: relative;
  background: var(--crate);
  color: var(--sand-2);
  padding: clamp(1.25rem, 3vw, 2.5rem);
  border: 6px solid #4e3520;
  box-shadow: inset 0 0 0 2px rgba(231, 216, 184, .18);
  background-image:
    linear-gradient(45deg, transparent 49.3%, rgba(0,0,0,.18) 49.5%, rgba(0,0,0,.18) 50.5%, transparent 50.7%),
    repeating-linear-gradient(0deg, transparent 0 46px, rgba(0,0,0,.12) 46px 48px);
}
.crate .stencil {
  font-weight: 900;
  font-size: clamp(2.6rem, 1.5rem + 6vw, 5.5rem);
  line-height: 1;
  letter-spacing: .02em;
  direction: ltr; text-align: start;
  color: var(--sand);
  margin: .2em 0 .25em;
  text-shadow: 0 2px 0 rgba(0,0,0,.35);
  word-break: break-word;
}
.crate .host { margin: 0; font-size: .95rem; opacity: .85; }
.crate .row { display: flex; flex-wrap: wrap; gap: 1.5rem 2.5rem; align-items: end; margin-top: 1.25rem; }
.crate .count { font-size: 2.2rem; font-weight: 850; line-height: 1; }
.crate .count small { font-size: .95rem; font-weight: 500; opacity: .8; }
.state { display: inline-flex; align-items: center; gap: .45rem; font-weight: 700; padding: .15rem .7rem; background: rgba(0,0,0,.25); }
.state::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: #8a8a8a; }
.state.on::before { background: #6fd36a; box-shadow: 0 0 0 0 rgba(111, 211, 106, .6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 .5rem rgba(111, 211, 106, 0); } 100% { box-shadow: 0 0 0 0 rgba(111, 211, 106, 0); } }
@media (prefers-reduced-motion: reduce) { .state.on::before { animation: none; } }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-inline-start: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 750; cursor: pointer; text-decoration: none;
  padding: .6rem 1.3rem; border: 2px solid transparent; border-radius: 2px;
  background: var(--ct); color: #fff;
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; color: inherit; border-color: currentColor; }
.btn.sand { background: var(--sand); color: var(--umber); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.copy { font: inherit; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; text-decoration: underline dotted; }

/* sections */
.section { margin-top: 2.5rem; }
.split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: start; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.panel { background: var(--sand-2); padding: 1.25rem 1.5rem; border-top: 4px solid var(--umber); }
.muted { color: rgba(42, 35, 27, .7); }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: .55rem .6rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .85rem; font-weight: 700; color: rgba(42, 35, 27, .7); }
td.n, th.n { text-align: end; font-feature-settings: "tnum"; white-space: nowrap; }
tbody tr:hover { background: rgba(255, 255, 255, .3); }
td a { color: var(--umber); font-weight: 650; text-decoration: none; }
td a:hover { text-decoration: underline; }
.rankno { width: 3rem; font-weight: 800; color: var(--crate); }
.table-wrap { overflow-x: auto; }

.tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs button { font: inherit; background: transparent; border: 2px solid var(--umber); color: var(--umber); padding: .3rem .9rem; cursor: pointer; border-radius: 2px; }
.tabs button[aria-pressed="true"] { background: var(--umber); color: var(--sand-2); }

/* stats grid on player page */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 1.5rem 0; }
.stats div { background: var(--sand-2); padding: .9rem 1rem; }
.stats dt { font-size: .85rem; color: rgba(42, 35, 27, .7); }
.stats dd { margin: 0; font-size: 1.6rem; font-weight: 850; font-feature-settings: "tnum"; }

.bar { height: .5rem; background: rgba(42, 35, 27, .12); }
.bar i { display: block; height: 100%; background: var(--crate); }

/* forms */
form { display: grid; gap: 1rem; max-width: 24rem; }
label { display: grid; gap: .3rem; font-weight: 650; }
input { font: inherit; padding: .55rem .8rem; border: 2px solid var(--umber); background: #fbf6ea; border-radius: 2px; direction: ltr; text-align: left; }
.error { color: var(--t); font-weight: 650; margin: 0; }
.ok { color: var(--live); font-weight: 650; margin: 0; }
.code { font-size: 2.4rem; font-weight: 900; letter-spacing: .25em; direction: ltr; display: inline-block; background: var(--umber); color: var(--sand); padding: .2rem 1rem; }
kbd { font-family: inherit; background: var(--umber); color: var(--sand-2); padding: .05rem .45rem; border-radius: 2px; direction: ltr; unicode-bidi: isolate; }

/* play */
.game-frame { position: relative; background: #000; aspect-ratio: 4 / 3; width: 100%; max-height: 80vh; }
.game-frame canvas, .game-frame iframe { width: 100%; height: 100%; display: block; border: 0; }
.game-overlay { position: absolute; inset: 0; display: grid; place-content: center; gap: 1rem; text-align: center; color: var(--sand-2); padding: 1rem; }

.foot { padding: 1.5rem max(1rem, (100% - 68rem) / 2); border-top: 1px solid var(--line); font-size: .9rem; }
.foot p { margin: 0; }
.empty { padding: 2rem 0; }
