:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6a64;
  --line: #dcd8cc;
  --lid: #f5c400;
  --lid-ink: #1d1d1b;
  --tote: #232323;
  --accent: #1f6feb;
  --danger: #b42318;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --surface: #1f1f1f;
    --ink: #f2f1ec;
    --muted: #a3a29b;
    --line: #34332f;
    --tote: #000;
    --accent: #6ea8ff;
    --danger: #ff8a80;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent); }
header.bar {
  position: sticky; top: 0; z-index: 5;
  background: var(--tote); color: #fff;
  border-bottom: 4px solid var(--lid);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
header.bar h1 { font-size: 18px; margin: 0; flex: 1; letter-spacing: .02em; }
header.bar h1 a { color: #fff; text-decoration: none; }
header.bar .who { font-size: 13px; opacity: .8; }
header.bar button { background: none; border: 0; color: #fff; font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; padding: 0; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }

.search { display: flex; gap: 8px; margin-bottom: 8px; }
.search input {
  flex: 1; min-width: 0; font: inherit; font-size: 17px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.search input:focus { outline: 3px solid var(--lid); border-color: transparent; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chip {
  font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.status { color: var(--muted); font-size: 14px; margin: 0 0 12px; min-height: 1.2em; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile {
  display: block; text-decoration: none; color: var(--ink);
  background: var(--tote); border-radius: var(--radius); overflow: hidden;
  border: 3px solid transparent; transition: opacity .15s, transform .15s;
}
.tile .thumb { aspect-ratio: 4 / 3; background: #333 center / cover no-repeat; display: grid; place-items: center; color: #999; font-size: 13px; }
.tile .label {
  margin: 8px; background: #fff; color: #111; border-radius: 4px;
  padding: 6px 8px; display: flex; align-items: baseline; gap: 6px;
}
.tile .label b { font-size: 26px; letter-spacing: .04em; line-height: 1; }
.tile .label span { font-size: 11px; color: #555; }
.tile .title { color: #eee; font-size: 13px; padding: 0 10px 10px; min-height: 1.4em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .hits { color: var(--lid); font-size: 12px; padding: 0 10px 10px; margin-top: -6px; }
.tile .hits mark { background: var(--lid); color: #111; border-radius: 2px; padding: 0 2px; }
.grid.searching .tile { opacity: .22; transform: scale(.97); }
.grid.searching .tile.match { opacity: 1; transform: none; border-color: var(--lid); }

.box-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.biglabel { background: #fff; color: #111; border: 2px solid #111; border-radius: 6px; padding: 6px 14px; display: flex; align-items: baseline; gap: 10px; }
.biglabel b { font-size: 40px; line-height: 1; letter-spacing: .04em; }
.biglabel span { font-size: 13px; color: #555; }
.box-head h2 { margin: 0; font-size: 22px; flex: 1; min-width: 200px; }
.photo { width: 100%; max-height: 70vh; object-fit: contain; background: #000; border-radius: var(--radius); display: block; }
.nophoto { background: var(--surface); border: 2px dashed var(--line); border-radius: var(--radius); padding: 40px 16px; text-align: center; color: var(--muted); }
.cols { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .cols { grid-template-columns: 3fr 2fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card h3 { margin: 0 0 8px; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.contents { margin: 0; padding-left: 20px; }
.contents li { margin: 2px 0; }
.meta { color: var(--muted); font-size: 14px; }
.history { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.history a { display: block; color: var(--muted); font-size: 12px; text-decoration: none; }
.history img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; display: block; background: #333; }

.btn {
  display: inline-block; font: inherit; font-weight: 600; font-size: 16px;
  padding: 12px 18px; border-radius: var(--radius); border: 0; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--lid); color: var(--lid-ink);
}
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

form.edit { display: grid; gap: 16px; max-width: 640px; }
form.edit label { display: grid; gap: 6px; font-weight: 600; }
form.edit .hint { font-weight: 400; color: var(--muted); font-size: 14px; }
form.edit input[type=text], form.edit textarea {
  font: inherit; padding: 10px 12px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%;
}
form.edit textarea { min-height: 200px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.step.required { border: 2px solid var(--lid); }
.step .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--lid); color: #111; font-size: 13px; font-weight: 700; margin-right: 6px; }
.preview { max-width: 100%; max-height: 300px; border-radius: 8px; display: block; margin-top: 10px; }
.check { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px; font-weight: 400 !important; }
.err { color: var(--danger); font-weight: 600; }

.login { max-width: 360px; margin: 10vh auto; padding: 16px; }
.login form { display: grid; gap: 12px; }
.login input { font: inherit; font-size: 17px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
