:root {
  --bg: #f7f3ec; --card: #fffdf9; --ink: #2b2620; --soft: #6b6157; --line: #ddd3c5;
  --accent: #8a4b2a; --accent-ink: #fff; --heart: #c0392b; --face: #ffc800; --ok: #2e7d32;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1d1a17; --card: #27231f; --ink: #f1ebe2; --soft: #b8ad9f; --line: #443d35;
          --accent: #d58a5c; --accent-ink: #1d1a17; --heart: #ff6b5b; --ok: #7bc47f; }
}
* { box-sizing: border-box; }
html { font-size: 19px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: Georgia, "Times New Roman", serif;
       line-height: 1.5; }
a { color: var(--accent); }
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap;
       padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--card); }
.brand { font-weight: bold; font-size: 1.15rem; text-decoration: none; color: var(--ink); }
.hello { color: var(--soft); }
main { max-width: 1100px; margin: 0 auto; padding: 18px 16px 80px; }
.loading, .note { color: var(--soft); }
h1 { font-size: 1.6rem; margin: 6px 0 10px; }
h2 { font-size: 1.2rem; margin: 22px 0 8px; }
.intro { max-width: 46em; }
.trays { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 16px; }
.tray { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
        overflow: hidden; text-decoration: none; color: var(--ink); }
.tray img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; background: #000; }
.tray .t { padding: 10px 12px; }
.tray .t b { display: block; }
.tray .t span { color: var(--soft); font-size: .85rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { position: relative; display: block; border-radius: 6px; overflow: hidden; background: #000;
         border: 3px solid transparent; }
.thumb img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
.thumb.done { border-color: var(--ok); }
.thumb .mark { position: absolute; top: 4px; right: 6px; font-size: 1.2rem; color: var(--heart);
               text-shadow: 0 0 3px #fff; }
.thumb .no { position: absolute; left: 6px; bottom: 4px; color: #fff; font-size: .8rem; text-shadow: 0 0 3px #000; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.btn { font: inherit; font-size: 1rem; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--line);
       background: var(--card); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-block; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.fav { font-size: 1.1rem; }
.btn.fav.on { background: var(--heart); color: #fff; border-color: var(--heart); }
.stage { text-align: center; margin: 12px 0; }
.photo { position: relative; display: inline-block; max-width: 100%; }
.photo img { display: block; max-width: 100%; max-height: 74vh; border-radius: 4px; touch-action: pan-y; }
.facebox { position: absolute; border: 3px solid var(--face); border-radius: 3px; pointer-events: none; }
.facebox span { position: absolute; top: -1.55em; left: -3px; background: var(--face); color: #000;
                font: bold .85rem/1.4 Arial, sans-serif; padding: 0 6px; border-radius: 3px; }
.hidefaces .facebox { display: none; }
.guess { color: var(--soft); font-size: .9rem; margin: 6px 0 14px; }
.form { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.form label { display: block; font-weight: bold; margin: 12px 0 4px; }
.form label small { font-weight: normal; color: var(--soft); }
input[type=text], textarea { width: 100%; font: inherit; font-size: 1rem; padding: 9px 11px; border-radius: 7px;
       border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
textarea { min-height: 7em; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.faces { display: grid; gap: 6px; }
.facerow { display: grid; grid-template-columns: 2.2em 1fr; align-items: center; gap: 8px; }
.facerow .num { background: var(--face); color: #000; font: bold .95rem Arial, sans-serif; text-align: center;
                border-radius: 4px; padding: 3px 0; }
.facerow .was { grid-column: 2; color: var(--soft); font-size: .8rem; margin-top: -4px; }
.status { color: var(--soft); font-size: .9rem; min-height: 1.4em; }
.status.err { color: var(--heart); }
.others { margin-top: 18px; }
.other { border-left: 4px solid var(--accent); background: var(--card); padding: 8px 12px; margin: 8px 0;
         border-radius: 0 8px 8px 0; white-space: pre-wrap; }
.other b { white-space: normal; }
@media (max-width: 640px) {
  html { font-size: 17px; }
  .row2 { grid-template-columns: 1fr; }
  .photo img { max-height: 60vh; }
}
.nav a { margin-right: 14px; font-size: 1.05rem; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px;
           background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.filters label { display: block; font-weight: bold; margin-bottom: 4px; }
select { width: 100%; font: inherit; font-size: 1rem; padding: 8px 10px; border-radius: 7px;
         border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.filters .check { display: flex; align-items: center; gap: 8px; margin-top: 30px; font-weight: normal; }
.count { margin: 14px 0 0; color: var(--soft); }
.noscroll { overflow: hidden; }
.show { position: fixed; inset: 0; background: #000; z-index: 50; color: #fff; }
.show-img { position: absolute; inset: 0 0 64px; width: 100%; height: calc(100% - 64px); object-fit: contain;
            transition: opacity 1s ease; opacity: 1; }
.show-img.hidden { opacity: 0; }
.show-cap { position: absolute; left: 0; right: 0; bottom: 64px; padding: 40px 28px 14px;
            background: linear-gradient(transparent, rgba(0,0,0,.78)); }
.show-names { font-size: 1.5rem; font-weight: bold; }
.show-line { font-size: 1.1rem; opacity: .92; }
.show-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 64px; display: flex; gap: 10px;
            align-items: center; justify-content: center; background: #111; padding: 0 10px; flex-wrap: wrap; }
.show-bar .btn { background: #2a2622; color: #fff; border-color: #444; padding: 8px 14px; }
.show-bar select { width: auto; background: #2a2622; color: #fff; border-color: #444; }
.show-count { color: #bbb; font-size: .9rem; }
@media (max-width: 640px) { .show-names { font-size: 1.15rem; } .show-line { font-size: .95rem; } }
.groups { display: grid; gap: 14px; margin-top: 14px; }
.group { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.crops { display: flex; flex-wrap: wrap; gap: 6px; }
.crops img { width: 84px; height: 84px; object-fit: cover; border-radius: 6px; display: block; }
.gname { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.gname input { max-width: 420px; }
input[type=file] { font: inherit; font-size: 1rem; max-width: 100%; }
.form .note { margin-top: 0; }
.btn.toggle.on { border: 2px solid var(--face); }
.summary { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin: 12px 0; }
.summary p { margin: 4px 0; }
.summary .who { font-size: 1.2rem; font-weight: bold; }
.summary .whenwhere span { margin-right: 22px; display: inline-block; }
details.guess { color: var(--soft); margin: 0 0 14px; }
details.guess summary { cursor: pointer; font-size: .95rem; }
details.guess p { font-size: .92rem; margin: 6px 0 0 18px; }
