:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
  background: #0d0d0d;
  color: #f2f2f2;
  --surface: #171717;
  --surface-raised: #202020;
  --border: #343434;
  --muted: #999999;
  --text: #f2f2f2;
  --inverse: #111111;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: #0d0d0d;
  -webkit-font-smoothing: antialiased;
}

button, textarea { font: inherit; }

.shell {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 32px) 18px calc(env(safe-area-inset-bottom) + 36px);
}

header { padding: 8px 2px 26px; }
.eyebrow { margin: 0 0 8px; color: #8b8b8b; font-size: 12px; font-weight: 700; letter-spacing: .18em; }
h1 { margin: 0; font-size: 34px; line-height: 1.12; letter-spacing: -.035em; }
.intro { margin: 13px 0 0; color: #ababab; font-size: 15px; line-height: 1.65; }

.card {
  margin-bottom: 12px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
}

.key-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -8px 0 12px;
  padding: 10px 12px;
  color: #8d8d8d;
  font-size: 13px;
}
.key-summary > div { display: flex; align-items: center; gap: 10px; }
.key-summary strong { font-weight: 600; }

.section-heading, .section-heading > div, .button-row {
  display: flex;
  align-items: center;
}
.section-heading { justify-content: space-between; margin-bottom: 14px; }
.section-heading > div { gap: 10px; }
.step { color: #777777; font-size: 12px; font-variant-numeric: tabular-nums; }
h2 { margin: 0; font-size: 17px; font-weight: 650; }
.status { color: var(--muted); font-size: 13px; }
.status.ready { color: #e5e5e5; }

textarea {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 14px;
  resize: none;
  border: 1px solid #3a3a3a;
  border-radius: 12px;
  outline: none;
  background: #101010;
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
textarea:focus { border-color: #8a8a8a; }
textarea::placeholder { color: #686868; }

.button-row { gap: 10px; }
button {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid #4a4a4a;
  border-radius: 12px;
  touch-action: manipulation;
  cursor: pointer;
  font-weight: 650;
}
button:active:not(:disabled) { transform: scale(.985); }
button:disabled { cursor: default; opacity: .34; }
.primary { flex: 1; border-color: #eeeeee; background: #eeeeee; color: var(--inverse); }
.secondary { background: var(--surface-raised); color: var(--text); }
.full { width: 100%; }
.compact { min-height: 36px; padding: 0 14px; border-radius: 10px; font-size: 13px; }
.destructive { flex: 1; border-color: #8b8b8b; background: #d8d8d8; color: #111111; }

dialog {
  width: min(calc(100% - 28px), 480px);
  max-height: calc(100vh - 40px);
  padding: 0;
  overflow: auto;
  border: 1px solid #3a3a3a;
  border-radius: 20px;
  background: #171717;
  color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, .72); }
.dialog-panel { padding: 20px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-heading .eyebrow { margin-bottom: 6px; }
.dialog-heading h2 { font-size: 22px; }
.icon-button { width: 40px; min-height: 40px; padding: 0; border: 0; background: rgba(0,0,0,0); color: #cfcfcf; font-size: 30px; font-weight: 300; }
.dialog-copy { margin: 18px 0; color: #a5a5a5; font-size: 14px; line-height: 1.6; }
.danger-zone { margin-top: 28px; padding-top: 18px; border-top: 1px solid #343434; }
.danger-zone > p { margin: 0 0 12px; color: #858585; font-size: 13px; }
.clear-confirm { margin-top: 12px; padding: 14px; border: 1px solid #4a4a4a; border-radius: 12px; background: #101010; }
.clear-confirm strong { display: block; margin-bottom: 12px; font-size: 14px; }
[hidden] { display: none !important; }

.message { min-height: 24px; margin: 18px 4px 0; color: #a8a8a8; font-size: 13px; line-height: 1.55; text-align: center; }
.message.error { color: #ededed; }
.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; }

@media (prefers-reduced-motion: no-preference) {
  button { transition: transform 100ms ease, opacity 150ms ease; }
}
