:root {
  color-scheme: dark;
  --roulette-background-image: url("/assets/cs2-roulette-bg.png");
  --roulette-background-position: 50% 50%;
  --roulette-background-mobile-position: var(--roulette-background-position);
  --roulette-background-active-position: var(--roulette-background-position);
  --roulette-background-size: cover;
  --roulette-background-mobile-size: var(--roulette-background-size);
  --roulette-background-active-size: var(--roulette-background-size);
  --amber: #ffb347;
  --amber-deep: #d77c18;
  --cyan: #61d6d2;
  --ink: #080b0e;
  --steel: #161d22;
  --line: rgba(255, 223, 172, 0.18);
  --paper: #f5efe3;
  --muted: #b8bec4;
  --danger: #ff7a5f;
  --accent-wash: rgba(255, 179, 71, 0.08);
  --accent-core: rgba(255, 179, 71, 0.24);
  --accent-core-shadow: rgba(255, 179, 71, 0.12);
  --focus-ring: rgba(97, 214, 210, 0.14);
  --spin-start: #f6c56b;
  --spin-text: #15100a;
  --spin-shadow: rgba(215, 124, 24, 0.23);
  --wheel-slice-1: #172127;
  --wheel-slice-2: #87531b;
  --wheel-slice-3: #243a3a;
  --wheel-slice-4: #311f1b;
  --wheel-separator: rgba(255, 226, 181, 0.18);
  --wheel-separator-dense: rgba(255, 226, 181, 0.09);
  --wheel-rim: rgba(255, 215, 151, 0.58);
  --wheel-label: #f5efe3;
  --wheel-label-stroke: rgba(4, 6, 8, 0.7);
}

body[data-theme="yellow"] {
  --amber: #ffcb3d;
  --amber-deep: #de8611;
  --cyan: #ffe37d;
  --line: rgba(255, 217, 102, 0.22);
  --accent-wash: rgba(255, 203, 61, 0.12);
  --accent-core: rgba(255, 203, 61, 0.26);
  --accent-core-shadow: rgba(255, 203, 61, 0.16);
  --focus-ring: rgba(255, 203, 61, 0.18);
  --spin-start: #ffe683;
  --spin-shadow: rgba(222, 134, 17, 0.3);
  --wheel-slice-1: #242016;
  --wheel-slice-2: #9b5d08;
  --wheel-slice-3: #4d3c18;
  --wheel-slice-4: #392316;
  --wheel-rim: rgba(255, 215, 103, 0.72);
}

body[data-theme="red"] {
  --amber: #ff6a62;
  --amber-deep: #a71d24;
  --cyan: #ff9b91;
  --line: rgba(255, 138, 128, 0.2);
  --accent-wash: rgba(255, 88, 88, 0.1);
  --accent-core: rgba(255, 94, 87, 0.24);
  --accent-core-shadow: rgba(255, 94, 87, 0.16);
  --focus-ring: rgba(255, 106, 98, 0.17);
  --spin-start: #ff9b86;
  --spin-text: #22090a;
  --spin-shadow: rgba(167, 29, 36, 0.34);
  --wheel-slice-1: #21181c;
  --wheel-slice-2: #851d27;
  --wheel-slice-3: #382025;
  --wheel-slice-4: #53151d;
  --wheel-separator: rgba(255, 184, 178, 0.18);
  --wheel-separator-dense: rgba(255, 184, 178, 0.09);
  --wheel-rim: rgba(255, 134, 124, 0.64);
}

body[data-theme="blue"] {
  --amber: #53b8ff;
  --amber-deep: #1265c7;
  --cyan: #7ae9ff;
  --line: rgba(123, 205, 255, 0.2);
  --accent-wash: rgba(73, 174, 255, 0.11);
  --accent-core: rgba(83, 184, 255, 0.23);
  --accent-core-shadow: rgba(83, 184, 255, 0.15);
  --focus-ring: rgba(83, 184, 255, 0.18);
  --spin-start: #8de6ff;
  --spin-text: #061523;
  --spin-shadow: rgba(18, 101, 199, 0.32);
  --wheel-slice-1: #131e29;
  --wheel-slice-2: #145086;
  --wheel-slice-3: #1c344b;
  --wheel-slice-4: #102737;
  --wheel-separator: rgba(183, 225, 255, 0.18);
  --wheel-separator-dense: rgba(183, 225, 255, 0.09);
  --wheel-rim: rgba(117, 202, 255, 0.68);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
}

body::before {
  background-color: var(--ink);
  background-image:
    linear-gradient(90deg, rgba(4, 6, 8, 0.92), rgba(4, 6, 8, 0.45) 48%, rgba(4, 6, 8, 0.88)),
    linear-gradient(180deg, rgba(4, 6, 8, 0.2), rgba(4, 6, 8, 0.92)),
    var(--roulette-background-image);
  background-position:
    center,
    center,
    var(--roulette-background-active-position);
  background-repeat: no-repeat;
  background-size:
    cover,
    cover,
    var(--roulette-background-active-size);
}

body::after {
  background:
    repeating-linear-gradient(90deg, transparent 0 54px, rgba(255, 255, 255, 0.018) 54px 55px),
    linear-gradient(180deg, var(--accent-wash), transparent 28%);
  mix-blend-mode: screen;
}

button,
input {
  font: inherit;
}

.arena {
  position: relative;
  z-index: 1;
  width: min(1380px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
  gap: clamp(20px, 3vw, 42px);
  padding: clamp(18px, 3vw, 42px) 0;
}

body[data-mode="viewer"] .arena {
  grid-template-rows: auto auto auto;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--amber);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.35rem, 5vw, 5.7rem);
  line-height: 0.92;
  text-transform: uppercase;
}

.title-lockup {
  min-height: clamp(46px, 7vw, 86px);
  display: flex;
  align-items: end;
}

.subdomain-logo {
  width: auto;
  max-width: min(100%, calc(100vw - 44px));
  height: clamp(52px, 5.4vw, 78px);
  display: block;
  object-fit: contain;
  object-position: left bottom;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.34));
}

.subdomain-logo[data-brand="cspro"] {
  height: clamp(68px, 7.3vw, 112px);
}

.subdomain-logo[data-brand="skinslendarias"] {
  width: min(250px, 24vw);
  height: auto;
}

.statusline {
  min-height: 48px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: end;
  gap: 11px;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.84rem;
  font-weight: 800;
}

.language-switch {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
}

.language-switch button {
  width: 42px;
  min-height: 36px;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
}

.language-switch button.active {
  background: var(--amber);
  color: var(--spin-text);
}

.language-switch button:hover:not(:disabled) {
  transform: none;
}

.online {
  border-left: 1px solid var(--line);
  padding-left: 11px;
}

.online strong {
  color: var(--paper);
}

.socket-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 18px currentColor;
}

.socket-dot.live {
  color: var(--cyan);
  background: var(--cyan);
}

.roulette-stage {
  min-height: 0;
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(300px, 410px);
  align-items: center;
  gap: clamp(20px, 4vw, 72px);
}

body[data-mode="viewer"] .roulette-stage {
  grid-template-columns: 1fr;
}

body[data-mode="viewer"] .wheel-shell {
  width: min(100%, 980px);
}

.results-panel {
  width: min(980px, 100%);
  justify-self: center;
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding: clamp(18px, 2.5vw, 30px);
  background: linear-gradient(135deg, rgba(10, 14, 17, 0.94), rgba(21, 28, 31, 0.68));
  backdrop-filter: blur(10px);
}

.results-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.results-head h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.8rem);
  line-height: 1;
  text-transform: uppercase;
}

.results-table-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.28);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.results-table th:nth-child(1),
.results-table td:nth-child(1) {
  width: 24%;
}

.results-table th:nth-child(2),
.results-table td:nth-child(2) {
  width: 32%;
}

.results-table th:nth-child(3),
.results-table td:nth-child(3) {
  width: 44%;
}

.results-table th,
.results-table td {
  height: 54px;
  border-bottom: 1px solid rgba(255, 223, 172, 0.11);
  padding: 0 clamp(12px, 2vw, 20px);
  text-align: left;
}

.results-table th {
  color: var(--amber);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.results-table td {
  color: var(--muted);
  font-weight: 800;
}

.results-table td strong {
  color: var(--paper);
  font-size: 1.35rem;
}

.results-table tr:last-child td {
  border-bottom: 0;
}

.empty-results td {
  text-align: center;
}

.security-footer {
  width: min(980px, 100%);
  justify-self: center;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
  padding: clamp(14px, 2vw, 22px) clamp(14px, 2vw, 24px);
  background: rgba(7, 10, 13, 0.64);
  color: var(--muted);
  line-height: 1.5;
  backdrop-filter: blur(8px);
}

.security-footer .eyebrow {
  margin-bottom: 0;
}

.security-footer p:last-child {
  margin: 0;
  max-width: 86ch;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.wheel-shell {
  position: relative;
  width: min(100%, 860px);
  max-width: 100%;
  min-width: 0;
  aspect-ratio: 1;
  justify-self: center;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 28px 34px rgba(0, 0, 0, 0.5));
}

.wheel-shell::before {
  position: absolute;
  inset: 4%;
  border: 1px solid rgba(255, 221, 166, 0.28);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(6, 8, 10, 0.3), rgba(6, 8, 10, 0.82) 68%);
  content: "";
}

#wheel {
  position: relative;
  width: 92%;
  height: 92%;
}

.pointer {
  position: absolute;
  z-index: 3;
  top: 1.4%;
  width: clamp(28px, 4vw, 48px);
  height: clamp(42px, 6vw, 72px);
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  background: linear-gradient(180deg, #fff2c6, var(--amber-deep));
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.58));
}

.wheel-core {
  position: absolute;
  z-index: 2;
  width: clamp(128px, 25%, 222px);
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  gap: 5px;
  border: 1px solid rgba(255, 229, 185, 0.32);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, var(--accent-core), transparent 34%),
    rgba(7, 10, 13, 0.94);
  box-shadow: inset 0 0 28px var(--accent-core-shadow), 0 0 0 12px rgba(7, 10, 13, 0.52);
  text-align: center;
  text-transform: uppercase;
}

.wheel-core span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.wheel-core strong {
  max-width: 8ch;
  overflow-wrap: normal;
  white-space: nowrap;
  font-size: clamp(1.8rem, 4vw, 4rem);
  line-height: 1;
}

.control-bay {
  min-width: 0;
  overflow: hidden;
  display: grid;
  gap: 18px;
  align-content: center;
  border-left: 1px solid var(--line);
  padding: clamp(4px, 2vw, 32px);
  background: linear-gradient(135deg, rgba(11, 15, 18, 0.92), rgba(18, 24, 28, 0.66));
  backdrop-filter: blur(10px);
}

.range-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.range-head output {
  color: var(--paper);
  font-size: clamp(1.4rem, 2.3vw, 2.4rem);
  font-weight: 900;
  line-height: 1;
}

form {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.login-panel,
.admin-panel {
  display: grid;
  gap: 18px;
}

.login-panel h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.7rem);
  line-height: 1;
  text-transform: uppercase;
}

.login-panel form {
  grid-template-columns: 1fr;
}

.wide,
.login-panel button {
  grid-column: 1 / -1;
}

label {
  min-width: 0;
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 900;
  text-transform: uppercase;
}

input {
  width: 100%;
  min-width: 0;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 4px;
  outline: 0;
  background: rgba(0, 0, 0, 0.34);
  color: var(--paper);
  padding: 0 14px;
}

input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

button {
  min-height: 58px;
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  color: var(--paper);
  font-weight: 950;
  text-transform: uppercase;
  transition: transform 160ms ease, filter 160ms ease, opacity 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

button:disabled {
  cursor: wait;
  opacity: 0.56;
}

.ghost {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  background: rgba(23, 31, 36, 0.88);
}

.spin {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 78px;
  background: linear-gradient(135deg, var(--spin-start), var(--amber-deep));
  color: var(--spin-text);
  box-shadow: 0 18px 34px var(--spin-shadow);
}

.spin-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border: 3px solid currentColor;
  border-radius: 50%;
  border-right-color: transparent;
}

.spin-label {
  width: auto;
  height: auto;
  border: 0;
  display: block;
  min-width: 0;
  line-height: 1.05;
  white-space: nowrap;
}

.round-feed {
  min-height: 86px;
  display: grid;
  align-items: center;
  border: 1px solid var(--line);
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--muted);
  line-height: 1.45;
}

.round-feed p {
  margin: 0;
}

.round-feed.error {
  border-color: rgba(255, 122, 95, 0.44);
  color: #ffd1c8;
}

@media (max-width: 860px) {
  :root {
    --roulette-background-active-position: var(--roulette-background-mobile-position);
    --roulette-background-active-size: var(--roulette-background-mobile-size);
  }

  .arena {
    width: min(100% - 20px, 720px);
    gap: 18px;
  }

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

  .statusline {
    justify-content: start;
    min-height: auto;
  }

  .subdomain-logo {
    height: clamp(36px, 9vw, 54px);
  }

  .subdomain-logo[data-brand="cspro"] {
    height: clamp(54px, 15vw, 74px);
  }

  .subdomain-logo[data-brand="skinslendarias"] {
    width: min(150px, 220px);
    height: auto;
  }

  .roulette-stage {
    grid-template-columns: 1fr;
    align-content: start;
    gap: 14px;
  }

  body[data-mode="viewer"] .wheel-shell {
    width: calc(100vw - 42px);
  }

  .wheel-shell {
    width: calc(100vw - 42px);
    max-width: 620px;
    justify-self: start;
    margin-left: 11px;
  }

  #wheel {
    width: 84%;
    height: 84%;
  }

  .control-bay {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding: 18px 14px;
  }

  .range-head {
    align-items: start;
    flex-direction: column;
  }

  .results-panel {
    width: 100%;
    padding: 18px 14px;
  }

  .results-head {
    align-items: start;
    flex-direction: column;
  }

  .results-table th,
  .results-table td {
    padding: 0 10px;
    font-size: 0.84rem;
  }
}
