:root {
  color-scheme: light;
  --bg: #f6f5f1; --panel: #fffefb; --fg: #1d1d1b; --muted: #6b6a65; --line: #d9d7cf;
  --accent: #e8590c; --accent-ink: #fff; --ok: #2f6b3a; --warn: #8a5a00; --err: #a1261b;
  --sans: 'Hanken Grotesk', system-ui, sans-serif; --mono: 'Geist Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--sans); display: grid; grid-template-rows: auto 1fr; overflow: hidden; }

header { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
header a.home { font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
header h1 { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
header label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
select, input, textarea { font: inherit; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
select { min-width: 220px; }
#who { margin-left: auto; font-size: 13px; color: var(--muted); }
header a.form { font-size: 13px; color: var(--muted); }

button { font: inherit; cursor: pointer; border-radius: 6px; padding: 9px 14px; border: 1px solid var(--line); background: #fff; color: var(--fg); transition: transform .12s cubic-bezier(.3,.7,.4,1), opacity .12s; }
button:hover { border-color: var(--fg); }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: default; transform: none; border-color: var(--line); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover:not(:disabled) { background: #cf4f09; }
button.quiet { background: transparent; }

main { display: grid; grid-template-columns: 1fr 340px; min-height: 0; }
.stage { position: relative; min-height: 0; overflow: hidden; }
#page { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
#box { position: absolute; pointer-events: none; border: 2px solid var(--accent); border-radius: 2px; box-shadow: 0 0 0 4000px rgba(20, 18, 14, .08); z-index: 2; }
#box.image { border-style: solid; border-color: #1a73e8; }
#box.ambiguous { border-style: dashed; border-color: var(--muted); box-shadow: none; }
#tip { position: absolute; pointer-events: none; z-index: 3; max-width: 440px; background: var(--fg); color: var(--bg); font-size: 12.5px; line-height: 1.4; padding: 6px 9px; border-radius: 4px; box-shadow: 0 6px 18px rgba(20, 18, 14, .22); }
#flash { position: absolute; left: 16px; bottom: 16px; z-index: 4; background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 6px; font-size: 14px; max-width: 520px; }

aside { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
aside .top { padding: 16px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
aside h2 { font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0; }
#count { font-size: 13px; color: var(--muted); margin: 0; }
#changes { list-style: none; margin: 0; padding: 8px 16px; overflow: auto; flex: 1; display: grid; gap: 8px; align-content: start; }
#changes li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
#changes b { font-size: 13px; font-weight: 600; }
#changes span { grid-column: 1; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
#changes button { grid-row: 1 / 3; grid-column: 2; align-self: center; padding: 6px 10px; font-size: 13px; }
#empty { padding: 8px 16px; color: var(--muted); font-size: 13px; margin: 0; }
aside .foot { padding: 16px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
#publish { width: 100%; padding: 12px; font-size: 15px; }
#status { font-size: 13px; margin: 0; }
#status.ok { color: var(--ok); } #status.warn { color: var(--warn); } #status.err { color: var(--err); }
#status button { margin-top: 8px; display: block; }

dialog { border: 1px solid var(--line); border-radius: 6px; padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--panel); color: var(--fg); box-shadow: 0 24px 60px rgba(20, 18, 14, .28); }
dialog::backdrop { background: rgba(20, 18, 14, .35); }
dialog form { padding: 20px; display: grid; gap: 12px; }
dialog h2 { font-size: 16px; margin: 0; }
dialog label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; }
dialog textarea { width: 100%; resize: vertical; line-height: 1.5; }
dialog .hint { margin: -4px 0 0; font-size: 12.5px; color: var(--muted); }
dialog .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photos figure { margin: 0; }
.photos img { width: 100%; height: 160px; object-fit: cover; border-radius: 4px; background: var(--bg); display: block; }
.photos figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
label.file input { padding: 8px; background: #fff; }

body.phone main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
body.phone aside { display: none; }
