:root { --bg:#f6f6f4; --panel:#fff; --ink:#1a1a1a; --muted:#6b6b6b; --line:#e2e2de; --accent:#1f6feb; color-scheme: light dark; }
@media (prefers-color-scheme: dark) { :root { --bg:#121212; --panel:#1c1c1c; --ink:#ececec; --muted:#9a9a9a; --line:#2e2e2e; --accent:#4c8dff; } }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin:0; background:var(--bg); color:var(--ink); font:15px/1.45 system-ui, sans-serif; }
header { position:sticky; top:0; z-index:10; display:flex; gap:10px; align-items:center; height:54px; padding:0 14px; background:var(--panel); border-bottom:1px solid var(--line); }
h1 { flex:1; min-width:0; margin:0; font-size:16px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
h2 { font-size:15px; margin:28px 0 8px; }
button, .button, select, input[type=password], input[type=text] { font:inherit; color:var(--ink); background:var(--panel); border:1px solid var(--line); border-radius:8px; padding:6px 12px; text-decoration:none; }
button, .button, select { cursor:pointer; }
.row.wrap { flex-wrap:wrap; }
#page { flex:1 1 100%; min-width:0; }
#create { align-items:center; }
#create input { flex:1; min-width:0; }
.prefix { color:var(--muted); }
button.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
button:disabled { opacity:.5; cursor:default; }
#view { padding:16px; }
.empty { text-align:center; color:var(--muted); margin-top:20vh; }
.sheet { max-width:900px; margin:0 auto 24px; }
.page { position:relative; background:#fff; box-shadow:0 1px 4px #0003; overflow:hidden; }
.page canvas { display:block; width:100%; height:100%; }
.sheet img { display:block; width:100%; height:auto; background:#fff; box-shadow:0 1px 4px #0003; }
.photo { position:relative; }
.photo img { user-select:none; }
.ocr { position:absolute; inset:0; z-index:2; overflow:hidden; container-type:inline-size; line-height:1; cursor:text; text-align:left; }
.ocr span { position:absolute; color:transparent; white-space:pre; transform-origin:0 0; font-family:sans-serif; }
.ocr br { user-select:none; }
.ocr ::selection { background:#1f6feb55; color:transparent; }
.ocr .end { position:absolute; inset:100% 0 0; z-index:-1; user-select:none; cursor:default; }
.ocr.selecting .end { top:0; }
.row { display:flex; gap:8px; }
.admin main { max-width:640px; margin:0 auto; padding:20px 16px; }
.admin input[type=password] { flex:1; min-width:0; }
#drop { display:flex; flex-direction:column; gap:8px; align-items:center; text-align:center; padding:32px 16px; border:2px dashed var(--line); border-radius:12px; background:var(--panel); cursor:pointer; }
#drop input { max-width:100%; }
#drop.over { border-color:var(--accent); }
#drop span, #message { color:var(--muted); }
ul { list-style:none; padding:0; margin:12px 0; }
li { display:flex; gap:10px; align-items:center; justify-content:space-between; padding:8px 0; border-bottom:1px solid var(--line); }
li > :first-child { min-width:0; overflow-wrap:anywhere; }
li a { color:var(--accent); }
@media (max-width:720px) {
  #view { padding:10px; }
  header { gap:6px; padding:0 8px; }
}
