:root {
  --bg: #050303;
  --panel: rgba(16, 14, 14, 0.94);
  --panel-soft: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(244, 226, 142, 0.34);
  --text: #fff8e7;
  --muted: #b9afa1;
  --soft: #81786e;
  --gold: #f4e28e;
  --gold-deep: #c99b38;
  --red: #d0202a;
  --green: #72e1b8;
  --amber: #f4b38e;
  --radius: 8px;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--bg);
  overflow-x: hidden;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 4%, rgba(208, 32, 42, 0.2), transparent 29rem),
    radial-gradient(circle at 88% 12%, rgba(244, 226, 142, 0.11), transparent 24rem),
    linear-gradient(145deg, #020202 0%, #0a0405 48%, #050303 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(244, 226, 142, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 226, 142, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img { max-width: 100%; }

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 20;
  padding: 10px 14px;
  color: #080604;
  background: var(--gold);
  border-radius: 4px;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.portal-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 0 max(22px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.portal-header,
.portal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.portal-header {
  min-height: 58px;
  border-bottom: 1px solid var(--line);
}

.brand-lockup { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-symbol-shell {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: rgba(244, 226, 142, 0.045);
}
.brand-symbol-shell img { width: 17px; height: 18px; }
.brand-logo { width: 88px; height: auto; }
.portal-context {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.portal-context span { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(114, 225, 184, 0.7); }

.portal-main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(440px, 1fr);
  align-items: center;
  gap: clamp(42px, 8vw, 110px);
  padding: clamp(50px, 9vh, 100px) 0;
}

.portal-intro { max-width: 470px; }
.eyebrow,
.state-kicker {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}
.portal-intro h1 {
  margin: 0;
  max-width: 11ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.45rem, 5.2vw, 5rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.principle { margin: 25px 0 0; color: var(--muted); font-size: clamp(1rem, 1.8vw, 1.2rem); }
.principle strong { color: var(--text); }
.trust-note {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}
.trust-note img { width: 24px; height: 25px; opacity: 0.72; }
.trust-note p { margin: 0; }

.portal-card {
  position: relative;
  width: 100%;
  max-width: 590px;
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(24, 19, 18, 0.96), var(--panel));
  box-shadow: var(--shadow);
  overflow: hidden;
}
.portal-card::before { display: block; height: 2px; content: ""; background: linear-gradient(90deg, var(--red), var(--gold), transparent 88%); }
.state-mount { padding: clamp(24px, 5vw, 46px); }
.state-header { margin-bottom: 28px; }
.state-header h2 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.25rem); line-height: 1.12; letter-spacing: -0.025em; }
.state-description { margin: 13px 0 0; color: var(--muted); font-size: 0.96rem; }
.state-email { color: var(--text); font-weight: 700; overflow-wrap: anywhere; }

.portal-form { display: grid; gap: 18px; }
.form-section { display: grid; gap: 16px; margin: 0; padding: 0; border: 0; }
.form-section + .form-section { margin-top: 10px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-section legend { width: 100%; margin-bottom: 5px; padding: 0; color: var(--text); font-size: 1rem; font-weight: 750; }
.section-help { margin: -10px 0 2px; color: var(--soft); font-size: 0.8rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field label { color: var(--text); font-size: 0.84rem; font-weight: 700; }
.field-help { margin: -1px 0 0; color: var(--soft); font-size: 0.75rem; line-height: 1.4; }
.optional { color: var(--soft); font-size: 0.72rem; font-weight: 500; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 5px;
  color: var(--text);
  background: rgba(3, 3, 3, 0.55);
  transition: border-color 160ms ease, background 160ms ease;
}
input, select { min-height: 48px; padding: 0 13px; }
textarea { min-height: 112px; padding: 12px 13px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #766e66; }
input:hover, select:hover, textarea:hover { border-color: rgba(244, 226, 142, 0.34); }
input:focus, select:focus, textarea:focus { border-color: var(--gold); background: rgba(3, 3, 3, 0.78); outline: 1px solid transparent; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 21px, calc(100% - 13px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.actions { display: grid; gap: 10px; margin-top: 7px; }
.actions-inline { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.button {
  min-height: 48px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 780;
  text-align: center;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: #0b0803; background: linear-gradient(135deg, #fff2ad, var(--gold-deep)); box-shadow: 0 10px 25px rgba(201, 155, 56, 0.13); }
.button-primary:hover { background: linear-gradient(135deg, #fff7cf, #ddb653); }
.button-secondary { color: var(--text); border-color: var(--line-strong); background: rgba(244, 226, 142, 0.035); }
.button-secondary:hover { border-color: var(--gold); background: rgba(244, 226, 142, 0.08); }
.text-button { width: fit-content; padding: 3px 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; font-weight: 650; text-decoration: underline; text-decoration-color: rgba(244, 226, 142, 0.36); text-underline-offset: 4px; }
.text-button:hover { color: var(--text); }
.danger-link { color: var(--amber); }

.notice {
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.86rem;
}
.notice strong { color: var(--text); }
.notice p { margin: 5px 0 0; }
.notice-error { border-left-color: var(--amber); }
.static-note { margin: 22px 0 0; color: var(--soft); font-size: 0.76rem; }

.plan-selection { margin: 0; padding: 0; border: 0; }
.plan-selection legend { margin-bottom: 5px; padding: 0; color: var(--text); font-size: 1rem; font-weight: 750; }
.plan-selection-title { margin: 0 0 5px; color: var(--text); font-size: 1rem; font-weight: 750; }
.plan-grid { display: grid; gap: 10px; margin-top: 16px; }
.plan-card { display: block; cursor: pointer; }
.plan-card-readonly { cursor: default; }
.plan-card input { position: absolute; width: 1px; height: 1px; margin: -1px; opacity: 0; }
.plan-card-content { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; min-height: 108px; padding: 16px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,0.02); transition: border-color 160ms ease, background 160ms ease, transform 160ms ease; }
.plan-card:hover .plan-card-content { border-color: var(--line-strong); transform: translateY(-1px); }
.plan-card-readonly:hover .plan-card-content { border-color: var(--line); transform: none; }
.plan-card input:focus-visible + .plan-card-content { outline: 2px solid var(--gold); outline-offset: 3px; }
.plan-card input:checked + .plan-card-content { border-color: var(--gold); background: rgba(244, 226, 142, 0.08); }
.plan-name { color: var(--text); font-weight: 780; }
.plan-price { grid-column: 2; grid-row: 1; color: var(--gold); font-size: 0.88rem; font-weight: 750; text-align: right; }
.plan-capacity { grid-column: 1 / -1; color: var(--text); font-size: 0.84rem; font-weight: 650; }
.plan-description { grid-column: 1 / -1; color: var(--muted); font-size: 0.78rem; line-height: 1.4; }
.billing-unavailable { margin-top: 20px; }

.status-visual { display: grid; place-items: center; width: 78px; height: 78px; margin-bottom: 26px; border: 1px solid var(--line-strong); border-radius: 50%; background: rgba(244, 226, 142, 0.035); }
.status-visual svg { width: 38px; height: 38px; fill: none; stroke: var(--gold); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.status-visual.pending svg { animation: breathe 2s ease-in-out infinite; }
.status-visual.rejected { border-color: rgba(244, 179, 142, 0.36); }
.status-visual.rejected svg { stroke: var(--amber); }
.status-visual.approved, .status-visual.coach { border-color: rgba(114, 225, 184, 0.38); }
.status-visual.approved svg, .status-visual.coach svg { stroke: var(--green); }
.status-actions { margin-top: 28px; }
.store-links { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.store-link { display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; text-decoration: none; background: rgba(255,255,255,0.025); }
.store-link:hover { border-color: var(--line-strong); }
.store-link small, .store-link strong { display: block; }
.store-link small { color: var(--muted); font-size: 0.65rem; }
.store-link strong { font-size: 0.88rem; }
.store-mark { color: var(--gold); }

.loader { display: flex; align-items: center; gap: 12px; margin-top: 26px; color: var(--muted); font-size: 0.86rem; }
.loader-dots { display: flex; gap: 5px; }
.loader-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); animation: loading 1.2s ease-in-out infinite; }
.loader-dots span:nth-child(2) { animation-delay: 140ms; }
.loader-dots span:nth-child(3) { animation-delay: 280ms; }

.portal-footer { min-height: 62px; padding-top: 17px; border-top: 1px solid var(--line); color: var(--soft); font-size: 0.73rem; }
.portal-footer p { margin: 0; }
.portal-footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 18px; }
.portal-footer a { text-underline-offset: 3px; }
.portal-footer a:hover { color: var(--text); }

@keyframes loading { 0%, 100% { opacity: 0.25; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@keyframes breathe { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

@media (max-width: 840px) {
  .portal-main { grid-template-columns: 1fr; gap: 38px; padding: 44px 0; }
  .portal-intro { max-width: 600px; text-align: center; margin: 0 auto; }
  .portal-intro h1 { max-width: 14ch; margin: 0 auto; font-size: clamp(2.35rem, 8vw, 4rem); }
  .trust-note { justify-content: center; margin-top: 30px; }
  .portal-card { justify-self: center; max-width: 620px; }
}

@media (max-width: 560px) {
  .portal-shell { width: min(100% - 24px, 1180px); }
  .portal-header { min-height: 54px; }
  .portal-context { font-size: 0; }
  .portal-context::after { content: "Coach"; font-size: 0.7rem; }
  .portal-main { padding: 34px 0 38px; gap: 30px; }
  .portal-intro h1 { font-size: clamp(2.15rem, 12vw, 3.2rem); }
  .principle { margin-top: 18px; }
  .trust-note { margin-top: 24px; text-align: left; }
  .state-mount { padding: 25px 20px 28px; }
  .state-header { margin-bottom: 24px; }
  .form-grid, .store-links { grid-template-columns: 1fr; }
  .portal-footer { align-items: flex-start; flex-direction: column; }
  .portal-footer nav { justify-content: flex-start; }
}

@media (max-width: 350px) {
  .portal-shell { width: calc(100% - 16px); }
  .state-mount { padding-inline: 16px; }
  .button { padding-inline: 12px; }
}

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