:root {
  --space: #0b0b0d; --glass: rgba(28,28,30,.66); --glass-2: rgba(255,255,255,.06); --hairline: rgba(255,255,255,.1);
  --ink: #f5f5f7; --muted: #98989d; --faint: #636366; --accent: #0a84ff;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--space); color: var(--ink); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }

header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.brand { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; }
.pages { display: flex; gap: 14px; }
.pages a { font-size: 12.5px; font-weight: 500; color: var(--accent); text-decoration: none; }
.pages a:hover { text-decoration: underline; }

main { display: grid; grid-template-columns: 320px 1fr; gap: 28px; padding: 24px; max-width: 1400px; margin: 0 auto; align-items: start; }
h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; }
.lead { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 18px; }
.row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
select, button {
  appearance: none; font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--ink);
  background: var(--glass); border: 1px solid var(--hairline); border-radius: 10px; padding: 9px 12px; cursor: pointer;
}
select { flex: 1; min-width: 0; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
button:hover { background: rgba(255,255,255,.12); }
button.primary { background: var(--accent); border-color: transparent; color: #fff; }
button.primary:hover { background: #2b94ff; }
button.ghost { color: var(--accent); }
.seg { display: flex; gap: 3px; background: var(--glass); border: 1px solid var(--hairline); border-radius: 10px; padding: 3px; }
.seg button { background: none; border: none; color: var(--muted); padding: 5px 12px; border-radius: 7px; }
.seg button.active { background: rgba(255,255,255,.14); color: var(--ink); }
.actions button { flex: 1 1 45%; }
.status { min-height: 18px; font-size: 12.5px; color: var(--muted); margin: 4px 0 8px; }
.note { font-size: 11.5px; color: var(--faint); line-height: 1.5; margin: 0; }

.preview { display: flex; justify-content: center; }
#frame { width: 100%; max-width: 720px; }
#frame[data-format="story"] { max-width: 420px; }
#frame[data-format="wide"] { max-width: 960px; }
#card { display: block; width: 100%; height: auto; border-radius: 18px; box-shadow: 0 24px 64px rgba(0,0,0,.6); border: 1px solid var(--hairline); }

@media (max-width: 820px) {
  main { grid-template-columns: 1fr; gap: 18px; padding: 16px; }
  #frame, #frame[data-format="wide"] { max-width: 100%; }
  #frame[data-format="story"] { max-width: 360px; margin: 0 auto; }
}
