/* Contest-App — Themes
   Default = "studio": neutral dark, Claude-warm accent, professional / restrained.
   Optional = "vibe": the original purple/cyan/pink gradient look.
   Theme is set on <body data-theme="..."> and switched by admin. */

:root {
  /* Studio defaults — applied when no data-theme is set, and explicit fallback */
  --bg-darkest: #0a0a0b;
  --bg-dark: #131315;
  --bg-card: #18181b;
  --bg-elevated: #242427;
  --border: #2a2a2d;
  --border-glow: #3a3a3d;

  --text: #fafafa;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;

  --accent: #cc785c;        /* Claude-warm clay */
  --accent-hover: #d68a6f;
  --accent-2: #8e8e93;      /* neutral gray secondary */
  --accent-pink: #cc785c;   /* alias to warm (collapsed rainbow) */
  --accent-warm: #d4a373;
  --accent-success: #16a34a;
  --accent-danger: #dc2626;

  --gradient-primary: linear-gradient(135deg, #d68a6f 0%, #a85a3d 100%);
  --gradient-secondary: linear-gradient(135deg, #2a2a2d 0%, #18181b 100%);
  --gradient-glow: radial-gradient(circle at top, rgba(204, 120, 92, 0.05), transparent 70%);

  --accent-glow-small: 0 0 0 transparent;
  --accent-glow-medium: 0 0 0 transparent;
  --body-bg-image: none;

  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --shadow-glow: 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.6), 0 4px 16px rgba(0, 0, 0, 0.3);

  --font-display: 'Outfit', system-ui, sans-serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

body[data-theme="vibe"] {
  --bg-darkest: #0a0a14;
  --bg-dark: #12121f;
  --bg-card: #1a1a2e;
  --bg-elevated: #232342;
  --border: #2a2a45;
  --border-glow: #3a3a5e;

  --text: #e8e8f0;
  --text-muted: #9090a8;
  --text-dim: #6a6a85;

  --accent: #a855f7;
  --accent-hover: #ec4899;
  --accent-2: #06b6d4;
  --accent-pink: #ec4899;
  --accent-warm: #f59e0b;

  --gradient-primary: linear-gradient(135deg, #a855f7 0%, #ec4899 100%);
  --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #a855f7 100%);
  --gradient-glow: radial-gradient(circle at top, rgba(168, 85, 247, 0.15), transparent 70%);

  --accent-glow-small: 0 0 12px rgba(168, 85, 247, 0.5);
  --accent-glow-medium: 0 0 24px rgba(168, 85, 247, 0.3);
  --body-bg-image:
    radial-gradient(circle at 15% 20%, rgba(168, 85, 247, 0.08), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(6, 182, 212, 0.06), transparent 40%);

  --shadow-glow: 0 0 32px rgba(168, 85, 247, 0.15);
  --brand-mark-filter: drop-shadow(0 0 12px rgba(168, 85, 247, 0.5));
  --hero-em-filter: drop-shadow(0 0 24px rgba(168, 85, 247, 0.3));
  --btn-primary-shadow: 0 4px 20px rgba(168, 85, 247, 0.4);
  --btn-primary-shadow-hover: 0 6px 28px rgba(168, 85, 247, 0.55);
  --vote-hover-shadow: 0 0 16px rgba(168, 85, 247, 0.3);
  --vote-voted-shadow: 0 0 20px rgba(168, 85, 247, 0.4);
  --dropzone-hover-bg: rgba(168, 85, 247, 0.04);
  --dropzone-active-bg: rgba(168, 85, 247, 0.08);
  --dropzone-active-shadow: 0 0 40px rgba(168, 85, 247, 0.2);
  --drop-icon-filter: drop-shadow(0 0 20px rgba(168, 85, 247, 0.4));
  --tier-free-bg: rgba(6, 182, 212, 0.12);
  --tier-free-color: var(--accent-2);
  --tier-free-border: rgba(6, 182, 212, 0.3);
  --tier-premium-bg: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(236, 72, 153, 0.18));
  --tier-premium-color: var(--accent-warm);
  --tier-premium-border: rgba(245, 158, 11, 0.4);
  --tier-premium-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
  --status-voting-bg: rgba(168, 85, 247, 0.15);
  --status-voting-border: rgba(168, 85, 247, 0.3);
  --status-voting-shadow: 0 0 12px rgba(168, 85, 247, 0.2);
  --focus-ring: 0 0 0 3px rgba(168, 85, 247, 0.15);
  --tier-tab-active-shadow: 0 4px 20px rgba(168, 85, 247, 0.3);
  --topnav-bg: rgba(10, 10, 20, 0.85);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg-darkest);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: var(--body-bg-image);
  background-attachment: fixed;
}

a { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hover); }

/* —— Topnav —— */
.topnav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--topnav-bg, rgba(10, 10, 11, 0.85));
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  letter-spacing: -.02em;
}
.brand:hover { color: var(--text); }
.brand-mark {
  font-size: 26px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: var(--brand-mark-filter, none);
}
.brand-text em {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-style: normal;
  font-weight: 700;
}

.nav-right { display: flex; gap: 20px; align-items: center; }
.nav-link {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  transition: color .2s;
}
.nav-link:hover { color: var(--text); }
.nav-link.admin-link {
  color: var(--accent-2);
  font-weight: 600;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 14px;
}
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.avatar-xs { width: 20px; height: 20px; }
.avatar-placeholder {
  background: var(--gradient-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: white;
  font-size: 12px;
}
.logout-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-muted);
  padding: 0 6px;
  transition: color .2s;
}
.logout-btn:hover { color: var(--accent-danger); }

/* —— Container / Footer —— */
.container { flex: 1; max-width: 1280px; margin: 0 auto; padding: 64px 32px; width: 100%; }
.footer {
  padding: 40px 32px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: var(--bg-dark);
}

/* —— Hero —— */
.hero {
  text-align: center;
  margin-bottom: 80px;
  padding: 40px 20px;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  pointer-events: none;
  z-index: -1;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(40px, 6vw, 72px);
  line-height: 1.05;
  letter-spacing: -.03em;
  margin-bottom: 20px;
}
.hero-title em {
  font-style: normal;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: var(--hero-em-filter, none);
}
.hero-sub {
  font-size: 18px;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
}

/* —— Section Titles —— */
.section-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 32px;
  text-align: center;
}
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--gradient-primary);
  margin: 12px auto 0;
  border-radius: 2px;
}

/* —— Contest Cards —— */
.contest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}
.contest-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: block;
  color: var(--text);
  position: relative;
  transition: all .25s ease;
  overflow: hidden;
}
.contest-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  padding: 1px;
  background: var(--gradient-primary);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition: opacity .25s;
}
.contest-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card), var(--shadow-glow);
  color: var(--text);
}
.contest-card:hover::before { opacity: 1; }
.contest-card h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 8px;
  color: var(--text);
}
.contest-card .theme {
  color: var(--accent-2);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
}
.contest-card .desc {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 20px;
  line-height: 1.55;
}
.contest-card .meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}
.contest-card .prize {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--accent-warm);
  font-weight: 600;
  font-size: 14px;
}
.prize-icon { color: var(--accent-warm); }

/* Status pills */
.status-pill {
  position: absolute;
  top: 18px;
  right: 18px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 100px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.status-pill.status-submission,
.contest-card.status-submission .status-pill {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}
.status-pill.status-voting,
.contest-card.status-voting .status-pill {
  background: var(--status-voting-bg, rgba(204, 120, 92, 0.12));
  color: var(--accent);
  border-color: var(--status-voting-border, rgba(204, 120, 92, 0.3));
  box-shadow: var(--status-voting-shadow, none);
}
.status-pill.status-ended,
.contest-card.status-ended .status-pill {
  background: var(--bg-elevated);
  color: var(--text-dim);
}
.status-pill.status-finalizing,
.contest-card.status-finalizing .status-pill {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-warm);
  border-color: rgba(245, 158, 11, 0.3);
}
.status-pill.status-draft,
.contest-card.status-draft .status-pill {
  background: var(--bg-elevated);
  color: var(--text-dim);
}

/* —— Contest detail header —— */
.contest-header { margin-bottom: 56px; text-align: center; }
.back {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--text-muted);
  font-size: 14px;
}
.back:hover { color: var(--accent); }
.contest-header h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: 12px;
  line-height: 1.1;
}
.theme-line {
  color: var(--accent-2);
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 16px;
}
.contest-desc {
  max-width: 720px;
  margin: 0 auto 24px;
  color: var(--text-muted);
  font-size: 17px;
}
.contest-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.contest-meta .status-pill { position: static; }

.prize-box {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 14px 24px;
  border-radius: 100px;
  gap: 10px;
  align-items: center;
  font-weight: 600;
  color: var(--accent-warm);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.1);
  margin-bottom: 24px;
}
.rules {
  margin: 24px auto;
  max-width: 720px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  text-align: left;
}
.rules summary {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
}
.rules p { margin-top: 12px; color: var(--text-muted); white-space: pre-line; }

.action-row { margin-top: 28px; }
.hint { color: var(--text-muted); font-style: italic; }
.empty {
  color: var(--text-muted);
  font-style: italic;
  padding: 80px 0;
  text-align: center;
  font-size: 17px;
}

/* —— Buttons —— */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 100px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .2s ease;
  letter-spacing: -.005em;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--btn-primary-shadow, 0 1px 3px rgba(0, 0, 0, 0.4));
}
.btn-primary:hover {
  color: white;
  box-shadow: var(--btn-primary-shadow-hover, 0 2px 8px rgba(0, 0, 0, 0.5));
}
.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-elevated); color: var(--text); }
.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.25); color: var(--accent-danger); }
.btn-sm { padding: 8px 16px; font-size: 12px; }

/* —— Gallery —— */
.masonry {
  columns: 340px;
  column-gap: 24px;
}
.card-img {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  break-inside: avoid;
  margin-bottom: 24px;
  overflow: hidden;
  position: relative;
  transition: all .25s;
}
.card-img:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}
.card-img img { width: 100%; height: auto; display: block; }
.card-body { padding: 16px; }
.card-body h4 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}
.by {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
}
.prompt-toggle summary {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
}
.prompt-toggle summary:hover { color: var(--accent); }
.prompt {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-darkest);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
  line-height: 1.5;
}

.vote-row {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
}
.vote-btn, .vote-display {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 7px 16px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .2s ease;
}
.vote-btn:hover {
  background: var(--bg-elevated);
  border-color: var(--accent);
  color: var(--accent-pink);
  box-shadow: var(--vote-hover-shadow, none);
}
.vote-btn.voted {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: var(--vote-voted-shadow, none);
}
.vote-btn.voted .heart { color: white; }
.heart { color: var(--accent-pink); font-size: 14px; }

.rank-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 1;
  background: var(--bg-darkest);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 100px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .05em;
  border: 1px solid var(--border);
}
.rank-badge.rank-1 {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: white;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
  border-color: transparent;
}
.rank-badge.rank-2 {
  background: linear-gradient(135deg, #94a3b8 0%, #cbd5e1 100%);
  color: var(--bg-darkest);
  border-color: transparent;
}
.rank-badge.rank-3 {
  background: linear-gradient(135deg, #b45309 0%, #d97706 100%);
  color: white;
  border-color: transparent;
}

/* —— Forms —— */
.submit-form { max-width: 680px; margin: 0 auto; }
.field { display: block; margin-bottom: 24px; }
.field span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.field small { font-size: 10px; opacity: .8; text-transform: none; letter-spacing: 0; }
.field input, .field textarea, .field select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus-ring, 0 0 0 3px rgba(204, 120, 92, 0.15));
}
.field-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.dropzone {
  position: relative;
  border: 2px dashed var(--border-glow);
  border-radius: var(--radius);
  padding: 56px 24px;
  text-align: center;
  margin-bottom: 28px;
  cursor: pointer;
  background: var(--bg-card);
  transition: all .2s;
}
.dropzone:hover { border-color: var(--accent); background: var(--dropzone-hover-bg, rgba(255, 255, 255, 0.02)); }
.dropzone.dragging {
  border-color: var(--accent);
  background: var(--dropzone-active-bg, rgba(255, 255, 255, 0.04));
  box-shadow: var(--dropzone-active-shadow, none);
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.drop-label { display: block; pointer-events: none; }
.drop-icon {
  font-size: 56px;
  margin-bottom: 16px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: var(--drop-icon-filter, none);
}
.drop-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .12em;
  margin-top: 10px;
}
.preview {
  max-width: 320px;
  max-height: 320px;
  margin: 20px auto 0;
  display: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  justify-content: center;
}

.error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  color: var(--accent-danger);
  margin-bottom: 24px;
}

/* —— Admin —— */
.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.admin-table th, .admin-table td {
  padding: 14px 18px;
  text-align: left;
}
.admin-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-muted);
  background: var(--bg-dark);
  font-weight: 600;
}
.admin-table td { border-top: 1px solid var(--border); }
.admin-table tr:hover td { background: var(--bg-elevated); }
.link { color: var(--accent); font-size: 13px; background: none; border: none; cursor: pointer; padding: 0; font-family: inherit; }
.link:hover { color: var(--accent-hover); }
.link-danger { color: var(--accent-danger); }
.link-danger:hover { color: #fca5a5; }
.link:hover { color: var(--accent-pink); }

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .2s;
}
.admin-card:hover { border-color: var(--border-glow); }
.admin-card.disq { opacity: .5; }
.admin-card img { width: 100%; height: 220px; object-fit: cover; }
.admin-card-body { padding: 18px; }
.admin-card-body h4 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}
.votes-line { color: var(--text-muted); margin: 10px 0; font-family: var(--font-mono); font-size: 13px; }
.inline-form {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 8px 0 0;
}
.inline-form label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.inline-form input[type="number"], .inline-form input[type="text"] {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-darkest);
  color: var(--text);
  width: 4em;
}
.checkbox { display: inline-flex; align-items: center; gap: 4px; }
.ok {
  color: var(--accent-success);
  margin-left: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

/* Dev-Banner */
.dev-banner {
  background: var(--gradient-primary);
  color: white;
  padding: 10px 16px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.dev-banner a {
  color: white;
  text-decoration: underline;
  font-weight: 700;
}
.dev-banner a:hover { color: white; opacity: .8; }

/* —— Responsive —— */
@media (max-width: 960px) {
  .container { padding: 48px 24px; }
  .topnav { padding: 16px 24px; }
  .admin-table-wrap { overflow-x: auto; }
  .admin-table { min-width: 760px; }
  .top-row { grid-template-columns: 40px 56px 1fr auto; gap: 12px; }
}

@media (max-width: 720px) {
  .topnav { padding: 14px 18px; flex-wrap: wrap; gap: 12px; row-gap: 8px; }
  .nav-right { gap: 12px; flex-wrap: wrap; }
  .container { padding: 32px 18px; }
  .hero { padding: 20px 0; margin-bottom: 40px; }
  .hero-title { font-size: 40px; }
  .field-grid-3 { grid-template-columns: 1fr; }
  .section-title { font-size: 26px; }

  /* Cards & grids → 1 column */
  .contest-grid { grid-template-columns: 1fr; gap: 16px; }
  .admin-grid { grid-template-columns: 1fr; gap: 16px; }
  .masonry { columns: 1; }

  /* Contest detail header */
  .contest-header h1 { font-size: 32px; }
  .contest-meta { flex-wrap: wrap; gap: 8px; }

  /* Archive */
  .archive-card { padding: 20px; }
  .archive-card-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .archive-card-head h2 { font-size: 22px; }
  .top-row { grid-template-columns: 36px 48px 1fr; row-gap: 4px; padding: 8px 10px; }
  .top-row .top-votes { grid-column: 1 / -1; justify-self: end; }

  /* Admin header / theme switcher */
  .theme-switcher { flex: 1 1 auto; justify-content: center; }

  /* Manage page submit form */
  .inline-form { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .container { padding: 24px 14px; }
  .topnav { padding: 12px 14px; }
  .hero-title { font-size: 32px; }
  .login-landing { padding: 40px 16px 32px; }
  .login-cta .btn-large { font-size: 16px; padding: 12px 24px; }
  .premium-notice { padding: 14px 16px; gap: 12px; font-size: 13px; }
  .premium-notice-icon { font-size: 22px; }
  .contest-card { padding: 22px; }
  .archive-card { padding: 16px; }
  .btn { padding: 10px 22px; }
  .btn-sm { padding: 7px 14px; }
  .user-chip span:not(.tier-badge) { display: none; }
  .nav-link { font-size: 13px; }
}

/* —— Tier system —— */
.tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
}
.tier-pill.tier-free {
  background: var(--tier-free-bg, rgba(255, 255, 255, 0.04));
  color: var(--tier-free-color, var(--text-muted));
  border-color: var(--tier-free-border, var(--border));
}
.tier-pill.tier-premium {
  background: var(--tier-premium-bg, rgba(212, 163, 115, 0.12));
  color: var(--tier-premium-color, var(--accent-warm));
  border-color: var(--tier-premium-border, rgba(212, 163, 115, 0.35));
  box-shadow: var(--tier-premium-shadow, none);
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  margin-left: 2px;
}
.tier-badge.tier-premium {
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.6));
}

.card-pills {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 6px;
  flex-direction: column;
  align-items: flex-end;
}
.card-pills .status-pill,
.card-pills .tier-pill {
  position: static;
}

/* —— Tier filter tabs —— */
.tier-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 40px;
  flex-wrap: wrap;
}
.tier-tab {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 10px 22px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}
.tier-tab:hover {
  color: var(--text);
  border-color: var(--border-glow);
}
.tier-tab.active {
  background: var(--gradient-primary);
  color: white;
  border-color: transparent;
  box-shadow: var(--tier-tab-active-shadow, var(--shadow-card));
}

.contest-card.tier-premium {
  border-color: rgba(245, 158, 11, 0.3);
}
.contest-card.tier-premium:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 32px rgba(245, 158, 11, 0.15);
}

/* —— Login Landing —— */
.login-landing {
  text-align: center;
  padding: 80px 20px 60px;
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}
.login-landing::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  pointer-events: none;
  z-index: -1;
}
.login-landing .hero-sub {
  margin-bottom: 40px;
}
.login-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.login-cta .btn-large {
  font-size: 18px;
  padding: 14px 36px;
}
.login-hint {
  color: var(--text-dim);
  font-size: 14px;
}

/* —— Approval status (admin manage) —— */
.admin-card.pending { box-shadow: 0 0 0 1px var(--accent-warm), var(--shadow-card); }
.admin-card-status { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.approval-pill {
  display: inline-block;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.approval-pill.approved {
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-success);
  border-color: rgba(16, 185, 129, 0.3);
}
.approval-pill.pending {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent-warm);
  border-color: rgba(245, 158, 11, 0.3);
}
.approval-pill.disq {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-danger);
  border-color: rgba(239, 68, 68, 0.3);
}
.hint.pending {
  color: var(--accent-warm);
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

/* —— Archive page —— */
.archive-list { display: flex; flex-direction: column; gap: 24px; }
.archive-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.archive-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}
.archive-card-head h2 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0;
}
.archive-card-head h2 a { color: var(--text); }
.archive-card-head h2 a:hover { color: var(--accent); }
.archive-card-head .theme { color: var(--accent-2); font-size: 14px; margin-top: 4px; }
.archive-card-meta {
  display: flex;
  gap: 24px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.archive-winner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 15px;
}
.archive-winner .winner-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-darkest);
  padding: 2px 8px;
  border-radius: 4px;
}
.archive-winner .muted { color: var(--text-dim); }

.top-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.top-row {
  display: grid;
  grid-template-columns: 48px 64px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.top-row.rank-1 { border-color: rgba(245, 158, 11, 0.5); box-shadow: 0 0 12px rgba(245, 158, 11, 0.1); }
.top-row.rank-2 { border-color: rgba(192, 192, 192, 0.4); }
.top-row.rank-3 { border-color: rgba(205, 127, 50, 0.4); }
.rank-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -.02em;
}
.rank-1 .rank-num { color: var(--accent-warm); }
.rank-2 .rank-num { color: #c0c0c0; }
.rank-3 .rank-num { color: #cd7f32; }
.top-thumb img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}
.top-info .top-title { font-weight: 600; font-size: 15px; }
.top-info .top-by { font-size: 13px; color: var(--text-muted); }
.top-votes { font-size: 14px; color: var(--text-muted); white-space: nowrap; }
.top-votes .heart { color: var(--accent-pink); }

/* —— Premium payout notice —— */
.premium-notice {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin: 24px 0 40px;
  padding: 18px 22px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(236, 72, 153, 0.06));
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}
.premium-notice-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.5));
  flex-shrink: 0;
}
.premium-notice-body strong { color: var(--text); font-weight: 600; }

/* —— Theme switcher (admin) —— */
.theme-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 4px 4px 4px 14px;
}
.theme-switcher-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.theme-chip {
  background: transparent;
  color: var(--text-muted);
  border: none;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: all .15s ease;
}
.theme-chip:hover { color: var(--text); }
.theme-chip.active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border-glow);
}

/* —— Studio polish — neutralize remaining vibe glow on contest cards and dev banner —— */
body[data-theme="studio"] .contest-card {
  background: var(--bg-card);
}
body[data-theme="studio"] .contest-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
  border-color: var(--border-glow);
}
body[data-theme="studio"] .contest-card::before {
  display: none;
}
body[data-theme="studio"] .dev-banner {
  background: rgba(212, 163, 115, 0.08);
  border-bottom: 1px solid rgba(212, 163, 115, 0.25);
  color: var(--accent-warm);
}

/* —— NSFW pill, blur, confirm gate —— */
.nsfw-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  padding: 5px 10px;
  border-radius: 100px;
  background: rgba(220, 38, 38, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.35);
}
.nsfw-blur {
  filter: blur(24px) saturate(0.6);
  pointer-events: none;
  user-select: none;
}
.nsfw-blur img { opacity: 0.85; }

.nsfw-gate {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 32px;
  margin-bottom: 32px;
  position: relative;
  z-index: 2;
}
.nsfw-gate-icon {
  font-size: 64px;
  margin-bottom: 16px;
}
.nsfw-gate h2 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 12px;
}
.nsfw-gate p {
  max-width: 540px;
  margin: 0 auto 24px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}
.nsfw-gate-back {
  margin-top: 20px !important;
  font-size: 13px;
}
.nsfw-gate-back a { color: var(--text-dim); }

/* —— Admin form: checkbox-style field —— */
.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}
.checkbox-field input[type="checkbox"] {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.checkbox-field > span { font-weight: 600; }
