:root {
  --bg: #f6f5f2; --card: #fff; --text: #222; --muted: #777; --line: #e4e2dc; --accent: #c0392b;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17181a; --card: #222427; --text: #e8e8e6; --muted: #98999b; --line: #34363a; --accent: #e5614f; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
header { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.logo { font-weight: 600; font-size: 1.2rem; color: var(--text); text-decoration: none; letter-spacing: .02em; }
main { max-width: 1200px; margin: 0 auto; padding: 24px; }
h1 { font-size: 1.4rem; font-weight: 600; margin: 0 0 4px; }
.intro { max-width: 640px; margin: 4px 0 12px; }
footer { text-align: center; padding: 28px 24px 36px; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--line); margin-top: 24px; }
.sub, .muted { color: var(--muted); font-size: .9rem; }
a { color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 20px; }
.tile { display: block; background: var(--card); border-radius: 10px; overflow: hidden; text-decoration: none; color: inherit;
  border: 1px solid var(--line); transition: transform .15s, box-shadow .15s; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.tile img { display: block; width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--line); }
.tile .cap { padding: 10px 14px; font-weight: 500; }
.tile .cap span { display: block; color: var(--muted); font-weight: 400; font-size: .85rem; }
.grid.photos { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.grid.photos .tile { border-radius: 6px; }

.viewer { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; margin-top: 16px; align-items: start; }
.stage { position: relative; background: #000; border-radius: 10px; overflow: hidden; display: flex; justify-content: center; align-items: center; min-height: 300px; }
.stage img { display: block; max-width: 100%; max-height: 78vh; }
.nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.45); color: #fff; font-size: 24px; cursor: pointer; }
.nav:hover { background: rgba(0,0,0,.75); }
.nav.prev { left: 12px; } .nav.next { right: 12px; }
.bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

.comments { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.comments h2 { margin: 0 0 12px; font-size: 1rem; }
.clist { max-height: 340px; overflow-y: auto; margin-bottom: 12px; }
.c { padding: 8px 0; border-bottom: 1px solid var(--line); }
.c:last-child { border-bottom: 0; }
.c b { font-weight: 600; } .c time { color: var(--muted); font-size: .75rem; margin-left: 6px; }
.c p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
form input, form textarea { width: 100%; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--text); font: inherit; }
form textarea { resize: vertical; min-height: 70px; }
form button { padding: 8px 16px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font: inherit; cursor: pointer; }
form button:disabled { opacity: .5; }
.hp { position: absolute; left: -9999px; }
.err { color: var(--accent); font-size: .85rem; margin-left: 8px; }

@media (max-width: 800px) {
  main { padding: 16px; }
  .viewer { grid-template-columns: 1fr; }
}
