/* ==========================================================================
   PadelScore demo — design tokens
   Copied verbatim from the app's apps/web/src/app/globals.css so the demo
   renders in exactly the app's colours, in both themes.
   ========================================================================== */

@import url("fonts.css");

:root {
  color-scheme: dark;
  --font-display: "Space Grotesk";
  --font-body: "Inter";

  --bg: #0b1622;
  --surface: #0f1b2a;
  --card: #111e2e;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --fill: rgba(255, 255, 255, 0.05);
  --fill-strong: rgba(255, 255, 255, 0.09);
  --fg: #f5f8fc;
  --fg2: #8a97a8;
  --fg3: #5c6878;
  --accent: #c6f24e;
  --accent-ink: #16310a;
  /* Theme-invariant translucent lime — defined only here so it cascades into html.light. */
  --accent-line: rgba(198, 242, 78, 0.4);
  --accent-soft: rgba(198, 242, 78, 0.15);
  --accent-faint: rgba(198, 242, 78, 0.05);
  --hot: #c6f24e;
  --hot-soft: rgba(198, 242, 78, 0.14);
  --blue: #3b82f6;
  --blue-soft: rgba(59, 130, 246, 0.16);
  --danger: #ff6b6b;
}

html.light {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --card: #ffffff;
  --line: rgba(10, 27, 46, 0.1);
  --line-strong: rgba(10, 27, 46, 0.18);
  --fill: rgba(10, 27, 46, 0.04);
  --fill-strong: rgba(10, 27, 46, 0.07);
  --fg: #0a1b2e;
  --fg2: #5b6678;
  --fg3: #9aa6b5;
  --accent: #c6f24e;
  --accent-ink: #16310a;
  --hot: #0f5fd9;
  --hot-soft: rgba(15, 95, 217, 0.1);
  --blue: #0f5fd9;
  --blue-soft: rgba(15, 95, 217, 0.1);
  --danger: #dc2626;
}

/* The demo shell itself is always dark — only the phone screen follows the theme. */
.font-display { font-family: var(--font-display), ui-sans-serif, sans-serif; }
.font-body { font-family: var(--font-body), ui-sans-serif, sans-serif; }

/* The app pads its chrome off env(safe-area-inset-*), which is 0 in a desktop browser.
   Inside the phone frame we stand in for a real device inset, so the sticky TopBar
   clears the notch exactly the way it clears an iPhone status bar. */
.safe-top { padding-top: 30px; }
.safe-bottom { padding-bottom: 0; }

/* ==========================================================================
   Demo shell — the phone frame, backdrop and caption rail
   ========================================================================== */

:root {
  --shell-bg: #060e18;
  --shell-fg: #eaf1fb;
  --shell-fg2: #8ba0bb;
  --shell-line: rgba(255, 255, 255, 0.1);
  --shell-card: rgba(255, 255, 255, 0.04);
  --brand-lime: #c6f24e;
  --brand-blue: #0f5fd9;
  --brand-court: #0a1b2e;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.demo-shell {
  margin: 0;
  background:
    radial-gradient(900px 620px at 88% -8%, rgba(15, 95, 217, 0.42), transparent 62%),
    radial-gradient(720px 520px at 4% 104%, rgba(198, 242, 78, 0.10), transparent 60%),
    linear-gradient(160deg, #071120 0%, var(--brand-court) 52%, #0b2340 100%),
    var(--shell-bg);
  background-color: var(--shell-bg);
  color: var(--shell-fg);
  font-family: var(--font-body), ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Faint court-line motif behind everything. */
body.demo-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 132px 132px;
  -webkit-mask-image: radial-gradient(1100px 800px at 50% 40%, #000 0%, transparent 78%);
  mask-image: radial-gradient(1100px 800px at 50% 40%, #000 0%, transparent 78%);
}

.stage {
  position: relative;
  z-index: 1;
  margin: 0 auto;
  display: flex;
  min-height: 100dvh;
  max-width: 1340px;
  flex-direction: column;
  gap: 28px;
  padding: 22px 20px 40px;
}

/* ---------- top bar ---------- */
.demo-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.demo-bar__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display), sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: #fff;
}
.demo-bar__dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--brand-lime);
  box-shadow: 0 0 0 4px rgba(198, 242, 78, 0.16);
}
.demo-bar__tag {
  border: 1px solid var(--shell-line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--shell-fg2);
  white-space: nowrap;
}
.demo-bar__spacer { flex: 1 1 auto; }

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--shell-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--shell-fg);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease;
  text-decoration: none;
}
.ghost-btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.2); }
.ghost-btn--solid { background: var(--brand-lime); border-color: var(--brand-lime); color: var(--brand-court); font-weight: 600; }
.ghost-btn--solid:hover { background: #d3f76c; border-color: #d3f76c; }

/* ---------- layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  align-items: start;
}

/* ---------- phone ---------- */
.phone-col { display: flex; flex-direction: column; align-items: center; gap: 16px; }

.phone {
  position: relative;
  width: 100%;
  max-width: 390px;
  border-radius: 44px;
  background: linear-gradient(160deg, #2b3646, #0b1017 46%);
  padding: 11px;
  box-shadow:
    0 40px 90px -30px rgba(0, 0, 0, 0.85),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}
/* The app's own <body> sets `color: var(--fg)`. Inside the demo the real body belongs
   to the shell, so the phone screen has to re-establish it — otherwise every element
   without an explicit text-* class inherits the shell's near-white and light mode
   renders as pale-on-white. */
.phone__screen,
.wide-scroll {
  color: var(--fg);
  background: var(--bg);
  font-family: var(--font-body), ui-sans-serif, system-ui, sans-serif;
}

.phone__screen {
  position: relative;
  overflow: hidden;
  border-radius: 34px;
  height: 764px;
  max-height: calc(100dvh - 210px);
  min-height: 520px;
}
.phone__notch {
  position: absolute;
  left: 50%;
  top: 8px;
  z-index: 40;
  height: 26px;
  width: 108px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #05080d;
  pointer-events: none;
}
/* The app's own scroll area inside the screen. */
.phone__scroll {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.phone__scroll::-webkit-scrollbar { width: 6px; }
.phone__scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 3px; }
.phone__scroll::-webkit-scrollbar-track { background: transparent; }

.phone-hint {
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: var(--shell-fg2);
  max-width: 380px;
}

/* ---------- caption rail ---------- */
.rail { display: flex; flex-direction: column; gap: 18px; }
.rail__eyebrow {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--brand-lime);
}
.rail__title {
  margin: 0;
  font-family: var(--font-display), sans-serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #fff;
}
.rail__body { margin: 0; font-size: 15px; line-height: 1.65; color: var(--shell-fg2); }
.rail__body strong { color: var(--shell-fg); font-weight: 600; }

.try {
  border: 1px solid var(--shell-line);
  border-radius: 18px;
  background: var(--shell-card);
  padding: 18px 20px;
}
.try__h {
  margin: 0 0 12px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--shell-fg2);
}
.try ol { margin: 0; padding: 0; list-style: none; counter-reset: t; display: flex; flex-direction: column; gap: 11px; }
.try li {
  counter-increment: t;
  position: relative;
  padding-left: 32px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--shell-fg);
}
.try li::before {
  content: counter(t);
  position: absolute;
  left: 0; top: 1px;
  display: grid;
  place-items: center;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: rgba(198, 242, 78, 0.14);
  color: var(--brand-lime);
  font-size: 11px;
  font-weight: 700;
}

.fact {
  border-left: 2px solid rgba(198, 242, 78, 0.45);
  padding: 2px 0 2px 15px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--shell-fg2);
}
.fact strong { color: var(--shell-fg); font-weight: 600; }

/* ---------- screen index ---------- */
.screens { display: flex; flex-wrap: wrap; gap: 8px; }
.screens a {
  border: 1px solid var(--shell-line);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  color: var(--shell-fg2);
  text-decoration: none;
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
  white-space: nowrap;
}
.screens a:hover { color: #fff; border-color: rgba(255, 255, 255, 0.28); background: rgba(255, 255, 255, 0.05); }
.screens a[aria-current="page"] {
  color: var(--brand-court);
  background: var(--brand-lime);
  border-color: var(--brand-lime);
  font-weight: 600;
}

/* ---------- foot ---------- */
.demo-foot {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--shell-line);
  margin-top: 6px;
  padding-top: 18px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--shell-fg2);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
}
.demo-foot a { color: var(--shell-fg); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- toast ---------- */
.toast-host {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 90;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  border-radius: 999px;
  background: rgba(10, 27, 46, 0.94);
  border: 1px solid rgba(198, 242, 78, 0.34);
  padding: 10px 20px;
  font-size: 13px;
  color: #fff;
  box-shadow: 0 16px 40px -14px rgba(0, 0, 0, 0.8);
  animation: toast-in 0.22s ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- widescreen page (full-bleed frame, rail underneath) ---------- */
.wide-frame {
  position: relative;
  z-index: 1;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--shell-line);
  border-radius: 20px;
  background: var(--bg);
  box-shadow: 0 40px 90px -34px rgba(0, 0, 0, 0.8);
}
.wide-scroll {
  height: 660px;
  max-height: calc(100dvh - 300px);
  min-height: 420px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.wide-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.wide-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 4px; }

@media (min-width: 1024px) {
  .stage { padding: 26px 32px 44px; gap: 34px; }
  .layout { grid-template-columns: minmax(0, 390px) minmax(0, 1fr); gap: 56px; }
  .phone-col { position: sticky; top: 26px; }
  .rail__title { font-size: 34px; }

  /* The widescreen screen is the point of that page — give it the full width
     and drop the rail underneath it. */
  .layout--wide { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  .layout--wide .phone-col { position: static; align-items: stretch; }
  .layout--wide .rail {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    gap: 20px 48px;
    align-items: start;
  }
  .layout--wide .rail > :first-child { grid-column: 1; }
  .layout--wide .rail__body { grid-column: 1; }
  .layout--wide .try { grid-column: 2; grid-row: 1 / span 3; }
  .layout--wide .screens { grid-column: 1 / -1; }
}

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