:root {
  --bg: #0b110d;
  --surface: #121b15;
  --surface-2: #1a261e;
  --line: #24352a;
  --text: #e8efe9;
  --muted: #8ea597;
  --pcb: #1f7a4a;
  --pcb-bright: #34c77b;
  --gold: #e3b341;
  --danger: #e5604f;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 500px at 50% -200px, rgba(52, 199, 123, 0.14), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 16px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  min-height: 100vh;
}
img, video { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 48px 16px 36px;
  max-width: 900px;
  margin: 0 auto;
}
.chip {
  display: inline-flex;
  gap: 6px;
  padding: 10px 14px 0;
  background: var(--pcb);
  border-radius: 6px 6px 0 0;
  margin-bottom: 20px;
  box-shadow: 0 0 40px rgba(52, 199, 123, 0.25);
}
.chip span {
  width: 18px;
  height: 22px;
  background: #0d1a12;
  border-radius: 2px;
  margin-bottom: 8px;
  position: relative;
}
.chip span::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: -10px;
  height: 8px;
  background: var(--gold);
  border-radius: 1px;
}
.headline { margin: 4px 0 0; font-weight: 600; }
.headline .dear {
  display: block;
  font-size: clamp(22px, 5vw, 30px);
  color: var(--gold);
  margin-bottom: 4px;
}
.headline .line {
  display: block;
  font-size: clamp(18px, 4.4vw, 24px);
  color: var(--text);
}
.counter {
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 800;
  font-size: clamp(44px, 12vw, 112px);
  line-height: 1.05;
  margin: 6px 0 6px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
#counter-unit { color: var(--pcb-bright); }
.tagline { margin: 14px 0 24px; font-size: clamp(16px, 4vw, 20px); color: var(--pcb-bright); font-style: italic; }
.sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

.login-card {
  max-width: 380px;
  margin: 12vh auto 0;
  padding: 22px 18px;
  display: grid;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
}
.login-card h1 { margin: 0; font-size: 22px; }
@media (max-width: 420px) { .login-card { margin: 8vh 16px 0; } }
.admin-bar a.btn { text-decoration: none; color: inherit; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, background 0.2s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn.primary { background: var(--pcb-bright); border-color: transparent; color: #04140b; }
.btn.primary:hover { background: #48d98c; }
.btn.danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn.wide { width: 100%; }
.icon-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  flex: none;
}

/* ---------- Grid ---------- */
main { max-width: 1200px; margin: 0 auto; padding: 0 16px 40px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
}
.card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  aspect-ratio: 1;
  cursor: pointer;
  padding: 0;
  text-align: left;
  animation: pop 0.35s ease both;
}
.card img, .card video { width: 100%; height: 100%; object-fit: cover; }
.card .badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(4, 20, 11, 0.82);
  border: 1px solid var(--pcb);
  color: var(--pcb-bright);
  font: 800 13px 'JetBrains Mono', monospace;
  padding: 3px 8px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.card .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 34px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}
/* The uploader's comment: small, over the bottom of the photo, max 2 lines. */
.card .cap {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0 6px 6px;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.92);
}
.card .cap-pill {
  display: inline-block;
  max-width: 100%;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid #000;
  border-radius: 10px;
  backdrop-filter: blur(2px);
}
.card .cap-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.empty, .loading { text-align: center; color: var(--muted); }
#sentinel { height: 1px; }
footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 40px; }

/* ---------- Dialogs ---------- */
dialog {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 20px;
  padding: 0;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(3px); }
.sheet { width: min(460px, calc(100% - 24px)); }
.sheet form { padding: 18px; display: grid; gap: 14px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { margin: 0; font-size: 20px; }

.drop {
  display: block;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  min-height: 150px;
  cursor: pointer;
  overflow: hidden;
  background: var(--bg);
}
#drop-empty { display: grid; place-content: center; text-align: center; gap: 4px; min-height: 150px; padding: 16px; }
#drop-empty small { color: var(--muted); }
#preview img, #preview video { width: 100%; max-height: 300px; object-fit: contain; background: #000; }

.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 14px; }
.field em { color: var(--muted); font-style: normal; font-weight: 400; }
.field input, .gb-input select {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  width: 100%;
  min-width: 0;
}
.field input:focus, .gb-input select:focus { outline: 2px solid var(--pcb-bright); outline-offset: 1px; }
.gb-input { display: grid; grid-template-columns: 1fr 84px; gap: 8px; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.form-msg { margin: 0; min-height: 1.2em; font-size: 14px; color: var(--muted); }
.form-msg.error { color: var(--danger); }
.form-msg.ok { color: var(--pcb-bright); }

.lightbox {
  width: min(960px, calc(100% - 16px));
  max-height: calc(100% - 16px);
  background: #000;
  position: fixed;
}
.lightbox .close { position: absolute; top: 10px; right: 10px; z-index: 2; }
#lightbox-media img, #lightbox-media video { width: 100%; max-height: 80vh; object-fit: contain; margin: 0 auto; }
#lightbox-caption { margin: 0; padding: 12px 16px 16px; color: var(--text); }
#lightbox-caption .gb { color: var(--pcb-bright); font: 800 16px 'JetBrains Mono', monospace; margin-right: 8px; }

/* ---------- Admin ---------- */
.admin-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(11, 17, 13, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.admin-bar h1 { font-size: 18px; margin: 0 auto 0 0; }
.tabs { display: flex; gap: 6px; }
.tabs button[aria-pressed='true'] { background: var(--pcb-bright); color: #04140b; border-color: transparent; }
.review-list { display: grid; gap: 14px; max-width: 760px; margin: 16px auto; padding: 0 16px 40px; }
.review {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.review .media { background: #000; }
.review .media img, .review .media video { width: 100%; max-height: 420px; object-fit: contain; }
.review .body { padding: 14px; display: grid; gap: 10px; }
.review .meta { color: var(--muted); font-size: 13px; }
.review .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.review .row input { width: 120px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.review .actions { display: flex; gap: 8px; }
.review .actions .btn { flex: 1; }
.notice { max-width: 760px; margin: 24px auto; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
