:root {
  color-scheme: light;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #66707a;
  --border: #dedfe2;
  --accent: #2f5bea;
  --accent-hover: #244bc8;
  --success: #16845b;
  --danger: #b43b43;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

.shell {
  width: min(100% - 40px, 760px);
  margin: 0 auto;
  padding: 28px 0 48px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.brand {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .08em;
  text-decoration: none;
}

.generation {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.intro { padding: 52px 0 28px; }

.context {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}

h1 {
  margin: 0 0 14px;
  max-width: 12ch;
  font-size: clamp(32px, 6vw, 46px);
  font-weight: 580;
  letter-spacing: -.025em;
  line-height: 1.08;
}

.intro > p:last-child {
  max-width: 65ch;
  margin: 0;
  color: var(--muted);
}

.privacy {
  display: grid;
  gap: 4px;
  margin-bottom: 34px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.privacy strong { font-size: 14px; font-weight: 620; }
.privacy span { color: var(--muted); font-size: 13px; }

form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.field { padding: 22px 24px; }
.field + .field { border-top: 1px solid var(--border); }

.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}

.label-row label { font-weight: 620; }
.label-row span {
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 10px;
  text-align: right;
}

input[type="file"],
input[type="password"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c9ccd1;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input[type="file"] { padding: 7px 9px; }
input[type="password"] { padding: 8px 11px; }

input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 6px 10px;
  border: 0;
  border-radius: 5px;
  background: #eff0f2;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

input:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(47, 91, 234, .24);
  outline-offset: 2px;
}

.field p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.confirm {
  display: flex;
  gap: 10px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.confirm input { margin: 4px 0 0; }
.confirm span { font-size: 13px; }

.action-row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  background: #fafafa;
  border-radius: 0 0 8px 8px;
}

button {
  min-height: 40px;
  padding: 8px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  font: inherit;
  font-weight: 620;
  cursor: pointer;
  transition: background-color 160ms ease-out;
}

button:hover { background: var(--accent-hover); }
button:disabled { background: #8d98b8; cursor: wait; }

#status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

#status[data-state="error"] { color: var(--danger); }
#status[data-state="success"] { color: var(--success); }

footer {
  display: grid;
  gap: 4px;
  padding: 18px 2px 0;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 560px) {
  .shell { width: min(100% - 24px, 760px); padding-top: 18px; }
  .intro { padding-top: 38px; }
  .field, .confirm, .action-row { padding-left: 16px; padding-right: 16px; }
  .label-row { display: grid; gap: 2px; }
  .label-row span { text-align: left; }
  .action-row { grid-template-columns: 1fr; }
  button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
