:root {
  --bg: #071019;
  --bg-deep: #02060a;
  --surface: rgba(8, 18, 28, 0.86);
  --surface-soft: rgba(8, 16, 24, 0.8);
  --surface-strong: rgba(6, 12, 18, 0.92);
  --line: rgba(144, 214, 255, 0.14);
  --line-strong: rgba(144, 214, 255, 0.24);
  --text: #edf8ff;
  --text-dim: #9ab6c9;
  --text-soft: #6f8ea5;
  --accent: #68efda;
  --accent-strong: #b8fff0;
  --accent-warm: #ffd66e;
  --accent-violet: #c89aff;
  /* Polished shadow — deeper, softer */
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.52), 0 4px 18px rgba(0, 0, 0, 0.28);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --content-width: 1320px;
  --heading-font: "Avenir Next Condensed", "Trebuchet MS", "PingFang SC", "Microsoft YaHei", sans-serif;
  --body-font: "Avenir Next", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  /* 8-pt spacing rhythm tokens */
  --sp-xs: 8px;
  --sp-sm: 12px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
}

body[data-mode="agent"] {
  --accent: #78ccff;
  --accent-strong: #c2ecff;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  font-family: var(--body-font);
  background:
    linear-gradient(115deg, rgba(255, 214, 110, 0.055), transparent 24%),
    linear-gradient(245deg, rgba(200, 154, 255, 0.075), transparent 28%),
    linear-gradient(180deg, #08131c 0%, #050d15 48%, #02060a 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: -28%;
  pointer-events: none;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

body::before {
  z-index: 0;
  opacity: 0.38;
  background:
    linear-gradient(135deg, transparent 0%, rgba(120, 204, 255, 0.14) 18%, transparent 30%),
    linear-gradient(135deg, transparent 28%, rgba(104, 239, 218, 0.15) 44%, transparent 56%),
    repeating-linear-gradient(
      135deg,
      transparent 0 26px,
      rgba(124, 212, 255, 0.09) 26px 30px,
      transparent 30px 82px
    ),
    repeating-linear-gradient(
      135deg,
      transparent 0 84px,
      rgba(255, 255, 255, 0.06) 84px 88px,
      transparent 88px 160px
    );
  background-size: 260px 260px, 320px 320px, 240px 240px, 420px 420px;
  mix-blend-mode: screen;
  mask-image: linear-gradient(135deg, transparent 0%, rgba(0, 0, 0, 0.95) 34%, rgba(0, 0, 0, 0.45) 76%, transparent 100%);
  animation: stream-flow 28s linear infinite;
}

body::after {
  z-index: 0;
  opacity: 0.28;
  background:
    linear-gradient(135deg, rgba(120, 204, 255, 0.18), transparent 36%),
    linear-gradient(135deg, transparent 44%, rgba(104, 239, 218, 0.22) 62%, transparent 82%),
    radial-gradient(circle at 78% 8%, rgba(255, 255, 255, 0.12), transparent 24%);
  filter: blur(40px);
  animation: stream-glow 26s ease-in-out infinite alternate;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.aurora,
.signal-mesh,
.scanline-layer,
.grid-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.signal-mesh {
  opacity: 0.34;
  background:
    linear-gradient(115deg, transparent 0 38%, rgba(255, 214, 110, 0.12) 38.4%, transparent 39.2%),
    linear-gradient(68deg, transparent 0 52%, rgba(200, 154, 255, 0.11) 52.4%, transparent 53.2%),
    repeating-linear-gradient(115deg, transparent 0 74px, rgba(120, 204, 255, 0.055) 74px 75px, transparent 75px 148px);
  background-size: 760px 760px, 880px 880px, 420px 420px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.18) 68%, transparent);
  animation: mesh-drift 42s linear infinite;
}

.scanline-layer {
  opacity: 0.16;
  background:
    repeating-linear-gradient(180deg, transparent 0 7px, rgba(255, 255, 255, 0.08) 7px 8px, transparent 8px 22px);
  mix-blend-mode: screen;
  animation: scanline-slide 18s linear infinite;
}

.aurora-a {
  /* Slightly dimmer + slower so aurora doesn't compete with content */
  background: radial-gradient(circle at 18% 18%, rgba(104, 239, 218, 0.072), transparent 34%);
  filter: blur(32px);
  animation: aurora-drift-a 32s ease-in-out infinite alternate;
}

.aurora-b {
  background: radial-gradient(circle at 82% 16%, rgba(120, 204, 255, 0.082), transparent 30%);
  filter: blur(32px);
  animation: aurora-drift-b 40s ease-in-out infinite alternate;
}

.grid-overlay {
  background-image:
    linear-gradient(rgba(166, 255, 225, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(166, 255, 225, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 82%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 32px), var(--content-width));
  margin: 0 auto;
  padding: 22px 0 56px;
}

.masthead,
.hero-panel,
.section-card,
.modal-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 24%),
    var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.masthead {
  position: relative;
  overflow: hidden;
  min-height: 390px;
  margin-bottom: 20px;
}

.masthead::before,
.hero-panel::before,
.section-card::before,
.auth-card::before,
.modal-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 18%, transparent 72%, rgba(120, 204, 255, 0.10)),
    linear-gradient(90deg, rgba(104, 239, 218, 0.16), transparent 28%, transparent 72%, rgba(255, 214, 110, 0.10));
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask-composite: xor;
  padding: 1px;
  opacity: 0.74;
}

.masthead-media {
  position: absolute;
  inset: 0;
}

.masthead-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  filter: saturate(1.08) contrast(1.04);
}

.masthead-fade {
  position: absolute;
  inset: 0;
  /* Softer midtone falloff — image reads more clearly until the bottom third */
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(4, 10, 16, 0.06) 28%, rgba(4, 10, 16, 0.32) 58%, rgba(4, 10, 16, 0.88) 100%);
}

.masthead::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 108px;
  background: linear-gradient(180deg, rgba(4, 10, 16, 0), rgba(4, 10, 16, 0.88));
}

.masthead-bar {
  position: absolute;
  inset: auto 0 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 26px 24px;
  background: linear-gradient(180deg, rgba(8, 18, 28, 0), rgba(8, 18, 28, 0.82) 32%, rgba(8, 18, 28, 0.95) 100%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 17px;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(104, 239, 218, 0.14), rgba(120, 204, 255, 0.2));
  border: 1px solid rgba(170, 230, 255, 0.18);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

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

.ghost-button,
.primary-button,
.secondary-button,
.sort-button,
.editor-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 11px 16px;
  /* Combined transition so every button animates smoothly */
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1),
              border-color 160ms ease,
              background 160ms ease,
              box-shadow 160ms ease,
              color 160ms ease,
              opacity 160ms ease;
}

.ghost-button {
  background: rgba(10, 20, 30, 0.68);
  border-color: rgba(153, 216, 255, 0.14);
  color: var(--text-dim);
  /* Subtle inner highlight */
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.ghost-button.is-active,
.sort-button.is-active {
  background: rgba(104, 239, 218, 0.13);
  border-color: rgba(166, 255, 225, 0.26);
  color: var(--text);
}

.ghost-button:hover {
  background: rgba(10, 22, 34, 0.84);
  border-color: rgba(153, 216, 255, 0.22);
  color: var(--text);
}

.secondary-button:hover {
  background: rgba(12, 26, 40, 0.80);
  border-color: rgba(149, 214, 255, 0.28);
  color: var(--text);
}

.primary-button {
  /* Teal-to-cyan gradient with subtle top shine */
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, transparent 40%),
    linear-gradient(135deg, rgba(80, 230, 200, 0.28) 0%, rgba(120, 204, 255, 0.36) 100%);
  border-color: rgba(120, 220, 255, 0.30);
  color: var(--text);
  font-weight: 600;
  box-shadow:
    0 2px 12px rgba(80, 220, 200, 0.10),
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease,
              box-shadow 150ms ease, opacity 150ms ease;
}

.primary-button:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 35%),
    linear-gradient(135deg, rgba(80, 230, 200, 0.38) 0%, rgba(120, 204, 255, 0.46) 100%);
  border-color: rgba(120, 230, 255, 0.50);
  box-shadow:
    0 4px 20px rgba(80, 220, 200, 0.18),
    0 1px 0 rgba(255, 255, 255, 0.12) inset;
}

.secondary-button,
.sort-button,
.editor-tool {
  /* Clearly dimmer than primary but with a hint of teal to stay on-theme */
  background: rgba(8, 20, 32, 0.72);
  border-color: rgba(149, 214, 255, 0.16);
  color: var(--text-dim);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.ghost-button:hover,
.primary-button:hover,
.secondary-button:hover,
.sort-button:hover,
.text-link:hover,
.line-item:hover,
.game-card:hover,
.contact-item:hover,
.editor-tool:hover {
  transform: translateY(-1px);
}

.main-layout {
  display: grid;
  gap: 20px;
}

.hero-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.18fr 0.82fr;
  gap: 20px;
  padding: 24px;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(110deg, transparent 0 9%, rgba(104, 239, 218, 0.07) 9.2%, transparent 9.8%),
    linear-gradient(110deg, transparent 0 62%, rgba(255, 214, 110, 0.07) 62.2%, transparent 62.8%),
    repeating-linear-gradient(110deg, transparent 0 62px, rgba(255, 255, 255, 0.025) 62px 63px, transparent 63px 126px);
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0.34), transparent 64%);
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-strong);
}

.hero-copy .eyebrow {
  display: block;
  padding: 0;
  margin-bottom: 16px;
  border: 0;
  background: transparent;
  /* Slightly cooler purple — sits above the warm gold mission line */
  color: #c89aff;
  font-size: clamp(1.18rem, 2.1vw, 1.72rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: none;
  text-shadow: 0 0 32px rgba(180, 120, 255, 0.22);
}

.hero-copy h1,
.section-heading h2,
.auth-header h2,
.modal-body h3 {
  margin: 0;
  font-family: var(--heading-font);
  line-height: 0.96;
  letter-spacing: 0.04em;
}

.hero-copy h1 {
  font-size: clamp(2.6rem, 4.2vw, 4.6rem);
  max-width: 11ch;
  /* Premium: wider tracking + text glow gives a distinct look */
  letter-spacing: 0.06em;
  text-shadow: 0 2px 32px rgba(180, 240, 255, 0.14), 0 0 8px rgba(104, 239, 218, 0.08);
  font-weight: 900;
  font-feature-settings: "kern" 1, "liga" 1;
}

.hero-mission {
  margin: 16px 0 0;
  max-width: 22ch;
  font-family: var(--heading-font);
  font-size: clamp(1.9rem, 3.2vw, 3rem);
  font-weight: 800;
  letter-spacing: 0.025em;
  line-height: 1.1;
  /* Warmer, richer gold with subtle glow */
  color: #ffe168;
  text-wrap: pretty;
  text-shadow:
    0 0 42px rgba(255, 210, 60, 0.28),
    0 2px 16px rgba(255, 180, 30, 0.18);
}

.hero-mission-line {
  display: block;
}

.hero-mission-line-bottom {
  margin-top: 2px;
}

.hero-mission-highlight {
  display: inline-block;
  margin-right: 0.1em;
  font-size: 1.44em;
  font-weight: 900;
  letter-spacing: 0.01em;
  /* Bright pop — clearly differentiated from the warm body */
  color: #ffcd1a;
  text-shadow:
    0 0 24px rgba(255, 200, 20, 0.50),
    0 0 8px rgba(255, 220, 60, 0.35);
  /* Slight upward baseline shift for emphasis */
  vertical-align: 0.02em;
}

.hero-mission-tail {
  display: inline;
}

.hero-subtitle,
.section-note,
#authSubtitle,
.session-meta,
.modal-meta,
.contact-label,
.feedback-message {
  color: var(--text-dim);
}

.hero-subtitle {
  margin: 14px 0 18px;
  max-width: 48ch;
  line-height: 1.7;
}

.hero-signal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 20px;
}

.hero-signal {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.hero-signal-warning {
  border-color: rgba(255, 208, 124, 0.2);
  background: linear-gradient(135deg, rgba(255, 181, 95, 0.16), rgba(120, 204, 255, 0.12));
  color: #fff2d6;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.leaderboard-panel {
  position: relative;
  overflow: hidden;
  margin-top: 24px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(149, 224, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 28%),
    rgba(5, 12, 18, 0.86);
}

.leaderboard-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 214, 110, 0.08), transparent 28%),
    repeating-linear-gradient(90deg, transparent 0 38px, rgba(120, 204, 255, 0.035) 38px 39px, transparent 39px 78px);
  opacity: 0.72;
}

.leaderboard-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.leaderboard-heading h2 {
  font-size: clamp(1.28rem, 2vw, 1.58rem);
}

.leaderboard-summary {
  color: var(--accent-strong);
  font-size: 0.94rem;
  line-height: 1.6;
  text-align: right;
}

.leaderboard-feed {
  display: grid;
  gap: 8px;
}

.leaderboard-row {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(149, 224, 255, 0.09);
  background: rgba(7, 16, 24, 0.82);
  transition: border-color 180ms ease, background 180ms ease;
}

.leaderboard-row::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(104, 239, 218, 0.08), transparent);
  transform: translateX(-120%);
  transition: transform 520ms ease;
}

.leaderboard-row:hover::after {
  transform: translateX(120%);
}

.leaderboard-row:hover {
  border-color: rgba(104, 239, 218, 0.18);
  background: rgba(10, 22, 34, 0.90);
}

.leaderboard-row.is-current {
  border-color: rgba(104, 239, 218, 0.24);
  background: linear-gradient(135deg, rgba(104, 239, 218, 0.08), rgba(120, 204, 255, 0.08));
}

.leaderboard-rank {
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: var(--heading-font);
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
  /* Default — ranks 4+ */
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}

/* Gold / Silver / Bronze medal tints */
.leaderboard-row:nth-child(1) .leaderboard-rank {
  background: rgba(255, 200, 30, 0.14);
  border-color: rgba(255, 200, 30, 0.36);
  color: #ffd94d;
  box-shadow: 0 0 10px rgba(255, 200, 30, 0.18) inset;
}

.leaderboard-row:nth-child(2) .leaderboard-rank {
  background: rgba(180, 200, 220, 0.12);
  border-color: rgba(200, 215, 230, 0.32);
  color: #c8dce8;
  box-shadow: 0 0 10px rgba(190, 210, 228, 0.14) inset;
}

.leaderboard-row:nth-child(3) .leaderboard-rank {
  background: rgba(200, 140, 80, 0.13);
  border-color: rgba(210, 155, 90, 0.30);
  color: #d4a06a;
  box-shadow: 0 0 10px rgba(200, 140, 80, 0.15) inset;
}

.leaderboard-main {
  min-width: 0;
}

.leaderboard-name {
  font-size: 0.98rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-meta {
  margin-top: 5px;
  color: var(--text-soft);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-points {
  display: grid;
  justify-items: end;
  gap: 4px;
}

.leaderboard-points-value {
  font-family: var(--heading-font);
  font-size: 1.12rem;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--accent-strong);
}

.leaderboard-points-label {
  color: var(--text-soft);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.metric-card {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 0%, rgba(120, 204, 255, 0.07), transparent 70%),
    rgba(6, 15, 23, 0.86);
  border: 1px solid rgba(152, 206, 255, 0.13);
  /* Smooth hover lift */
  transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
              border-color 200ms ease,
              box-shadow 200ms ease;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 214, 110, 0.08), transparent 34%),
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(255, 255, 255, 0.035) 18px 19px, transparent 19px 38px);
  opacity: 0.58;
}

.metric-card:hover {
  transform: translateY(-3px);
  border-color: rgba(152, 206, 255, 0.28);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.36),
    0 0 0 1px rgba(104, 239, 218, 0.08) inset,
    0 0 18px rgba(104, 239, 218, 0.06) inset;
}

.metric-value {
  display: block;
  font-size: clamp(1.2rem, 2.8vw, 2rem);
  font-family: var(--heading-font);
  letter-spacing: 0.04em;
  /* Tabular nums keep counters from jittering */
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  color: var(--accent-strong);
  line-height: 1.1;
}

.metric-label {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.auth-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(120, 204, 255, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(255, 214, 110, 0.055), transparent 36%),
    rgba(7, 16, 25, 0.86);
}

.auth-badge,
.category-pill,
.status-pill,
.inline-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(120, 204, 255, 0.12);
  border: 1px solid rgba(120, 204, 255, 0.18);
  color: var(--accent-strong);
}

.inline-status.user-live {
  background: rgba(104, 239, 218, 0.11);
  border-color: rgba(104, 239, 218, 0.18);
}

.auth-header p {
  margin: 10px 0 0;
  line-height: 1.65;
}

.auth-card.is-signed-in .auth-header h2 {
  font-size: clamp(2rem, 3vw, 2.8rem);
  color: var(--text);
}

.auth-card.is-signed-in .auth-header {
  margin-bottom: 6px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.auth-tab {
  border-radius: 999px;
  border: 1px solid rgba(150, 207, 255, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-dim);
  padding: 10px 16px;
}

.auth-tab.active {
  color: var(--text);
  border-color: rgba(149, 224, 255, 0.28);
  background: rgba(104, 239, 218, 0.12);
}

.auth-form,
.modal-composer-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.auth-form label,
.modal-composer-form label {
  display: grid;
  gap: 8px;
}

.auth-form span,
.modal-composer-form span,
.editor-label {
  color: var(--text-dim);
  font-size: 0.9rem;
}

input,
select,
textarea {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(140, 216, 255, 0.16);
  background: rgba(6, 14, 21, 0.92);
  color: var(--text);
  padding: 13px 14px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(120, 204, 255, 0.24);
  border-color: rgba(120, 204, 255, 0.28);
}

.session-panel {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.session-line {
  font-size: 1.02rem;
}

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

.profile-chip {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(149, 224, 255, 0.11);
  background: rgba(5, 12, 18, 0.78);
}

.profile-chip-label {
  display: block;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.profile-chip-value {
  display: block;
  margin-top: 8px;
  font-family: var(--heading-font);
  font-size: 1.18rem;
  letter-spacing: 0.04em;
}

.session-actions {
  display: grid;
  gap: 10px;
}

.text-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}

.session-logout {
  justify-self: start;
  margin-top: 2px;
  font-size: 0.92rem;
}

.session-logout:hover {
  color: var(--accent-strong);
}

.full-width {
  width: 100%;
}

.feedback-message {
  min-height: 22px;
  margin: 4px 0 0;
  line-height: 1.6;
}

.section-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading h2 {
  font-size: clamp(1.46rem, 2.7vw, 2.08rem);
}

.toolbar-card {
  padding-block: 18px;
}

.toolbar-heading {
  margin-bottom: 0;
}

.compact-heading h2 {
  font-size: clamp(1.28rem, 2vw, 1.6rem);
}

.section-heading-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.section-note {
  max-width: 42ch;
  line-height: 1.65;
}

.text-link {
  color: var(--accent-strong);
  font-size: 0.94rem;
}

.sort-switch {
  display: inline-flex;
  gap: 10px;
}

.games-grid,
.contact-grid,
.feed-grid {
  display: grid;
  gap: 16px;
}

.games-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.feed-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.lower-grid {
  grid-template-columns: 1fr;
}

.game-card,
.contact-item,
.line-item,
.empty-state {
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
  border: 1px solid rgba(149, 224, 255, 0.1);
}

.game-card {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 14px;
  min-height: 236px;
  padding: 20px;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
              border-color 220ms ease,
              box-shadow 220ms ease;
}

.game-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.075), transparent 24%),
    linear-gradient(315deg, rgba(255, 214, 110, 0.075), transparent 38%);
  opacity: 0.78;
}

.game-card::after {
  content: "";
  position: absolute;
  top: -20%;
  bottom: -20%;
  width: 34%;
  left: -42%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
  transform: skewX(-18deg);
  transition: left 620ms cubic-bezier(0.22, 1, 0.36, 1);
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(104, 239, 218, 0.36);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.44),
    0 0 0 1px rgba(104, 239, 218, 0.08) inset;
}

.game-card:hover::after {
  left: 112%;
}

.game-card.shadow {
  opacity: 0.78;
  filter: saturate(0.12);
  background: rgba(15, 18, 24, 0.88);
}

.game-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.game-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), transparent 44%),
    linear-gradient(135deg, rgba(104, 239, 218, 0.13), rgba(120, 204, 255, 0.16));
  border: 1px solid rgba(149, 224, 255, 0.15);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.035) inset, 0 12px 34px rgba(0, 0, 0, 0.22);
}

.game-icon::before,
.game-icon::after {
  content: "";
  position: absolute;
}

.game-icon.cards::before {
  width: 20px;
  height: 28px;
  border-radius: 7px;
  border: 2px solid rgba(255, 255, 255, 0.84);
  transform: rotate(-8deg);
}

.game-icon.cards::after {
  width: 20px;
  height: 28px;
  border-radius: 7px;
  border: 2px solid rgba(104, 239, 218, 0.92);
  transform: translate(7px, 5px) rotate(8deg);
}

.game-icon.tiles::before,
.game-icon.tiles::after {
  width: 14px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.06));
}

.game-icon.tiles::before {
  transform: translate(-9px, 0);
}

.game-icon.tiles::after {
  transform: translate(9px, 0);
}

.game-icon.chips::before,
.game-icon.chips::after {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(255, 214, 124, 0.88);
}

.game-icon.chips::after {
  transform: translate(8px, 8px);
  border-color: rgba(104, 239, 218, 0.88);
}

.game-icon.orbit::before {
  width: 30px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  transform: rotate(30deg);
}

.game-icon.orbit::after {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(104, 239, 218, 0.5);
  transform: translate(9px, -6px);
}

.game-icon.dice::before {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.84);
}

.game-icon.dice::after {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    -7px -7px 0 rgba(255, 255, 255, 0.92),
    7px 7px 0 rgba(255, 255, 255, 0.92),
    -7px 7px 0 rgba(255, 255, 255, 0.92),
    7px -7px 0 rgba(255, 255, 255, 0.92);
}

.game-icon.spark::before {
  width: 30px;
  height: 30px;
  clip-path: polygon(50% 0%, 63% 36%, 100% 50%, 64% 64%, 50% 100%, 36% 64%, 0% 50%, 37% 36%);
  background: linear-gradient(135deg, rgba(255, 214, 124, 0.88), rgba(104, 239, 218, 0.7));
}

.status-pill.live {
  background: rgba(104, 239, 218, 0.12);
  color: var(--accent-strong);
}

.status-pill.shadow {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(235, 243, 250, 0.76);
}

.game-title {
  margin: 0;
  font-size: 1.18rem;
}

.game-description {
  margin: 0;
  line-height: 1.7;
  color: var(--text-dim);
  min-height: 3.4em;
}

.compact-card {
  padding-bottom: 18px;
}

.line-list {
  display: grid;
  gap: 10px;
}

.line-item {
  width: 100%;
  appearance: none;
  text-align: left;
  color: inherit;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  padding: 15px 16px;
  /* Separator between items */
  border-bottom: 1px solid rgba(149, 214, 255, 0.07);
  transition: background 180ms ease, border-color 180ms ease;
  border-radius: 0;
}

.line-item:last-child {
  border-bottom: none;
}

.line-item:hover {
  background: rgba(104, 239, 218, 0.04);
  /* Match border colour to accent on hover */
  border-bottom-color: rgba(104, 239, 218, 0.12);
}

.line-item-main {
  min-width: 0;
}

.line-item-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.line-item-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.97rem;
  font-weight: 500;
  line-height: 1.5;
}

.line-item-summary {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.line-item-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--text-soft);
}

.line-item-action {
  font-size: 0.92rem;
  color: var(--accent-strong);
  white-space: nowrap;
  align-self: center;
}

.line-list.expanded .line-item {
  padding-block: 16px;
}

.empty-state {
  padding: 16px;
  line-height: 1.65;
  color: var(--text-dim);
}

.contact-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contact-grid-modal {
  margin-top: 8px;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
}

.contact-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-strong);
}

.contact-value {
  font-size: 1.08rem;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 10, 0.82);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 32px), 920px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  padding: 24px;
}

.detail-modal,
.composer-modal,
.guide-modal,
.contact-modal {
  width: min(calc(100% - 32px), 900px);
}

.guide-hero {
  margin-bottom: 18px;
}

.guide-lead {
  margin: 12px 0 0;
  color: var(--text-dim);
  line-height: 1.7;
}

.signal-card {
  margin-bottom: 18px;
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(104, 239, 218, 0.22);
  background:
    radial-gradient(circle at 0 50%, rgba(104, 239, 218, 0.16), transparent 26%),
    linear-gradient(135deg, rgba(104, 239, 218, 0.08), rgba(120, 204, 255, 0.08));
  box-shadow: 0 0 32px rgba(104, 239, 218, 0.08);
}

.signal-card-tag {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-strong);
  border: 1px solid rgba(104, 239, 218, 0.24);
  background: rgba(104, 239, 218, 0.08);
}

.signal-card-title {
  margin-top: 12px;
  font-family: var(--heading-font);
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  letter-spacing: 0.04em;
}

.signal-card-text {
  margin-top: 10px;
  color: var(--text-dim);
  line-height: 1.7;
}

.guide-steps {
  display: grid;
  gap: 12px;
}

.guide-step {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(149, 224, 255, 0.11);
  background: rgba(6, 14, 21, 0.84);
}

.guide-step-index {
  min-width: 48px;
  font-family: var(--heading-font);
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  color: var(--accent-strong);
}

.guide-step-main h4 {
  margin: 0;
  font-size: 1.02rem;
}

.guide-step-main p {
  margin: 8px 0 0;
  color: var(--text-dim);
  line-height: 1.7;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 1.4rem;
}

.modal-body {
  padding-right: 10px;
}

.modal-body h3 {
  font-size: clamp(1.86rem, 4vw, 2.7rem);
}

.modal-meta {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.modal-content {
  margin-top: 18px;
  line-height: 1.85;
  color: var(--text-dim);
}

.modal-content p,
.modal-content ul,
.modal-content ol,
.modal-content blockquote {
  margin: 0 0 1em;
}

.modal-content blockquote {
  border-left: 3px solid rgba(120, 204, 255, 0.28);
  padding-left: 14px;
  color: var(--text);
}

.list-modal-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.editor-shell {
  display: grid;
  gap: 10px;
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.editor-tool {
  padding: 9px 12px;
}

.rich-editor {
  min-height: 260px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(140, 216, 255, 0.16);
  background: rgba(6, 14, 21, 0.92);
  color: var(--text);
  padding: 14px;
  line-height: 1.8;
  outline: none;
}

.rich-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-soft);
}

[hidden] {
  display: none !important;
}

@keyframes stream-flow {
  from {
    transform: translate3d(8%, -8%, 0) rotate(-12deg);
  }
  to {
    transform: translate3d(-8%, 8%, 0) rotate(-12deg);
  }
}

@keyframes stream-glow {
  from {
    transform: translate3d(6%, -6%, 0) rotate(-8deg);
  }
  to {
    transform: translate3d(-6%, 6%, 0) rotate(-10deg);
  }
}

@keyframes aurora-drift-a {
  from {
    transform: translate3d(3%, -3%, 0);
  }
  to {
    transform: translate3d(-4%, 4%, 0);
  }
}

@keyframes aurora-drift-b {
  from {
    transform: translate3d(3%, -3%, 0);
  }
  to {
    transform: translate3d(-4%, 4%, 0);
  }
}

@keyframes mesh-drift {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-70px, 46px, 0);
  }
}

@keyframes scanline-slide {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(0, 44px, 0);
  }
}

.site-footer {
  text-align: center;
  padding: 32px 16px 24px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.8;
  border-top: 1px solid var(--line);
  margin-top: 48px;
}

.site-footer a {
  color: var(--accent);
}

@media (max-width: 1120px) {
  .hero-panel,
  .feed-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .games-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .app-shell {
    width: min(calc(100% - 20px), var(--content-width));
    padding-top: 16px;
  }

  .masthead {
    min-height: 280px;
  }

  .section-heading,
  .toolbar-heading,
  .leaderboard-heading,
  .section-heading-actions,
  .list-modal-header {
    flex-direction: column;
    align-items: start;
  }

  .metrics-grid,
  .profile-grid {
    grid-template-columns: 1fr 1fr;
  }

  .topbar-actions,
  .sort-switch {
    width: 100%;
  }

  .sort-button {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  .line-item {
    grid-template-columns: 1fr;
  }

  .leaderboard-row {
    grid-template-columns: auto 1fr;
  }

  .guide-step {
    grid-template-columns: 1fr;
  }

  .leaderboard-points {
    grid-column: 1 / -1;
    justify-items: start;
    margin-left: 60px;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: calc(100% - 12px);
    padding: 10px 0 40px;
  }

  /* Masthead: image area — no nav inside, just the image */
  .masthead {
    min-height: auto;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin-bottom: 0;
    overflow: hidden;
  }

  .masthead-media {
    position: relative;
    inset: auto;
  }

  .masthead-media img {
    display: block;
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center 26%;
  }

  .masthead-fade {
    display: none;
  }

  .masthead::after {
    display: none;
  }

  /* Nav bar: sits below the image as a normal-flow bar */
  .masthead-bar {
    position: relative;
    inset: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--surface-strong);
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    margin-bottom: 14px;
  }

  .masthead-bar .brand {
    margin-right: auto;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .topbar-actions {
    gap: 6px;
    width: auto;
    flex: 1;
    justify-content: flex-end;
  }

  .ghost-button,
  .primary-button,
  .secondary-button,
  .sort-button {
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
  }

  .hero-panel {
    padding: 16px;
    gap: 14px;
    border-radius: var(--radius-lg);
  }

  .section-card {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .hero-copy .eyebrow {
    font-size: 1rem;
    margin-bottom: 10px;
  }

  .hero-copy h1 {
    max-width: none;
    font-size: clamp(1.8rem, 9vw, 2.6rem);
    line-height: 1.05;
  }

  .hero-mission {
    font-size: clamp(1.4rem, 6vw, 2rem);
    margin-top: 10px;
  }

  .hero-mission-highlight {
    font-size: 1.2em;
  }

  .hero-subtitle {
    font-size: 14px;
    margin: 10px 0 14px;
    max-width: none;
  }

  .hero-signal {
    min-height: 36px;
    padding: 8px 14px;
    font-size: 13px;
  }

  .hero-signal-row {
    margin-bottom: 14px;
  }

  .metrics-grid,
  .profile-grid,
  .games-grid,
  .contact-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .metric-card {
    padding: 12px;
  }

  .metric-value {
    font-size: 1.4rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .section-heading h2 {
    font-size: 1.3rem;
  }

  .modal-card {
    width: calc(100% - 16px);
    max-height: calc(100vh - 24px);
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .detail-modal,
  .composer-modal,
  .guide-modal,
  .contact-modal {
    width: calc(100% - 16px);
  }

  .modal-content {
    font-size: 14px;
    line-height: 1.7;
  }

  .leaderboard-summary {
    text-align: left;
  }

  .leaderboard-points {
    margin-left: 0;
  }

  .leaderboard-row {
    font-size: 14px;
    gap: 8px;
  }

  .line-item {
    padding: 10px 0;
  }

  .main-layout {
    gap: 14px;
  }

  .site-footer {
    margin-top: 32px;
    padding: 20px 12px 18px;
    font-size: 12px;
  }

  /* Auth card mobile */
  .auth-header h2 {
    font-size: 1.2rem;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  textarea {
    font-size: 16px; /* prevent iOS zoom on focus */
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

/* Extra small phones */
@media (max-width: 400px) {
  .app-shell {
    width: calc(100% - 8px);
  }

  .hero-panel,
  .section-card {
    padding: 12px;
  }

  .masthead {
    min-height: 160px;
  }

  .masthead-bar {
    padding: 8px;
    gap: 6px;
  }

  .ghost-button,
  .primary-button,
  .secondary-button {
    padding: 7px 10px;
    font-size: 12px;
  }

  .hero-copy h1 {
    font-size: 1.6rem;
  }

  .hero-mission {
    font-size: 1.2rem;
  }

  .metrics-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .ghost-button,
  .primary-button,
  .secondary-button {
    padding: 7px 10px;
    font-size: 12px;
  }
}

/* ===== How-to-enter DDZ modal ===== */
.howto-modal {
  max-width: 820px;
  width: 92vw;
}
/* Shrink modal title so "如何让我的AI Agent进入斗地主游戏" fits on one line */
.howto-modal h3 {
  font-size: 18px;
  line-height: 1.35;
  margin: 6px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 540px) {
  .howto-modal h3 {
    font-size: 15px;
    white-space: normal;
  }
}
.howto-subtitle {
  margin: 6px 0 0;
  color: rgba(205, 232, 245, 0.75);
  font-size: 14px;
}
.howto-step {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}
.howto-pick-btn {
  font-size: 16px;
  font-weight: 700;
  padding: 14px 16px;
}
.howto-back-btn {
  font-size: 14px;
  opacity: 0.85;
  flex: 0 0 auto;
}
.howto-prompt-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}
.howto-intro,
.howto-outro {
  background: rgba(6, 18, 28, 0.58);
  /* Warm teal-to-gold gradient on the left bar */
  border-left: 3px solid;
  border-image: linear-gradient(180deg, rgba(104, 239, 218, 0.80), rgba(255, 200, 60, 0.55)) 1;
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  color: #e8f8ff;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.howto-outro {
  margin-top: 4px;
  color: rgba(205, 232, 245, 0.9);
}
.howto-outro:empty,
.howto-intro:empty {
  display: none;
}
.howto-steps-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 14px 0;
}
.howto-step-card {
  position: relative;
  background: rgba(6, 18, 28, 0.72);
  border: 1.5px solid rgba(108, 241, 255, 0.38);
  border-radius: 12px;
  padding: 14px 48px 14px 16px;  /* right padding reserved for copy icon */
  box-shadow: 0 2px 14px rgba(34, 200, 240, 0.08);
}
.howto-step-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.howto-step-body > *:first-child {
  margin-top: 0;
}
.howto-step-pretext,
.howto-step-posttext {
  margin: 0;
  font-size: 15px;
  line-height: 1.65;
  color: #e8f8ff;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.howto-step-posttext {
  color: rgba(205, 232, 245, 0.92);
  font-size: 14px;
}
.howto-step-label {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #e8f8ff;
  line-height: 1.35;
}
/* Copy icon button: pinned to top-right of the step card */
.howto-step-copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  /* Increased from 32×32 to 36×36 for easier tap target */
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(108, 241, 255, 0.11);
  border: 1px solid rgba(108, 241, 255, 0.42);
  border-radius: 9px;
  color: #cdeaf5;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.howto-step-copy-btn:hover {
  background: rgba(108, 241, 255, 0.22);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 241, 255, 0.18);
}
/* Clean focus ring — no default outline */
.howto-step-copy-btn:focus-visible {
  outline: 2px solid rgba(108, 241, 255, 0.70);
  outline-offset: 2px;
}
.howto-step-copy-btn.is-copied {
  background: rgba(80, 220, 140, 0.22);
  border-color: rgba(80, 220, 140, 0.6);
  color: #b8f5d0;
  box-shadow: 0 0 10px rgba(80, 220, 140, 0.18);
}
.howto-step-copy-btn svg {
  display: block;
}
.howto-step-code {
  margin: 0;
  background: rgba(2, 10, 18, 0.85);
  border: 1px solid rgba(108, 241, 255, 0.2);
  border-radius: 8px;
  padding: 12px 14px;
  max-height: 260px;
  overflow: auto;
}
.howto-step-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-style: italic;
  font-size: 14px;
  line-height: 1.6;
  color: #cdeaf5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  display: block;
}
.howto-modal .modal-body {
  max-height: 80vh;
  overflow-y: auto;
}

/* Single-shot test prompt box (bbIMSB / bbMBTI onboarding) — no italic */
.howto-test-card {
  margin-top: 14px;
}
.howto-test-prompt {
  margin: 0;
  background: rgba(2, 10, 18, 0.85);
  border: 1px solid rgba(108, 241, 255, 0.2);
  border-radius: 8px;
  padding: 14px 16px;
  max-height: 60vh;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  line-height: 1.6;
  color: #e8f8ff;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}

/* DDZ card top-right pill: clickable button, constrained to stay within the card */
.status-pill-howto {
  cursor: pointer;
  border: 1px solid rgba(108, 241, 255, 0.55);
  background: rgba(108, 241, 255, 0.10);
  color: #cdeaf5;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;              /* reset parent .status-pill's tracking */
  text-transform: none;           /* keep "bb" lowercase instead of auto-uppercasing */
  padding: 5px 11px;
  border-radius: 999px;
  white-space: normal;
  max-width: 64%;
  text-align: center;
  /* Arrow appended via ::after */
  transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
  font-family: inherit;
}
/* Inviting arrow */
.status-pill-howto::after {
  content: " →";
  opacity: 0.72;
  font-size: 0.95em;
  display: inline;
}
.status-pill-howto:hover {
  background: rgba(108, 241, 255, 0.20);
  border-color: rgba(108, 241, 255, 0.80);
  transform: translateY(-1px);
  animation: pill-pulse 1.2s ease-in-out infinite;
}

/* Subtle breathing pulse on hover */
@keyframes pill-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(108, 241, 255, 0); }
  50%       { box-shadow: 0 0 8px 2px rgba(108, 241, 255, 0.22); }
}

/* ===== UI refresh overrides: tighter, calmer operational interface ===== */
:root {
  --surface: rgba(8, 18, 28, 0.9);
  --surface-soft: rgba(8, 18, 28, 0.82);
  --surface-strong: rgba(6, 14, 22, 0.94);
  --line: rgba(160, 220, 255, 0.16);
  --line-strong: rgba(160, 220, 255, 0.28);
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.42), 0 2px 12px rgba(0, 0, 0, 0.25);
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 8px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.rich-editor:focus-visible {
  outline: 2px solid rgba(104, 239, 218, 0.55);
  outline-offset: 3px;
}

.aurora-a,
.aurora-b {
  opacity: 0.72;
}

/* ===== Performance overrides (smooth + still alive) =====
   Strategy: keep ONLY the cheapest visual movement (the two .aurora radial
   gradients drifting with transform-only) and kill everything that costs
   real GPU work each frame:
     - filter:blur(32-40px) on body::after / .aurora-a / .aurora-b
       → blur is a per-frame full-viewport pixel pass, dominant cost.
     - mix-blend-mode:screen on body::before / .scanline-layer
       → forces compositing of full-screen layer each frame.
     - looping animations on body::before / body::after / .signal-mesh /
       .scanline-layer → not visually critical, skip the work.
   Result: page still feels alive (slow drifting glow) without the GPU
   thrash that caused scroll lag. Transform-only animations on layers that
   are promoted (will-change: transform) stay cheap. */

/* ===== Smooth + visibly alive =====
   Keep all decorative layers GPU-friendly (transform-only animations, no
   filter/blur, no mix-blend-mode), but make the movement actually
   *perceptible* by raising base opacity and widening the translate range.
   Layer rasterization happens once; subsequent frames are pure GPU
   compositor work, which is cheap regardless of the layer's gradient
   content. */

body::after {
  animation: none !important;
}

/* body::before stays animated (stream-flow) — pure transform-only, the
   browser only re-translates the already-rasterized layer. We just kill
   mix-blend-mode (the actual scroll-lag source) and crank opacity so it's
   visible without the additive blend. */
body::before {
  mix-blend-mode: normal !important;
  opacity: 0.6 !important;
  animation-duration: 50s !important;
}

.signal-mesh {
  animation-duration: 80s !important;
  opacity: 0.45 !important;
}

body::before,
body::after,
.signal-mesh,
.aurora,
.aurora-a,
.aurora-b,
.grid-overlay {
  contain: layout paint style;
}

/* Scanline: drop mix-blend-mode, raise opacity, and use a subtly tinted
   highlight (warm white) so lines are visible against dark bg without
   needing screen blend. Movement was set to 44px over 36s on a 22px-period
   pattern (visually static). Override the keyframe range below. */
.scanline-layer {
  contain: layout paint style;
  mix-blend-mode: normal !important;
  opacity: 0.32 !important;
  animation: scanline-slide-visible 28s linear infinite !important;
}

@keyframes scanline-slide-visible {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, 220px, 0); }
}

/* Promote the scrolling content + every card-like surface into its own GPU
   compositor layer. With `contain: layout paint`, scrolling never makes the
   browser repaint sibling cards, and `transform: translateZ(0)` on the
   scroll container itself keeps the entire content layer GPU-composited. */
.app-shell {
  transform: translateZ(0);
  will-change: transform;
}

.masthead,
.hero-panel,
.section-card,
.auth-card,
.modal-card,
.game-card,
.line-item,
.profile-chip,
.empty-state,
.contact-item,
.metric-card,
.leaderboard-panel {
  contain: layout paint;
}

body::after {
  filter: none !important;
}

/* Aurora keeps drifting (transform-only, GPU layer) but loses the blur. */
/* Aurora: drop the blur (was the heaviest cost) but make up for it by
   bumping the gradient alpha and widening the keyframe translate range
   so the drift is actually visible. */
.aurora-a {
  filter: none !important;
  background: radial-gradient(circle at 22% 18%, rgba(104, 239, 218, 0.18), transparent 38%) !important;
  animation: aurora-drift-a-visible 50s ease-in-out infinite alternate !important;
}
.aurora-b {
  filter: none !important;
  background: radial-gradient(circle at 78% 16%, rgba(120, 204, 255, 0.20), transparent 38%) !important;
  animation: aurora-drift-b-visible 60s ease-in-out infinite alternate !important;
}
@keyframes aurora-drift-a-visible {
  from { transform: translate3d(8%, -6%, 0); }
  to   { transform: translate3d(-10%, 8%, 0); }
}
@keyframes aurora-drift-b-visible {
  from { transform: translate3d(-6%, -8%, 0); }
  to   { transform: translate3d(8%, 6%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

.masthead {
  min-height: 360px;
}

.masthead-fade {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(4, 10, 16, 0.08) 34%, rgba(4, 10, 16, 0.36) 64%, rgba(4, 10, 16, 0.92) 100%);
}

.hero-panel {
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
}

.auth-card,
.leaderboard-panel,
.metric-card,
.game-card,
.contact-item,
.empty-state,
.profile-chip {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.primary-button,
.secondary-button,
.ghost-button,
.sort-button,
.auth-tab,
.editor-tool {
  border-radius: var(--radius-sm);
}

.primary-button {
  font-weight: 700;
}

.auth-tabs {
  background: rgba(3, 10, 16, 0.7);
  border: 1px solid rgba(149, 224, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 5px;
  gap: 5px;
}

.auth-tab {
  border-color: transparent;
}

.auth-tab.active {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.game-card {
  min-height: 216px;
  align-content: start;
}

.game-description {
  min-height: auto;
}

.line-list {
  gap: 8px;
}

.line-item {
  border: 1px solid rgba(149, 224, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(7, 16, 24, 0.55);
  padding: 13px 14px;
}

.line-item:hover {
  border-color: rgba(104, 239, 218, 0.18);
}

.line-item:last-child {
  border-bottom: 1px solid rgba(149, 224, 255, 0.08);
}

.modal-card {
  border-color: var(--line-strong);
}

.modal-close {
  border-radius: var(--radius-sm);
}

.howto-modal {
  width: min(calc(100% - 32px), 900px);
}

.howto-step-card,
.howto-test-prompt,
.howto-step-code {
  border-radius: var(--radius-sm);
}

.howto-step-card {
  border-color: rgba(108, 241, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 30%),
    rgba(5, 14, 22, 0.82);
}

.howto-step-copy-btn {
  border-radius: var(--radius-sm);
}

.howto-test-prompt,
.howto-step-code {
  background: rgba(2, 8, 14, 0.92);
  border-color: rgba(108, 241, 255, 0.18);
}

@media (max-width: 1120px) {
  .hero-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .masthead {
    border-radius: var(--radius-lg);
  }

  .topbar-actions {
    flex-basis: 100%;
  }

  .ghost-button,
  .primary-button,
  .secondary-button,
  .sort-button {
    min-height: 38px;
  }

  .line-item {
    padding: 12px;
  }
}

/* ============================================================
   ===== UI v3 — Premium polish (zero per-frame cost) =====
   Principles:
   - Static gradients / one-shot entrance animations / hover-only
     micro-interactions. Nothing new animates continuously except
     two tiny elements (live dot, ~8px).
   - Scroll-reveal is IntersectionObserver-driven, transform/opacity
     only, fires once per element then unobserves.
   ============================================================ */

/* --- Viewport top hairline: static fixed 2px gradient --- */
html::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 60;
  pointer-events: none;
  background: linear-gradient(90deg,
    transparent 2%,
    rgba(104, 239, 218, 0.65) 24%,
    rgba(120, 204, 255, 0.85) 50%,
    rgba(200, 154, 255, 0.65) 76%,
    transparent 98%);
  opacity: 0.85;
}

/* --- Custom scrollbar + selection: free premium touches --- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(4, 10, 16, 0.6); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(104, 239, 218, 0.28), rgba(120, 204, 255, 0.24));
  border-radius: 8px;
  border: 2px solid rgba(4, 10, 16, 0.8);
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(120, 214, 255, 0.4); }
::selection { background: rgba(104, 239, 218, 0.32); color: #fff; }

/* --- Film grain: piggyback on the already-animated scanline layer.
       Same composited layer = zero extra per-frame cost. Tile is 110px,
       loop distance 220px = exact 2 tiles → seamless. --- */
.scanline-layer {
  inset: -240px 0 0 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='110' height='110'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.34 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E") repeat,
    repeating-linear-gradient(180deg, transparent 0 7px, rgba(255, 255, 255, 0.07) 7px 8px, transparent 8px 22px);
  opacity: 0.26 !important;
}

/* --- Hero title: gradient ink + one-shot sheen sweep on load --- */
.hero-copy h1 {
  background: linear-gradient(120deg,
    #f2fdff 0%, #c8fff2 30%, #8fd8ff 58%, #d8b8ff 92%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #eafcff; /* fallback */
  text-shadow: none;
  filter: drop-shadow(0 2px 18px rgba(120, 214, 255, 0.18));
  animation: title-sheen 1.7s cubic-bezier(0.22, 1, 0.36, 1) 0.25s 1 both;
}
@keyframes title-sheen {
  from { background-position: 130% 0; }
  to   { background-position: 0% 0; }
}

/* Signature underline bar below the hero title */
.hero-copy h1::after {
  content: "";
  display: block;
  width: 76px;
  height: 3px;
  margin-top: 18px;
  border-radius: 3px;
  background: linear-gradient(90deg, #68efda, rgba(120, 204, 255, 0.65) 60%, transparent);
  box-shadow: 0 0 14px rgba(104, 239, 218, 0.45);
}

/* --- Masthead: one-shot cinematic settle (image scales 1.05 → 1) --- */
.masthead-media img {
  animation: media-settle 1.9s cubic-bezier(0.22, 1, 0.36, 1) both;
  transform-origin: 50% 30%;
}
@keyframes media-settle {
  from { transform: scale(1.05); }
  to   { transform: scale(1); }
}

/* --- Section headings: gradient ink + signature accent dash --- */
.section-heading h2,
.leaderboard-heading h2 {
  background: linear-gradient(115deg, #f2fbff 8%, #c2e7f8 60%, #93c8e0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #eef8ff;
}
.section-kicker::before {
  content: "";
  display: inline-block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  margin-right: 8px;
  vertical-align: 0.22em;
  background: linear-gradient(90deg, var(--accent), transparent);
}

/* --- Primary buttons: vivid gradient + dark ink + hover shine sweep --- */
.primary-button {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.94), rgba(125, 211, 252, 0.94));
  border-color: transparent;
  color: #04222b;
  font-weight: 800;
  text-shadow: none;
  box-shadow:
    0 6px 22px rgba(56, 189, 248, 0.20),
    0 1px 0 rgba(255, 255, 255, 0.34) inset;
}
.primary-button:hover {
  background: linear-gradient(135deg, rgba(110, 245, 224, 1), rgba(140, 220, 255, 1));
  border-color: transparent;
  box-shadow:
    0 10px 30px rgba(56, 189, 248, 0.32),
    0 1px 0 rgba(255, 255, 255, 0.4) inset;
}
.primary-button:active { transform: translateY(0) scale(0.985); }
.primary-button::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -70%;
  width: 42%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  transform: skewX(-18deg);
  transition: left 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.primary-button:hover::after { left: 128%; }

/* --- Metric cards: per-index accent + colored value + top stripe --- */
.metric-card                { --mc: 104, 239, 218; }
.metric-card:nth-child(2)   { --mc: 120, 204, 255; }
.metric-card:nth-child(3)   { --mc: 255, 214, 110; }
.metric-card:nth-child(4)   { --mc: 200, 154, 255; }
.metric-card::before {
  background:
    linear-gradient(90deg, rgba(var(--mc), 0.8), rgba(var(--mc), 0.1) 55%, transparent) top/100% 2px no-repeat,
    radial-gradient(120% 90% at 50% 0%, rgba(var(--mc), 0.10), transparent 60%);
  opacity: 1;
}
.metric-value { color: rgb(var(--mc)); }
.metric-card:hover {
  border-color: rgba(var(--mc), 0.40);
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.38),
    0 0 22px rgba(var(--mc), 0.10);
}

/* --- Game cards: per-index accent stripe + colored hover glow --- */
.game-card                  { --gc: 104, 239, 218; }
.game-card:nth-child(3n+2)  { --gc: 120, 204, 255; }
.game-card:nth-child(3n)    { --gc: 255, 214, 110; }
.game-card::before {
  background:
    linear-gradient(90deg, rgba(var(--gc), 0.85), rgba(var(--gc), 0.12) 55%, transparent) top/100% 2px no-repeat,
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 26%),
    radial-gradient(130% 80% at 50% 0%, rgba(var(--gc), 0.07), transparent 56%);
  opacity: 1;
}
.game-card:hover {
  border-color: rgba(var(--gc), 0.46);
  box-shadow:
    0 14px 44px rgba(0, 0, 0, 0.46),
    0 0 26px rgba(var(--gc), 0.12);
}
.game-icon {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 10px 30px rgba(0, 0, 0, 0.24),
    0 0 18px rgba(var(--gc, 104, 239, 218), 0.12);
}

/* --- Live pill: breathing dot (tiny element, compositor-only) --- */
.status-pill.live::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 7px;
  background: #5eead4;
  box-shadow: 0 0 8px rgba(94, 234, 212, 0.85);
  animation: live-dot 2.4s ease-in-out infinite;
}
@keyframes live-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.72); }
}

/* --- Leaderboard podium: gold halo for #1 --- */
.leaderboard-row:nth-child(1) {
  border-color: rgba(255, 200, 30, 0.26);
  background: linear-gradient(90deg, rgba(255, 200, 30, 0.07), rgba(7, 16, 24, 0.82) 44%);
}
.leaderboard-points-value {
  background: linear-gradient(120deg, #d8fff5, #8fe8d4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent-strong);
}
.leaderboard-row:nth-child(1) .leaderboard-points-value {
  background: linear-gradient(120deg, #fff2c2, #ffd94d);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* --- Auth card: HUD corner brackets (static) --- */
.auth-card { isolation: isolate; }
.auth-card::after {
  content: "";
  position: absolute;
  inset: 9px;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(90deg, rgba(104, 239, 218, 0.55), transparent 22px) top left / 30px 1px,
    linear-gradient(180deg, rgba(104, 239, 218, 0.55), transparent 22px) top left / 1px 30px,
    linear-gradient(270deg, rgba(120, 204, 255, 0.5), transparent 22px) bottom right / 30px 1px,
    linear-gradient(0deg, rgba(120, 204, 255, 0.5), transparent 22px) bottom right / 1px 30px;
  background-repeat: no-repeat;
  opacity: 0.85;
}
.auth-tab.active {
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.16), rgba(125, 211, 252, 0.14));
  border-color: rgba(120, 220, 255, 0.30);
}

/* --- Inputs: calmer chrome, brighter focus --- */
input, select, textarea, .rich-editor {
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
input:focus, select:focus, textarea:focus, .rich-editor:focus {
  outline: none;
  border-color: rgba(104, 239, 218, 0.45);
  box-shadow:
    0 0 0 3px rgba(104, 239, 218, 0.12),
    0 0 18px rgba(104, 239, 218, 0.08);
  background: rgba(7, 17, 26, 0.96);
}

/* --- Modals: pop-in entrance (replays on open since display toggles) --- */
.modal-backdrop {
  background: rgba(2, 6, 10, 0.84);
  animation: backdrop-fade 0.26s ease both;
}
.modal-card { animation: modal-pop 0.32s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes backdrop-fade { from { opacity: 0; } }
@keyframes modal-pop {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
}

/* --- Footer: gradient divider + breathing room --- */
.site-footer {
  position: relative;
  border-top: none;
  margin-top: 56px;
  padding-top: 36px;
}
.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 80%);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(120, 204, 255, 0.4), rgba(104, 239, 218, 0.4), transparent);
}

/* --- Headings wrap nicer where supported --- */
.hero-copy h1, .hero-mission, .section-heading h2, .modal-body h3 {
  text-wrap: balance;
}

/* --- Scroll-reveal: tagged by JS only (no-JS pages unaffected).
       transform/opacity transition, one-shot. --- */
.rv {
  opacity: 0;
  transform: translateY(16px) scale(0.994);
}
.rv.is-in {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.55s ease var(--rv-d, 0ms),
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1) var(--rv-d, 0ms);
}

@media (prefers-reduced-motion: reduce) {
  .rv { opacity: 1; transform: none; }
  .hero-copy h1 { animation: none; background-position: 0% 0; }
  .masthead-media img { animation: none; }
}

/* --- Mobile: soften the heavy bits --- */
@media (max-width: 640px) {
  .hero-copy h1::after { margin-top: 12px; width: 56px; }
  .auth-card::after { inset: 7px; opacity: 0.6; }
  html::before { height: 2px; }
  .rv { transform: translateY(12px); }
}

/* ============================================================
   ===== UI v4 — Editorial impact redesign =====
   Structural drama: top nav over a taller cinematic masthead,
   giant outlined watermark, infinite brand ticker, hero panel
   overlapping the artwork, rotating border beams, oversized
   ghost numerals. Idle cost budget unchanged: ticker + auth
   beam are single transform-only compositor layers; everything
   else is static or hover/one-shot.
   ============================================================ */

/* --- Bold nebula wash (static, painted once) --- */
body::after {
  background:
    radial-gradient(46% 60% at 86% 8%, rgba(255, 196, 80, 0.14), transparent 70%),
    radial-gradient(54% 72% at 8% 88%, rgba(150, 90, 255, 0.18), transparent 72%),
    radial-gradient(42% 54% at 50% 38%, rgba(56, 150, 255, 0.09), transparent 75%);
  opacity: 0.9;
}
.aurora-a {
  background: radial-gradient(circle at 22% 18%, rgba(104, 239, 218, 0.26), transparent 42%) !important;
}
.aurora-b {
  background: radial-gradient(circle at 78% 16%, rgba(120, 204, 255, 0.28), transparent 42%) !important;
}

/* --- Masthead: nav rides on top, artwork breathes, watermark anchors --- */
.masthead {
  min-height: 470px;
  margin-bottom: 0;
}
.masthead-bar {
  inset: 0 0 auto;
  padding: 18px 26px;
  background: linear-gradient(180deg, rgba(4, 10, 16, 0.85) 0%, rgba(4, 10, 16, 0.35) 62%, transparent 100%);
}
.masthead-fade {
  background:
    linear-gradient(180deg, rgba(4, 10, 16, 0.30) 0%, rgba(4, 10, 16, 0) 24%, rgba(4, 10, 16, 0.10) 52%, rgba(4, 10, 16, 0.74) 82%, rgba(4, 10, 16, 0.96) 100%);
}
.masthead::after {
  height: 150px;
  background: linear-gradient(180deg, rgba(4, 10, 16, 0), rgba(4, 10, 16, 0.95));
}
.masthead-ghost {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 2px;
  z-index: 1;
  font-family: var(--heading-font);
  font-weight: 900;
  font-size: clamp(3rem, 9.6vw, 8.6rem);
  line-height: 0.92;
  letter-spacing: 0.015em;
  white-space: nowrap;
  overflow: hidden;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(190, 235, 255, 0.22);
  pointer-events: none;
  user-select: none;
}

/* --- Brand ticker: one transform-only compositor layer --- */
.ticker {
  position: relative;
  z-index: 2;
  overflow: hidden;
  margin: 0 0 0;
  padding: 13px 0;
  border-block: 1px solid rgba(160, 220, 255, 0.13);
  background: rgba(4, 11, 18, 0.82);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  contain: layout paint style;
}
.ticker-track {
  display: inline-flex;
  white-space: nowrap;
  will-change: transform;
  animation: ticker-roll 36s linear infinite;
}
.ticker-seg {
  display: inline-block;
  font-family: var(--heading-font);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(208, 236, 248, 0.78);
}
.ticker-seg i {
  font-style: normal;
  color: #ffd66e;
  margin: 0 22px;
  text-shadow: 0 0 10px rgba(255, 214, 110, 0.4);
}
@keyframes ticker-roll {
  to { transform: translate3d(-50%, 0, 0); }
}

/* --- Hero panel overlaps the artwork: magazine layering --- */
.main-layout { position: relative; z-index: 2; }
.hero-panel {
  margin-top: 26px;
  padding: 30px 28px;
  border-color: rgba(160, 220, 255, 0.22);
}

/* --- Display typography: go big --- */
.hero-copy .eyebrow {
  font-size: clamp(1rem, 1.6vw, 1.3rem);
  letter-spacing: 0.2em;
  margin-bottom: 18px;
}
.hero-copy h1 {
  font-size: clamp(3.2rem, 7vw, 6.6rem);
  max-width: none;
  line-height: 0.98;
  letter-spacing: 0.04em;
}
.hero-copy h1 .ht-ch {
  display: inline-block;
  transform: translateY(118%);
  opacity: 0;
  animation: ht-rise 0.72s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes ht-rise {
  to { transform: translateY(0); opacity: 1; }
}
.hero-mission {
  font-size: clamp(2.1rem, 3.8vw, 3.4rem);
  max-width: none;
}
.hero-subtitle {
  font-size: 1.04rem;
  max-width: 52ch;
}

/* --- Metric numbers: oversized data display --- */
.metric-card { padding: 18px 16px 16px; }
.metric-value {
  font-size: clamp(2rem, 3.8vw, 3.2rem);
  font-weight: 800;
}

/* --- Section headings: editorial scale --- */
.section-heading h2 { font-size: clamp(1.7rem, 3.2vw, 2.6rem); }
.compact-heading h2 { font-size: clamp(1.34rem, 2.2vw, 1.7rem); }

/* --- Ghost numerals: oversized outlined counters --- */
.main-layout { counter-reset: sec; }
.main-layout .section-card:not(.toolbar-card) { counter-increment: sec; }
.main-layout .section-card:not(.toolbar-card)::after {
  content: "0" counter(sec);
  position: absolute;
  top: -6px;
  right: 14px;
  z-index: 0;
  font-family: var(--heading-font);
  font-size: clamp(3.6rem, 7vw, 6rem);
  font-weight: 900;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(170, 225, 255, 0.12);
  pointer-events: none;
  user-select: none;
}
.games-grid { counter-reset: gc; }
.game-card { counter-increment: gc; }
.game-card::before {
  content: "0" counter(gc);
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 12px 6px 0;
  font-family: var(--heading-font);
  font-size: 4.2rem;
  font-weight: 900;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(var(--gc), 0.26);
}

/* --- Rotating border beam: masked rim + transform-only spin --- */
.card-beam {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  padding: 1.5px;
  pointer-events: none;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  overflow: hidden;
}
.card-beam::before {
  content: "";
  position: absolute;
  inset: -120%;
  background: conic-gradient(from 0deg,
    transparent 0deg 268deg,
    rgba(104, 239, 218, 0.0) 290deg,
    rgba(104, 239, 218, 0.9) 322deg,
    rgba(125, 211, 252, 0.95) 338deg,
    rgba(200, 154, 255, 0.55) 350deg,
    transparent 360deg);
  animation: beam-spin 4.6s linear infinite;
}
@keyframes beam-spin {
  to { transform: rotate(1turn); }
}
/* Game cards: beam armed only while hovered → zero idle cost */
.game-card .card-beam::before {
  animation-play-state: paused;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.game-card:hover .card-beam::before {
  animation-play-state: running;
  opacity: 1;
}

/* --- Leaderboard #1: podium presence --- */
.leaderboard-row:nth-child(1) {
  padding-block: 15px;
  border-color: rgba(255, 200, 30, 0.32);
}
.leaderboard-row:nth-child(1) .leaderboard-name { font-size: 1.06rem; }

/* --- Mobile re-assertions (this layer is appended after the original
       media queries, so small-screen behavior must be restated) --- */
@media (max-width: 860px) {
  .masthead { min-height: 360px; }
  .masthead-ghost { font-size: clamp(2.4rem, 11vw, 4.6rem); }
  .hero-panel { margin-top: 18px; }
}

@media (max-width: 640px) {
  /* Restore stacked masthead flow: image block + nav bar below */
  .masthead {
    min-height: auto;
    margin-bottom: 0;
  }
  .masthead-bar {
    position: relative;
    inset: auto;
    padding: 10px 12px;
    background: var(--surface-strong);
  }
  .masthead-ghost {
    bottom: auto;
    top: 132px;
    left: 12px;
    right: 12px;
    font-size: 12.5vw;
    -webkit-text-stroke-width: 1px;
    opacity: 0.85;
  }
  .ticker { padding: 9px 0; }
  .ticker-seg { font-size: 12px; letter-spacing: 0.18em; }
  .hero-panel { margin-top: 14px; padding: 18px 16px; }
  .hero-copy h1 { font-size: clamp(2.4rem, 12vw, 3.4rem); line-height: 1; }
  .hero-mission { font-size: clamp(1.5rem, 7vw, 2.2rem); }
  .metric-value { font-size: clamp(1.6rem, 7vw, 2.2rem); }
  .main-layout .section-card:not(.toolbar-card)::after {
    font-size: 2.8rem;
    top: -2px;
    right: 10px;
  }
  .game-card::before { font-size: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .card-beam::before { animation: none; opacity: 0; }
  .hero-copy h1 .ht-ch { transform: none; opacity: 1; animation: none; }
}

/* ============================================================
   ===== UI v5 — Cinematic layer: stars, glitch, tilt, beams =====
   Every persistent effect below is transform/opacity-only on its
   own compositor layer (the work category phones are optimized
   for). Pointer effects are desktop-hover-only.
   ============================================================ */

/* --- Scroll progress bar: CSS scroll-driven (zero JS), progressive --- */
.scroll-progress { display: none; }
@supports (animation-timeline: scroll()) {
  .scroll-progress {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2.5px;
    z-index: 70;
    pointer-events: none;
    transform-origin: 0 50%;
    background: linear-gradient(90deg, #68efda, #78ccff 50%, #c89aff);
    box-shadow: 0 0 12px rgba(104, 239, 218, 0.5);
    animation: scroll-grow linear both;
    animation-timeline: scroll();
  }
  @keyframes scroll-grow {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
  }
}

/* --- Starfield: one static dust layer + one twinkling layer --- */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  contain: layout paint style;
}
.starfield::before,
.starfield::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: repeat;
}
.starfield::before {
  opacity: 0.5;
  background-image:
    radial-gradient(1.4px 1.4px at 12% 24%, rgba(255, 255, 255, 0.9), transparent 100%),
    radial-gradient(1px 1px at 38% 64%, rgba(190, 235, 255, 0.8), transparent 100%),
    radial-gradient(1.2px 1.2px at 64% 18%, rgba(255, 255, 255, 0.7), transparent 100%),
    radial-gradient(1px 1px at 82% 48%, rgba(170, 230, 255, 0.75), transparent 100%),
    radial-gradient(1.1px 1.1px at 50% 86%, rgba(255, 255, 255, 0.6), transparent 100%);
  background-size: 460px 420px;
}
.starfield::after {
  background-image:
    radial-gradient(1.6px 1.6px at 24% 42%, rgba(140, 245, 225, 0.95), transparent 100%),
    radial-gradient(1.2px 1.2px at 72% 76%, rgba(255, 255, 255, 0.85), transparent 100%),
    radial-gradient(1.8px 1.8px at 88% 14%, rgba(150, 210, 255, 0.9), transparent 100%),
    radial-gradient(1.1px 1.1px at 8% 78%, rgba(255, 230, 170, 0.8), transparent 100%);
  background-size: 540px 500px;
  animation: star-twinkle 5.4s ease-in-out infinite alternate;
}
@keyframes star-twinkle {
  from { opacity: 0.12; }
  to   { opacity: 0.72; }
}

/* --- Shooting stars over the masthead (tiny layers, idle 90% of cycle) --- */
.shooting-star {
  position: absolute;
  top: 36px;
  left: -140px;
  z-index: 1;
  width: 130px;
  height: 1.6px;
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25) 40%, rgba(190, 240, 255, 0.95));
  box-shadow: 0 0 8px rgba(190, 240, 255, 0.6);
}
.ss-a { animation: shoot-a 9s linear 2.5s infinite; }
.ss-b {
  top: 110px;
  width: 95px;
  animation: shoot-b 13s linear 8s infinite;
}
@keyframes shoot-a {
  0%   { transform: translate3d(0, 0, 0) rotate(14deg); opacity: 0; }
  2%   { opacity: 0.95; }
  7%   { transform: translate3d(62vw, 150px, 0) rotate(14deg); opacity: 0; }
  100% { transform: translate3d(62vw, 150px, 0) rotate(14deg); opacity: 0; }
}
@keyframes shoot-b {
  0%   { transform: translate3d(0, 0, 0) rotate(10deg); opacity: 0; }
  2%   { opacity: 0.8; }
  6.5% { transform: translate3d(78vw, 110px, 0) rotate(10deg); opacity: 0; }
  100% { transform: translate3d(78vw, 110px, 0) rotate(10deg); opacity: 0; }
}

/* --- Watermark glitch: RGB-split bursts (transform/opacity steps only) --- */
.masthead-ghost::before,
.masthead-ghost::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: transparent;
  pointer-events: none;
  opacity: 0;
}
.masthead-ghost::before {
  -webkit-text-stroke-color: rgba(104, 239, 218, 0.85);
  animation: ghost-glitch-a 7s steps(1, end) 3s infinite;
}
.masthead-ghost::after {
  -webkit-text-stroke-color: rgba(255, 110, 199, 0.75);
  animation: ghost-glitch-b 7s steps(1, end) 3s infinite;
}
@keyframes ghost-glitch-a {
  0%, 90%  { opacity: 0; transform: translate3d(0, 0, 0); }
  90.6%    { opacity: 0.9; transform: translate3d(-7px, 3px, 0); }
  91.6%    { opacity: 0.75; transform: translate3d(5px, -2px, 0); }
  92.6%    { opacity: 0.9; transform: translate3d(-3px, 1px, 0); }
  93.4%, 100% { opacity: 0; transform: translate3d(0, 0, 0); }
}
@keyframes ghost-glitch-b {
  0%, 90.3% { opacity: 0; transform: translate3d(0, 0, 0); }
  90.9%     { opacity: 0.8; transform: translate3d(6px, -3px, 0); }
  91.9%     { opacity: 0.65; transform: translate3d(-5px, 2px, 0); }
  92.9%     { opacity: 0.8; transform: translate3d(3px, -1px, 0); }
  93.6%, 100% { opacity: 0; transform: translate3d(0, 0, 0); }
}

/* --- Pointer FX (desktop only): 3D tilt + rim glow following cursor --- */
@media (hover: hover) and (pointer: fine) {
  .game-card, .auth-card, .metric-card { --rx: 0deg; --ry: 0deg; }

  /* End-state transform doubles as the tilt rig. Wins over .rv.is-in. */
  .game-card.is-in, .game-card:not(.rv),
  .auth-card.is-in, .auth-card:not(.rv),
  .metric-card.is-in, .metric-card:not(.rv) {
    transform: perspective(950px) rotateX(var(--rx)) rotateY(var(--ry));
  }
  .game-card.is-in:hover, .game-card:not(.rv):hover {
    transform: perspective(950px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-4px);
  }
  .metric-card.is-in:hover, .metric-card:not(.rv):hover {
    transform: perspective(950px) rotateX(var(--rx)) rotateY(var(--ry)) translateY(-3px);
  }
  .auth-card { transition: transform 200ms ease-out; }

  /* Rim glow: radial light at cursor, masked to the 1.5px border rim */
  .card-beam {
    background: radial-gradient(190px circle at var(--mx, 50%) var(--my, 50%),
      rgba(140, 230, 255, 0.65), rgba(140, 230, 255, 0.1) 55%, transparent 72%);
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .game-card:hover .card-beam,
  .auth-card:hover .card-beam {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .starfield::after { animation: none; opacity: 0.4; }
  .shooting-star { display: none; }
  .masthead-ghost::before, .masthead-ghost::after { animation: none; opacity: 0; }
  .scroll-progress { display: none; }
}
