:root {
  --bg: #0f0f12; --panel: #18181d; --ink: #f2eee6; --muted: #a39e94; --gold: #e3c06f; --hair: rgba(242,238,230,.12); --bad: #ff6b6b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 "Atkinson Hyperlegible Next", system-ui, "Segoe UI", sans-serif; padding: calc(env(safe-area-inset-top, 0px) + 20px) max(16px, 3vw) 120px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
h1 { margin: 0; font: 400 clamp(32px, 5vw, 44px)/1 Limelight, Georgia, serif; color: var(--gold); }
h2 { margin: 0 0 4px; font-size: 19px; }
small, .muted { color: var(--muted); font-size: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
.card { background: var(--panel); border-radius: 20px; padding: 20px; display: grid; gap: 14px; box-shadow: inset 0 0 0 1px var(--hair); min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card.narrow { max-width: 420px; margin: 40px auto; }
#mediaCard { margin-top: 18px; }
label { display: grid; gap: 6px; font-size: 15px; color: var(--muted); }
input[type=text], input:not([type]), input[type=password], select {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 0; border-radius: 12px; padding: 11px 13px; box-shadow: inset 0 0 0 1px var(--hair); width: 100%;
}
button { font: inherit; font-weight: 700; color: var(--ink); background: var(--bg); border: 0; border-radius: 999px; padding: 10px 18px; box-shadow: inset 0 0 0 1px var(--hair); cursor: pointer; }
button.primary { background: linear-gradient(180deg, #f6dc8f, var(--gold)); color: #1b1608; box-shadow: none; padding: 12px 26px; }
button.ghost { background: transparent; }
button:active { transform: scale(.97); }
form#loginForm { display: grid; gap: 14px; }
.status { margin: 0; color: var(--gold); min-height: 1.4em; }
.toggle, fieldset label { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 16px; }
.toggle.sub { margin-left: 30px; color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; accent-color: var(--gold); flex: none; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 8px; }
fieldset.inline { display: flex; flex-wrap: wrap; gap: 8px 18px; }
legend { color: var(--muted); font-size: 15px; padding: 0; margin-bottom: 6px; width: 100%; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper span { flex: 1; color: var(--ink); }
.stepper button { width: 40px; height: 40px; padding: 0; font-size: 20px; }
.stepper output { min-width: 2ch; text-align: center; font-weight: 700; font-size: 20px; }
.share { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.share canvas { width: 140px; height: 140px; border-radius: 12px; background: #fff; image-rendering: pixelated; }
.share div { display: grid; gap: 8px; min-width: 0; flex: 1; }
code { font: 500 13px "IBM Plex Mono", Consolas, monospace; color: #d9d3c5; word-break: break-all; background: var(--bg); padding: 8px 10px; border-radius: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; }
.devrow { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; }
.savebar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 16px; padding: 14px max(16px, 3vw) calc(env(safe-area-inset-bottom, 0px) + 14px); background: rgba(15,15,18,.94); box-shadow: 0 -1px 0 var(--hair); z-index: 5; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs button[aria-pressed="true"] { background: var(--gold); color: #1b1608; box-shadow: none; }
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.item { background: var(--bg); border-radius: 14px; padding: 10px; display: grid; gap: 8px; box-shadow: inset 0 0 0 1px var(--hair); }
.item img, .item video { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; background: #222; }
.item audio { width: 100%; }
.item .meta { font-size: 13px; color: var(--muted); }
.item .row button, .item .row a { flex: 1; text-align: center; font-size: 14px; padding: 7px 10px; }
.item a { color: var(--ink); text-decoration: none; font-weight: 700; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--hair); }
.item .danger { color: var(--bad); }
.item .print { background: linear-gradient(180deg, #f6dc8f, var(--gold)); color: #1b1608; box-shadow: none; flex-basis: 100%; }
.code { font: 600 13px "IBM Plex Mono", Consolas, monospace; letter-spacing: .08em; color: var(--ink); background: none; padding: 0; }
.empty { color: var(--muted); grid-column: 1 / -1; }
.drive { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
input[type=url] { font: inherit; font-size: 16px; color: var(--ink); background: var(--bg); border: 0; border-radius: 12px; padding: 11px 13px; box-shadow: inset 0 0 0 1px var(--hair); width: 100%; }
.card a { color: var(--gold); }
@media (max-width: 700px) { .drive { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .devrow { grid-template-columns: 1fr; } }
