:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #1d9bf0;
  --ok: #16a34a;
  --err: #dc2626;
  --card-bg: #f8fafc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --fg: #f1f5f9;
    --muted: #94a3b8;
    --border: #1e293b;
    --card-bg: #111c30;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
}
.site-header h1 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.site-header nav { display: flex; gap: 18px; }
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.site-header nav a:hover { color: var(--fg); }

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 500;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.ghost {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}

.status { padding: 10px 14px; border-radius: 8px; margin: 12px 0; font-size: 14px; }
.status.hidden { display: none; }
.status.error { background: var(--err); color: white; }
.status.ok { background: var(--ok); color: white; }
.status:empty { display: none; }

.hint { color: var(--muted); font-size: 13px; text-align: center; }
.counter { color: var(--muted); font-size: 13px; text-align: center; }

/* ------- vote page ------- */
.vote-page .pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 16px;
}
.vote-page .card {
  margin: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.vote-page .image-button {
  background: transparent;
  padding: 0;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  position: relative;
}
.vote-page .image-button:hover img,
.vote-page .image-button:focus-visible img {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}
.vote-page .image-button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
}
.vote-page figcaption {
  text-align: center;
  padding: 10px 4px 4px;
  font-size: 14px;
}
.vote-page figcaption a {
  color: var(--accent);
  text-decoration: none;
}
.vote-page figcaption a:hover { text-decoration: underline; }

.action-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 12px 0;
}

kbd {
  display: inline-block;
  padding: 1px 6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

/* ------- leaderboard ------- */
.leaderboard {
  width: 100%;
  border-collapse: collapse;
}
.leaderboard th, .leaderboard td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}
.leaderboard th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.leaderboard td img { border-radius: 6px; object-fit: cover; display: block; background: var(--card-bg); }
.leaderboard a { color: var(--accent); text-decoration: none; }
.leaderboard a:hover { text-decoration: underline; }

/* ------- takedown ------- */
.takedown-form { max-width: 540px; margin-top: 16px; }
.takedown-form fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 10px 14px;
}
.takedown-form fieldset label {
  display: block;
  padding: 4px 0;
  font-size: 14px;
}
.form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.form-row label { font-size: 13px; color: var(--muted); }
.form-row input, .form-row textarea {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--fg);
  font: inherit;
}

.nsfw-badge {
  display: inline-block;
  background: var(--err);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 6px;
  letter-spacing: 0.05em;
}

.nsfw-body .site-header { border-bottom-color: var(--err); }

@media (max-width: 700px) {
  .vote-page .pair { grid-template-columns: 1fr; }
  .site-header { flex-direction: column; gap: 8px; }
}
