:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1d1d1f;
  --tag: #6e6e73;
  --meta: #86868b;
  --hotkey-bg: #f5f5f7;
  --button-border: #d2d2d7;
  --muted: var(--tag);
  --soft: var(--hotkey-bg);
  --line: var(--button-border);
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --danger: #c4302b;
  --success: #137333;
  --focus-ring: rgba(0, 113, 227, 0.28);
  --font-rounded: ui-rounded, "SF Pro Rounded", "SF Pro Text", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #f5f5f7;
    --tag: #a1a1a6;
    --meta: #86868b;
    --hotkey-bg: #1d1d1f;
    --button-border: #3a3a3c;
    --accent: #2997ff;
    --accent-hover: #4ba6ff;
    --danger: #ff6b62;
    --success: #7ee787;
    --focus-ring: rgba(41, 151, 255, 0.32);
  }
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-rounded);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.flow-shell {
  max-width: 660px;
  margin: 4rem auto 3rem;
  padding: 0 1.5rem;
}

.top-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 2.4rem;
  color: var(--fg);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.top-link:hover { opacity: 0.82; text-decoration: none; }
.top-link:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; border-radius: 8px; }
.top-link-icon { width: 32px; height: 32px; border-radius: 7px; flex: 0 0 auto; }

.flow-icon { display: none; }

.flow-header { margin: 0 0 1.6rem; }

.flow-header h1 {
  margin: 0 0 0.6rem;
  font-size: 2.1rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0;
}

.flow-header p {
  margin: 0;
  color: var(--fg);
  font-size: 1.12rem;
  line-height: 1.5;
  font-weight: 500;
}

.flow-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.8rem;
  margin: 0;
}

.flow-grid--single { grid-template-columns: 1fr; }

.flow-panel { margin: 0; padding: 0; }

.flow-panel h2 {
  margin: 0 0 0.7rem;
  font-size: 1.32rem;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: 0;
}

.flow-stack { display: grid; gap: 1rem; }
.flow-row { display: grid; gap: 0.4rem; }

label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input, select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  padding: 0 1.1rem;
}

input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.segment {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.segment[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 1.35rem;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button:hover { border-color: var(--muted); text-decoration: none; }
.button-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.button:disabled, .button[aria-busy="true"] { opacity: 0.6; cursor: not-allowed; }

.button-link {
  border-color: transparent;
  color: var(--accent);
}

.button-link:hover {
  border-color: transparent;
  color: var(--accent-hover);
  text-decoration: underline;
}

.status {
  min-height: 1.35em;
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.status[data-state="success"] { color: var(--success); }
.status[data-state="error"] { color: var(--danger); }
.status:empty { display: none; }

.account-summary {
  display: grid;
  gap: 0.6rem;
  margin: 0;
  padding: 0.95rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}

.account-summary div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.account-summary dt {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.95rem;
}

.account-summary dd {
  margin: 0;
  font-family: var(--font-mono);
}

.code-box {
  overflow-wrap: anywhere;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.hidden { display: none !important; }

.flow-offset { margin-top: 0.9rem; }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 1.1rem;
  margin-top: 2.4rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--line);
  color: var(--meta);
}

.site-footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  font-size: 0.92rem;
}

.site-footer-link {
  color: inherit;
  text-decoration: none;
}

.site-footer-link:hover {
  color: var(--fg);
  text-decoration: underline;
}

.site-footer-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

.wozi-footer-social {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: center;
  gap: 0.55rem;
  margin-left: auto;
  color: var(--meta);
}

.wozi-footer-link {
  color: inherit;
  text-decoration: none;
}

.wozi-footer-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid transparent;
  border-radius: 50%;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.wozi-footer-social-link:hover {
  background: var(--soft);
  border-color: var(--line);
  color: var(--fg);
  text-decoration: none;
}

.wozi-footer-social-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.wozi-footer-social-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.wozi-footer-social-icon--github {
  width: 24px;
  height: 24px;
}

@media (max-width: 700px) {
  .flow-shell { max-width: 560px; margin: 2.6rem auto 2.5rem; padding: 0 1.35rem; }
  .top-link { margin-bottom: 2rem; }
  .flow-header h1 { font-size: 1.85rem; }
  .flow-header p { font-size: 1.06rem; }
  .flow-panel h2 { font-size: 1.22rem; }
  .button-row .button { flex: 1 1 100%; }
  .segmented { grid-template-columns: 1fr; }
  .site-footer, .wozi-footer-social { justify-content: flex-start; margin-left: 0; }
}

@media (max-width: 430px) {
  .flow-shell { margin: 2.1rem auto 2rem; padding: 0 1.1rem; }
  .top-link { margin-bottom: 1.6rem; }
  .flow-header h1 { font-size: 1.7rem; }
}
