/* Key frame styles. The key origin loads nothing from anywhere else, so the
   values below MIRROR web/design-system/zoza-tokens.css (Midnight for dark,
   Daybreak for light). Keep them in sync with that file. System fonts only. */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius-sm: 8px;
  --radius-md: 12px;
  --sheet-radius: 20px;
  --inset: 16px;
  --gap: 12px;
  --tap-min: 44px;
  --cta-h: 52px;
  --title-size: 17px;
  --meta-size: 13px;

  --bg-elevated: #131A2E;
  --bg-hover: #1B2240;
  --bg-sunken: #060916;
  --text-primary: #F5F7FA;
  --text-secondary: #7A8290;
  --text-on-accent: #051018;
  --border-hairline: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --accent-primary: #19C3D6;
  --mkt-down-text: #FF5A5F;
  --mkt-warn-text: #E8A13C;
  --scrim: rgba(6, 9, 22, 0.60);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.55);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-elevated: #FFFFFF;
    --bg-hover: #EEF1F6;
    --bg-sunken: #EEF1F6;
    --text-primary: #0A0F1F;
    --text-secondary: #5A6275;
    --text-on-accent: #FFFFFF;
    --border-hairline: rgba(10, 15, 31, 0.08);
    --border-strong: rgba(10, 15, 31, 0.16);
    --accent-primary: #0E97A8;
    --mkt-down-text: #D23B3B;
    --mkt-warn-text: #B5791A;
    --scrim: rgba(10, 15, 31, 0.32);
    --shadow-modal: 0 12px 36px rgba(10, 15, 31, 0.14);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-primary);
  -webkit-text-size-adjust: 100%;
}

.scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--scrim);
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}
.scrim.open { display: flex; }

.sheet {
  width: 100%;
  max-width: 440px;
  max-height: 100%;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
  border-radius: var(--sheet-radius) var(--sheet-radius) 0 0;
  box-shadow: var(--shadow-modal);
  padding: 20px var(--inset) calc(var(--inset) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 600px) {
  .scrim { align-items: center; padding: var(--inset); }
  .sheet { border-radius: var(--sheet-radius); padding: 24px; }
}

h1 {
  font-size: 20px;
  font-weight: 650;
  line-height: 1.25;
  margin: 0 0 8px;
}

p { margin: 0 0 12px; }
.muted { color: var(--text-secondary); font-size: 14px; }
.busy { margin: 8px 0; color: var(--text-secondary); }

.error {
  color: var(--mkt-down-text);
  font-size: 14px;
  margin: 4px 0 8px;
}

.actions {
  display: flex;
  gap: var(--gap);
  margin-top: 16px;
}
.actions button { flex: 1; }

button {
  font: inherit;
  min-height: var(--tap-min);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-primary);
  padding: 0 16px;
  cursor: pointer;
}
button.primary {
  min-height: var(--cta-h);
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--text-on-accent);
  font-weight: 600;
}
button.secondary { min-height: var(--cta-h); }
button:disabled { opacity: 0.5; cursor: default; }
button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

.choices { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 4px; }
.choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 12px 14px;
  min-height: 64px;
}
.choice:hover { background: var(--bg-hover); }
.choice-title { font-weight: 600; }
.choice-text { color: var(--text-secondary); font-size: var(--meta-size); }

.field { display: block; margin: 0 0 10px; }
.field-label { display: block; font-size: var(--meta-size); color: var(--text-secondary); margin-bottom: 4px; }
input, textarea {
  width: 100%;
  font: inherit;
  color: var(--text-primary);
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: var(--tap-min);
}
input.pin { letter-spacing: 0.2em; }
textarea.phrase { font-family: var(--font-mono); resize: vertical; }

.words {
  list-style: none;
  counter-reset: w;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0;
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 14px;
  user-select: none;
  -webkit-user-select: none;
}
.words li {
  counter-increment: w;
  background: var(--bg-sunken);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  overflow-wrap: anywhere;
}
.words li::before {
  content: counter(w) ". ";
  color: var(--text-secondary);
}
@media (max-width: 360px) {
  .words { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.rows { margin: 12px 0; }
.row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-hairline);
}
.row dt { color: var(--text-secondary); font-size: 14px; flex: 0 0 auto; }
.row dd {
  margin: 0;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 14px;
  overflow-wrap: anywhere;
  min-width: 0;
}
.row.danger dd { color: var(--mkt-down-text); font-weight: 600; }

.warnings {
  margin: 8px 0 12px;
  padding: 10px 12px 10px 28px;
  border: 1px solid var(--mkt-warn-text);
  border-radius: var(--radius-sm);
  color: var(--mkt-warn-text);
  font-size: 14px;
}
.warnings li + li { margin-top: 4px; }

.app-note {
  font-size: 14px;
  color: var(--text-secondary);
  border-left: 2px solid var(--border-strong);
  padding-left: 10px;
  overflow-wrap: anywhere;
}
