:root {
  --bg: #f5f6f8; --card: #fff; --text: #1b1f24; --muted: #5d6673; --border: #dde1e6;
  --accent: #2459d6; --accent-text: #fff; --err: #c62828;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171b; --card: #1d2126; --text: #e8eaed; --muted: #9aa3ad; --border: #333a42; --accent: #5b8cff; --accent-text: #0b0d10; --err: #ff7b7b; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, Segoe UI, sans-serif; background: var(--bg); color: var(--text); }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; } h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
a { color: var(--accent); }
.top { display: flex; justify-content: space-between; align-items: center; padding: .75rem 1rem; background: var(--card); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; text-decoration: none; color: var(--text); white-space: nowrap; }
@media (max-width: 600px) {
  body { font-size: 16px; } /* 16px+ inputs stop iOS from zooming on focus */
  .top { padding: .5rem .75rem; gap: .5rem; }
  nav .muted { display: none; } /* email hidden on phones; still shown in admin */
  .layout { padding: 0 .75rem; margin-top: .75rem; }
  .card { padding: .85rem; }
  h1 { font-size: 1.3rem; }
  .drop { padding: 2rem .75rem; }
  #work .card > .row:first-child { display: grid; grid-template-columns: 1fr 1fr; }
  #work .card > .row:first-child .primary { grid-column: 1 / -1; }
  button, .button { min-height: 44px; }
}
nav { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.layout > *, .grid > * { min-width: 0; }
.layout { display: grid; grid-template-columns: 1fr 200px; gap: 1rem; max-width: 1300px; margin: 1rem auto; padding: 0 1rem; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } aside { order: 2; } }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; margin-bottom: 1rem; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .grid { grid-template-columns: 1fr; } }
.drop { text-align: center; padding: 3rem 1rem; border-style: dashed; }
.drop.over { border-color: var(--accent); }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .75rem; }
.drop .row { justify-content: center; }
button, .button, select, input, textarea { font: inherit; color: inherit; }
button, .button { padding: .55rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--card); cursor: pointer; display: inline-block; }
button:hover, .button:hover { border-color: var(--accent); }
button:focus-visible, .button:focus-within, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.link { border: 0; background: none; color: var(--accent); padding: .3rem; }
button:disabled { opacity: .5; cursor: not-allowed; }
select, input[type=email], input[type=password], input[type=search], textarea { width: 100%; padding: .5rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
canvas { width: 100%; height: auto; display: block; border-radius: 8px; background: repeating-conic-gradient(var(--border) 0 25%, transparent 0 50%) 0 0/16px 16px; }
#editor { touch-action: none; cursor: crosshair; }
.controls { display: grid; gap: .6rem; margin-top: .75rem; }
.controls label { display: grid; gap: .25rem; }
.controls .check { display: flex; gap: .4rem; align-items: center; }
.controls .row select { width: auto; }
input[type=range] { width: 100%; }
textarea { margin-top: .75rem; font-family: ui-monospace, monospace; font-size: 13px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .err { color: var(--err); min-height: 1.2em; }
.pages { display: flex; gap: .5rem; overflow-x: auto; margin-top: .5rem; }
.pages img { height: 90px; border: 1px solid var(--border); border-radius: 6px; }
.lock { font-size: .8em; }
body.signed-in .lock { display: none; }
.ad { background: var(--card); border: 1px dashed var(--border); border-radius: 8px; padding: .75rem; margin: 0 auto 1rem; text-align: center; max-width: 1300px; overflow: hidden; }
.ad::before { content: "Ad"; display: block; font-size: .7rem; color: var(--muted); }
header + .ad { margin: 1rem; }
dialog { border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--text); width: min(420px, 92vw); }
dialog::backdrop { background: rgb(0 0 0 / .5); }
dialog label { display: grid; gap: .25rem; margin-top: .6rem; }
#camDlg { width: min(720px, 96vw); }
#camDlg video { width: 100%; border-radius: 8px; background: #000; }
