/* ==========================================================================
   IRONCROWN — interface styles
   ========================================================================== */

:root {
  --bg: #0c0a08;
  --panel: rgba(20, 16, 12, 0.86);
  --panel-solid: #16120e;
  --panel-2: rgba(40, 32, 24, 0.7);
  --line: rgba(227, 179, 79, 0.22);
  --line-strong: rgba(227, 179, 79, 0.55);
  --gold: #e3b34f;
  --gold-2: #f7dc92;
  --text: #f4ede1;
  --muted: #b6a891;
  --red: #e2463f;
  --blue: #4c8ff2;
  --green: #6fd08c;
  --danger: #ff5a4e;
  --radius: 12px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  --font-display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
  outline: none;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: auto;
  animation: fade-in 0.35s ease;
}

.screen.active {
  display: flex;
}

.screen.passthrough {
  pointer-events: none;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  margin: 0;
}

h2 {
  font-size: 26px;
}

h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 12px;
}

h3 .count {
  color: var(--muted);
}

.spaced {
  margin-top: 22px;
}

/* ---------- Title & crest ---------- */

.title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(38px, 5.4vw, 80px);
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
  background: linear-gradient(180deg, #fff3cf 0%, var(--gold) 55%, #9b6d1d 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, 0.7));
}

.crest-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M8 46 L12 18 L24 32 L32 10 L40 32 L52 18 L56 46 Z' fill='%23e3b34f' stroke='%233a2608' stroke-width='2.5' stroke-linejoin='round'/%3E%3Crect x='8' y='48' width='48' height='8' rx='2' fill='%23e3b34f'/%3E%3Ccircle cx='32' cy='8' r='4' fill='%23f7dc92'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
}

.crest-mark.small {
  width: 46px;
  height: 46px;
  margin: 0 0 10px;
}

/* ---------- Boot ---------- */

#screen-boot {
  background: radial-gradient(ellipse at center, #1e1812 0%, #080706 75%);
}

.boot {
  text-align: center;
  width: min(420px, 90vw);
}

.bar {
  height: 6px;
  margin: 28px 0 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #9b6d1d, var(--gold-2));
  transition: width 0.3s ease;
}

/* ---------- Main menu ---------- */

#screen-main {
  align-items: stretch;
  justify-content: flex-start;
  padding: 0;
  background: linear-gradient(90deg, rgba(8, 6, 4, 0.88) 0%, rgba(8, 6, 4, 0.55) 34%, transparent 62%);
}

.main-layout {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: clamp(28px, 6vh, 72px) clamp(24px, 6vw, 88px);
}

.main-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 42px;
  width: min(460px, 100%);
}

.tagline {
  margin: 12px 0 0;
  font-family: var(--font-display);
  letter-spacing: 0.35em;
  text-transform: uppercase;
  font-size: 13px;
  color: var(--gold-2);
  opacity: 0.85;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.menu-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 16px 22px;
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 10px;
  background: rgba(20, 16, 12, 0.62);
  backdrop-filter: blur(6px);
  cursor: pointer;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.menu-btn:hover,
.menu-btn:focus-visible {
  transform: translateX(8px);
  border-color: var(--line-strong);
  border-left-color: var(--gold);
  background: rgba(40, 30, 18, 0.8);
  outline: none;
}

.menu-btn.primary {
  background: linear-gradient(90deg, rgba(120, 82, 24, 0.75), rgba(40, 30, 18, 0.7));
  border-color: var(--line-strong);
  border-left-color: var(--gold);
}

.menu-btn-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.06em;
}

.menu-btn-sub {
  font-size: 13px;
  color: var(--muted);
}

.main-right {
  display: flex;
  align-items: flex-end;
}

.profile-card {
  width: 260px;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.main-footer {
  position: absolute;
  left: clamp(24px, 6vw, 88px);
  right: clamp(24px, 6vw, 88px);
  bottom: 18px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Panels & controls ---------- */

.panel {
  width: min(560px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 26px 28px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel.narrow {
  width: min(440px, 100%);
}

.panel.wide {
  width: min(1040px, 100%);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-head p {
  margin: 6px 0 0;
}

.panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.panel-foot p {
  margin: 0;
  text-align: center;
  flex: 1;
}

.field-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 8px;
}

.text-input,
.code-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  outline: none;
  transition: border-color 0.15s ease;
  user-select: text;
}

.text-input:focus,
.code-input:focus {
  border-color: var(--gold);
}

.code-input {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
}

.join-row {
  display: flex;
  gap: 10px;
}

.join-row .btn {
  min-width: 110px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(60, 46, 28, 0.55);
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  background: rgba(90, 68, 36, 0.75);
  border-color: var(--gold);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(180deg, #e8bb57, #b8852c);
  border-color: #f2cf7c;
  color: #1c1307;
  font-weight: 700;
}

.btn.primary:hover {
  background: linear-gradient(180deg, #f3ca6c, #c79436);
}

.btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.16);
}

.btn.ghost:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

.btn.small {
  padding: 6px 12px;
  font-size: 13px;
}

.btn.wide {
  width: 100%;
  margin-top: 16px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  flex: none;
}

.icon-btn:hover {
  border-color: var(--gold);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 18px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.status-line {
  min-height: 20px;
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.status-line.error {
  color: var(--danger);
}

/* Segmented control */
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
}

.seg button {
  padding: 7px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.seg button.on {
  background: var(--gold);
  color: #1c1307;
}

.seg button:disabled {
  cursor: default;
}

.seg.wide-seg {
  display: flex;
}

.seg.wide-seg button {
  flex: 1;
}

/* Range */
.range-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #2a1d0b;
  box-shadow: 0 0 0 3px rgba(227, 179, 79, 0.2);
}

input[type='range']::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #2a1d0b;
}

input[type='range']:disabled {
  opacity: 0.5;
  cursor: default;
}

output {
  min-width: 44px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Toggle switch */
.switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: background 0.2s ease;
  flex: none;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #cfc3ad;
  transition: transform 0.2s ease, background 0.2s ease;
}

.switch.on {
  background: rgba(227, 179, 79, 0.35);
  border-color: var(--gold);
}

.switch.on::after {
  transform: translateX(20px);
  background: var(--gold);
}

/* ---------- Multiplayer & public lobbies ---------- */

.panel.mp {
  width: min(920px, 100%);
}

.mp-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 28px;
}

.mp-hint {
  margin: 8px 0 0;
  text-align: center;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-weight: 600;
}

.toggle-row .s-help {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  margin-top: 2px;
}

.toggle-row + .btn.wide {
  margin-top: 14px;
}

.pl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.pl-head h3 {
  margin: 0;
}

.public-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
}

.pl-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.pl-row:hover {
  border-color: var(--line-strong);
}

.pl-info {
  flex: 1;
  min-width: 0;
}

.pl-name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pl-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 3px;
}

.pl-meta .live {
  color: #ff8a80;
  font-weight: 700;
}

.pl-count {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold-2);
}

.pl-empty {
  padding: 26px 14px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  line-height: 1.5;
}

/* ---------- Lobby ---------- */

.lobby-grid {
  display: grid;
  grid-template-columns: 1fr 1.25fr;
  gap: 28px;
}

.code-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  background: rgba(0, 0, 0, 0.3);
}

.code-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.code-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 0.22em;
  color: var(--gold-2);
  user-select: text;
}

.player-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.player-list li.you {
  border-color: var(--line-strong);
}

.player-list .p-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  color: var(--gold);
  flex: none;
}

.player-list .p-icon svg {
  width: 18px;
  height: 18px;
}

.player-list .p-name {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.tag.host {
  background: rgba(227, 179, 79, 0.18);
  color: var(--gold-2);
}

.tag.bot {
  background: rgba(76, 143, 242, 0.15);
  color: #9cc2ff;
}

.kick-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.kick-btn:hover {
  color: var(--danger);
}

.class-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.class-card {
  padding: 14px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.class-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.class-card.on {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(120, 82, 24, 0.55), rgba(40, 30, 18, 0.6));
  box-shadow: 0 0 0 1px var(--gold) inset;
}

.class-card .cc-icon {
  width: 34px;
  height: 34px;
  color: var(--gold);
  margin-bottom: 8px;
}

.class-card .cc-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
}

.class-card .cc-blurb {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 10px;
  min-height: 48px;
  line-height: 1.35;
}

.stat {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.stat .pips {
  display: flex;
  gap: 3px;
}

.stat .pips i {
  flex: 1;
  height: 5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
}

.stat .pips i.f {
  background: var(--gold);
}

.settings-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-rows .row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.chat-box {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
  padding: 10px;
}

.chat-log {
  height: 120px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 8px;
  user-select: text;
}

.chat-log .sys {
  color: var(--muted);
  font-style: italic;
}

.chat-log b {
  color: var(--gold-2);
}

/* ---------- Vote ---------- */

#screen-vote {
  background: rgba(8, 6, 4, 0.55);
}

.vote-wrap {
  width: min(1120px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
}

.vote-head {
  position: relative;
  text-align: center;
  margin-bottom: 12px;
}

.vote-head h2 {
  font-size: 34px;
}

.vote-head p {
  margin: 8px 0 14px;
}

.timer-bar {
  height: 4px;
  width: min(420px, 80%);
  margin: 0 auto;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.timer-fill {
  height: 100%;
  background: var(--gold);
  width: 100%;
  transition: width 0.25s linear;
}

.vote-timer {
  position: absolute;
  right: 0;
  top: 0;
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 900;
  color: var(--gold-2);
}

.vote-label {
  margin: 20px 0 10px;
}

.vote-grid {
  display: grid;
  gap: 14px;
}

.vote-grid.modes {
  grid-template-columns: repeat(5, 1fr);
}

.vote-grid.maps {
  grid-template-columns: repeat(3, 1fr);
}

.vote-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  padding: 0;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.3s ease;
}

.vote-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
}

.vote-card.mine {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold), 0 12px 40px rgba(227, 179, 79, 0.18);
}

.vote-card.winner {
  border-color: var(--gold-2);
  box-shadow: 0 0 0 3px var(--gold-2), 0 0 60px rgba(247, 220, 146, 0.45);
  transform: scale(1.03);
}

.vote-card.loser {
  opacity: 0.3;
}

.vote-card .vc-art {
  height: 92px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #3b2a15, #120e0a);
  color: var(--gold);
}

.vote-card .vc-art svg {
  width: 44px;
  height: 44px;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.6));
}

.vote-grid.maps .vc-art {
  height: 150px;
  background-size: cover;
  background-position: center;
}

.vote-card .vc-body {
  padding: 12px 14px 14px;
}

.vote-card .vc-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.vote-card .vc-tag {
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(226, 70, 63, 0.2);
  color: #ff9a92;
  letter-spacing: 0.08em;
}

.vote-card .vc-tag.pve {
  background: rgba(111, 208, 140, 0.18);
  color: #9fe8b6;
}

.vote-card .vc-blurb {
  font-size: 12.5px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.4;
}

.vote-card .vc-votes {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 99px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--line-strong);
  color: var(--gold-2);
}

.vote-card .vc-voters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
  min-height: 20px;
}

.vote-card .vc-voters span {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.vote-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 22px;
}

/* ---------- Loading ---------- */

#screen-loading {
  background: radial-gradient(ellipse at center, rgba(24, 18, 12, 0.92), rgba(6, 5, 4, 0.98));
}

.loading {
  text-align: center;
}

.loading-kicker {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--gold);
  margin: 0 0 10px;
}

.loading-title {
  font-size: clamp(34px, 5vw, 58px);
}

.spinner {
  width: 46px;
  height: 46px;
  margin: 30px auto;
  border-radius: 50%;
  border: 3px solid rgba(227, 179, 79, 0.15);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- How to play ---------- */

.howto-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.howto-grid section {
  padding: 16px;
  border-radius: 12px;
  background: var(--panel-2);
}

.howto-grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
}

.howto-grid li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.howto-grid li span:first-child {
  color: var(--muted);
}

.howto-grid p {
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 10px;
}

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom-width: 2px;
  background: rgba(0, 0, 0, 0.35);
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* ---------- Settings ---------- */

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 10px 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: -1px;
}

.tab.active {
  color: var(--gold-2);
  border-bottom-color: var(--gold);
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 340px;
}

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting .s-label {
  font-weight: 600;
}

.setting .s-help {
  display: block;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-top: 3px;
}

.setting .text-input {
  width: 220px;
}

.bind-btn {
  min-width: 140px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  font-weight: 600;
}

.bind-btn.listening {
  border-color: var(--gold);
  color: var(--gold-2);
  animation: pulse 1s ease infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}

/* ---------- Pause & results ---------- */

#screen-pause,
#screen-results {
  background: rgba(6, 5, 4, 0.55);
}

.pause {
  text-align: center;
}

.pause .muted {
  margin: 8px 0 4px;
}

.pause-class {
  margin-top: 18px;
  text-align: left;
}

.results {
  text-align: center;
}

.results-kicker {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}

.results-title {
  font-size: clamp(32px, 4.5vw, 52px);
}

.results-reason {
  margin: 8px 0 22px;
}

.results-table,
.scoreboard {
  text-align: left;
}

.sb-grid {
  display: grid;
  gap: 18px;
}

.sb-grid.two {
  grid-template-columns: 1fr 1fr;
}

.sb-team-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 10px 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
}

table.sb {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.sb th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 10px;
  text-align: right;
}

table.sb th:first-child,
table.sb td:first-child {
  text-align: left;
}

table.sb td {
  padding: 8px 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

table.sb tr.me td {
  background: rgba(227, 179, 79, 0.12);
}

table.sb tr.dead td {
  opacity: 0.55;
}

table.sb .sb-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

table.sb .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

/* ---------- HUD ---------- */

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  font-family: var(--font-body);
}

#hud[hidden] {
  display: none;
}

.hud-top {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
}

.score-panel {
  display: flex;
  align-items: stretch;
  gap: 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(12, 10, 8, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(4px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.score-panel .sp-team {
  min-width: 78px;
  padding: 6px 14px;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 28px;
}

.score-panel .sp-team small {
  display: block;
  font-family: var(--font-body);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: 0.85;
}

.score-panel .sp-mid {
  padding: 8px 18px;
  text-align: center;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.score-panel .sp-time {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.score-panel .sp-mode {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.score-panel .sp-gates {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-top: 5px;
}

.score-panel .sp-gates i {
  display: block;
  width: 26px;
  height: 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.score-panel .sp-gates i b {
  display: block;
  height: 100%;
  background: #c08a4a;
}

.score-panel .sp-gates i.down {
  background: rgba(255, 90, 78, 0.55);
}

.score-panel .sp-flag {
  display: inline-block;
  margin-top: 2px;
  font-size: 10px;
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
}

#hud-minimap {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 2px solid rgba(227, 179, 79, 0.45);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  background: #111;
}

.killfeed {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  max-width: 440px;
}

.kf-line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 7px;
  background: rgba(10, 8, 6, 0.66);
  font-size: 13px;
  font-weight: 600;
  animation: kf-in 0.25s ease;
  transition: opacity 0.5s ease;
}

.kf-line.me {
  background: rgba(120, 82, 24, 0.7);
  border: 1px solid rgba(227, 179, 79, 0.5);
}

.kf-line .kf-icon {
  width: 16px;
  height: 16px;
  color: #ddd;
  opacity: 0.85;
}

.kf-line.note {
  font-weight: 500;
  color: var(--muted);
}

@keyframes kf-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
}

.announce {
  position: absolute;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: 90%;
}

.ann {
  animation: ann-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
  transition: opacity 0.6s ease;
  margin-bottom: 8px;
}

.ann .ann-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(30px, 4vw, 54px);
  letter-spacing: 0.06em;
  color: var(--gold-2);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.8), 0 0 30px rgba(227, 179, 79, 0.35);
}

.ann.small .ann-title {
  font-size: 22px;
}

.ann.streak .ann-title {
  font-size: 30px;
  color: #ff8a5c;
}

.ann .ann-sub {
  font-size: 15px;
  color: var(--text);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  margin-top: 4px;
}

@keyframes ann-in {
  from {
    opacity: 0;
    transform: scale(1.4);
  }
}

.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
}

.ch-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.65);
}

.ch-draw {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: rotate(-90deg);
  transition: opacity 0.15s ease;
}

.ch-draw circle {
  fill: none;
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 2.5;
}

.ch-draw .ch-draw-fill {
  stroke: #fff;
  stroke-dasharray: 100.5;
  stroke-dashoffset: 100.5;
}

.crosshair.drawing .ch-draw {
  opacity: 1;
}

.crosshair.full .ch-draw-fill {
  stroke: var(--gold-2);
}

.hitmarker {
  position: absolute;
  inset: 6px;
  opacity: 0;
  background:
    linear-gradient(45deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%),
    linear-gradient(-45deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%);
  -webkit-mask: radial-gradient(circle, transparent 7px, #000 8px);
  mask: radial-gradient(circle, transparent 7px, #000 8px);
}

.hitmarker.show {
  animation: hm 0.3s ease;
}

.hitmarker.kill {
  background:
    linear-gradient(45deg, transparent 44%, var(--danger) 44%, var(--danger) 56%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, var(--danger) 44%, var(--danger) 56%, transparent 56%);
}

@keyframes hm {
  0% {
    opacity: 1;
    transform: scale(1.3);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

.damage-dirs {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
}

.dmg-dir {
  position: absolute;
  left: -70px;
  top: -70px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border-top: 5px solid rgba(255, 50, 40, 0.85);
  filter: blur(0.5px) drop-shadow(0 0 6px rgba(255, 30, 20, 0.8));
  -webkit-mask: conic-gradient(from -30deg, #000 0 60deg, transparent 60deg);
  mask: conic-gradient(from -30deg, #000 0 60deg, transparent 60deg);
}

.nameplates,
.markers,
.dmg-numbers {
  position: absolute;
  inset: 0;
}

.np {
  position: absolute;
  transform: translate(-50%, -100%);
  text-align: center;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.np .np-bar {
  width: 64px;
  height: 4px;
  margin: 3px auto 0;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

.np .np-fill {
  height: 100%;
  background: currentColor;
}

.marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 1px 3px #000;
}

.marker .mk-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid currentColor;
  background: rgba(0, 0, 0, 0.55);
}

.marker .mk-icon svg {
  width: 16px;
  height: 16px;
}

.dmg-num {
  position: absolute;
  transform: translate(-50%, -50%);
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

.dmg-num.head {
  color: #ffd35a;
  font-size: 21px;
}

.dmg-num.blocked {
  color: #9fb8d8;
  font-size: 14px;
}

.vitals {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.class-badge {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--gold);
  background: rgba(12, 10, 8, 0.75);
  border: 1px solid rgba(227, 179, 79, 0.4);
}

.class-badge svg {
  width: 32px;
  height: 32px;
}

.bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ult {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.ult-ring {
  --p: 0deg;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: conic-gradient(var(--gold) var(--p), rgba(255, 255, 255, 0.12) 0);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.3s ease;
}

.ult-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(12, 10, 8, 0.9);
  color: var(--muted);
}

.ult-icon svg {
  width: 26px;
  height: 26px;
}

.ult.ready .ult-ring {
  animation: ult-pulse 1.1s ease-in-out infinite;
}

.ult.ready .ult-icon {
  color: var(--gold-2);
}

.ult.active .ult-ring {
  background: conic-gradient(#ff5a3c var(--p), rgba(255, 255, 255, 0.12) 0);
}

.ult.active .ult-icon {
  color: #ff8a5c;
}

@keyframes ult-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(247, 220, 146, 0.55), 0 4px 16px rgba(0, 0, 0, 0.45);
  }
  50% {
    box-shadow: 0 0 0 9px rgba(247, 220, 146, 0), 0 4px 16px rgba(0, 0, 0, 0.45);
  }
}

.ult-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-shadow: 0 1px 2px #000;
}

.ult.ready .ult-label {
  color: var(--gold-2);
}

.class-card .cc-super {
  font-size: 11.5px;
  color: var(--gold-2);
  margin: -2px 0 8px;
  line-height: 1.35;
}

.vbar {
  position: relative;
  width: 280px;
  height: 22px;
  border-radius: 7px;
  overflow: hidden;
  background: rgba(10, 8, 6, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.vbar.st {
  height: 9px;
}

.vbar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.15s ease;
}

.vbar.hp .vbar-fill {
  background: linear-gradient(90deg, #a3231c, #e24a3a);
}

.vbar.st .vbar-fill {
  background: linear-gradient(90deg, #b8852c, #f0cd74);
}

.vbar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding-left: 10px;
  font-size: 12.5px;
  font-weight: 700;
  text-shadow: 0 1px 2px #000;
}

.hints {
  position: absolute;
  top: 100px;
  left: 50%;
  transition: opacity 0.6s ease;
  transform: translateX(-50%);
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 3px #000;
  display: flex;
  gap: 16px;
}

.chat {
  position: absolute;
  left: 18px;
  bottom: 96px;
  width: 380px;
  pointer-events: auto;
}

.chat-lines {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.95);
}

.chat-line {
  transition: opacity 0.6s ease;
}

.chat-line b {
  margin-right: 6px;
}

.chat-input {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--gold);
  background: rgba(0, 0, 0, 0.7);
  outline: none;
  user-select: text;
}

.fps {
  position: absolute;
  top: 200px;
  left: 18px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #9fe8b6;
  text-shadow: 0 1px 2px #000;
}

.death {
  position: absolute;
  left: 50%;
  top: 62%;
  transform: translateX(-50%);
  text-align: center;
  padding: 18px 30px;
  border-radius: 14px;
  background: rgba(10, 6, 5, 0.7);
  border: 1px solid rgba(226, 70, 63, 0.35);
}

.death[hidden] {
  display: none;
}

.death .death-kicker {
  margin: 0 0 4px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: #ff8a80;
}

.death h2 {
  font-size: 26px;
}

.death p {
  margin: 8px 0 0;
}

.scoreboard {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, 94vw);
  max-height: 80vh;
  overflow: auto;
  padding: 22px 24px;
  border-radius: 16px;
  background: rgba(14, 11, 8, 0.9);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.scoreboard[hidden] {
  display: none;
}

.scoreboard h2 {
  text-align: center;
  margin-bottom: 16px;
}

.click-to-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.35);
  text-align: center;
  pointer-events: auto;
  cursor: pointer;
}

.click-to-play[hidden] {
  display: none;
}

.click-to-play h2 {
  font-size: 36px;
}

.lowhp {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(160, 0, 0, 0.55) 100%);
}

.hitflash {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(200, 20, 10, 0.4) 100%);
}

/* ---------- Toasts & modal ---------- */

#toasts {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 340px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font-size: 14px;
  animation: fade-in 0.25s ease;
  transition: opacity 0.4s ease;
}

.toast.error {
  border-color: rgba(255, 90, 78, 0.6);
}

#modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.55);
}

#modal[hidden] {
  display: none;
}

.modal-card {
  width: min(400px, 90vw);
  padding: 24px;
  border-radius: 14px;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.modal-card p {
  margin: 10px 0 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .lobby-grid,
  .mp-grid,
  .howto-grid {
    grid-template-columns: 1fr;
  }
  .vote-grid.modes {
    grid-template-columns: repeat(2, 1fr);
  }
  .vote-grid.maps {
    grid-template-columns: 1fr;
  }
  .sb-grid.two {
    grid-template-columns: 1fr;
  }
  .main-right {
    display: none;
  }
  .vbar {
    width: 200px;
  }
  .chat {
    width: 280px;
  }
}
