:root {
  --canvas: #050914;
  --canvas-soft: #0a1020;
  --paper: rgba(17, 27, 45, 0.82);
  --surface: rgba(22, 34, 55, 0.92);
  --surface-soft: rgba(10, 18, 32, 0.68);
  --ink: #f8fafc;
  --ink-soft: #a8b3c7;
  --ink-strong: #d8e2f3;
  --gold: #f7b500;
  --gold-dark: #f59e0b;
  --gold-soft: rgba(247, 181, 0, 0.12);
  --line: rgba(148, 163, 184, 0.22);
  --line-strong: rgba(250, 204, 21, 0.38);
  --success: #6ee7b7;
  --danger: #fca5a5;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% -10%, rgba(247, 181, 0, 0.18), transparent 31rem),
    radial-gradient(circle at 90% 12%, rgba(37, 99, 235, 0.11), transparent 29rem),
    linear-gradient(155deg, var(--canvas), var(--canvas-soft) 58%, #07101d);
  background-attachment: fixed;
}

button, input, select, textarea { font: inherit; }
button { touch-action: manipulation; }

.prototype-banner {
  padding: 0.4rem 1rem;
  text-align: center;
  color: #d8e2f3;
  background: rgba(0, 0, 0, 0.55);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  min-height: 74px;
  background: rgba(5, 9, 20, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  color: #fff;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  border-radius: 8px;
}
.brand img { display: block; width: clamp(150px, 24vw, 205px); height: 42px; object-fit: contain; object-position: left center; }
.brand::after {
  content: "";
  position: absolute;
  inset: -80% -35%;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.46) 49%, transparent 60%);
  transform: translateX(-75%) rotate(4deg);
  animation: logo-shine 5.8s ease-in-out infinite;
  pointer-events: none;
  mix-blend-mode: screen;
}
@keyframes logo-shine {
  0%, 68% { transform: translateX(-75%) rotate(4deg); opacity: 0; }
  74% { opacity: .65; }
  88%, 100% { transform: translateX(75%) rotate(4deg); opacity: 0; }
}
.header-meta { display: flex; gap: 0.55rem; color: var(--ink-soft); font-size: 0.88rem; }
.header-back {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 1.3rem;
  cursor: pointer;
}
.header-back:hover { border-color: var(--line-strong); background: var(--gold-soft); }

.progress-wrap {
  padding: 0.85rem clamp(1rem, 4vw, 3rem) 0;
  max-width: 1000px;
  margin: 0 auto;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.84rem;
}

.progress-track { height: 5px; overflow: hidden; background: rgba(148,163,184,0.2); border-radius: 99px; }
.progress-track span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-dark)); transition: width 220ms ease; box-shadow: 0 0 18px rgba(247,181,0,.4); }

.app-shell {
  width: min(920px, calc(100% - 2rem));
  margin: 1.25rem auto 3rem;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.035), transparent 42%),
    var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.screen { padding: clamp(1.35rem, 4vw, 3rem); }
.screen-narrow { max-width: 700px; margin: 0 auto; }
.eyebrow { color: var(--gold); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0.75rem; font-size: clamp(2rem, 5vw, 3.3rem); line-height: 1.04; }
h2 { margin-bottom: 0.65rem; font-size: clamp(1.55rem, 3.4vw, 2.25rem); line-height: 1.15; }
h3 { margin-bottom: 0.45rem; font-size: 1.05rem; }
.lead { max-width: 670px; color: var(--ink-soft); font-size: 1.03rem; line-height: 1.65; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.84rem; }

.language-grid, .choice-grid, .summary-grid, .form-grid {
  display: grid;
  gap: 0.9rem;
}

.language-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 2rem; }
.choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1.4rem; }
.summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1.4rem; }

.choice-card {
  width: 100%;
  min-height: 112px;
  padding: 1rem;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: linear-gradient(145deg, rgba(255,255,255,0.035), transparent), var(--surface-soft);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.choice-card:hover { border-color: var(--line-strong); transform: translateY(-1px); background-color: var(--surface); }
.choice-card[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-soft); box-shadow: 0 0 0 2px rgba(247, 181, 0, 0.13), 0 12px 34px rgba(0,0,0,.22); }
.choice-title { display: block; margin-bottom: 0.35rem; font-weight: 800; }
.choice-detail { display: block; color: var(--ink-soft); font-size: 0.88rem; line-height: 1.45; }
.price { display: block; margin-top: 0.6rem; color: var(--gold); font-weight: 800; }
.language-choice-card { position: relative; min-height: 104px; padding-right: 4.5rem; }
.language-choice-flag { position: absolute; top: 50%; right: 1rem; transform: translateY(-50%); display: grid; place-items: center; width: 3rem; height: 3rem; border: 1px solid rgba(247, 181, 0, 0.28); border-radius: 50%; background: rgba(247, 181, 0, 0.09); font-size: 1.65rem; box-shadow: inset 0 1px 0 rgba(255,255,255,.07); }

.language-screen-active .app-header { display: none; }
.language-screen-active .app-shell {
  width: min(42rem, calc(100% - 2rem));
  margin-top: clamp(2rem, 18vh, 12rem);
  border-radius: 20px;
}
.language-screen-active .screen { padding: 1.6rem; }
.language-auth-card { width: 100%; }
.language-auth-logo {
  position: relative;
  display: inline-flex;
  overflow: hidden;
  padding: 0.42rem 0.58rem;
  border: 1px solid rgba(250, 204, 21, 0.18);
  border-radius: 16px;
  background: radial-gradient(circle at 58% 0%, rgba(247, 181, 0, 0.18), transparent 58%), rgba(4, 9, 18, 0.76);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.34), 0 0 34px rgba(245, 158, 11, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.language-auth-logo::after {
  content: "";
  position: absolute;
  inset: -55% auto -55% -70%;
  width: 46%;
  transform: rotate(18deg);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.34), transparent);
  animation: language-logo-shine 3.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes language-logo-shine {
  0%, 58% { left: -70%; opacity: 0; }
  66% { opacity: .8; }
  85%, 100% { left: 135%; opacity: 0; }
}
.language-auth-logo img { display: block; width: 132px; height: 38px; object-fit: contain; position: relative; z-index: 1; }
.language-auth-heading { margin-top: 1rem; }
.language-heading-stack { display: grid; gap: 0.06rem; margin-top: 0.45rem; }
.language-auth-title, .language-auth-subtitle { margin: 0; }
.language-auth-title, .language-auth-subtitle { font-size: clamp(1.7rem, 4vw, 2rem); line-height: 1.04; }
.language-auth-title { color: #fff; font-weight: 800; }
.language-auth-subtitle { color: #bdc8db; font-weight: 650; }
.language-option-card {
  min-height: 104px;
  padding: 0.85rem;
  color: var(--ink);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(5, 9, 20, 0.62);
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.language-option-card:hover { transform: translateY(-1px); border-color: var(--gold); background: rgba(17,27,45,.95); }
.language-option-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; }
.language-option-name { display: block; font-size: 1rem; font-weight: 800; }
.language-option-prompt { display: block; margin-top: 0.15rem; color: var(--ink-soft); font-size: 0.78rem; }
.language-option-card .language-choice-flag { position: static; transform: none; flex: 0 0 auto; width: 2.25rem; height: 2.25rem; font-size: 1.05rem; }
.language-option-cta { display: inline-flex; margin-top: 0.65rem; padding: 0.42rem 0.82rem; border-radius: 999px; color: #111827; background: var(--gold); font-size: 0.65rem; font-weight: 900; letter-spacing: .04em; }

.field { display: flex; flex-direction: column; gap: 0.42rem; }
.field.full { grid-column: 1 / -1; }
.field label, .field-label { font-size: 0.88rem; font-weight: 750; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 49px;
  padding: 0.78rem 0.9rem;
  color: var(--ink);
  background: rgba(5, 9, 20, 0.72);
  border: 1px solid var(--line);
  border-radius: 14px;
  color-scheme: dark;
}
.field textarea { min-height: 100px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid rgba(247, 181, 0, 0.14); border-color: var(--gold); }
.field-help { margin: 0; color: var(--ink-soft); font-size: .79rem; line-height: 1.4; }
.phone-field { display: grid; grid-template-columns: minmax(255px, 1.25fr) minmax(92px, .35fr) minmax(150px, 1fr); gap: .65rem; }
.dial-code-input { font-variant-numeric: tabular-nums; }
.phone-preview { margin-top: .3rem; color: var(--gold); font-size: .8rem; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.member-photo-card { display: grid; justify-items: center; gap: 1rem; margin: 1.25rem 0; padding: clamp(1rem, 3vw, 1.5rem); border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); text-align: center; }
.member-photo-preview { display: grid; justify-items: center; gap: .65rem; }
.member-photo-preview img, .member-photo-placeholder { width: min(300px, 72vw); aspect-ratio: 1; border-radius: 22px; border: 2px solid rgba(245, 183, 0, .55); background: #08101f; box-shadow: 0 18px 42px rgba(0, 0, 0, .28); }
.member-photo-preview img { display: block; object-fit: cover; }
.member-photo-placeholder { display: grid; place-items: center; color: var(--ink-soft); font-size: clamp(4rem, 16vw, 7rem); }
.member-photo-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; }
.member-photo-actions .btn { display: inline-flex; align-items: center; justify-content: center; }

.notice, .summary-card, .document-card, details {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.notice { margin: 1rem 0; line-height: 1.55; }
.notice.important { border-left: 5px solid var(--gold); background: var(--gold-soft); }
.notice.success { border-left: 5px solid var(--success); }
.summary-card dt { color: var(--ink-soft); font-size: 0.8rem; }
.summary-card dd { margin: 0.22rem 0 0; font-weight: 750; }

.check-list { display: grid; gap: 0.85rem; margin: 1.2rem 0; }
.check-row { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 0.75rem; line-height: 1.5; }
.check-row input { width: 22px; height: 22px; margin-top: 0.08rem; accent-color: var(--gold-dark); }

details { margin: 0.85rem 0; }
summary { cursor: pointer; font-weight: 800; }
details p, details ol { margin: 0.85rem 0 0; color: var(--ink-soft); line-height: 1.55; }
details li + li { margin-top: 0.48rem; }

.error-box {
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  color: var(--danger);
  background: rgba(127, 29, 29, .28);
  border: 1px solid rgba(252, 165, 165, .45);
  border-radius: 10px;
}

.field-invalid,
.choice-card.field-invalid,
.document-card.field-invalid {
  border-color: #fb7185 !important;
  box-shadow: 0 0 0 3px rgba(251, 113, 133, .18);
}
.field.field-invalid { padding: .65rem; border: 1px solid #fb7185; border-radius: 14px; background: rgba(127, 29, 29, .16); }
.field-invalid input,
.field-invalid select,
.field-invalid .signature-canvas { border-color: #fb7185 !important; }
.check-row.field-invalid { padding: .75rem; border: 1px solid #fb7185; border-radius: 12px; background: rgba(127, 29, 29, .16); }
.check-row.field-invalid span { color: #fecdd3; }
.error-notice { border-left: 5px solid #fb7185; background: rgba(127, 29, 29, .2); }
.delivery-result { margin-top: 1rem; }
.completion-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1rem; }

.screen-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1rem clamp(1.35rem, 4vw, 3rem) 1.35rem;
  border-top: 1px solid var(--line);
  background: rgba(5, 9, 20, 0.5);
}

.btn {
  min-height: 48px;
  padding: 0.75rem 1.2rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface-soft);
  font-weight: 800;
  cursor: pointer;
}
.btn:hover { border-color: var(--line-strong); }
.btn-primary { color: #111827; border-color: var(--gold); background: linear-gradient(135deg, var(--gold), var(--gold-dark)); box-shadow: 0 12px 28px rgba(245,158,11,.18); }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn-gold { color: #111827; border-color: var(--gold); background: var(--gold); }
.btn-small { min-height: 38px; padding: 0.52rem 0.75rem; font-size: 0.84rem; }

.signature-stack { display: grid; gap: 1rem; margin-top: 1.2rem; }
.document-card.signed { border-color: rgba(110,231,183,.55); background: rgba(6,78,59,.22); }
.document-head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; }
.status-pill { flex: 0 0 auto; padding: 0.28rem 0.58rem; border-radius: 999px; background: rgba(148,163,184,.14); color: var(--ink-soft); font-size: 0.77rem; font-weight: 800; }
.document-card.signed .status-pill { background: rgba(110,231,183,.12); color: var(--success); }
.signature-canvas { display: block; width: 100%; height: 170px; margin: 0.85rem 0; border: 1px dashed #9b9387; border-radius: 10px; background: #fff; touch-action: none; }
.signature-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }

.pdf-result { margin: 1.4rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-soft); }
.pdf-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; margin: 1rem 0; }
.pdf-actions .btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.pdf-preview { width: 100%; min-height: 660px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pdf-loader { width: 32px; height: 32px; margin: 1rem auto; border: 3px solid rgba(148,163,184,.28); border-top-color: var(--gold); border-radius: 50%; animation: pdf-spin .8s linear infinite; }
@keyframes pdf-spin { to { transform: rotate(360deg); } }

.complete-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 1.15rem;
  border-radius: 50%;
  color: #052e24;
  background: var(--success);
  font-size: 2rem;
  font-weight: 800;
}

.admin-body { min-height: 100vh; background: var(--bg); color: var(--ink); }
.admin-header { display: flex; align-items: center; gap: 1rem; padding: 1rem clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--line); background: #050914; }
.admin-header img { width: 145px; height: 44px; object-fit: contain; }
.admin-header div { display: grid; gap: .15rem; }
.admin-header div span { color: var(--ink-soft); font-size: .82rem; }
.admin-header a { margin-left: auto; color: var(--gold); font-weight: 750; }
.admin-main { width: min(1180px, calc(100% - 2rem)); margin: 2rem auto; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .8fr); gap: 1rem; }
.admin-card { padding: clamp(1rem, 3vw, 1.6rem); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.admin-card h1, .admin-card h2 { margin-top: 0; }
.admin-card form { display: grid; gap: 1rem; }
.admin-card label { display: grid; gap: .4rem; font-weight: 750; }
.admin-card input { width: 100%; min-height: 48px; padding: .75rem .85rem; color: var(--ink); border: 1px solid var(--line); border-radius: 12px; background: #050914; }
.admin-card small { color: var(--ink-soft); font-weight: 400; }
.admin-card dl { display: grid; grid-template-columns: minmax(130px, .5fr) 1fr; gap: .7rem 1rem; }
.admin-card dt { color: var(--ink-soft); }
.admin-card dd { margin: 0; overflow-wrap: anywhere; }
.admin-login { width: min(460px, 100%); margin: 8vh auto; }
.admin-table { margin-top: 1rem; }
.table-scroll { overflow-x: auto; }
.admin-table table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: .75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.admin-table th { color: var(--ink-soft); font-size: .8rem; }
.admin-table a { color: var(--gold); font-weight: 750; }

@media (max-width: 680px) {
  .app-shell { width: calc(100% - 1rem); margin-top: 0.65rem; border-radius: 17px; }
  .header-meta { display: none; }
  .language-grid, .choice-grid, .summary-grid, .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .screen-actions { position: sticky; bottom: 0; }
  .screen-actions .btn { flex: 1; }
  .brand img { width: 150px; }
  .phone-field { grid-template-columns: 105px 1fr; }
  .phone-field select { grid-column: 1 / -1; }
  .language-screen-active .app-shell { margin-top: 0.75rem; }
  .language-screen-active .screen { padding: 0.9rem; }
  .language-auth-logo img { width: 116px; height: 34px; }
  .language-auth-heading { margin-top: 0.8rem; }
  .language-auth-title, .language-auth-subtitle { font-size: clamp(1.35rem, 6.25vw, 1.55rem); }
  .language-grid { gap: 0.55rem; margin-top: 0.9rem; }
  .language-option-card { min-height: 80px; padding: 0.72rem 0.8rem; }
  .language-option-cta { margin-top: 0.5rem; }
  .pdf-preview { min-height: 520px; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-header img { width: 112px; }
  .member-photo-actions { width: 100%; }
  .member-photo-actions .btn { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
  .brand::after { animation: none; }
}
