:root {
  color-scheme: dark;
  --bg: #101010;
  --panel: #181818;
  --panel-2: #222;
  --line: #303030;
  --text: #f5f5f5;
  --muted: #a9a9a9;
  --accent: #f5a623;
  --danger: #ff5b5b;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { cursor: pointer; }

.site-header { position: sticky; top: 0; z-index: 10; display: grid; grid-template-columns: auto minmax(180px, 680px) auto; align-items: center; gap: 18px; padding: 14px clamp(16px, 4vw, 56px); background: rgba(16, 16, 16, .94); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.brand { display: inline-flex; align-items: center; color: white; text-decoration: none; font-size: clamp(24px, 3vw, 36px); font-weight: 900; letter-spacing: -1.6px; }
.brand b { margin-left: 5px; padding: 2px 7px 3px; border-radius: 5px; background: var(--accent); color: #111; line-height: 1; }
.search { display: flex; min-width: 0; }
.search input { width: 100%; min-width: 0; border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; background: var(--panel-2); color: var(--text); padding: 11px 13px; outline: none; }
.search input:focus { border-color: var(--accent); }
.search button, .upload-trigger { border: 0; background: var(--accent); color: #111; font-weight: 800; }
.search button { border-radius: 0 8px 8px 0; padding: 0 18px; }
.upload-trigger { border-radius: 8px; padding: 11px 18px; }

.category-nav { display: flex; gap: 10px; overflow-x: auto; padding: 16px clamp(16px, 4vw, 56px) 8px; scrollbar-width: none; }
.category-nav button { border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); padding: 8px 17px; white-space: nowrap; }
.category-nav button.active { border-color: var(--accent); background: var(--accent); color: #111; font-weight: 800; }

main { padding: 12px clamp(16px, 4vw, 56px) 60px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.media-card { position: relative; display: block; overflow: hidden; aspect-ratio: 16 / 10; border-radius: 10px; background: var(--panel); border: 1px solid #242424; text-decoration: none; }
.media-card img, .media-card video { width: 100%; height: 100%; display: block; object-fit: cover; transition: transform .22s ease, opacity .22s ease; }
.media-card:hover img, .media-card:hover video { transform: scale(1.025); opacity: .9; }
.badge { position: absolute; right: 9px; bottom: 9px; border-radius: 5px; background: rgba(0,0,0,.78); color: #fff; padding: 4px 7px; font-size: 12px; font-weight: 800; }
.empty-state, .loading { text-align: center; color: var(--muted); padding: 72px 16px; }
.empty-state h1 { color: var(--text); margin: 0 0 8px; }

.modal { width: min(480px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--text); padding: 28px; box-shadow: 0 24px 80px rgba(0,0,0,.6); }
.modal::backdrop { background: rgba(0,0,0,.78); backdrop-filter: blur(5px); }
.modal h2 { margin: 0 38px 8px 0; }
.modal p { color: var(--muted); line-height: 1.55; }
.close { position: absolute; top: 13px; right: 16px; border: 0; background: transparent; color: var(--muted); font-size: 30px; }
.modal form { display: grid; gap: 14px; }
.modal label { display: grid; gap: 8px; color: #ddd; font-size: 14px; }
.modal input { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #111; color: white; padding: 12px; }
.primary, .secondary { border-radius: 8px; padding: 11px 15px; font-weight: 800; }
.primary { border: 0; background: var(--accent); color: #111; }
.secondary { width: 100%; margin-top: 12px; border: 1px solid var(--line); background: transparent; color: var(--muted); }
.status { min-height: 1.5em; margin-bottom: 0; }
.status.error { color: var(--danger); }
.status.success { color: #65d58a; }

.notice-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.92); }
.notice-backdrop[hidden] { display: none; }
.notice-card { width: min(500px, 100%); border: 1px solid var(--line); border-radius: 14px; background: var(--panel); padding: 32px; text-align: center; box-shadow: 0 24px 100px rgba(0,0,0,.72); }
.notice-card h1 { margin: 25px 0 10px; }
.notice-card p { color: var(--muted); line-height: 1.65; }
.notice-card .primary { min-width: 160px; margin-top: 10px; }

@media (max-width: 700px) {
  .site-header { grid-template-columns: 1fr auto; gap: 12px; }
  .search { grid-column: 1 / -1; grid-row: 2; }
  .upload-trigger { grid-column: 2; grid-row: 1; }
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .media-card { border-radius: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
