
:root {
  --bg: #F8FAFC; --surface: #FFFFFF; --surface-2: #F8FAFC; --surface-3: #F1F5F9;
  --border: #E2E8F0; --border-strong: #CBD5E1;
  --text: #0F172A; --text-muted: #64748B; --text-faint: #94A3B8;
  --brand: #2563EB; --brand-hover: #1D4ED8; --brand-soft: #EFF6FF; --brand-text: #1D4ED8;
  --success: #16A34A; --success-soft: #F0FDF4; --warn: #B45309; --warn-soft: #FFFBEB;
  --danger: #B91C1C; --danger-soft: #FEF2F2;
  --focus: 0 0 0 3px rgba(37, 99, 235, .12);
  --shadow-md: 0 12px 32px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .08);
  --r-sm: 10px; --r-md: 12px; --r-lg: 14px; --r-full: 999px;
  --ff: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-mono: "Geist Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1120; --surface: #111827; --surface-2: #0F172A; --surface-3: #1E293B;
    --border: #1F2A3D; --border-strong: #334155;
    --text: #E2E8F0; --text-muted: #94A3B8; --text-faint: #64748B;
    --brand: #3B82F6; --brand-hover: #60A5FA; --brand-soft: rgba(59, 130, 246, .14); --brand-text: #93C5FD;
    --success: #22C55E; --success-soft: rgba(34, 197, 94, .12); --warn: #FBBF24; --warn-soft: rgba(245, 158, 11, .12);
    --danger: #F87171; --danger-soft: rgba(239, 68, 68, .12);
    --focus: 0 0 0 3px rgba(59, 130, 246, .28);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0B1120; --surface: #111827; --surface-2: #0F172A; --surface-3: #1E293B;
  --border: #1F2A3D; --border-strong: #334155;
  --text: #E2E8F0; --text-muted: #94A3B8; --text-faint: #64748B;
  --brand: #3B82F6; --brand-hover: #60A5FA; --brand-soft: rgba(59, 130, 246, .14); --brand-text: #93C5FD;
  --success: #22C55E; --success-soft: rgba(34, 197, 94, .12); --warn: #FBBF24; --warn-soft: rgba(245, 158, 11, .12);
  --danger: #F87171; --danger-soft: rgba(239, 68, 68, .12);
  --focus: 0 0 0 3px rgba(59, 130, 246, .28);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--ff); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 16px calc(env(safe-area-inset-bottom, 0px) + 24px);
}
a { color: var(--brand-text); }

.beta-tag { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--warn); background: var(--warn-soft); padding: 3px 9px; border-radius: var(--r-full); }

.card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 28px 24px; }
.card + .card { margin-top: 16px; }
.logo { width: 52px; height: 52px; display: grid; place-items: center; margin: 0 auto 16px; background: var(--brand); border-radius: var(--r-md); box-shadow: var(--shadow-md); }
.logo svg { width: 30px; height: 30px; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; text-align: center; margin: 0 0 6px; text-wrap: balance; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { text-align: center; color: var(--text-muted); font-size: 14px; margin: 0 0 24px; }
.head { display: flex; justify-content: center; margin-bottom: 14px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 6px; }
input { width: 100%; min-height: 40px; padding: 8px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-sm); font-size: 16px; font-family: inherit; }
input:focus { outline: none; border-color: #93C5FD; box-shadow: var(--focus); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; top: 0; right: 0; height: 100%; min-height: 40px; width: 44px; display: flex; align-items: center; justify-content: center; background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 0; }
.pw-eye:hover { color: var(--text); }
.hint { font-size: 12.5px; color: var(--text-faint); margin-top: 5px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 16px; font-size: 14px; font-weight: 600; font-family: inherit; border-radius: var(--r-sm); border: 1px solid transparent; min-height: 42px; cursor: pointer; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--brand-soft); outline-offset: 1px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-3); }
.btn-block { width: 100%; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row .btn { flex: 1 1 140px; }

.alert { padding: 11px 13px; border-radius: var(--r-sm); font-size: 14px; margin-bottom: 16px; }
.alert[hidden] { display: none; }
.alert-error { background: var(--danger-soft); color: var(--danger); border: 1px solid var(--danger); }
.alert-ok { background: var(--success-soft); color: var(--success); border: 1px solid var(--success); }

.or { display: flex; align-items: center; gap: 10px; color: var(--text-faint); font-size: 12.5px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
#googleButton { display: flex; justify-content: center; min-height: 44px; }

dl.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 14px; margin: 0 0 20px; font-size: 14px; }
dl.facts dt { color: var(--text-muted); }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-full); background: var(--brand-soft); color: var(--brand-text); }
.linkbox { display: flex; gap: 8px; margin-top: 10px; }
.linkbox input { font-size: 13px; font-family: var(--f-mono); }
.muted { color: var(--text-muted); font-size: 13px; }
.center { text-align: center; }

.brand-logo { display: block; width: 128px; margin: 0 auto 14px; }
.brand-logo img { display: block; width: 100%; height: auto; }
.brand-logo .logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo .logo-light { display: none; }
  :root:not([data-theme="light"]) .brand-logo .logo-dark { display: block; }
}
:root[data-theme="dark"] .brand-logo .logo-light { display: none; }
:root[data-theme="dark"] .brand-logo .logo-dark { display: block; }

.theme-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  background: var(--surface); color: var(--text-muted); border: 1px solid var(--border);
  border-radius: var(--r-full); cursor: pointer; box-shadow: var(--shadow-md);
}
.theme-btn:hover { color: var(--text); border-color: var(--border-strong); }
.theme-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-soft); border-color: var(--brand); }
.theme-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.theme-btn .i-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
.theme-btn-corner {
  position: fixed; z-index: 5;
  top: calc(env(safe-area-inset-top, 0px) + 14px); right: calc(env(safe-area-inset-right, 0px) + 14px);
}

@media (max-width: 520px) {
  body:has(.theme-btn-corner) { padding-top: calc(env(safe-area-inset-top, 0px) + 66px); }
}

.back-link {
  position: fixed; z-index: 5;
  top: calc(env(safe-area-inset-top, 0px) + 14px); left: calc(env(safe-area-inset-left, 0px) + 14px);
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 10px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-full);
  font-size: 14px; font-weight: 600; text-decoration: none; box-shadow: var(--shadow-md);
}
.back-link:hover { border-color: var(--border-strong); }
.back-link:focus-visible { outline: none; box-shadow: var(--focus); }
.back-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
body:has(.back-link) { padding-top: calc(env(safe-area-inset-top, 0px) + 70px); }
