/* Tokens inherited from T3 Code's dark theme. */
:root {
  --background: #000;
  --foreground: #f1f3f7;
  --muted: #0a0a0a;
  --muted-foreground: #a3a3a3;
  --accent: #191a1d;
  --border: #ffffff14;
  --input: #ffffff2e;
  --primary: #2349d0; /* T3 --primary oklch(48.8% .217 264) */
  --primary-foreground: #fff;
  --success: #34d399;
  --error: #fca5a5;
  --radius: .5rem;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

main {
  max-width: 34rem;
  margin: 0 auto;
  padding:
    calc(1.25rem + env(safe-area-inset-top)) calc(1rem + env(safe-area-inset-right))
    calc(2rem + env(safe-area-inset-bottom)) calc(1rem + env(safe-area-inset-left));
}

h1 { font-size: 1.5rem; margin: 0 0 1.25rem; font-weight: 650; }
h2 { font-size: 1.1rem; margin: 2rem 0 .75rem; color: var(--muted-foreground); font-weight: 600; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.bar h1 { margin: 0; white-space: nowrap; }

.stack { display: flex; flex-direction: column; gap: .75rem; }
.card { background: var(--muted); border: 1px solid var(--border); border-radius: calc(var(--radius) * 2); padding: 1rem; }
.muted { color: var(--muted-foreground); }
.state { margin: 0; font-weight: 600; }
.state.on { color: var(--success); }
.notice { background: var(--accent); border-radius: var(--radius); padding: .75rem 1rem; }

label { font-weight: 600; }
input[type="password"] {
  min-height: 52px;
  padding: 0 1rem;
  font: inherit;
  color: var(--foreground);
  background: var(--background);
  border: 1px solid #7a7a7a; /* >= 3:1 against the page, WCAG 1.4.11 */
  border-radius: var(--radius);
  width: 100%;
}

button {
  min-height: 52px;
  min-width: 48px;
  padding: 0 1.25rem;
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  width: 100%;
  touch-action: manipulation;
}
button.primary { background: var(--primary); color: var(--primary-foreground); }
button.secondary { background: var(--accent); color: var(--foreground); border-color: var(--input); margin-top: .75rem; }
.card button.secondary { margin-top: 0; }
button.ghost { width: auto; white-space: nowrap; padding: 0 .9rem; background: transparent; color: var(--muted-foreground); border-color: var(--border); font-weight: 500; font-size: 1rem; }
button:disabled { opacity: .6; cursor: progress; }
:focus-visible { outline: 3px solid #7aa2ff; outline-offset: 2px; }

.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.history a {
  display: block;
  min-height: 56px;
  padding: .75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  color: var(--foreground);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.history a:active { background: var(--accent); }
.history .t { display: block; font-weight: 600; }
.history .b { display: block; }
.history .w { display: block; color: var(--muted-foreground); font-size: .9rem; }

.status { min-height: 1.5em; margin: 1rem 0 0; }
.status.error { color: var(--error); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
