/* ---------- Tokens ---------- */
:root {
  --bg: #f6f2ea;
  --surface: #ffffff;
  --ink: #211a14;
  --ink-soft: #5b4d3e;
  --muted: #8c7d6a;
  --border: #e5dcc9;

  --brand: #7a1128;
  --brand-dark: #57091c;
  --brand-bright: #a3213e;
  --brand-soft: #f3e2e2;

  --pink: #7c2454;
  --pink-soft: #f1e2ec;
  --orange: #a8551c;
  --orange-soft: #f5e6d8;
  --cyan: #10665b;
  --cyan-soft: #dbe9e5;
  --gold: #8a6d1f;
  --gold-soft: #f2ecd8;

  --success: #2c7a4b;
  --success-soft: #e3f1e8;
  --danger: #c0392b;
  --danger-soft: #f8e3df;

  --radius: 10px;
  --radius-sm: 7px;
  --shadow-hard: 3px 3px 0 var(--ink);
  --shadow-hard-sm: 2px 2px 0 var(--ink);

  --font-display: 'Fraunces', 'Iowan Old Style', serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;
  --font-body: 'Archivo', -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
}

a { color: var(--brand); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.icon, .cat-icon, .empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.icon svg, .cat-icon svg, .empty-icon svg { width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Header ---------- */
.site-header {
  position: relative;
  padding: 52px 24px 40px;
  background: var(--brand);
  overflow: hidden;
}
.header-inner {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
}
.wordmark { max-width: 640px; }
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.wordmark h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6vw, 3.4rem);
  margin: 0;
  letter-spacing: -0.01em;
  color: #fff;
}
.tagline {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.88);
  margin: 10px 0 0;
  font-size: 1.3rem;
}

/* ---------- Filters ---------- */
.filters {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
  padding: 26px 24px 22px;
  position: relative;
  z-index: 2;
}
.category-filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filter-btn {
  background: var(--surface);
  border: 2px solid var(--ink);
  color: var(--ink);
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  box-shadow: var(--shadow-hard);
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, color 0.12s ease;
}
.filter-btn:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.filter-btn:active { transform: translate(1px, 1px); box-shadow: none; }
.filter-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.filter-btn.cat-vintage_clothing.active { background: var(--pink); border-color: var(--ink); }
.filter-btn.cat-sports_cards.active { background: var(--orange); border-color: var(--ink); }
.filter-btn.cat-trading_cards.active { background: var(--gold); border-color: var(--ink); }
.filter-btn.cat-sneakers.active { background: var(--cyan); border-color: var(--ink); }

.nav-actions { margin-left: auto; }

.profile-menu-wrap { position: relative; }
.profile-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.profile-toggle .icon { width: 18px; height: 18px; flex-shrink: 0; }
.profile-toggle:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 var(--ink); }
.profile-toggle.open { transform: translate(1px, 1px); box-shadow: none; background: var(--ink); color: #fff; }

.profile-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-hard);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 20;
  animation: drop-in 0.14s ease;
}
.profile-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  text-decoration: none;
  box-sizing: border-box;
  background: none;
  border: none;
  color: var(--ink);
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  transition: background 0.12s ease, color 0.12s ease;
}
.profile-menu-item:hover { background: var(--bg); }
.profile-menu-item.primary { background: var(--brand); color: #fff; }
.profile-menu-item.primary:hover { background: var(--brand-dark); }
.profile-menu-item.danger { color: var(--danger); }
.profile-menu-item.danger:hover { background: var(--danger-soft); }
.profile-menu-divider { height: 1px; background: var(--border); margin: 4px 2px; }
.profile-menu-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 8px 12px 2px;
  margin: 0;
}
.profile-menu-label span { color: var(--ink); font-weight: 700; }

/* ---------- Toolbar (search + sort) ---------- */
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 20px;
}
.search-input, .sort-select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
}
.search-input { flex: 1; min-width: 200px; }
#users-search-input { display: block; width: 100%; max-width: 360px; margin: 0 0 14px; box-sizing: border-box; }
.search-input:focus, .sort-select:focus { border-color: var(--ink); outline: none; }
.sort-select { flex-shrink: 0; cursor: pointer; font-family: var(--font-mono); font-size: 0.8rem; }

/* ---------- Admin panel ---------- */
.admin-panel {
  max-width: 1052px;
  margin: 0 auto 28px;
  padding: 0 24px;
  animation: drop-in 0.18s ease;
}
@keyframes drop-in {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.admin-panel h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  margin: 0 0 14px;
  color: var(--ink);
}
.admin-panel .pending-heading { margin-top: 28px; }
.panel-subtitle {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1rem;
  margin: -8px 0 16px;
  max-width: 60ch;
}
.admin-content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.admin-content-header h2 { margin: 0 0 14px; }
.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  margin-bottom: 14px;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.logout-btn:hover { color: var(--danger); border-color: var(--danger); }
#admin-login { max-width: 360px; }

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin: -4px 0 14px;
}
.image-grid:empty { margin: 0; }
.image-thumb {
  position: relative;
  height: 84px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  background-color: var(--bg);
}
.image-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-thumb .remove-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  border: none;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-thumb .remove-btn:hover { background: var(--danger); }
.image-thumb.uploading::after {
  content: 'Uploading…';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- My Tickets ---------- */
.tickets-lookup-form { display: flex; gap: 10px; margin: 16px 0 20px; flex-wrap: wrap; }
.tickets-lookup-form input {
  flex: 1;
  min-width: 200px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.tickets-lookup-form input:focus { border-color: var(--ink); outline: none; }
.tickets-lookup-form button {
  background: var(--brand);
  border: 2px solid var(--ink);
  color: #fff;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 0.1s ease;
}
.tickets-lookup-form button:hover { transform: translate(-1px, -1px); }
.tickets-lookup-form button:active { transform: translate(1px, 1px); box-shadow: none; }

.auth-form { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.auth-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.auth-form input:focus { border-color: var(--ink); outline: none; }
.auth-form button {
  background: var(--brand);
  border: 2px solid var(--ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 0.1s ease;
}
.auth-form button:hover { transform: translate(-1px, -1px); }
.auth-form button:active { transform: translate(1px, 1px); box-shadow: none; }
.auth-form button.danger-btn { background: var(--danger); }

.auth-switch { font-size: 0.85rem; color: var(--ink-soft); margin: 4px 0 0; }
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--brand);
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--brand-dark); }

.guest-lookup-label { margin-top: 18px !important; }

.wordmark-link { color: inherit; text-decoration: none; }

.full-width-label { flex: 1 1 100%; }
.apply-textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  resize: vertical;
  box-sizing: border-box;
}

.tickets-results { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.ticket-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.ticket-entry-info h4 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 6px 0 4px;
  font-size: 1rem;
}
.ticket-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  white-space: nowrap;
}
.ticket-status .icon { width: 13px; height: 13px; }
.ticket-status.won { background: var(--success-soft); color: var(--success); }
.ticket-status.lost { background: var(--border); color: var(--muted); }
.ticket-status.open { background: var(--brand-soft); color: var(--brand); }
.admin-panel form {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
}
.form-row { display: flex; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.form-row label {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-weight: 600;
}
.form-row input, .form-row select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-body);
}
.form-row input:focus, .form-row select:focus { border-color: var(--ink); outline: none; }
.admin-panel button[type="submit"] {
  background: var(--brand);
  color: #fff;
  border: 2px solid var(--ink);
  padding: 11px 26px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 0.1s ease;
}
.admin-panel button[type="submit"]:hover { transform: translate(-1px, -1px); }
.admin-panel button[type="submit"]:active { transform: translate(1px, 1px); box-shadow: none; }
.action-message { color: var(--brand); font-weight: 600; font-size: 0.87rem; min-height: 1.2em; margin: 12px 2px 0; }

.hidden { display: none !important; }

.pending-list { display: flex; flex-direction: column; gap: 10px; }
.pending-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.pending-info { flex: 1; min-width: 220px; }
.pending-info h4 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 6px 0 4px;
  font-size: 1.05rem;
}
.pending-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 2px 0;
}
.pending-actions { display: flex; gap: 8px; flex-shrink: 0; }
.approve-btn, .reject-btn {
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: transform 0.1s ease;
}
.approve-btn { background: var(--success); color: #fff; }
.approve-btn:hover:not(:disabled) { transform: translate(-1px, -1px); }
.reject-btn { background: var(--danger-soft); color: var(--danger); }
.reject-btn:hover:not(:disabled) { transform: translate(-1px, -1px); }
.approve-btn:disabled, .reject-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- Raffle grid ---------- */
.raffle-grid {
  max-width: 1100px;
  margin: 8px auto 0;
  padding: 0 24px 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 26px 22px;
}
.loading, .empty-state {
  color: var(--muted);
  grid-column: 1 / -1;
  text-align: center;
  padding: 72px 20px;
  font-size: 0.95rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.loading .empty-icon, .empty-state .empty-icon { width: 40px; height: 40px; opacity: 0.55; }
.load-more-btn {
  display: block;
  margin: 8px auto 48px;
  background: var(--surface);
  border: 2px solid var(--ink);
  color: var(--ink);
  padding: 12px 32px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 0.1s ease;
}
.load-more-btn:hover:not(:disabled) { transform: translate(-1px, -1px); }
.load-more-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.loading .empty-icon { animation: pulse-icon 1.4s ease-in-out infinite; }
@keyframes pulse-icon {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.12); opacity: 0.75; }
}

/* Card */
.raffle-card {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-hard);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.raffle-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
}
.raffle-card:focus-visible { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.raffle-card:active { transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }

.raffle-card .thumb {
  height: 178px;
  background-color: var(--bg);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border-bottom: 2px solid var(--ink);
  transition: transform 0.3s ease;
}
.raffle-card:hover .thumb { transform: scale(1.045); }
.raffle-card.cat-vintage_clothing .thumb { background-color: var(--pink-soft); }
.raffle-card.cat-sports_cards .thumb { background-color: var(--orange-soft); }
.raffle-card.cat-trading_cards .thumb { background-color: var(--gold-soft); }
.raffle-card.cat-sneakers .thumb { background-color: var(--cyan-soft); }

.raffle-card .thumb .cat-icon {
  width: 52px;
  height: 52px;
  color: var(--ink);
  opacity: 0.45;
}
.sold-out-badge, .hot-badge {
  position: absolute;
  top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 5px 10px;
  border: 1.5px solid var(--ink);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}
.sold-out-badge { right: 10px; background: var(--ink); color: #fff; border-color: var(--ink); }
.hot-badge { left: 10px; background: var(--danger); color: #fff; }
.hot-badge .icon { width: 11px; height: 11px; }

.category-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.3px;
  font-weight: 700;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  color: #fff;
}
.category-tag.cat-vintage_clothing { background: var(--pink); }
.category-tag.cat-sports_cards { background: var(--orange); }
.category-tag.cat-trading_cards { background: var(--gold); }
.category-tag.cat-sneakers { background: var(--cyan); }

.raffle-card .stub {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.raffle-card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.3;
  color: var(--ink);
}
.ticket-meta {
  display: flex;
  align-items: baseline;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: auto;
  gap: 8px;
  flex-wrap: wrap;
}
.ticket-meta .price {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
}
.ticket-meta .meta-dot { opacity: 0.5; }

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.35), transparent 65%);
  background-color: var(--brand);
  transition: width 0.25s ease;
}
.raffle-card.cat-vintage_clothing .progress-fill { background-color: var(--pink); }
.raffle-card.cat-sports_cards .progress-fill { background-color: var(--orange); }
.raffle-card.cat-trading_cards .progress-fill { background-color: var(--gold); }
.raffle-card.cat-sneakers .progress-fill { background-color: var(--cyan); }

.status-drawn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--brand);
  font-weight: 700;
  text-transform: uppercase;
}
.status-drawn .icon { width: 14px; height: 14px; }

/* ---------- Modal / full ticket view ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(33, 26, 20, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fade-in 0.15s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: 16px;
  max-width: 540px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 6px 6px 0 var(--ink);
  animation: modal-pop 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-content::before {
  content: '';
  position: sticky;
  top: 0;
  display: block;
  height: 5px;
  background: var(--brand);
  z-index: 3;
}
.modal-content.cat-vintage_clothing::before { background: var(--pink); }
.modal-content.cat-sports_cards::before { background: var(--orange); }
.modal-content.cat-trading_cards::before { background: var(--gold); }
.modal-content.cat-sneakers::before { background: var(--cyan); }
.modal-image {
  height: 220px;
  background-color: var(--bg);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  border-bottom: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-image .cat-icon { width: 68px; height: 68px; color: var(--ink); opacity: 0.4; }
.modal-gallery {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  overflow-x: auto;
  border-bottom: 2px solid var(--ink);
  background: var(--bg);
}
.gallery-thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  overflow: hidden;
  cursor: pointer;
  background: none;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb.active { border-color: var(--brand); }
.modal-body-inner { padding: 26px 28px 28px; }
.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: var(--surface);
  border: 2px solid var(--ink);
  color: var(--ink);
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  font-size: 1.3rem; cursor: pointer; line-height: 1;
  font-family: var(--font-body);
  display: flex; align-items: center; justify-content: center;
  z-index: 4;
  box-shadow: var(--shadow-hard-sm);
}
.modal-close:hover { color: var(--danger); }
.modal-close:active { transform: translate(1px, 1px); box-shadow: none; }
.modal-content h2 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 12px 0 6px;
  font-size: 1.6rem;
  line-height: 1.25;
  color: var(--ink);
}
.modal-content p.description { color: var(--ink-soft); line-height: 1.55; margin: 0 0 14px; }
.draw-date-hint { color: var(--muted); font-family: var(--font-mono); font-size: 0.78rem; margin: 8px 0 0; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; }
.modal-content .ticket-meta { font-size: 0.9rem; margin-bottom: 8px; }

.buy-form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.buy-form input[type="text"],
.buy-form input[type="email"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.buy-form input:focus { border-color: var(--ink); outline: none; }

.limit-hint {
  color: var(--muted);
  font-size: 0.78rem;
  margin: -4px 0 0;
}

.buying-as {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 0;
}
.buying-as strong { color: var(--ink); }

.signin-gate {
  margin-top: 20px;
  padding: 18px;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
}
.signin-gate .panel-subtitle { margin: 0 0 14px; max-width: none; }
.signin-gate-btn {
  background: var(--brand);
  border: 2px solid var(--ink);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 0.1s ease;
}
.signin-gate-btn:hover { transform: translate(-1px, -1px); }
.signin-gate-btn:active { transform: translate(1px, 1px); box-shadow: none; }

.stepper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.stepper {
  display: flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.step-btn {
  background: var(--bg);
  border: none;
  color: var(--ink);
  width: 38px; height: 38px;
  font-size: 1.2rem;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 700;
  transition: background 0.12s ease;
}
.step-btn:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand); }
.step-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.stepper input[type="number"] {
  width: 52px;
  text-align: center;
  background: var(--surface);
  border: none;
  border-left: 2px solid var(--ink);
  border-right: 2px solid var(--ink);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 9px 4px;
  -moz-appearance: textfield;
}
.stepper input[type="number"]::-webkit-inner-spin-button,
.stepper input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.cost-preview {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  color: var(--brand);
  font-weight: 700;
  text-align: right;
}
.cost-preview .cost-label {
  display: block;
  font-family: var(--font-body);
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.buy-form button[type="submit"] {
  background: var(--brand);
  color: #fff;
  border: 2px solid var(--ink);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 0.1s ease;
}
.buy-form button[type="submit"]:hover { transform: translate(-1px, -1px); }
.buy-form button[type="submit"]:active { transform: translate(1px, 1px); box-shadow: none; }
.buy-form button[type="submit"]:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: var(--shadow-hard-sm); }

.checkout-step { margin-top: 18px; }
.checkout-step .back-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0;
  margin-bottom: 10px;
}
.checkout-step .back-btn:hover { color: var(--brand); }
.checkout-step h3 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0 0 6px;
  font-size: 1.15rem;
}
.demo-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
}
.demo-notice .icon { width: 15px; height: 15px; flex-shrink: 0; }
.checkout-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
  margin: 0 0 8px;
}
.checkout-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.checkout-row { display: flex; gap: 10px; }
.checkout-row input { flex: 1; min-width: 0; }
.checkout-fields input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.92rem;
  width: 100%;
}
.checkout-fields input:focus { border-color: var(--ink); outline: none; }
#complete-purchase-btn {
  width: 100%;
  background: var(--brand);
  color: #fff;
  border: 2px solid var(--ink);
  padding: 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 0.1s ease;
}
#complete-purchase-btn:hover:not(:disabled) { transform: translate(-1px, -1px); }
#complete-purchase-btn:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: none; }
#complete-purchase-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.sold-out-notice {
  background: var(--bg);
  border: 1px dashed var(--border);
  color: var(--muted);
  padding: 14px;
  border-radius: var(--radius-sm);
  margin-top: 18px;
  font-size: 0.88rem;
  text-align: center;
  font-weight: 600;
}

.draw-btn {
  background: var(--danger-soft);
  color: var(--danger);
  border: 2px dashed var(--danger);
  padding: 11px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  transition: background 0.15s ease;
}
.draw-btn:hover:not(:disabled) { background: #f3d1ca; }
.draw-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.admin-manage-row { display: flex; gap: 10px; margin: 16px 0 0; flex-wrap: wrap; }
.edit-raffle-btn, .cancel-raffle-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  cursor: pointer;
  font-weight: 700;
}
.edit-raffle-btn:hover { border-color: var(--ink); }
.cancel-raffle-btn { color: var(--danger); border-color: var(--danger-soft); }
.cancel-raffle-btn:hover { background: var(--danger-soft); }

.edit-raffle-form {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 14px;
}
.edit-raffle-form button[type="submit"] {
  background: var(--brand);
  color: #fff;
  border: 2px solid var(--ink);
  padding: 11px 26px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  box-shadow: var(--shadow-hard-sm);
  transition: transform 0.1s ease;
}
.edit-raffle-form button[type="submit"]:hover { transform: translate(-1px, -1px); }
.edit-raffle-form button[type="submit"]:active { transform: translate(1px, 1px); box-shadow: none; }
.edit-raffle-form .cancel-edit-btn {
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  margin-left: 12px;
}
.edit-raffle-form .field-note { font-size: 0.75rem; color: var(--ink-soft); margin: -8px 0 14px; }

.winner-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--success-soft);
  border: 1px dashed var(--success);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--success);
}
.winner-banner .icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ---------- Footer ---------- */
.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 40px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}
.site-footer a { text-decoration: underline; text-underline-offset: 2px; }
.site-footer a:hover { color: var(--brand); }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .site-header { padding: 40px 18px 32px; }
  .wordmark h1 { font-size: 2rem; }
  .tagline { font-size: 1.1rem; }
  .filters { padding: 16px 18px 16px; flex-direction: column; align-items: stretch; }
  /* A plain flex-wrap row with flex:1 buttons stretches a lone leftover
     button (an odd count wraps to a final row of one) to the full row
     width, since each flex line sizes independently. A 2-column grid
     keeps every button the same width regardless of how many wrap. */
  .category-filters { display: grid; grid-template-columns: repeat(2, 1fr); width: 100%; }
  .filter-btn { text-align: center; }
  /* .nav-actions was never display:flex, so justify-content here was a
     no-op — its child (.profile-menu-wrap, a plain block div) just
     stretched to the full 100% width set below, leaving the dropdown menu
     (position:absolute; right:0 of that wrap) anchored far from the
     visible Profile button instead of right below it. */
  .nav-actions { display: flex; margin-left: 0; width: 100%; justify-content: flex-end; }
  .toolbar { padding: 0 18px 20px; flex-direction: column; }
  .search-input { min-width: 0; }
  .raffle-grid { padding: 0 18px 60px; grid-template-columns: 1fr; }
  .admin-panel { padding: 0 18px; }
  .form-row { flex-direction: column; gap: 14px; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-content { max-width: 100%; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal-content::before { border-radius: 0; }
  .modal-image { border-radius: 0; }
  .stepper-row { justify-content: flex-start; }
  .cost-preview { text-align: left; }
  .checkout-row { flex-direction: column; }
  .pending-item, .ticket-entry { flex-direction: column; align-items: stretch; }
  .pending-actions { justify-content: flex-end; }
}
