:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #6b6b66;
  --line: #deded7;
  --paper: #f7f7f2;
  --panel: #ffffff;
  --accent: #2457d6;
  --positive: #237a4b;
  --negative: #b33b32;
  --warning: #8a5a00;
  --control: #ffffff;
  --image-bg: #e8e8e1;
  --badge-bg: #ecece6;
  --final-ink: #694600;
  --final-bg: #fff0bd;
  --error-bg: #fff0ee;
  --error-line: #f1c2bd;
  --progress-bg: #e5e5df;
  --button-ink: #ffffff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f2f2ed;
  --muted: #aaa9a1;
  --line: #3d3d39;
  --paper: #151514;
  --panel: #20201e;
  --accent: #84a8ff;
  --positive: #3d9b68;
  --negative: #d86459;
  --warning: #e0a43c;
  --control: #292927;
  --image-bg: #30302d;
  --badge-bg: #343430;
  --final-ink: #ffd978;
  --final-bg: #4a3a12;
  --error-bg: #431f1d;
  --error-line: #743a35;
  --progress-bg: #363632;
  --button-ink: #171717;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, .button {
  border: 1px solid var(--ink); border-radius: 7px; background: var(--ink); color: var(--button-ink);
  padding: .62rem .9rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
button:hover, .button:hover { opacity: .86; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary, .button.secondary { background: var(--control); color: var(--ink); border-color: var(--line); }
button.positive.active { background: var(--positive); border-color: var(--positive); }
button.negative.active { background: var(--negative); border-color: var(--negative); }
button.danger { color: var(--negative); }
a { color: var(--accent); }
.site-header { min-height: 62px; padding: 0 max(1rem, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { color: var(--ink); font-weight: 800; text-decoration: none; letter-spacing: -.03em; }
#global-nav { display: flex; align-items: center; gap: .55rem; }
.nav-control { width: auto; min-width: 4.5rem; padding: .45rem .55rem; }
.nav-link { color: var(--ink); text-decoration: none; padding: .45rem .25rem; }
.nav-link:hover { text-decoration: underline; }
.theme-toggle { min-width: 7.5rem; padding: .45rem .6rem; }
.page { width: min(1180px, calc(100% - 2rem)); margin: 2rem auto 5rem; }
.narrow { max-width: 560px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head h1, h1 { margin: 0; letter-spacing: -.04em; }
h2, h3 { letter-spacing: -.025em; }
.muted { color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem; }
.stack { display: grid; gap: 1rem; }
.row { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.spread { justify-content: space-between; }
form label { display: grid; gap: .4rem; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; background: var(--control); padding: .7rem .75rem; color: var(--ink); }
textarea { min-height: 100px; resize: vertical; }
.form-actions { display: flex; align-items: center; gap: .7rem; margin-top: .4rem; }
.shoot-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.shoot-card { color: inherit; text-decoration: none; transition: transform .12s ease; }
.shoot-card:hover { transform: translateY(-2px); }
.shoot-card h2 { margin: 0 0 .4rem; }
.stats { display: flex; gap: 1rem; color: var(--muted); font-size: .92rem; }
.shoot-nav { display: flex; gap: .35rem; overflow-x: auto; margin: -1rem 0 1.5rem; padding-bottom: .3rem; }
.shoot-nav a { text-decoration: none; white-space: nowrap; color: var(--muted); padding: .45rem .7rem; border-radius: 6px; }
.shoot-nav a.active { background: var(--ink); color: var(--button-ink); }
.toolbar { display: grid; grid-template-columns: 1fr auto; gap: .8rem; margin-bottom: 1rem; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.photo-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.photo-card img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--image-bg); cursor: pointer; }
.photo-meta { padding: .75rem; display: grid; gap: .65rem; }
.filename { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .86rem; font-weight: 650; }
.selection-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.selection-buttons button { padding: .45rem .5rem; font-size: .88rem; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; background: var(--badge-bg); color: var(--muted); padding: .18rem .5rem; font-size: .78rem; font-weight: 700; }
.badge.final { color: var(--final-ink); background: var(--final-bg); }
.photo-detail { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 1.5rem; align-items: start; }
.photo-large { width: 100%; max-height: 78vh; object-fit: contain; background: var(--image-bg); border-radius: 10px; }
.side-panel { position: sticky; top: 82px; }
.name-list { margin: .5rem 0 0; padding-left: 1.2rem; }
.comments { display: grid; gap: .7rem; }
.comment { border-top: 1px solid var(--line); padding-top: .7rem; }
.comment p { margin: .3rem 0 0; white-space: pre-wrap; }
.comment-meta { color: var(--muted); font-size: .8rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: .75rem; }
th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
.comparison-list { display: grid; gap: .6rem; }
.comparison-row { display: grid; grid-template-columns: 72px 1fr auto; align-items: center; gap: .8rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .5rem; color: inherit; text-decoration: none; }
.comparison-row img { width: 72px; height: 54px; object-fit: cover; border-radius: 5px; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); border: 1px dashed var(--line); border-radius: 10px; }
.error { color: var(--negative); background: var(--error-bg); border: 1px solid var(--error-line); padding: .7rem; border-radius: 7px; }
#toast { position: fixed; right: 1rem; bottom: 1rem; max-width: 380px; background: var(--ink); color: var(--button-ink); padding: .8rem 1rem; border-radius: 8px; box-shadow: 0 8px 30px #0003; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; z-index: 20; }
#toast.show { opacity: 1; transform: none; }
.progress { height: 5px; background: var(--progress-bg); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }
.manual { max-width: 860px; }
.manual-toc { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.manual-content { padding: clamp(1.25rem, 4vw, 2.5rem); }
.manual-content section { scroll-margin-top: 82px; }
.manual-content section + section { border-top: 1px solid var(--line); margin-top: 2rem; padding-top: 1.25rem; }
.manual-content h2 { margin-top: 0; }
.manual-content li { padding-left: .25rem; margin-block: .7rem; line-height: 1.55; }
.manual-definitions { display: grid; gap: 1rem; }
.manual-definitions div { display: grid; gap: .3rem; }
.manual-definitions dt { font-weight: 750; }
.manual-definitions dd { margin: 0; color: var(--muted); line-height: 1.5; }

@media (max-width: 760px) {
  .page { width: min(100% - 1rem, 1180px); margin-top: 1rem; }
  .photo-detail { grid-template-columns: 1fr; }
  .side-panel { position: static; }
  .page-head { align-items: stretch; flex-direction: column; }
  .toolbar { grid-template-columns: 1fr; }
  .site-header { padding-inline: .75rem; }
  #global-nav > span { display: none; }
  .nav-link { font-size: .9rem; }
  .theme-toggle { min-width: auto; }
}
