/* ==========================================================================
   MaxToken — Apple Liquid Glass Edition
   Restrained typography, translucent refractive surfaces, specular edges.
   ========================================================================== */

:root {
  --canvas: #F3F5F9;
  --ink: #111318;
  --ink-2: rgba(17, 19, 24, 0.66);
  --ink-3: rgba(17, 19, 24, 0.44);

  --accent: #0071E3;
  --accent-hover: #0077ED;
  --danger: #D93025;
  --danger-tint: rgba(217, 48, 37, 0.08);
  --danger-edge: rgba(217, 48, 37, 0.24);
  --ok: #1E8E3E;

  /* Liquid Glass tokens */
  --glass-bg: rgba(255, 255, 255, 0.56);
  --glass-bg-strong: rgba(255, 255, 255, 0.74);
  --glass-border: rgba(255, 255, 255, 0.78);
  --glass-hairline: rgba(17, 19, 24, 0.07);
  --glass-inset-top: rgba(255, 255, 255, 0.92);
  --glass-inset-bottom: rgba(17, 19, 24, 0.05);
  --glass-shadow:
    0 14px 36px -14px rgba(15, 23, 42, 0.11),
    0 2px 6px -1px rgba(15, 23, 42, 0.04);

  --orb-1: rgba(120, 178, 255, 0.44);
  --orb-2: rgba(242, 186, 152, 0.36);
  --orb-3: rgba(176, 164, 255, 0.34);

  --btn-dark-bg: #16181D;
  --btn-dark-fg: #FFFFFF;

  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", sans-serif;
  --font-mono: "SF Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  --canvas: #090B10;
  --ink: #F5F7FA;
  --ink-2: rgba(245, 247, 250, 0.68);
  --ink-3: rgba(245, 247, 250, 0.42);

  --accent: #2997FF;
  --accent-hover: #47A7FF;
  --danger: #FF6961;
  --danger-tint: rgba(255, 105, 97, 0.12);
  --danger-edge: rgba(255, 105, 97, 0.28);
  --ok: #30D158;

  --glass-bg: rgba(28, 32, 42, 0.54);
  --glass-bg-strong: rgba(36, 41, 54, 0.72);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-hairline: rgba(255, 255, 255, 0.08);
  --glass-inset-top: rgba(255, 255, 255, 0.2);
  --glass-inset-bottom: rgba(0, 0, 0, 0.32);
  --glass-shadow:
    0 20px 44px -16px rgba(0, 0, 0, 0.58),
    0 2px 8px -2px rgba(0, 0, 0, 0.35);

  --orb-1: rgba(41, 151, 255, 0.22);
  --orb-2: rgba(217, 119, 87, 0.18);
  --orb-3: rgba(138, 120, 255, 0.2);

  --btn-dark-bg: #F5F7FA;
  --btn-dark-fg: #090B10;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-height: 100%;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, p, ul, ol {
  margin: 0;
}

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

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--glass-hairline);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Ambient Refractive Mesh */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(88px);
  opacity: 0.9;
  will-change: transform;
}

.orb--1 {
  width: 560px;
  height: 560px;
  top: -180px;
  left: -100px;
  background: radial-gradient(circle, var(--orb-1), transparent 70%);
}

.orb--2 {
  width: 520px;
  height: 520px;
  top: 120px;
  right: -140px;
  background: radial-gradient(circle, var(--orb-2), transparent 70%);
}

.orb--3 {
  width: 600px;
  height: 600px;
  bottom: -220px;
  left: 28%;
  background: radial-gradient(circle, var(--orb-3), transparent 70%);
}

/* Signature Liquid Glass Material */
.glass {
  position: relative;
  background: linear-gradient(155deg, var(--glass-bg-strong) 0%, var(--glass-bg) 100%);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid var(--glass-border);
  box-shadow:
    inset 0 1px 0 var(--glass-inset-top),
    inset 0 -1px 0 var(--glass-inset-bottom),
    var(--glass-shadow);
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 0%),
    rgba(255, 255, 255, 0.24),
    transparent 62%
  );
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}

[data-theme="dark"] .glass::before {
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 0%),
    rgba(255, 255, 255, 0.09),
    transparent 62%
  );
}

.glass:hover::before {
  opacity: 1;
}

/* Container */
.container {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Floating Pill Navigation */
.nav-shell {
  position: sticky;
  top: 14px;
  z-index: 40;
  padding: 0 20px;
  display: flex;
  justify-content: center;
}

.nav-pill {
  width: 100%;
  max-width: 880px;
  height: 52px;
  padding: 0 8px 0 18px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2997FF, #D97757);
  box-shadow: 0 0 10px rgba(41, 151, 255, 0.45);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-links a {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  transition: color 0.16s ease;
}

.nav-links a:hover {
  color: var(--ink);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.glass-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--glass-hairline);
  background: rgba(128, 128, 140, 0.08);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.glass-icon:hover {
  background: rgba(128, 128, 140, 0.16);
  color: var(--ink);
}

.glass-icon svg {
  width: 16px;
  height: 16px;
}

.i-moon { display: none; }
[data-theme="dark"] .i-sun { display: none; }
[data-theme="dark"] .i-moon { display: block; }

/* Capsule Buttons */
.pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: none;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}

.pill-btn:hover {
  transform: translateY(-1px);
}

.pill-btn:active {
  transform: scale(0.98);
}

.pill-btn--dark {
  background: var(--btn-dark-bg);
  color: var(--btn-dark-fg);
}

.pill-btn--accent {
  height: 44px;
  padding: 0 24px;
  font-size: 14px;
  background: var(--accent);
  color: #FFFFFF;
  box-shadow: 0 8px 22px -8px rgba(0, 113, 227, 0.55);
}

.pill-btn--accent:hover {
  background: var(--accent-hover);
}

.pill-btn--glass {
  height: 44px;
  padding: 0 22px;
  font-size: 14px;
  color: var(--ink);
}

.pill-btn.is-muted {
  opacity: 0.45;
}

.mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-hairline);
  background: rgba(128, 128, 140, 0.1);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
  white-space: nowrap;
}

.mini-pill:hover {
  background: rgba(128, 128, 140, 0.18);
}

.mini-pill--solid {
  background: var(--accent);
  border-color: transparent;
  color: #FFFFFF;
}

.mini-pill--solid:hover {
  background: var(--accent-hover);
}

/* Hero */
.hero {
  text-align: center;
  padding: 64px 0 40px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 22px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(30, 142, 62, 0.16);
}

.hero__title {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin-bottom: 14px;
}

.hero__title span {
  display: inline-block;
  margin-left: 10px;
  font-size: 0.42em;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink-2);
  vertical-align: middle;
}

.hero__sub {
  font-size: 16px;
  color: var(--ink-2);
  margin-bottom: 30px;
}

.hero__sub strong {
  color: var(--ink);
  font-weight: 600;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 620px;
  margin: 0 auto 28px;
}

.kpi {
  border-radius: var(--radius-lg);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.kpi__num {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.kpi__label {
  font-size: 12px;
  color: var(--ink-3);
}

.hero__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Bento Grid */
.bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  border-radius: var(--radius-xl);
  padding: 24px 26px;
  display: flex;
  flex-direction: column;
}

.card__eyebrow {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  margin-bottom: 6px;
}

.card h2 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}

.clean-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--ink-2);
  font-size: 14px;
}

.clean-list li {
  position: relative;
  padding-left: 14px;
}

.clean-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-3);
}

.clean-list strong {
  color: var(--ink);
  font-weight: 600;
}

.card--ip {
  justify-content: space-between;
}

.card__note {
  color: var(--ink-2);
  font-size: 14px;
  margin-bottom: 18px;
}

.ip-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 14px;
  border-radius: 16px;
  background: rgba(128, 128, 140, 0.08);
  border: 1px solid var(--glass-hairline);
}

.ip-box > span {
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ip-box__ops {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Minimal Refund Calculator */
.calc {
  border-radius: var(--radius-xl);
  padding: 24px 26px;
  margin-bottom: 16px;
}

.calc__top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.calc__formula {
  font-size: 14px;
  color: var(--ink-2);
}

.calc__readout {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.calc__tag {
  font-size: 13px;
  color: var(--ink-2);
}

.calc__tag b {
  color: var(--ink);
}

.calc__amount {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
}

.calc__amount.is-zero {
  color: var(--danger);
}

/* Apple-style Slider */
.liquid-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(128, 128, 140, 0.22);
  outline: none;
  margin: 6px 0 16px;
  cursor: pointer;
}

.liquid-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 0.5px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: transform 0.14s ease;
}

.liquid-slider::-webkit-slider-thumb:hover {
  transform: scale(1.08);
}

.liquid-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 0.5px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.calc__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.preset-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  height: 28px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-hairline);
  background: rgba(128, 128, 140, 0.08);
  color: var(--ink-2);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  color: var(--ink);
  background: rgba(128, 128, 140, 0.16);
}

.chip-btn.is-active {
  background: var(--btn-dark-bg);
  color: var(--btn-dark-fg);
  border-color: transparent;
}

.calc__hint {
  font-size: 12px;
  color: var(--ink-3);
}

/* Risk Card (Tinted Liquid Glass) */
.risk-card {
  border-radius: var(--radius-xl);
  padding: 24px 26px;
  margin-bottom: 16px;
  background: linear-gradient(155deg, var(--danger-tint) 0%, var(--glass-bg) 100%);
  border-color: var(--danger-edge);
}

.risk-card__head {
  margin-bottom: 14px;
}

.risk-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--danger-tint);
  border: 1px solid var(--danger-edge);
  color: var(--danger);
  font-size: 11.5px;
  font-weight: 600;
}

.risk-lines {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.risk-lines li {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--danger-edge);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}

[data-theme="dark"] .risk-lines li {
  background: rgba(20, 22, 28, 0.46);
}

.risk-lines .mono {
  font-size: 11.5px;
  color: var(--danger);
  font-weight: 600;
  flex-shrink: 0;
}

/* Apple iOS Switch Confirmation Bar */
.confirm-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--glass-hairline);
  flex-wrap: wrap;
}

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--ink-2);
  user-select: none;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-ui {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(128, 128, 140, 0.28);
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.switch-row input:checked + .switch-ui {
  background: var(--ok);
}

.switch-row input:checked + .switch-ui::after {
  transform: translateX(18px);
}

.switch-row input:checked ~ span:last-child {
  color: var(--ink);
  font-weight: 500;
}

/* Reference Strip */
.ref-strip {
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.ref-strip__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--ink-2);
}

.ref-strip__meta strong {
  color: var(--ink);
}

.ref-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  background: rgba(128, 128, 140, 0.12);
  color: var(--ink-2);
}

/* Footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 28px;
  padding-bottom: 44px;
  font-size: 12.5px;
  color: var(--ink-3);
  flex-wrap: wrap;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

/* Responsive */
@media (max-width: 740px) {
  .nav-links {
    display: none;
  }

  .hero {
    padding: 44px 0 30px;
  }

  .hero__title span {
    display: block;
    margin-left: 0;
    margin-top: 6px;
  }

  .bento,
  .kpi-row {
    grid-template-columns: 1fr;
  }

  .kpi-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .kpi {
    padding: 12px 8px;
  }

  .kpi__num {
    font-size: 20px;
  }

  .card,
  .calc,
  .risk-card {
    padding: 20px;
    border-radius: 24px;
  }

  .confirm-bar .pill-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .glass::before { display: none; }
}
