/* Nova Sport Rivals — tokens, reset, app frame. */

:root {
  --bg0: #030a22;
  --bg1: #0a1c52;
  --bg2: #10307f;
  --blue: #1e6bff;
  --blue-2: #3d8bff;
  --blue-deep: #0b2a8a;
  --cyan: #4fe3ff;
  --cyan-soft: rgba(79, 227, 255, 0.16);
  --gold: #ffd166;
  --danger: #ff5a6e;
  --good: #3ddc97;
  --text: #eef4ff;
  --muted: #a6b8e2;
  --panel: rgba(18, 44, 120, 0.55);
  --panel-strong: rgba(24, 58, 150, 0.78);
  --line: rgba(130, 180, 255, 0.22);
  --line-strong: rgba(150, 200, 255, 0.45);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 28px rgba(0, 8, 40, 0.45);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --fs: 15px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

:root[data-arena='arena_cyan'] {
  --bg0: #021824;
  --bg1: #06395a;
  --bg2: #0b5a86;
  --blue: #11a4e8;
  --blue-2: #2fc5ff;
  --blue-deep: #064a73;
  --cyan: #7ff5ff;
  --panel: rgba(8, 70, 110, 0.55);
  --panel-strong: rgba(10, 90, 140, 0.8);
}

:root[data-arena='arena_ice'] {
  --bg0: #0b1424;
  --bg1: #1b2e4d;
  --bg2: #2c4a78;
  --blue: #4f8cff;
  --blue-2: #8cb6ff;
  --blue-deep: #22406f;
  --cyan: #d8f3ff;
  --panel: rgba(60, 90, 140, 0.45);
  --panel-strong: rgba(70, 105, 165, 0.72);
}

:root[data-arena='arena_aurora'] {
  --bg0: #0a0826;
  --bg1: #1d1a5c;
  --bg2: #2e3a9c;
  --blue: #5b6cff;
  --blue-2: #8a7dff;
  --blue-deep: #2a237a;
  --cyan: #6ff0ff;
  --panel: rgba(50, 44, 140, 0.55);
  --panel-strong: rgba(62, 56, 170, 0.78);
}

:root[data-contrast='high'] {
  --muted: #d6e2ff;
  --line: rgba(200, 225, 255, 0.55);
  --line-strong: rgba(230, 242, 255, 0.85);
  --panel: rgba(10, 26, 80, 0.92);
}

:root[data-text='large'] {
  --fs: 17px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.4;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(120% 70% at 50% -10%, var(--bg2) 0%, transparent 60%),
    radial-gradient(90% 60% at 100% 110%, rgba(79, 227, 255, 0.12) 0%, transparent 60%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg0) 70%);
  background-attachment: fixed;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

img,
svg {
  max-width: 100%;
}

/* Guard from 12.1: a bare inline SVG without size attributes must never stretch to the container. */
/* :where() keeps specificity at zero so art containers below can size their own SVGs. */
:where(svg:not([width]):not([height])) {
  width: 24px;
  height: 24px;
  flex: none;
}

/* Art containers size their SVG explicitly. */
.card-art > svg,
.avatar > svg,
.trophy-art > svg,
.hero-art > svg,
.chapter-art > svg,
.chapter-banner > svg,
.unlock-art > svg,
.welcome-crest > svg,
.result-crest > svg,
.mini-card > svg,
.preview-card > svg {
  width: 100%;
  height: 100%;
  display: block;
}

.icon {
  flex: none;
  display: block;
}

[hidden] {
  display: none !important;
}

#app {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
}

.screen {
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
}

.screen-enter {
  animation: screen-in 0.26s ease-out both;
}

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

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.content::-webkit-scrollbar {
  display: none;
}

/* Scrolling column: children keep their natural height instead of being squeezed to fit. */
.content > * {
  flex-shrink: 0;
}

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

.small {
  font-size: 0.86em;
}

.center {
  text-align: center;
  display: flex;
  justify-content: center;
}

:root[data-motion='reduced'] *,
:root[data-motion='reduced'] *::before,
:root[data-motion='reduced'] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.08s !important;
}

/* Splash (static markup in index.html, removed after boot). */
#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: radial-gradient(80% 60% at 50% 40%, #12348f 0%, #030a22 70%);
  transition: opacity 0.45s ease;
}

#splash.done {
  opacity: 0;
  pointer-events: none;
}

#splash .splash-crest {
  width: 120px;
  height: 120px;
  animation: splash-pulse 1.6s ease-in-out infinite;
}

#splash h1 {
  font-size: 26px;
  letter-spacing: 0.04em;
}

#splash p {
  color: #a6b8e2;
  font-size: 14px;
}

.splash-bar {
  width: 140px;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.splash-bar span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: 4px;
  background: linear-gradient(90deg, #4fe3ff, #3d8bff);
  animation: splash-load 1.1s ease-in-out infinite;
}

@keyframes splash-pulse {
  50% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 18px rgba(79, 227, 255, 0.55));
  }
}

@keyframes splash-load {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(260%);
  }
}

/* Offline banner */
#net-banner {
  position: fixed;
  left: 50%;
  top: calc(8px + var(--safe-top));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(40, 20, 60, 0.92);
  border: 1px solid rgba(255, 90, 110, 0.6);
  color: #ffd9de;
  font-size: 13px;
  box-shadow: var(--shadow);
}

#net-banner svg {
  width: 16px;
  height: 16px;
}
