:root {
  color-scheme: dark;
  --bg: #07111f;
  --surface: rgba(15, 31, 50, 0.82);
  --surface-strong: #10233a;
  --surface-soft: rgba(22, 45, 69, 0.72);
  --line: rgba(164, 195, 220, 0.14);
  --line-strong: rgba(164, 195, 220, 0.24);
  --text: #f4f8fb;
  --muted: #96a9ba;
  --accent: #58e2c2;
  --accent-bright: #8ff5dc;
  --accent-ink: #06251f;
  --blue: #58a6ff;
  --danger: #ff7285;
  --warning: #ffc66d;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.34);
  --radius-xl: 30px;
  --radius-lg: 22px;
  --radius-md: 15px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(33, 84, 105, 0.32), transparent 38%),
    linear-gradient(160deg, #081524 0%, #06101d 55%, #07111f 100%);
  color: var(--text);
}

button, input, textarea { font: inherit; }
button { color: inherit; }

.ambient {
  position: fixed;
  z-index: 0;
  width: 340px;
  height: 340px;
  border-radius: 999px;
  filter: blur(110px);
  opacity: 0.12;
  pointer-events: none;
}
.ambient-a { top: 18%; left: -180px; background: var(--accent); }
.ambient-b { right: -200px; bottom: 10%; background: var(--blue); }

.app-shell {
  position: relative;
  z-index: 1;
  width: min(100% - 32px, 860px);
  margin: 0 auto;
  padding: 28px 0 max(34px, env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(88, 226, 194, 0.22);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(88, 226, 194, 0.2), rgba(88, 166, 255, 0.06));
  box-shadow: inset 0 1px rgba(255,255,255,.05);
}

.brand-mark svg { width: 29px; fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linecap: round; }
.brand > span:last-child { display: flex; flex-direction: column; line-height: 1.05; }
.brand strong { font-size: 17px; letter-spacing: .01em; }
.brand small { margin-top: 5px; color: var(--muted); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; }

.support-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 27, 43, 0.64);
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(12px);
}
.support-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 12px currentColor; }
.support-pill[data-state="supported"] { color: var(--accent-bright); }
.support-pill[data-state="supported"] .support-dot { background: var(--accent); }
.support-pill[data-state="unsupported"] { color: #ff9ca9; }
.support-pill[data-state="unsupported"] .support-dot { background: var(--danger); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: center;
  min-height: 300px;
  padding: 46px 46px 34px;
}

.eyebrow, .stage-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 760;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 7vw, 70px);
  line-height: .99;
  letter-spacing: -.055em;
}
.hero h1 span { color: #9eb1c2; }
.hero-copy { max-width: 450px; margin: 24px 0 0; color: var(--muted); font-size: 15px; line-height: 1.8; }

.signal-art { position: relative; display: grid; width: 240px; height: 240px; place-items: center; }
.signal-ring { position: absolute; border: 1px solid rgba(88, 226, 194, .14); border-radius: 50%; }
.ring-1 { width: 112px; height: 112px; }
.ring-2 { width: 168px; height: 168px; }
.ring-3 { width: 224px; height: 224px; }
.signal-ring::after { content: ""; position: absolute; top: 50%; left: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px var(--accent); }
.ring-1::after { animation: orbit 6s linear infinite; transform-origin: 59px 0; }
.ring-2::after { animation: orbit 9s linear reverse infinite; transform-origin: 87px 0; }
.ring-3::after { animation: orbit 13s linear infinite; transform-origin: 115px 0; }
.signal-core {
  display: grid;
  width: 82px;
  height: 82px;
  place-items: center;
  border: 1px solid rgba(88, 226, 194, .38);
  border-radius: 25px;
  background: linear-gradient(145deg, rgba(88, 226, 194, .22), rgba(17, 42, 63, .9));
  box-shadow: 0 0 50px rgba(88, 226, 194, .13), inset 0 1px rgba(255,255,255,.09);
  transform: rotate(-5deg);
}
.signal-core svg { width: 46px; fill: none; stroke: var(--accent-bright); stroke-width: 2.1; stroke-linecap: round; }

@keyframes orbit { to { transform: rotate(360deg); } }

.workspace {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(160deg, rgba(16, 36, 58, .92), rgba(10, 24, 40, .92));
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.04);
  backdrop-filter: blur(18px);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 9px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 16, 29, .44);
}
.mode-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
  transition: .2s ease;
}
.mode-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mode-button:hover { color: var(--text); }
.mode-button.active { background: rgba(88, 226, 194, .1); color: var(--accent-bright); box-shadow: inset 0 0 0 1px rgba(88, 226, 194, .12); }

.panel { padding: 34px; }
.panel[hidden] { display: none; }

.scan-stage {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: center;
  gap: 42px;
  min-height: 300px;
  padding: 22px;
}

.scan-visual { position: relative; display: grid; width: 210px; height: 210px; place-items: center; }
.scan-orbit { position: absolute; border: 1px solid rgba(88, 226, 194, .15); border-radius: 50%; }
.orbit-a { width: 180px; height: 180px; }
.orbit-b { width: 138px; height: 138px; }
.phone-shape {
  position: relative;
  display: block;
  width: 88px;
  height: 142px;
  border: 2px solid rgba(226, 241, 250, .72);
  border-radius: 19px;
  background: linear-gradient(145deg, #19334c, #0d2034);
  box-shadow: 0 22px 48px rgba(0,0,0,.34);
  transform: rotate(-8deg);
}
.phone-shape::after { content:""; position:absolute; inset:6px; border:1px solid rgba(255,255,255,.05); border-radius:13px; }
.phone-speaker { position:absolute; top:8px; left:50%; width:25px; height:3px; border-radius:2px; background:rgba(216,236,246,.3); transform:translateX(-50%); }
.phone-nfc { position:absolute; top:49px; left:50%; width:42px; height:42px; transform:translateX(-50%); }
.phone-nfc i { position:absolute; top:50%; left:0; border:2px solid var(--accent); border-top-color:transparent; border-bottom-color:transparent; border-left-color:transparent; border-radius:50%; transform:translateY(-50%); }
.phone-nfc i:nth-child(1) { width:12px; height:14px; left:3px; }
.phone-nfc i:nth-child(2) { width:23px; height:29px; left:3px; opacity:.7; }
.phone-nfc i:nth-child(3) { width:36px; height:44px; left:3px; opacity:.35; }

.scan-stage.scanning .scan-orbit { animation: pulse 1.8s ease-out infinite; }
.scan-stage.scanning .orbit-b { animation-delay: .55s; }
@keyframes pulse { 0% { transform:scale(.72); opacity:0; } 30% { opacity:1; } 100% { transform:scale(1.22); opacity:0; } }

.scan-content h2, .form-heading h2, .section-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.025em; }
.scan-content > p:not(.stage-kicker) { max-width: 400px; margin: 13px 0 24px; color: var(--muted); line-height: 1.7; }

.primary-button, .secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 21px;
  border: 0;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.primary-button { background: linear-gradient(135deg, var(--accent-bright), var(--accent)); color: var(--accent-ink); box-shadow: 0 12px 30px rgba(88, 226, 194, .17); }
.primary-button svg { width: 21px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; }
.primary-button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(88, 226, 194, .24); }
.primary-button:disabled { opacity: .38; cursor: not-allowed; box-shadow: none; }
.secondary-button { min-width: 110px; border:1px solid var(--line-strong); background:rgba(255,255,255,.04); }

.result-section { padding: 28px; border-top: 1px solid var(--line); border-radius: var(--radius-lg); background: rgba(4, 15, 27, .34); }
.hidden { display: none !important; }
.section-heading, .form-heading { display:flex; align-items:center; justify-content:space-between; gap:20px; }
.icon-button { display:grid; width:42px; height:42px; place-items:center; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.035); cursor:pointer; }
.icon-button:hover { border-color:var(--line-strong); background:rgba(255,255,255,.07); }
.icon-button svg { width:19px; fill:none; stroke:currentColor; stroke-width:1.8; }
.tag-meta { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:22px 0; }
.tag-meta > div { padding:14px 16px; border:1px solid var(--line); border-radius:13px; background:rgba(255,255,255,.025); }
.tag-meta dt { color:var(--muted); font-size:11px; letter-spacing:.08em; text-transform:uppercase; }
.tag-meta dd { margin:6px 0 0; overflow-wrap:anywhere; font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:13px; }
.record-list { display:grid; gap:12px; }
.record-card { padding:17px; border:1px solid var(--line); border-radius:15px; background:var(--surface-soft); }
.record-card header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:10px; }
.record-badge { padding:5px 8px; border-radius:7px; background:rgba(88,226,194,.1); color:var(--accent-bright); font-size:10px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; }
.record-card small { color:var(--muted); font-family:ui-monospace, SFMono-Regular, Menlo, monospace; }
.record-value { margin:0; color:#dbe8f0; line-height:1.65; overflow-wrap:anywhere; white-space:pre-wrap; }
.record-value a { color:var(--accent-bright); }

.form-heading { margin-bottom:25px; }
.capacity-hint { padding:7px 10px; border:1px solid var(--line); border-radius:9px; color:var(--muted); font-family:ui-monospace, SFMono-Regular, Menlo, monospace; font-size:11px; }
.record-type-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }
.type-card { position:relative; display:flex; min-height:96px; flex-direction:column; align-items:center; justify-content:center; gap:10px; border:1px solid var(--line); border-radius:15px; background:rgba(255,255,255,.025); color:var(--muted); font-size:12px; font-weight:700; cursor:pointer; transition:.18s ease; }
.type-card:hover { border-color:var(--line-strong); color:var(--text); }
.type-card.active { border-color:rgba(88,226,194,.36); background:rgba(88,226,194,.085); color:var(--accent-bright); }
.type-card input { position:absolute; opacity:0; pointer-events:none; }
.type-icon { display:grid; width:34px; height:34px; place-items:center; border-radius:10px; background:rgba(255,255,255,.04); }
.type-icon svg { width:20px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.dynamic-fields { display:grid; gap:16px; margin-top:24px; }
.field { display:grid; gap:8px; }
.field label { color:#c7d5df; font-size:12px; font-weight:700; }
.field input, .field textarea { width:100%; border:1px solid var(--line); outline:none; border-radius:13px; background:rgba(4,14,25,.56); color:var(--text); transition:border-color .18s, box-shadow .18s; }
.field input { height:50px; padding:0 15px; }
.field textarea { min-height:132px; padding:14px 15px; resize:vertical; line-height:1.6; }
.field input::placeholder, .field textarea::placeholder { color:#62778a; }
.field input:focus, .field textarea:focus { border-color:rgba(88,226,194,.5); box-shadow:0 0 0 3px rgba(88,226,194,.08); }
.field-error { min-height:15px; margin:0; color:#ff9daa; font-size:11px; }
.contact-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.contact-grid .field:first-child { grid-column:1/-1; }

.consent-row { display:flex; align-items:flex-start; gap:11px; margin:22px 0 18px; color:var(--muted); font-size:12px; line-height:1.6; cursor:pointer; }
.consent-row input { position:absolute; opacity:0; }
.custom-checkbox { display:grid; width:20px; height:20px; flex:0 0 auto; place-items:center; margin-top:1px; border:1px solid var(--line-strong); border-radius:6px; background:rgba(255,255,255,.03); }
.custom-checkbox svg { width:13px; fill:none; stroke:var(--accent-ink); stroke-width:2.2; opacity:0; }
.consent-row input:checked + .custom-checkbox { border-color:var(--accent); background:var(--accent); }
.consent-row input:checked + .custom-checkbox svg { opacity:1; }
.write-button { width:100%; }

.notice-card { display:flex; gap:14px; margin-top:18px; padding:18px 20px; border:1px solid rgba(255,198,109,.15); border-radius:17px; background:rgba(255,198,109,.045); }
.notice-card > svg { width:20px; height:20px; flex:0 0 auto; fill:none; stroke:var(--warning); stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.notice-card strong { font-size:13px; }
.notice-card p { margin:4px 0 0; color:var(--muted); font-size:12px; line-height:1.6; }
.notice-card .platform-note { margin-top:8px; }
.notice-card .platform-note strong { color:#c7d5df; font-size:inherit; }
.notice-card.supported { border-color:rgba(88,226,194,.14); background:rgba(88,226,194,.04); }
.notice-card.supported > svg { stroke:var(--accent); }
.id-card-notice { border-color:rgba(88,166,255,.16); background:rgba(88,166,255,.045); }
.id-card-notice > svg { stroke:var(--blue); }
.id-card-notice p + p { margin-top:8px; }

footer { display:flex; justify-content:space-between; gap:20px; padding:22px 5px 0; color:#647a8d; font-size:11px; }
footer button { padding:0; border:0; background:none; color:var(--accent); cursor:pointer; }

.toast { position:fixed; z-index:20; right:22px; bottom:22px; max-width:min(390px,calc(100vw - 44px)); padding:13px 16px; border:1px solid var(--line-strong); border-radius:12px; background:#163049; box-shadow:0 18px 45px rgba(0,0,0,.4); font-size:13px; opacity:0; pointer-events:none; transform:translateY(14px); transition:.22s ease; }
.toast.show { opacity:1; transform:none; }
.toast.error { border-color:rgba(255,114,133,.35); background:#3a1b2a; }

dialog { width:min(420px,calc(100% - 34px)); padding:32px; border:1px solid var(--line-strong); border-radius:24px; background:#0e2136; color:var(--text); box-shadow:0 28px 90px rgba(0,0,0,.62); text-align:center; }
dialog::backdrop { background:rgba(2,8,15,.76); backdrop-filter:blur(8px); }
dialog h2 { margin:20px 0 8px; font-size:22px; }
dialog p { margin:0 0 24px; color:var(--muted); line-height:1.65; }
.dialog-icon { display:grid; width:68px; height:68px; margin:auto; place-items:center; border-radius:22px; background:rgba(88,226,194,.08); color:var(--accent); }
.dialog-icon svg { display:none; width:34px; fill:none; stroke:currentColor; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.dialog-spinner { width:30px; height:30px; border:2px solid rgba(88,226,194,.18); border-top-color:var(--accent); border-radius:50%; animation:spin .8s linear infinite; }
.dialog-icon[data-state="success"] { color:var(--accent); }
.dialog-icon[data-state="error"] { color:var(--danger); background:rgba(255,114,133,.08); }
.dialog-icon[data-state="success"] .dialog-spinner, .dialog-icon[data-state="error"] .dialog-spinner { display:none; }
.dialog-icon[data-state="success"] .dialog-success, .dialog-icon[data-state="error"] .dialog-error { display:block; }
@keyframes spin { to { transform:rotate(360deg); } }

@media (max-width: 700px) {
  .app-shell { width:min(100% - 22px, 620px); padding-top:18px; }
  .support-pill { padding:8px 10px; }
  .support-pill #supportText { max-width:104px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .hero { grid-template-columns:1fr; min-height:auto; padding:58px 14px 34px; }
  .hero h1 { font-size:clamp(43px,15vw,64px); }
  .hero-copy { margin-top:20px; }
  .signal-art { display:none; }
  .panel { padding:22px 16px; }
  .scan-stage { grid-template-columns:1fr; gap:12px; min-height:auto; padding:3px 4px 24px; text-align:center; }
  .scan-visual { width:180px; height:180px; margin:auto; transform:scale(.86); }
  .scan-content > p:not(.stage-kicker) { margin-left:auto; margin-right:auto; }
  .record-type-grid { grid-template-columns:repeat(2,1fr); }
  .type-card { min-height:82px; }
  .contact-grid { grid-template-columns:1fr; }
  .contact-grid .field:first-child { grid-column:auto; }
  .tag-meta { grid-template-columns:1fr; }
  .result-section { padding:22px 16px; }
}

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