:root {
  color-scheme: light;
  --page: #f5f6f8;
  --surface: #fff;
  --ink: #192332;
  --muted: #5d6775;
  --line: #e0e4e9;
  --accent: #2456ce;
  --accent-hover: #1d45a6;
  --error: #a32929;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, a, .plan-option { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button, a, input { transition: background-color 150ms, border-color 150ms, color 150ms; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.5rem, 5vw, 1.875rem); font-weight: 650; letter-spacing: -.035em; line-height: 1.25; }
h2 { font-size: 1.0625rem; font-weight: 650; letter-spacing: -.015em; line-height: 1.4; }
p { color: var(--muted); font-size: .9375rem; line-height: 1.6; }

.portal-shell {
  width: min(100%, 528px);
  margin: 0 auto;
  padding: max(56px, env(safe-area-inset-top)) 24px max(32px, env(safe-area-inset-bottom));
}
.topbar { display: flex; justify-content: center; margin-bottom: 28px; }
.brand { display: inline-flex; gap: 12px; align-items: center; padding: 4px; border: 0; border-radius: 8px; color: var(--ink); background: transparent; text-align: left; }
.brand strong { font-size: 1rem; font-weight: 650; letter-spacing: -.02em; }
.brand-mark { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border-radius: 11px; background: var(--ink); color: white; font-size: .875rem; font-weight: 700; letter-spacing: -.04em; }
.access-card { padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 8px 32px #19233205; }
.card-header { margin-bottom: 28px; }
.card-header p { margin-top: 8px; }
.tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--page); border-radius: 10px; margin-bottom: 28px; }
.tab { min-height: 44px; padding: 10px 4px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: .875rem; font-weight: 600; }
.tab:hover { color: var(--ink); background: #e9ecf1; }
.tab.active { color: var(--ink); background: var(--surface); border-color: var(--line); box-shadow: 0 1px 3px #19233208; }
.section-intro { margin-bottom: 24px; }
.section-intro p { margin-top: 6px; }
.form-stack { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; }
.field label { font-size: .875rem; font-weight: 600; }
.field input { width: 100%; min-width: 0; min-height: 50px; border: 1px solid #8993a2; border-radius: 9px; padding: 12px 14px; background: white; color: var(--ink); font-size: 1rem; }
.field input::placeholder { color: var(--muted); }
#voucher-code { letter-spacing: .045em; }
.primary-button { display: flex; justify-content: center; align-items: center; width: 100%; min-height: 48px; padding: 12px 16px; border: 1px solid transparent; border-radius: 9px; background: var(--accent); color: white; font-size: .9375rem; font-weight: 600; line-height: 1.5; text-align: center; text-decoration: none; }
.primary-button:hover:not(:disabled) { background: var(--accent-hover); }
.primary-button:active:not(:disabled) { background: #183987; }
.primary-button:disabled { background: #edf0f4; color: #667180; }
.hint { font-size: .75rem; line-height: 1.5; text-align: center; }
.empty-state { padding-top: 4px; text-align: center; }
.state-icon { display: block; width: 44px; height: 44px; margin: 0 auto 20px; color: var(--muted); }
.empty-state p { max-width: 300px; margin: 8px auto 24px; font-size: .875rem; }
.video-frame { overflow: hidden; border-radius: 10px; background: #111923; aspect-ratio: 16 / 9; }
.video-frame video { display: block; width: 100%; height: 100%; object-fit: contain; }
.video-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: .8125rem; line-height: 1.5; }
.video-meta strong { font-weight: 500; overflow-wrap: anywhere; }
#ad-timer { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress { margin: 12px 0 24px; height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); }
.plan-list { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.plan-option { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.plan-option:hover { border-color: #8993a2; }
.plan-option:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #f7f9ff; }
.plan-option input { width: 18px; height: 18px; flex-shrink: 0; margin: 0; accent-color: var(--accent); }
.plan-copy { flex: 1; min-width: 0; }
.plan-copy strong { display: block; font-size: .875rem; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.plan-copy small { display: block; color: var(--muted); font-size: .75rem; line-height: 1.5; margin-top: 3px; }
.plan-price { flex-shrink: 0; text-align: right; font-variant-numeric: tabular-nums; }
.plan-price strong { display: block; font-size: 1.0625rem; font-weight: 650; }
.plan-price small { display: block; margin-top: 4px; font-size: .75rem; color: var(--muted); }
.loading-text { text-align: center; padding: 24px 0; }
.message { margin-top: 20px; padding: 12px 14px; color: var(--ink); background: var(--page); border-radius: 8px; font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.message.error { color: var(--error); background: #fff3f3; }
.success-panel { text-align: center; padding-top: 8px; }
.success-panel .state-icon { color: var(--accent); width: 48px; height: 48px; }
.success-panel h2 { font-size: 1.5rem; }
.success-panel p { margin: 12px 0 28px; }
.portal-footer { margin-top: 24px; color: var(--muted); font-size: .75rem; line-height: 1.6; text-align: center; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 20px; overflow-y: auto; background: #19233299; }
.modal { width: min(100%, 420px); max-height: 100%; overflow-y: auto; padding: 24px; border-radius: 16px; background: var(--surface); box-shadow: 0 24px 64px #19233233; }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: -8px -8px 20px 0; }
.close-button { flex-shrink: 0; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 1.75rem; }
.close-button:hover { background: var(--page); color: var(--ink); }
body.modal-open { overflow: hidden; }
.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; }

@media (max-width: 540px) {
  .portal-shell { padding: max(28px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
  .topbar { margin-bottom: 24px; }
  .access-card { padding: 24px 20px; border-radius: 16px; }
  .card-header { margin-bottom: 24px; }
  .tabs { margin-bottom: 24px; }
  .plan-option { padding: 14px 12px; gap: 10px; }
}
@media (max-width: 350px) {
  .portal-shell { padding-left: 12px; padding-right: 12px; }
  .access-card { padding: 24px 16px; }
  .plan-option { flex-wrap: wrap; }
  .plan-price { margin-left: auto; }
}
@media (max-height: 600px) and (orientation: landscape) {
  .portal-shell { padding-top: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
