*, *::before, *::after { box-sizing: border-box; }

:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-soft: #f8faf9;
  --text: #172321;
  --muted: #64716f;
  --border: #dbe4e2;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #e7f4f2;
  --success: #16794c;
  --danger: #b4233c;
  --danger-soft: #fff0f2;
  --shadow: 0 18px 48px rgba(19, 54, 49, .08);
  --radius: 18px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1514; --surface: #151f1e; --surface-soft: #192523;
    --text: #edf5f3; --muted: #9aa9a6; --border: #2b3b38;
    --accent: #5eead4; --accent-hover: #99f6e4; --accent-soft: #173532;
    --success: #6ee7a8; --danger: #fda4af; --danger-soft: #381d24;
    --shadow: 0 18px 48px rgba(0, 0, 0, .24);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1514; --surface: #151f1e; --surface-soft: #192523;
  --text: #edf5f3; --muted: #9aa9a6; --border: #2b3b38;
  --accent: #5eead4; --accent-hover: #99f6e4; --accent-soft: #173532;
  --success: #6ee7a8; --danger: #fda4af; --danger-soft: #381d24;
  --shadow: 0 18px 48px rgba(0, 0, 0, .24);
}

html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font: 15px/1.55 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, select { font: inherit; }
button, [role="button"], select { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button:focus-visible, [role="button"]:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; }
.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; }

.shell { width: min(100% - 32px, 680px); margin: 0 auto; padding: max(24px, env(safe-area-inset-top)) 0 max(28px, env(safe-area-inset-bottom)); }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 52px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 18px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: white; background: var(--accent); font-size: 15px; }
.theme-control select { min-height: 38px; padding: 0 30px 0 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }

.intro { margin-bottom: 24px; }
.eyebrow { display: flex; align-items: center; gap: 8px; color: var(--accent); font-size: 13px; font-weight: 650; }
.privacy-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
h1 { margin: 15px 0 8px; font-size: clamp(32px, 7vw, 46px); line-height: 1.08; letter-spacing: -.045em; }
.intro > p { max-width: 570px; margin: 0; color: var(--muted); font-size: 16px; }
.pair-status { display: flex; align-items: flex-start; gap: 10px; margin-top: 20px; padding: 12px 14px; color: var(--accent); background: var(--accent-soft); border-radius: 12px; font-size: 13px; }
.pair-status svg { width: 19px; flex: 0 0 19px; fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }

.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.upload-card { padding: 10px; }
.dropzone { display: grid; justify-items: center; padding: 46px 24px 38px; text-align: center; border: 1.5px dashed var(--border); border-radius: 12px; background: var(--surface-soft); cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.dropzone:hover, .dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.dragging { transform: scale(.995); }
.upload-icon { width: 38px; height: 38px; margin-bottom: 15px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dropzone h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.02em; }
.dropzone p { max-width: 430px; margin: 0 0 22px; color: var(--muted); }
.dropzone small { margin-top: 12px; color: var(--muted); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 11px; font-weight: 680; cursor: pointer; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.button:active { transform: translateY(1px); }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover { background: var(--accent-hover); }
.button-secondary { color: var(--text); background: var(--surface); border-color: var(--border); }
.button-secondary:hover { border-color: var(--accent); }
.button[disabled] { opacity: .62; cursor: wait; }
.text-button { padding: 7px; color: var(--accent); background: transparent; border: 0; font-weight: 650; cursor: pointer; }
.selection { display: flex; align-items: center; gap: 12px; padding: 14px 12px 4px; }
.selection svg { width: 25px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linejoin: round; }
.selection div { min-width: 0; flex: 1; }
.selection strong, .selection span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection span { color: var(--muted); font-size: 12px; }

.status-card { margin-top: 18px; padding: 24px; }
.status-heading { display: flex; align-items: flex-start; gap: 14px; }
.status-symbol { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 18px; font-weight: 800; }
.status-heading h2 { margin: 1px 0 2px; font-size: 20px; letter-spacing: -.02em; }
.status-heading p { margin: 0; color: var(--muted); }
.checks { display: grid; gap: 9px; margin-top: 22px; }
.check { display: grid; grid-template-columns: 20px 1fr; gap: 10px; padding: 11px 12px; border-radius: 10px; background: var(--surface-soft); }
.check-mark { color: var(--success); font-weight: 800; }
.check.error .check-mark, .check.error strong { color: var(--danger); }
.check strong { display: block; font-size: 14px; }
.check span { display: block; color: var(--muted); font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }
.actions .text-button { margin-left: auto; }
[data-state="reading"] .status-symbol, [data-state="validating"] .status-symbol, [data-state="syncing"] .status-symbol { animation: pulse 1.2s ease-in-out infinite; }
[data-state="invalid"] .status-symbol, [data-state="sync_error"] .status-symbol { color: var(--danger); background: var(--danger-soft); }
[data-state="synced"] .status-symbol { color: var(--success); }
footer { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; color: var(--muted); font-size: 12px; }

@keyframes pulse { 50% { opacity: .45; transform: scale(.94); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (max-width: 560px) {
  .shell { width: min(100% - 22px, 680px); }
  .topbar { margin-bottom: 38px; }
  .theme-control select { width: 116px; }
  .dropzone { padding: 36px 18px 30px; }
  .status-card { padding: 20px 17px; }
  .actions { align-items: stretch; }
  .actions .button { width: 100%; }
  .actions .text-button { width: 100%; margin-left: 0; }
}
