/* ── Variables ──────────────────────────────────────────────────────────────── */
:root {
  --bg:           #0d0d0d;
  --surface:      #181818;
  --felt:         #0f2a0f;
  --felt-border:  #1e4a1e;
  --gold:         #c9a84c;
  --gold-light:   #e8c96a;
  --gold-dim:     rgba(201,168,76,0.35);
  --text:         #f0e8d0;
  --muted:        #888;
  --border:       #2a2a2a;
  --red-suit:     #e03030;
  --black-suit:   #d0ccc0;

  /* Series accent colors */
  --c-red:    #a01818;
  --c-black:  #2a2a2a;
  --c-green:  #5a9900;
  --c-lights: #1a2d55;
  --c-chips:  #3a1255;
  --c-1of1:   #5a3a08;
}

/* ── Reset & Base ────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
}

/* ── Auth Bar ────────────────────────────────────────────────────────────────── */
.auth-bar {
  background: #0a0a0a;
  border-bottom: 1px solid #222;
  padding: 0.35rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
}

#auth-status {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.auth-btn {
  background: none;
  border: 1px solid #444;
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  padding: 0.2rem 0.7rem;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.15s;
}

.auth-btn:hover { border-color: var(--gold); color: var(--gold); }
.auth-btn.logged-in { border-color: #2a6a2a; color: #6dbf6d; }
.auth-btn.logged-in:hover { border-color: #e74c3c; color: #e74c3c; }

/* ── Banner ──────────────────────────────────────────────────────────────────── */
.banner {
  background: linear-gradient(135deg, #1a0000 0%, #2a0505 30%, #1a0a00 60%, #0a0a1a 100%);
  border-bottom: 2px solid var(--gold);
  padding: 2rem 2rem 1.5rem;
  text-align: center;
  position: relative;
}

.banner-suits {
  font-size: 1.6rem;
  letter-spacing: 1.2rem;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(201,168,76,0.5);
  margin-bottom: 0.6rem;
}

.banner-brand {
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--gold-light);
  letter-spacing: 0.06em;
  text-shadow: 0 2px 12px rgba(201,168,76,0.4);
  line-height: 1.1;
}

.banner-sub {
  font-size: 0.95rem;
  color: #b0a080;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 0.35rem;
}

/* ── Summary Bar ─────────────────────────────────────────────────────────────── */
.summary-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 1.5rem;
}

.summary-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.summary-card {
  background: #222;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1.2rem;
  min-width: 130px;
  text-align: center;
}

.sc-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.sc-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold-light);
}

.series-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.series-badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid rgba(255,255,255,0.15);
}

.series-badge.series-red    { background: var(--c-red);    color: #f0c0c0; }
.series-badge.series-black  { background: #383838;          color: #d0d0d0; }
.series-badge.series-green  { background: var(--c-green);   color: #d8f0a0; }
.series-badge.series-lights { background: var(--c-lights);  color: #a0c0f0; }
.series-badge.series-chips  { background: var(--c-chips);   color: #d0a0f0; }
.series-badge.series-1of1   { background: var(--c-1of1);    color: var(--gold-light); }

/* ── Main ────────────────────────────────────────────────────────────────────── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.2rem 3rem;
}

/* ── Series Sections ─────────────────────────────────────────────────────────── */
.series-section {
  margin-bottom: 2rem;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
}

.series-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1.1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.series-red    .series-header { background: var(--c-red); }
.series-black  .series-header { background: #2a2a2a; }
.series-green  .series-header { background: var(--c-green); }
.series-lights .series-header { background: var(--c-lights); }
.series-chips  .series-header { background: var(--c-chips); }
.series-1of1   .series-header { background: var(--c-1of1); }

.series-name {
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-light);
}

.series-meta {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.04em;
}

/* ── Card Grid ───────────────────────────────────────────────────────────────── */
.series-grid {
  background: var(--felt);
  padding: 0.8rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.grid-header-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.grid-header-suit {
  width: 34px;
  flex-shrink: 0;
}

.grid-header-value {
  width: 80px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(240,232,208,0.45);
}

.suit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.suit-label {
  width: 34px;
  flex-shrink: 0;
  font-size: 1.4rem;
  text-align: center;
  line-height: 1;
}

.suit-label.suit-red   { color: var(--red-suit); }
.suit-label.suit-black { color: var(--black-suit); }

/* ── Card Slot ───────────────────────────────────────────────────────────────── */
.card-slot {
  width: 80px;
  height: 112px;
  border-radius: 6px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}

.card-slot.empty {
  border: 2px dashed rgba(201,168,76,0.22);
  background: rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.card-slot.empty:hover {
  border-color: rgba(201,168,76,0.7);
  background: rgba(201,168,76,0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

.card-slot.empty:hover .slot-add {
  opacity: 1;
}

.card-slot.owned {
  border: 2px solid rgba(201,168,76,0.4);
  background: #111;
}

.card-slot.owned:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(201,168,76,0.3);
}

.card-slot.owned img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Slot placeholder content */
.slot-sym {
  font-size: 1.5rem;
  opacity: 0.18;
  line-height: 1;
}

.slot-val {
  font-size: 0.68rem;
  opacity: 0.3;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.slot-add {
  font-size: 1.1rem;
  opacity: 0;
  color: var(--gold);
  font-weight: 300;
  transition: opacity 0.15s;
  position: absolute;
  bottom: 6px;
  right: 8px;
}

/* Duplicate count badge */
.slot-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--gold);
  color: #111;
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  line-height: 1.5;
  letter-spacing: 0.03em;
  pointer-events: none;
}

/* Owned card placeholder (no photo yet) */
.slot-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: #111;
}

.slot-placeholder .slot-sym { opacity: 0.3; font-size: 1.8rem; }
.slot-placeholder .slot-val { opacity: 0.5; font-size: 0.75rem; }

/* Card slot wrapper (slot + serial below) */
.card-slot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Serial number below card */
.slot-serial {
  font-size: 0.58rem;
  text-align: center;
  color: var(--gold);
  letter-spacing: 0.04em;
  white-space: nowrap;
  width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.82);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.hidden { display: none; }

.modal {
  background: #1e1e1e;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  width: 100%;
  max-width: 540px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}

.modal-header {
  background: #111;
  border-bottom: 1px solid #333;
  padding: 0.9rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1;
}

.modal-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.06em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.2rem;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 1.2rem;
}

/* ── Form ────────────────────────────────────────────────────────────────────── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  gap: 0.3rem;
}

label.full-width { grid-column: 1 / -1; }

input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  background: #111;
  border: 1px solid #3a3a3a;
  border-radius: 5px;
  color: var(--text);
  padding: 0.45rem 0.6rem;
  font-size: 0.9rem;
  font-family: inherit;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(201,168,76,0.2);
}

select option { background: #1e1e1e; }

textarea { resize: vertical; min-height: 56px; }

/* Bonus row */
.form-group {
  margin-bottom: 0.9rem;
}

.group-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.bonus-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.radio-label {
  font-size: 0.88rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.inline-label {
  font-size: 0.82rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.grams-input {
  width: 64px !important;
  display: inline-block;
}

/* Photos */
.photos-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.photo-slot {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.photo-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.photo-preview {
  width: 100%;
  aspect-ratio: 2/3;
  background: #111;
  border: 1px dashed #3a3a3a;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: pointer;
}

.no-photo {
  font-size: 0.75rem;
  color: #444;
}

.file-input { display: none; }

.upload-btn {
  display: block;
  text-align: center;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 5px;
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text);
  letter-spacing: 0.03em;
  transition: background 0.15s;
}

.upload-btn:hover { background: #383838; }

.remove-photo-btn {
  background: none;
  border: none;
  color: #c0392b;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  text-align: center;
}

.remove-photo-btn:hover { color: #e74c3c; }

/* Buttons */
.form-actions {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
  padding-top: 0.4rem;
  border-top: 1px solid #2a2a2a;
}

.btn-primary {
  background: var(--gold);
  color: #111;
  border: none;
  border-radius: 6px;
  padding: 0.55rem 1.3rem;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
}

.btn-primary:hover { background: var(--gold-light); }

.btn-danger {
  background: rgba(192,57,43,0.15);
  color: #e74c3c;
  border: 1px solid rgba(192,57,43,0.4);
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-danger:hover { background: rgba(192,57,43,0.3); }

.btn-secondary {
  background: #2a2a2a;
  color: var(--muted);
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.btn-secondary:hover { color: var(--text); background: #333; }

/* ── Lightbox ─────────────────────────────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.hidden { display: none; }

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.8);
  cursor: default;
}

.lightbox-close {
  position: fixed;
  top: 1.2rem;
  right: 1.5rem;
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  font-size: 1.8rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.lightbox-close:hover { background: rgba(255,255,255,0.3); }

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 680px) {
  .form-row { grid-template-columns: 1fr; }
  .photos-section { grid-template-columns: 1fr; }

  .grid-header-value { width: 62px; }
  .card-slot         { width: 62px; height: 87px; }
  .grid-header-suit  { width: 28px; }
  .suit-label        { width: 28px; font-size: 1.1rem; }
}
