:root {
  --bg: #0f0f0f;
  --bg-panel: #141414;
  --text: #cecece;
  --text-muted: #888;
  --text-bright: #fff;
  --accent: #cd412b;
  --accent-dark: #35211d;
  --accent-mid: #6f3025;
  --accent-glow: rgba(205, 65, 43, 0.4);
  --safety: #7bb940;
  --border: #2a2a2a;
  --font: 'Roboto', system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  min-height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.no-video .video-bg__media {
  opacity: 0;
}

body.no-video .video-bg {
  background:
    url('img/poster.jpg') center / cover no-repeat,
    var(--bg);
}

@keyframes wipe-flash {
  0%, 100% { filter: none; }
  30% { filter: brightness(2) contrast(0.8); }
  50% { filter: invert(0.15); }
}

/* Video background */
.video-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
}

.video-bg__media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.02);
}

.video-bg__overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 8, 8, 0.55) 0%, rgba(8, 8, 8, 0.82) 55%, rgba(8, 8, 8, 0.92) 100%),
    radial-gradient(ellipse 80% 60% at 50% 20%, rgba(205, 65, 43, 0.18) 0%, transparent 65%);
  pointer-events: none;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  opacity: 0.035;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.4) 2px,
    rgba(0, 0, 0, 0.4) 4px
  );
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding:
    calc(1.25rem + var(--safe-top))
    calc(1rem + var(--safe-right))
    calc(1.5rem + var(--safe-bottom))
    calc(1rem + var(--safe-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.page__card {
  width: min(560px, 100%);
  padding: clamp(1.25rem, 4vw, 2rem);
  background: rgba(14, 14, 14, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.page__header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.logo-btn {
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  display: block;
  margin: 0 auto 0.75rem;
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.logo-btn__frame {
  width: clamp(72px, 18vw, 88px);
  height: clamp(72px, 18vw, 88px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(360deg, var(--accent-mid) 0%, var(--accent-dark) 100%);
  border: 2px solid var(--accent);
  box-shadow:
    0 0 28px var(--accent-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) {
  .logo-btn:hover .logo-btn__frame {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 0 40px var(--accent-glow);
  }
}

.logo-btn:active .logo-btn__frame {
  transform: scale(0.96);
}

.logo-btn.shake .logo-btn__frame {
  animation: logo-shake 0.45s ease;
}

@keyframes logo-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(8deg); }
  60% { transform: rotate(-5deg); }
  80% { transform: rotate(5deg); }
}

.logo-btn__img {
  width: clamp(44px, 12vw, 56px);
  height: clamp(44px, 12vw, 56px);
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.logo-btn__hint {
  display: block;
  margin-top: 6px;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.45;
}

@media (hover: hover) {
  .logo-btn__hint {
    opacity: 0;
    transition: opacity 0.2s;
  }

  .logo-btn:hover .logo-btn__hint {
    opacity: 0.6;
  }
}

.page__domain {
  font-size: clamp(0.8rem, 2.5vw, 0.9rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-bright);
  word-break: break-word;
}

.live-ticker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 1rem;
  max-width: 100%;
  padding: 6px 12px;
  background: rgba(20, 20, 20, 0.9);
  border: 1px solid var(--border);
  font-size: clamp(0.65rem, 2.2vw, 0.75rem);
  color: var(--text-muted);
}

.live-ticker__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--safety);
  box-shadow: 0 0 8px var(--safety);
  animation: blink 1.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.live-ticker strong {
  color: var(--safety);
  font-variant-numeric: tabular-nums;
}

.page__main {
  text-align: center;
}

.badge {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-bright);
  background: var(--accent);
  border: 1px solid #000;
  animation: badge-float 3s ease-in-out infinite;
}

@keyframes badge-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.title {
  font-size: clamp(1.35rem, 6vw, 2.35rem);
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
  line-height: 1.25;
}

.title__premium {
  display: inline-block;
  cursor: help;
  padding: 0 0.15em;
  color: #1a1a1a;
  font-weight: 700;
  border: 1px solid #000;
  background-color: #dcc8e4;
  background-image:
    radial-gradient(ellipse 85% 75% at 12% 22%, #f0a4c4 0%, transparent 58%),
    radial-gradient(ellipse 75% 65% at 88% 18%, #d8f0a0 0%, transparent 52%),
    radial-gradient(ellipse 80% 70% at 18% 88%, #90d4f0 0%, transparent 55%),
    linear-gradient(118deg, #e8b0d0 0%, #e8e0a8 28%, #a8d8f0 52%, #c8b8e8 78%, #e0b0d8 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .title__premium:hover,
  .title__premium:focus {
    transform: scale(1.06) rotate(-1deg);
  }
}

.lead {
  font-size: clamp(0.95rem, 3.5vw, 1.05rem);
  color: var(--text);
  margin-bottom: 1.25rem;
}

.lead strong {
  color: var(--text-bright);
  font-weight: 500;
}

.features {
  list-style: none;
  text-align: left;
  width: 100%;
  margin-bottom: 1.25rem;
}

.features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 0.55rem 0;
  font-size: clamp(0.82rem, 3vw, 0.9rem);
  color: var(--text-muted);
  border-bottom: 1px solid rgba(42, 42, 42, 0.6);
  line-height: 1.4;
}

.features li:last-child {
  border-bottom: none;
}

.tag {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 7px;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #aaa;
}

.tag--premium {
  color: #1a1a1a;
  border-color: #000;
  background-color: #dcc8e4;
  background-image:
    radial-gradient(ellipse 85% 75% at 12% 22%, #f0a4c4 0%, transparent 58%),
    linear-gradient(118deg, #e8b0d0 0%, #e8e0a8 28%, #a8d8f0 52%, #c8b8e8 100%);
}

.note {
  font-size: clamp(0.78rem, 3vw, 0.85rem);
  color: var(--text-muted);
  padding-top: 0.75rem;
  line-height: 1.45;
}

.note--mobile {
  display: none;
}

kbd {
  display: inline-block;
  padding: 2px 6px;
  font-size: 0.75rem;
  font-family: inherit;
  background: #222;
  border: 1px solid #444;
  border-radius: 2px;
  color: var(--text);
}

.page__footer {
  margin-top: 1.75rem;
  text-align: center;
}

.footer__copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: calc(16px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 50;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 14px 18px;
  background: rgba(20, 20, 18, 0.95);
  border: 1px solid var(--accent);
  border-left: 4px solid var(--accent);
  color: var(--text-bright);
  font-size: clamp(0.82rem, 3vw, 0.9rem);
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.toast.is-visible {
  transform: translateX(-50%) translateY(0);
}

.toast strong {
  color: var(--accent);
}

/* F1 console */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding:
    calc(0.75rem + var(--safe-top))
    calc(0.75rem + var(--safe-right))
    calc(0.75rem + var(--safe-bottom))
    calc(0.75rem + var(--safe-left));
}

.overlay[hidden] {
  display: none;
}

.console {
  width: min(640px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  border: 1px solid #333;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

.console__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: #1a1a1a;
  border-bottom: 1px solid #333;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.console__close {
  border: none;
  background: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  min-width: 44px;
  min-height: 44px;
}

.console__close:hover {
  color: var(--accent);
}

.console__out {
  margin: 0;
  padding: 14px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: clamp(0.72rem, 2.8vw, 0.8rem);
  line-height: 1.5;
  color: #9fdf9f;
  flex: 1;
  overflow-y: auto;
  white-space: pre-wrap;
  -webkit-overflow-scrolling: touch;
}

.console__hint {
  padding: 8px 14px 12px;
  font-size: 0.68rem;
  color: #555;
  border-top: 1px solid #222;
}

@media (max-width: 768px) {
  .page__card {
    padding: 1.15rem 1rem 1.25rem;
  }

  .page__header {
    margin-bottom: 1.15rem;
  }

  .features li {
    flex-wrap: wrap;
  }

  .note--desktop {
    display: none;
  }

  .note--mobile {
    display: block;
  }
}

@media (max-width: 380px) {
  .live-ticker {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }

  .title {
    letter-spacing: 0.01em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .badge,
  .live-ticker__dot,
  .logo-btn.shake .logo-btn__frame {
    animation: none;
  }

  .video-bg__media {
    display: none;
  }

  body {
    background: url('img/poster.jpg') center / cover no-repeat fixed;
  }
}
