:root {
  --accent: #1f2937;
  --bg: #f5f6f8; --card: #ffffff; --ink: #111827; --on-ink: #ffffff; --muted: #6b7280; --line: #e5e7eb;
  --field: #ffffff; --error-bg: #fef2f2; --error: #b91c1c; --ok-bg: #f0fdf4; --ok: #166534;
  --radius: 12px; --shadow: 0 1px 2px rgb(16 24 40 / .04), 0 8px 24px rgb(16 24 40 / .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b0d12; --card: #12151c; --ink: #f3f4f6; --on-ink: #0b0d12; --muted: #9ca3af; --line: #262b36;
    --field: #0f1218; --error-bg: #2a1215; --error: #fca5a5; --ok-bg: #0f2418; --ok: #86efac; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--ink);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-underline-offset: 2px; }
@media (prefers-color-scheme: dark) { a { color: color-mix(in srgb, var(--accent) 55%, white); } }

.hero { display: none; }
.shell { width: 100%; max-width: 420px; margin: 0 auto; padding: 40px 16px 24px; display: grid; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; color: var(--ink); }

.app-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 8%, var(--card)); border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); }
.app-badge { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; }
.app-banner strong { display: block; font-size: 14px; }
.app-banner div span { font-size: 13px; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; box-shadow: var(--shadow);
  display: grid; gap: 14px; }
h1 { font-size: 22px; line-height: 1.25; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 6px; }
.lead { margin: -6px 0 4px; color: var(--muted); }
.fine { margin: -4px 0 0; font-size: 12.5px; color: var(--muted); }
.app-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.app-card { min-width: 0; display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); border-top: 3px solid var(--app-accent); border-radius: 10px; color: var(--ink); text-decoration: none; }
.app-card:hover { border-color: var(--app-accent); }
.app-card:focus-visible { outline: 2px solid var(--app-accent); outline-offset: 2px; }
.app-card strong { font-size: 12px; line-height: 1.25; }
.app-card span { font-size: 11px; line-height: 1.3; color: var(--muted); }

form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 550; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
.link-sm { font-weight: 500; font-size: 13px; }
input:not([type=checkbox]) { width: 100%; font: inherit; font-weight: 400; font-size: 16px; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input.code { letter-spacing: .3em; font-variant-numeric: tabular-nums; }
.password { position: relative; display: block; }
.password input { padding-right: 46px; }
.reveal { position: absolute; inset: 4px 4px 4px auto; width: 38px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; color: var(--muted);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.6-7 10-7 10 7 10 7-3.6 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: 20px; }
.reveal[aria-pressed=true] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l18 18M10.6 5.1A10 10 0 0 1 12 5c6.4 0 10 7 10 7a17 17 0 0 1-3.2 4M6.6 6.6A17 17 0 0 0 2 12s3.6 7 10 7a9.6 9.6 0 0 0 5.4-1.6M9.9 9.9a3 3 0 0 0 4.2 4.2'/%3E%3C/svg%3E"); }
.reveal:focus-visible { outline: 2px solid var(--accent); }
.hint { font-weight: 400; font-size: 12.5px; color: var(--muted); }

.strength { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 12.5px; color: var(--muted); min-height: 18px; }
.strength .bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; flex: 1; }
.strength i { height: 4px; border-radius: 4px; background: var(--line); transition: background .2s; }
.strength[data-score="1"] i:nth-child(-n+1) { background: #dc2626; }
.strength[data-score="2"] i:nth-child(-n+2) { background: #f59e0b; }
.strength[data-score="3"] i:nth-child(-n+3) { background: #65a30d; }
.strength[data-score="4"] i { background: #16a34a; }
.strength[data-score="0"] { display: none; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--muted); }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 46px; padding: 10px 16px;
  font: inherit; font-weight: 600; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, opacity .15s; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, black); border-color: transparent; }
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-small { width: auto; min-height: 36px; padding: 6px 14px; font-size: 14px; }
.btn[aria-busy=true] { opacity: .65; cursor: progress; }
.btn[aria-busy=true]::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.switch { margin: 4px 0 0; text-align: center; font-size: 14px; color: var(--muted); }

.alert, .notice { border-radius: 10px; padding: 11px 13px; font-size: 14px; }
.alert { background: var(--error-bg); color: var(--error); }
.notice { background: var(--ok-bg); color: var(--ok); display: grid; gap: 10px; }
.notice p { margin: 0; }
[hidden] { display: none !important; }

.scopes { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 4px; }
.rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.rows li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; }
.rows li + li { border-top: 1px solid var(--line); }
.rows strong { display: block; font-size: 14px; }
.rows span { font-size: 13px; color: var(--muted); }
.panel { display: grid; gap: 8px; padding: 14px; border-radius: var(--radius); background: var(--bg); font-size: 14px; }
.panel p { margin: 0; }
.secret { display: block; padding: 8px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-size: 13px; word-break: break-all; }
.muted { color: var(--muted); }

.foot { text-align: center; font-size: 12.5px; color: var(--muted); }
.foot p { margin: 2px 0; }
.foot a { color: inherit; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (min-width: 640px) { .shell { padding-top: 72px; } .card { padding: 32px; } }

/* Web: brand panel on the left, form on the right. */
@media (min-width: 960px) {
  :root { --hero-bg: color-mix(in srgb, var(--accent) 86%, black); }
  .page { display: grid; grid-template-columns: minmax(380px, 46%) 1fr; min-height: 100dvh; }
  .hero { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 48px 56px; color: #fff;
    background: radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--accent) 70%, white) 0%, transparent 55%), var(--hero-bg); }
  .hero-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 17px; }
  .hero-brand .brand-mark { color: #fff; width: 30px; height: 30px; }
  .hero-body { max-width: 440px; }
  .hero-badge { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: rgb(255 255 255 / .16);
    border: 1px solid rgb(255 255 255 / .28); font-size: 24px; font-weight: 700; margin-bottom: 16px; }
  .hero-kicker { margin: 0 0 6px; font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; opacity: .8; }
  .hero-title { margin: 0 0 14px; font-size: 34px; line-height: 1.15; font-weight: 700; letter-spacing: -.025em; }
  .hero-text { margin: 0 0 28px; font-size: 16px; opacity: .82; }
  .hero-apps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
  .hero-apps li { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13.5px;
    background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .18); }
  .hero-apps li.current { background: #fff; color: var(--hero-bg); font-weight: 600; }
  .hero-apps i { width: 8px; height: 8px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 2px rgb(255 255 255 / .7); }
  .hero-foot { margin: 0; font-size: 13px; opacity: .7; }
  .shell { align-self: center; padding: 48px 24px; }
  .app-cards { display: none; }
  .shell > .brand, .shell > .app-banner { display: none; }
}
