:root {
  --max: 980px;

  /* Dark (default) */
  --bg: #0b0d12;
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.7);
  --muted-2: rgba(255, 255, 255, 0.55);
  --surface: rgba(255, 255, 255, 0.06);
  --surface-2: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  --brand: #8b5cf6;
  --brand2: #22c55e;

  --radius: 18px;
  --navH: 74px;
}

/* Light theme */
:root[data-theme="light"] {
  --bg: #f7f7fb;
  --text: rgba(10, 12, 18, 0.92);
  --muted: rgba(10, 12, 18, 0.72);
  --muted-2: rgba(10, 12, 18, 0.55);
  --surface: rgba(10, 12, 18, 0.04);
  --surface-2: rgba(10, 12, 18, 0.07);
  --border: rgba(10, 12, 18, 0.12);
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.12);
}

/* Let the browser render native controls correctly for the theme */
html {
  color-scheme: dark;
}
:root[data-theme="light"] {
  color-scheme: light;
}

/* Fallback: make dropdown options readable */
select option {
  color: #111;
  background: #fff;
}

/* When in dark theme, prefer dark dropdown */
:root:not([data-theme="light"]) select option {
  color: #fff;
  background: #111;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Arial,
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(
      1200px 700px at 20% -10%,
      rgba(139, 92, 246, 0.2),
      transparent 55%
    ),
    radial-gradient(
      900px 600px at 90% 10%,
      rgba(34, 197, 94, 0.14),
      transparent 50%
    ),
    radial-gradient(
      700px 500px at 40% 110%,
      rgba(59, 130, 246, 0.12),
      transparent 55%
    ),
    var(--bg);
  line-height: 1.55;

  /* leave room for mobile bottom nav */
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--navH));
}

a {
  color: inherit;
  text-decoration: none;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px;
}

header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  border-bottom: 1px solid var(--border);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  max-width: var(--max);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
  letter-spacing: 0.2px;
}

.badge {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}

/* header actions (back + theme) */
.actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.link {
  color: color-mix(in oklab, var(--text) 82%, transparent);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.link:hover {
  border-color: var(--border);
  background: var(--surface);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.icon-btn:hover {
  background: var(--surface-2);
}

.hero {
  padding: 28px 0 18px;
}

h1 {
  font-size: clamp(28px, 5vw, 44px);
  line-height: 1.1;
  margin: 10px 0 12px;
}

h2 {
  margin: 0 0 12px;
  font-size: clamp(18px, 2.4vw, 22px);
}

.muted {
  color: var(--muted);
}

.kicker {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
}

.cta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  box-shadow: 0 1px 0 color-mix(in oklab, var(--text) 6%, transparent) inset;
  transition:
    transform 0.08s ease,
    background 0.15s ease,
    border-color 0.15s ease;
  min-height: 48px;
}
.btn:hover {
  background: var(--surface-2);
  border-color: color-mix(in oklab, var(--border) 80%, white 20%);
}
.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.95),
    rgba(59, 130, 246, 0.92)
  );
  box-shadow: var(--shadow);
}
.btn.secondary {
  border-color: transparent;
  background: linear-gradient(
    135deg,
    rgba(34, 197, 94, 0.88),
    rgba(16, 185, 129, 0.78)
  );
  box-shadow: var(--shadow);
}

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}

.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
}

.card strong {
  display: block;
  margin-bottom: 6px;
}

.section {
  padding: 18px 0;
}

.hr {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

.footer {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding: 16px 0;
  color: var(--muted-2);
  font-size: 13px;
}

.notice {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 6px;
  background: linear-gradient(135deg, var(--brand), #3b82f6);
  flex: 0 0 auto;
}

.iframe-wrap {
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 80%, transparent);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 0 color-mix(in oklab, var(--text) 6%, transparent) inset;
}

iframe {
  width: 100%;
  border: 0;
  display: block;
  background: transparent;
}

/* Mobile bottom nav */
.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  padding: 10px 12px calc(env(safe-area-inset-bottom) + 10px);
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
}

.mobile-nav .inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.nav-item {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  min-height: 54px;
}

.nav-item strong {
  font-weight: 650;
  color: inherit;
}

.nav-item .ico {
  font-size: 18px;
  line-height: 1;
}

.nav-item:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.nav-item[aria-current="page"] {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

/* Desktop: hide bottom nav and remove body padding for it */
@media (min-width: 720px) {
  body {
    padding-bottom: 0;
  }
  .cta {
    grid-template-columns: 1.2fr 1fr 1fr;
  }
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .mobile-nav {
    display: none;
  }
}

:focus-visible {
  outline: 3px solid rgba(139, 92, 246, 0.65);
  outline-offset: 3px;
  border-radius: 12px;
}
/* ---- iPhone safe-area fixes (top/bottom/left/right) ---- */

/* Header: don’t sit under the notch/status bar */
header {
  padding-top: env(safe-area-inset-top);
}

/* Bottom nav: keep away from home indicator AND side cutouts */
.mobile-nav {
  padding-left: calc(12px + env(safe-area-inset-left));
  padding-right: calc(12px + env(safe-area-inset-right));
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

/* Make sure inner container never overflows */
.mobile-nav .inner {
  width: 100%;
}

/* Give the page enough bottom space so content doesn’t hide behind the nav.
   Increase this if your footer still gets covered. */
body {
  padding-bottom: calc(env(safe-area-inset-bottom) + 96px);
}

/* (Optional) If top content still feels tight, give main content a little breathing room */
main.wrap {
  padding-top: 8px;
}
/* --- FIX: prevent horizontal overflow + make header responsive on small screens --- */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Allow header row to wrap instead of overflowing */
.top {
  flex-wrap: wrap;
}

/* Make brand area shrink nicely */
.brand {
  min-width: 0;
}

/* On small screens, reduce or hide the long badge so header fits */
@media (max-width: 420px) {
  .badge {
    display: none;
  }

  /* Keep actions compact */
  .actions .link {
    padding: 8px 10px;
  }
  .icon-btn {
    min-width: 40px;
    height: 40px;
  }
}

/* Also protect the mobile bottom nav from overflow */
.mobile-nav,
.mobile-nav .inner {
  max-width: 100%;
  overflow-x: hidden;
}
