:root {
  --bg: #000;
  --panel: rgba(0, 0, 0, 0.94);
  --panel-soft: rgba(5, 5, 5, 0.86);
  --line: rgba(255, 138, 42, 0.22);
  --line-strong: rgba(255, 138, 42, 0.52);
  --text: #ff9f5a;
  --muted: #8c7b70;
  --cyan: #37e7ff;
  --blue: #4d7dff;
  --mint: #44ffbd;
  --amber: #ffb000;
  --gold: #ff8a2a;
  --orange: #ff6b35;
  --magenta: #ff3d8b;
  --purple: #8f5cff;
  --red: #ff4976;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --display: "Arial Black", Impact, Haettenschweiler, system-ui, sans-serif;
  --pixel-shadow: 4px 4px 0 rgba(0, 0, 0, 0.78);
  --card-shadow: 7px 7px 0 rgba(0, 0, 0, 0.58);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background: #000;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px, rgba(255,255,255,.025) 2px, rgba(255,255,255,.025) 4px);
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.shell {
  width: min(1360px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 44px;
  position: relative;
  z-index: 1;
}

.topbar {
  min-height: 62px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-bottom: 2px solid rgba(255, 138, 42, 0.52);
  background: #000;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.74), 0 0 24px rgba(255, 107, 53, 0.08), inset 0 0 18px rgba(255, 138, 42, 0.025);
  backdrop-filter: blur(18px);
}

.brand {
  padding-left: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mark {
  width: 34px;
  height: 34px;
  border: 1px solid var(--cyan);
  display: grid;
  place-items: center;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 15px;
  box-shadow: 0 0 18px rgba(55, 231, 255, 0.35), inset 0 0 14px rgba(55, 231, 255, 0.16);
}

.logo {
  width: 44px;
  height: 44px;
  display: block;
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, 0.72)) drop-shadow(0 0 14px rgba(55, 231, 255, 0.42));
}

.brand-name {
  font-weight: 850;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: var(--display);
  text-shadow: var(--pixel-shadow);
}

.brand-sub {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.nav {
  display: flex;
  border: 1px solid var(--line);
  background: rgba(8, 18, 30, 0.8);
  padding: 4px;
  gap: 4px;
}

.nav a {
  padding: 8px 13px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav a.active,
.nav a:hover {
  color: #041017;
  background: var(--orange);
  box-shadow: 0 0 16px rgba(255, 107, 53, 0.22);
}

.account-chip {
  justify-self: end;
  padding-right: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #021117;
  background: linear-gradient(135deg, var(--cyan), var(--mint));
  font-family: var(--mono);
  font-weight: 900;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  position: relative;
  overflow: hidden;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.72), 0 24px 80px rgba(0, 0, 0, 0.42), inset 0 0 24px rgba(255, 138, 42, 0.025);
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.035);
}

.hero {
  margin-top: 18px;
  min-height: 560px;
  padding: 32px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 28px;
  align-items: center;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
  pointer-events: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.kicker,
.section-meta,
.label,
.tag {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

h1 {
  margin: 12px 0 18px;
  max-width: 820px;
  font-size: clamp(44px, 8vw, 108px);
  line-height: 0.92;
  letter-spacing: 0;
  text-transform: uppercase;
  font-family: var(--display);
  color: var(--orange);
  text-shadow: 3px 3px 0 rgba(0, 0, 0, 0.78), 0 0 14px rgba(255, 107, 53, 0.24);
}

.lede {
  max-width: 720px;
  color: var(--muted);
  font-size: clamp(16px, 1.8vw, 20px);
}

.actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: rgba(8, 18, 30, 0.78);
  padding: 12px 16px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.58);
}

.btn.primary {
  background: var(--orange);
  color: #021117;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.68), 0 0 20px rgba(255, 107, 53, 0.22);
}

.btn.danger { border-color: rgba(255, 73, 118, 0.55); color: var(--red); }

.timeframe {
  display: inline-flex;
  border: 1px solid var(--line);
  background: rgba(8, 18, 30, 0.72);
  padding: 4px;
  gap: 4px;
}

.timeframe button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 13px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.timeframe button.active {
  background: var(--orange);
  color: #021117;
  box-shadow: 0 0 18px rgba(55, 231, 255, 0.3);
}

.grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 20px 22px 0;
}

.section-title {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-family: var(--display);
  color: var(--orange);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.68);
}

.stat-grid {
  padding: 18px 22px 22px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.stat {
  border: 1px solid rgba(86, 230, 255, 0.14);
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 77, 214, 0.06), rgba(3, 9, 16, 0.42));
}

.stat b {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 7px;
}

.stat span {
  font-family: var(--mono);
  font-size: 19px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.output-viz {
  position: relative;
  min-height: 250px;
  border: 1px solid rgba(86, 230, 255, 0.14);
  background:
    radial-gradient(circle, rgba(255, 138, 42, 0.22) 1px, transparent 2px),
    linear-gradient(rgba(255, 138, 42, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 138, 42, 0.02) 1px, transparent 1px),
    #000;
  background-size: 18px 18px, 100% 42px, 42px 100%, auto;
  overflow: hidden;
}

.output-viz svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.viz-label,
.viz-total,
.viz-axis {
  position: absolute;
  z-index: 1;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.viz-label { left: 18px; top: 15px; color: var(--muted); font-size: 10px; }
.viz-total { right: 18px; top: 14px; color: var(--cyan); font-size: 13px; font-weight: 900; }
.viz-axis {
  left: 18px;
  right: 18px;
  bottom: 14px;
  display: flex;
  justify-content: space-between;
  color: rgba(127, 168, 179, 0.82);
  font-size: 10px;
}

.crt-frame {
  position: relative;
  border: 4px solid rgba(255, 138, 42, 0.72);
  background: #020304;
  padding: 18px;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.7), 0 0 24px rgba(255, 107, 53, 0.12);
}

.crt-frame::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(77, 240, 255, 0.34);
  pointer-events: none;
  z-index: 1;
}

.crt-frame .output-viz {
  min-height: 320px;
}

.crt-buttons {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.crt-buttons span {
  width: 18px;
  height: 18px;
  display: block;
  background: var(--magenta);
  box-shadow: 0 0 10px rgba(255, 77, 214, 0.36);
}

.crt-buttons span:nth-child(2) { background: var(--orange); box-shadow: 0 0 10px rgba(255, 107, 53, 0.42); }
.crt-buttons span:nth-child(3) { background: var(--mint); box-shadow: 0 0 10px rgba(68, 255, 189, 0.48); }

.meter-board {
  padding: 18px 22px 22px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  align-items: end;
  min-height: 170px;
}

.meter-bar {
  min-height: 12px;
  background: linear-gradient(180deg, var(--bar-top, var(--cyan)), var(--bar-bottom, var(--blue)));
  box-shadow: 0 0 16px rgba(55, 231, 255, 0.32);
}

.meter-bar:nth-child(4n+1) { --bar-top: var(--gold); --bar-bottom: #b8960f; }
.meter-bar:nth-child(4n+2) { --bar-top: var(--magenta); --bar-bottom: #722dff; }
.meter-bar:nth-child(4n+3) { --bar-top: var(--cyan); --bar-bottom: var(--blue); }
.meter-bar:nth-child(4n+4) { --bar-top: var(--mint); --bar-bottom: #0e8f72; }

.friend-board {
  padding: 18px 22px 22px;
  overflow-x: auto;
}

.friend-stage {
  min-width: 780px;
  height: 360px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 92px;
  grid-template-columns: none;
  align-items: end;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 138, 42, 0.2);
  background:
    radial-gradient(circle, rgba(255, 138, 42, 0.18) 1px, transparent 2px),
    linear-gradient(180deg, rgba(255, 107, 53, 0.035), rgba(2, 3, 4, 0.34));
  background-size: 18px 18px, auto;
}

.friend-column {
  min-height: 100%;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 10px;
  align-items: end;
}

.friend-meter {
  width: 100%;
  min-height: 30px;
  display: grid;
  grid-template-rows: repeat(18, 1fr);
  gap: 4px;
  align-items: end;
}

.friend-meter i {
  display: block;
  min-height: 8px;
  background: rgba(255, 138, 42, 0.12);
  border: 1px solid rgba(255, 138, 42, 0.14);
}

.friend-meter i.lit {
  background: var(--friend-color, var(--orange));
  border-color: var(--friend-color, var(--orange));
  box-shadow: 0 0 12px color-mix(in srgb, var(--friend-color, var(--orange)) 48%, transparent);
}

.friend-face {
  width: 56px;
  height: 56px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid var(--friend-color, var(--orange));
  background: #08040a;
  color: var(--friend-color, var(--orange));
  font-family: var(--display);
  font-size: 22px;
  box-shadow: 0 0 16px color-mix(in srgb, var(--friend-color, var(--orange)) 38%, transparent);
}

.friend-face:hover {
  transform: translateY(-2px);
}

.friend-name {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-align: center;
  white-space: nowrap;
}

.friend-name:hover,
.handle:hover {
  color: var(--cyan);
}

.friend-output {
  color: var(--orange);
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
  white-space: nowrap;
}

.view-tabs {
  display: flex;
  gap: 8px;
  padding: 18px 22px 0;
}

.view-tabs .btn {
  padding: 9px 12px;
}

[data-board-view="list"].is-hidden,
[data-board-view="visual"].is-hidden {
  display: none;
}

.mega-number {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: clamp(44px, 7vw, 92px);
  line-height: 0.9;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-shadow: var(--pixel-shadow), 0 0 28px rgba(55, 231, 255, 0.42);
}

.leader-row {
  display: grid;
  grid-template-columns: 54px 1fr 142px 170px 98px;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 9px 14px;
  border-top: 1px solid rgba(86, 230, 255, 0.12);
}

.leader-row.you {
  background: linear-gradient(90deg, rgba(55, 231, 255, 0.16), transparent);
  border-left: 2px solid var(--cyan);
}

.pos, .score, .percentile, .model, .hours {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.pos { color: var(--muted); font-weight: 900; }
.score { color: var(--amber); font-weight: 850; text-align: right; }
.percentile { color: var(--cyan); font-weight: 900; text-align: right; }
.model { color: var(--muted); font-size: 12px; text-align: right; }
.hours { color: var(--mint); text-align: right; }

.player { display: flex; align-items: center; gap: 10px; min-width: 0; }
.player .avatar { width: 32px; height: 32px; flex: 0 0 auto; background: rgba(55, 231, 255, 0.12); color: var(--post-color, var(--cyan)); border: 1px solid var(--post-color, rgba(86, 230, 255, 0.32)); }
.handle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 760; }

.profile-card {
  padding: 24px;
  border: 1px solid rgba(86, 230, 255, 0.16);
  background:
    radial-gradient(circle, rgba(255, 138, 42, 0.16) 1px, transparent 2px),
    linear-gradient(180deg, rgba(255, 107, 53, 0.05), rgba(3, 9, 16, 0.48)),
    #000;
  background-size: 20px 20px, auto, auto;
}

.profile-orb {
  width: 78px;
  height: 78px;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  border: 2px solid var(--orange);
  color: var(--orange);
  background: #000;
  font-family: var(--display);
  font-size: 34px;
  box-shadow: 0 0 18px rgba(255, 107, 53, 0.24);
}

.award-grid,
.card-grid {
  padding: 18px 22px 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.award-card,
.info-card,
.post {
  border: 1px solid rgba(86, 230, 255, 0.15);
  background: linear-gradient(180deg, rgba(255, 107, 53, 0.045), rgba(55, 231, 255, 0.025), rgba(3, 9, 16, 0.44));
  padding: 16px;
}

.award-card .callout,
.info-card h3 {
  font-size: 19px;
  line-height: 1.18;
  font-weight: 850;
  margin: 12px 0 10px;
}

.award-card p,
.info-card p,
.post p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.form {
  padding: 18px 22px 22px;
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  border: 1px solid rgba(86, 230, 255, 0.2);
  background: rgba(3, 9, 16, 0.72);
  color: var(--text);
  padding: 12px;
  outline: none;
}

.field textarea { min-height: 110px; resize: vertical; }

.feed {
  padding: 12px 22px 22px;
  display: grid;
  gap: 12px;
}

.post-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.post-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--post-color, var(--orange));
  color: var(--post-color, var(--orange));
  background: #000;
  font-family: var(--display);
  font-size: 14px;
  box-shadow: 0 0 12px color-mix(in srgb, var(--post-color, var(--orange)) 34%, transparent);
}

.post-stat {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.post-meter {
  height: 6px;
  background: rgba(255, 138, 42, 0.12);
  border: 1px solid rgba(255, 138, 42, 0.18);
  overflow: hidden;
}

.post-meter span {
  display: block;
  height: 100%;
  width: var(--meter, 50%);
  background: linear-gradient(90deg, var(--post-color, var(--orange)), var(--cyan));
  box-shadow: 0 0 12px color-mix(in srgb, var(--post-color, var(--orange)) 42%, transparent);
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border-top: 1px solid rgba(86, 230, 255, 0.12);
  padding: 14px 0;
}

.toggle-row p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.switch {
  width: 50px;
  height: 28px;
  border: 1px solid var(--line-strong);
  background: rgba(55, 231, 255, 0.1);
  padding: 3px;
  flex: 0 0 auto;
}

button.switch {
  cursor: pointer;
  font: inherit;
  color: inherit;
  display: block;
  transition: background 0.15s, border-color 0.15s;
}

button.switch:disabled,
button.switch[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
}

.switch::before {
  content: "";
  display: block;
  width: 20px;
  height: 20px;
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(55, 231, 255, 0.5);
  transform: translateX(20px);
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
}

.switch[aria-pressed="false"] {
  background: rgba(127, 168, 179, 0.08);
  border-color: rgba(127, 168, 179, 0.4);
}

.switch[aria-pressed="false"]::before {
  transform: translateX(0);
  background: rgba(127, 168, 179, 0.55);
  box-shadow: none;
}

.is-hidden { display: none !important; }

.account-chip a.signin {
  background: var(--cyan);
  color: #021117;
  padding: 8px 14px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
  box-shadow: 0 0 18px rgba(55, 231, 255, 0.3);
}

.account-chip a.signout {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.account-chip a.signout:hover { color: var(--text); }

.mini-note {
  color: var(--muted);
  font-size: 13px;
  font-family: var(--mono);
}

footer {
  margin-top: 28px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 980px) {
  .topbar, .hero { grid-template-columns: 1fr; }
  .topbar { padding: 14px; }
  .brand, .account-chip { padding: 0; justify-self: start; }
  .nav { width: 100%; justify-content: center; flex-wrap: wrap; }
  .span-3, .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
  .award-grid, .card-grid { grid-template-columns: 1fr 1fr; }
  .leader-row { grid-template-columns: 46px 1fr 110px; }
  .leader-row .model, .leader-row .hours { display: none; }
}

@media (max-width: 620px) {
  .shell { width: min(100vw - 20px, 1360px); padding-top: 10px; }
  .hero { padding: 20px; min-height: auto; }
  .timeframe { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .award-grid, .card-grid, .stat-grid { grid-template-columns: 1fr; }
  .output-viz { min-height: 190px; }
  h1 { font-size: clamp(38px, 15vw, 70px); }
}
