:root {
  color-scheme: dark;
  --panel: rgba(9, 12, 14, 0.78);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f3f6ee;
  --muted: #a9b4b0;
  --accent: #f2c84b;
  --danger: #e65345;
  --good: #50d26f;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #101417;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select {
  font: inherit;
}

.ops-shell,
#ops-canvas {
  width: 100vw;
  height: 100vh;
}

#ops-canvas {
  display: block;
  cursor: crosshair;
}

.topbar,
.side-panel,
.center-card,
.landing-panel {
  position: fixed;
  z-index: 5;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255,255,255,0.1), transparent 34%), var(--panel);
  box-shadow: 0 22px 70px rgba(0,0,0,0.38);
  backdrop-filter: blur(16px) saturate(1.12);
}

.topbar {
  top: 14px;
  left: 50%;
  width: min(1040px, calc(100vw - 28px));
  min-height: 62px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(150px, 1.25fr) repeat(5, minmax(82px, 0.65fr)) 58px 112px;
  gap: 8px;
  align-items: stretch;
  padding: 8px;
  border-radius: 8px;
}

.brand,
.stat,
.topbar button {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(3, 5, 6, 0.52);
  border-radius: 6px;
  padding: 8px 10px;
}

.brand strong {
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
}

.brand span,
.stat span,
.side-panel .label,
.side-panel p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.stat b {
  margin-top: 3px;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.stat.reward b {
  color: var(--good);
}

.topbar button,
.side-panel button,
.side-panel select {
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(8, 12, 14, 0.82);
  border-radius: 6px;
}

.topbar button,
.side-panel button {
  cursor: pointer;
  font-weight: 800;
}

.topbar button {
  padding: 0 12px;
}

.side-panel {
  left: 16px;
  bottom: 16px;
  width: min(310px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
}

.landing-panel {
  right: 16px;
  bottom: 16px;
  width: min(760px, calc(100vw - 350px));
  min-height: 220px;
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(190px, 0.8fr) minmax(170px, 0.75fr);
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
}

.landing-panel.hidden {
  display: none;
}

.landing-copy,
.profile-card,
.leaderboard-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 9px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(3, 5, 6, 0.5);
  border-radius: 6px;
  padding: 12px;
}

.landing-copy h1 {
  margin: 0;
  color: var(--accent);
  font-size: 34px;
  line-height: 0.95;
}

.landing-copy p,
.profile-card label,
.leaderboard-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.landing-grid,
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.landing-grid span,
.metrics-grid span,
.leaderboard-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 6px;
  background: rgba(8, 12, 14, 0.72);
  padding: 7px 8px;
  color: var(--text);
  font-size: 12px;
}

.metrics-grid b,
.metrics-grid small {
  display: block;
}

.metrics-grid small {
  color: var(--muted);
  font-size: 10px;
}

.profile-preview {
  width: 100%;
  aspect-ratio: 1;
  min-height: 150px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: rgba(8, 12, 14, 0.72);
}

.panel-title {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-card input,
.profile-card select,
.profile-card button {
  width: 100%;
  min-height: 34px;
  margin-top: 4px;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(8, 12, 14, 0.82);
  border-radius: 6px;
  padding: 0 9px;
}

.profile-card button {
  cursor: pointer;
  font-weight: 900;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.swatch-grid input[type="color"] {
  padding: 2px;
}

.leaderboard-list {
  display: grid;
  gap: 6px;
}

.leaderboard-row b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-row i {
  color: var(--good);
  font-style: normal;
  font-weight: 900;
}

.side-panel select,
.side-panel button {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
}

.side-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.room-list {
  display: grid;
  gap: 6px;
  max-height: min(42vh, 360px);
  overflow: auto;
  padding-right: 2px;
}

.room-row {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  background: rgba(5, 8, 10, 0.72);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.room-row.active {
  border-color: rgba(242, 200, 75, 0.72);
  box-shadow: inset 0 0 0 1px rgba(242, 200, 75, 0.25);
}

.room-row.full {
  opacity: 0.55;
}

.room-row b,
.room-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.room-row b {
  font-size: 12px;
}

.room-row span {
  color: var(--muted);
  font-size: 10px;
}

.room-count {
  color: var(--good);
  font-weight: 900;
  font-size: 12px;
}

.crosshair {
  position: fixed;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,0.82);
  box-shadow: 0 0 8px rgba(0,0,0,0.6);
}

.crosshair::before {
  left: 12px;
  top: 4px;
  width: 2px;
  height: 18px;
}

.crosshair::after {
  left: 4px;
  top: 12px;
  width: 18px;
  height: 2px;
}

.scope-overlay {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: none;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(5, 7, 8, 0.95) calc(50% - 1px), rgba(5, 7, 8, 0.95) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(0deg, transparent calc(50% - 1px), rgba(5, 7, 8, 0.95) calc(50% - 1px), rgba(5, 7, 8, 0.95) calc(50% + 1px), transparent calc(50% + 1px)),
    radial-gradient(circle at center, transparent 0 33vmin, rgba(0,0,0,0.96) 33.2vmin 100%);
}

.scope-overlay::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 66vmin;
  height: 66vmin;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(5, 7, 8, 0.95);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.72), inset 0 0 22px rgba(0,0,0,0.38);
}

.scope-overlay.active {
  display: block;
}

body:has(.scope-overlay.active) .crosshair {
  display: none;
}

.hitmarker {
  position: fixed;
  z-index: 4;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 42px;
  border: 2px solid transparent;
  transform: translate(-50%, -50%) rotate(45deg) scale(0.75);
  opacity: 0;
  pointer-events: none;
}

.hitmarker.active {
  border-color: var(--accent);
  opacity: 1;
  animation: hit 130ms ease-out;
}

.damage-vignette {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: radial-gradient(circle, transparent 48%, rgba(230, 83, 69, 0.35));
  opacity: 0;
  transition: opacity 160ms ease;
}

.damage-vignette.active {
  opacity: 1;
}

.center-card {
  left: 50%;
  top: 50%;
  width: min(440px, calc(100vw - 34px));
  transform: translate(-50%, -50%);
  padding: 22px;
  border-radius: 8px;
  text-align: center;
}

.center-card.hidden {
  display: none;
}

.center-card h1 {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 42px;
  line-height: 1;
}

.center-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

@keyframes hit {
  from { transform: translate(-50%, -50%) rotate(45deg) scale(1.2); }
  to { transform: translate(-50%, -50%) rotate(45deg) scale(0.75); }
}

@media (max-width: 760px) {
  .topbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 0;
  }

  .brand,
  .topbar button {
    grid-column: span 2;
  }

  .stat b {
    font-size: 18px;
  }

  .side-panel {
    left: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    max-height: 42vh;
    overflow: auto;
  }

  .landing-panel {
    left: 10px;
    right: 10px;
    top: 162px;
    bottom: auto;
    width: auto;
    max-height: 42vh;
    grid-template-columns: 1fr;
    overflow: auto;
  }
}
