/* ══════════════════════════════════════════════════════════
   SPRINTERVENTION — "THE OPERATOR"
   Premium dark editorial aesthetic.
   Bebas Neue · IBM Plex Mono · Lora
   Near-black / Warm cream / Amber gold
══════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; -webkit-font-smoothing: antialiased; }

/* ── Grain texture overlay ──────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9997;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

/* ── Critical: hidden attribute always wins ─────────────── */
[hidden] { display: none !important; }

/* ── Screen switching ───────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
#screen-landing.active { display: flex; }
#screen-game.active { display: flex; flex-direction: column; }

/* ── App header gold accent line ────────────────────────── */
.app-header {
  position: relative;
}
.app-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 56px;
  height: 1px;
  background: #c8973a;
  z-index: 1;
}

/* ── Landing card rotation ──────────────────────────────── */
@keyframes landingCardFade { from { opacity: 0; } to { opacity: 1; } }
.landing-card-fade { animation: landingCardFade 0.6s ease forwards; }

/* ── Landing screen ─────────────────────────────────────── */
#screen-landing {
  background:
    radial-gradient(ellipse 60% 40% at 50% 20%, rgba(200,151,58,0.04) 0%, transparent 70%),
    #07070b;
}

/* ── Landing hero cards ─────────────────────────────────── */
.landing-hero-cards {
  position: relative;
  width: 260px;
  height: 190px;
  margin-bottom: 2.75rem;
  flex-shrink: 0;
}

.lc-black {
  position: absolute;
  left: 0;
  top: 14px;
  width: 128px;
  height: 174px;
  background: linear-gradient(160deg, #111118 0%, #0a0a10 100%);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform: rotate(-5deg);
  box-shadow:
    0 24px 64px rgba(0,0,0,0.9),
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -1px 0 rgba(0,0,0,0.3);
  z-index: 1;
  transition: transform 0.5s cubic-bezier(0.2,0.9,0.4,1);
}
.lc-black:hover { transform: rotate(-7deg) translateY(-5px); }

.lc-black-text {
  font-family: 'Lora', Georgia, serif;
  color: #ede8d8;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.55;
}

.lc-pick {
  font-family: 'IBM Plex Mono', monospace;
  color: rgba(237,232,216,0.2);
  font-size: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-weight: 600;
  align-self: flex-end;
}

.lc-white {
  position: absolute;
  right: 0;
  top: 0;
  width: 128px;
  height: 174px;
  background: #f2ead6;
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transform: rotate(4deg);
  box-shadow:
    0 20px 56px rgba(0,0,0,0.8),
    0 4px 12px rgba(0,0,0,0.4);
  z-index: 2;
  transition: transform 0.5s cubic-bezier(0.2,0.9,0.4,1);
}
.lc-white:hover { transform: rotate(6deg) translateY(-5px); }

.lc-brand {
  font-family: 'Bebas Neue', sans-serif;
  color: #111;
  font-size: 1.2rem;
  line-height: 1;
  letter-spacing: 0.03em;
}

/* ── Landing typography ─────────────────────────────────── */
.landing-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 3.6rem;
  letter-spacing: 0.05em;
  color: #ede8d8;
  text-align: center;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.landing-sub {
  text-align: center;
  color: #5c5c72;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  margin-bottom: 2.25rem;
  font-family: 'IBM Plex Mono', monospace;
}

.landing-panel-title {
  font-family: 'Bebas Neue', sans-serif;
  color: #ede8d8;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

/* ── Room code pill ─────────────────────────────────────── */
.room-code-pill {
  background: #131319;
  border: 1px solid #242430;
  border-radius: 4px;
  padding: 0.35rem 0.65rem;
}

/* ── Modal panel ─────────────────────────────────────────── */
.modal-panel {
  border-radius: 6px;
}
.modal-rule {
  width: 32px;
  height: 2px;
  background: #c8973a;
  margin: 0 auto;
}

/* ── Step dots (config wizard) ──────────────────────────── */
.step-dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #242430;
}
.step-dot.active-dot {
  background: #c8973a;
}

/* ── Dynamic state classes ───────────────────────────────── */
.selected {
  border-color: #c8973a !important;
  box-shadow: 0 0 0 2px #c8973a, 0 8px 24px rgba(200,151,58,0.22) !important;
  transform: translateY(-4px) scale(1.01) !important;
}
.locked     { opacity: 0.45 !important; cursor: not-allowed !important; pointer-events: none !important; }
.flipping   { animation: cardFlip 0.55s ease-in-out; }
.drag-over  { border-color: #c8973a !important; background: rgba(200,151,58,0.03) !important; }
#winner-area { display: none; }
#winner-area.visible { display: block; }
.urgent     { color: #c43028 !important; animation: pulse 0.5s ease infinite; }
.filled     { background: #c8973a !important; border-color: #c8973a !important; animation: dotPulse 0.4s ease; }
.removed-sub { opacity: 0.35 !important; pointer-events: none !important; }
.score-leading { color: #c8973a !important; border-color: #c8973a !important; }
.tab-btn.active { border-color: #ede8d8 !important; color: #ede8d8 !important; }

/* ── Mode segmented control (step 2 card builder vs import) ── */
.mode-seg {
  display: flex; border: 1px solid #242430; border-radius: 4px; overflow: hidden;
}
.mode-seg-btn {
  flex: 1; padding: 0.45rem 0.75rem;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  background: transparent; color: #5c5c72;
  border: none; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.mode-seg-btn + .mode-seg-btn { border-left: 1px solid #242430; }
.mode-seg-btn.active { background: #131319; color: #ede8d8; }

/* ── Toggle checkbox ────────────────────────────────────── */
.toggle {
  appearance: none; -webkit-appearance: none;
  width: 36px; height: 20px; background: #131319;
  border-radius: 999px; position: relative; cursor: pointer;
  border: 1px solid #242430; transition: background 0.18s ease; flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; background: #3a3a50;
  border-radius: 50%; transition: transform 0.2s;
}
.toggle:checked { background: #ede8d8; border-color: #ede8d8; }
.toggle:checked::after { transform: translateX(16px); background: #07070b; }

/* ── Inputs ──────────────────────────────────────────────── */
.input {
  display: block; width: 100%;
  background: #131319; color: #ede8d8;
  border: 1px solid #242430; border-radius: 4px;
  padding: 0.68rem 0.9rem; font-size: 0.85rem;
  font-family: 'IBM Plex Mono', monospace;
  transition: border-color 0.15s ease; outline: none;
}
.input:focus { border-color: #c8973a; }
.input::placeholder { color: #38384a; }
.input-sm {
  background: #131319; color: #ede8d8; border: 1px solid #242430;
  border-radius: 4px; padding: 0.3rem 1.6rem 0.3rem 0.55rem;
  font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; outline: none;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235c5c72' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.5rem center;
  cursor: pointer;
}
.input-sm:focus { border-color: #c8973a; }
.textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.file-input { display: none; }

/* ── Buttons ─────────────────────────────────────────────── */
button, .btn-primary, .btn-ghost, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem; font-weight: 600;
  padding: 0.6rem 1.15rem; border-radius: 3px;
  border: none; cursor: pointer; text-decoration: none;
  min-height: 40px;
  transition: background 0.14s, transform 0.1s, opacity 0.14s, border-color 0.14s;
  white-space: nowrap; user-select: none;
  letter-spacing: 0.06em; text-transform: uppercase;
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.32; cursor: not-allowed; transform: none; }

.btn-primary { background: #ede8d8; color: #07070b; }
.btn-primary:hover:not(:disabled) { background: #d8d2c0; }
.btn-primary:focus-visible { outline: 2px solid #c8973a; outline-offset: 3px; }

.btn-nav {
  background: #c8973a; color: #07070b; font-weight: 700;
  letter-spacing: 0.08em; padding: 0.75rem 1.75rem; border-radius: 2px;
}
.btn-nav:hover:not(:disabled) { background: #b8872a; }
.btn-nav:focus-visible { outline: 2px solid #c8973a; outline-offset: 3px; }

.btn-ghost  { background: transparent; color: #ede8d8; border: 1px solid #242430; }
.btn-ghost:hover:not(:disabled) { border-color: #5c5c72; background: rgba(237,232,216,0.03); }

.btn-secondary { background: transparent; color: #5c5c72; border: 1px solid #242430; }
.btn-secondary:hover:not(:disabled) { color: #ede8d8; border-color: #5c5c72; }

.btn-skip { color: #5c5c72; font-size: 0.7rem; padding: 0.35rem 0.75rem; min-height: 30px; }
.btn-sm   { font-size: 0.72rem !important; padding: 0.38rem 0.82rem !important; min-height: 32px !important; }
.btn-lg   { font-size: 0.85rem; padding: 0.85rem 1.75rem; min-height: 48px; }
.btn-icon { padding: 0.3rem 0.5rem; min-height: auto; border: none; background: transparent; color: #5c5c72; font-size: 0.9rem; text-transform: none; letter-spacing: 0; }
.btn-icon:hover { color: #ede8d8; background: transparent; }
.full { width: 100%; }

/* ── Card panel ─────────────────────────────────────────── */
.card {
  background: #0d0d14;
  border: 1px solid #1c1c28;
  border-radius: 6px; padding: 1.25rem; margin-bottom: 1rem;
  box-shadow: 0 2px 20px rgba(0,0,0,0.35);
}

/* ── Utility text classes (used in JS templates) ─────────── */
.muted-text { color: #5c5c72; font-size: 0.78rem; }

/* ── Badge ──────────────────────────────────────────────── */
.badge {
  display: inline-block; background: #131319; color: #5c5c72;
  border-radius: 3px; padding: 1px 8px; font-size: 0.68rem; font-weight: 600;
  margin-left: 6px; vertical-align: middle;
  border: 1px solid #1c1c28;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.05em;
}

/* ── Votes badge ────────────────────────────────────────── */
.votes-badge {
  background: #ede8d8; color: #07070b;
  border-radius: 2px; padding: 1px 9px;
  font-size: 0.78rem; font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
}

/* ── Score bar chips ─────────────────────────────────────── */
.score-chip {
  font-size: 0.72rem; font-weight: 700; background: #131319;
  border: 1px solid #242430; border-radius: 3px; padding: 3px 10px; color: #5c5c72;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em;
}
.score-chip.score-leading {
  border-color: #c8973a; color: #c8973a;
  background: rgba(200,151,58,0.06);
}

/* ── Player list ─────────────────────────────────────────── */
.player-list-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.52rem 0.8rem; background: #0f0f16;
  border: 1px solid #1a1a24; border-radius: 4px;
  font-size: 0.8rem; color: #ede8d8;
  font-family: 'IBM Plex Mono', monospace;
}
.player-status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-connected    { background: #2a8c52; box-shadow: 0 0 4px rgba(42,140,82,0.4); }
.dot-disconnected { background: #3a3a50; }
.dot-removed      { background: #1a1a22; }
.player-host-badge {
  font-size: 0.6rem; background: #c8973a; color: #07070b;
  border-radius: 2px; padding: 1px 6px; margin-left: auto;
  font-family: 'IBM Plex Mono', monospace; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
}

/* ── Submission dots ─────────────────────────────────────── */
.sub-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #131319; border: 1px solid #242430; transition: background 0.25s;
}
.sub-dot.filled {
  background: #c8973a; border-color: #c8973a;
  animation: dotPulse 0.4s ease;
  box-shadow: 0 0 6px rgba(200,151,58,0.4);
}

/* ── White cards (renderHand) ───────────────────────────── */
.white-card {
  background: #f2ead6; color: #0e0e16;
  border-radius: 6px; padding: 0.9rem;
  font-size: 0.88rem; font-weight: 500; line-height: 1.55;
  font-family: 'Lora', Georgia, serif;
  cursor: pointer; border: 2px solid transparent;
  box-shadow:
    0 4px 18px rgba(0,0,0,0.55),
    0 1px 4px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.6);
  transition: transform 0.15s, border-color 0.12s, box-shadow 0.15s;
  min-height: 96px; position: relative;
  animation: cardSlideIn 0.22s ease both;
}
.white-card:hover { transform: translateY(-4px); box-shadow: 0 12px 36px rgba(0,0,0,0.65), inset 0 1px 0 rgba(255,255,255,0.6); }
.white-card.selected {
  border-color: #c8973a;
  box-shadow: 0 0 0 2px #c8973a, 0 10px 28px rgba(200,151,58,0.28), inset 0 1px 0 rgba(255,255,255,0.6);
  transform: translateY(-4px) scale(1.01);
}
.white-card.locked { opacity: 0.5; pointer-events: none; }
.white-card .card-number {
  position: absolute; top: 6px; right: 8px;
  font-size: 0.62rem; color: #8a8070; font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
}

/* ── Reader submissions ───────────────────────────────────── */
.reader-submission-card {
  background: #f2ead6; color: #0e0e16;
  border-radius: 6px; padding: 1.1rem;
  font-size: 0.9rem; font-weight: 500; line-height: 1.55;
  font-family: 'Lora', Georgia, serif;
  cursor: pointer; border: 2px solid transparent;
  box-shadow: 0 4px 18px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.6);
  min-height: 104px;
  transition: transform 0.15s, border-color 0.12s, box-shadow 0.15s;
  animation: cardSlideIn 0.22s ease both;
}
.reader-submission-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(0,0,0,0.65), border-color rgba(200,151,58,0.4), inset 0 1px 0 rgba(255,255,255,0.6);
  border-color: rgba(200,151,58,0.4);
}
.reader-submission-card.removed-sub { opacity: 0.35; pointer-events: none; }
.removed-label {
  font-size: 0.68rem; color: #5c5c72; text-transform: uppercase;
  margin-top: 0.5rem; font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.06em;
}

/* ── Winner cards ────────────────────────────────────────── */
.black-card-winner { animation: winnerPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both; }
.white-card-winner {
  background: #f2ead6; color: #0e0e16;
  border-radius: 6px; padding: 1.4rem;
  min-width: 180px; max-width: 280px; min-height: 140px;
  font-size: 1rem; font-weight: 600; line-height: 1.55;
  font-family: 'Lora', Georgia, serif;
  box-shadow:
    0 0 0 2px #c8973a,
    0 12px 48px rgba(200,151,58,0.3),
    0 4px 16px rgba(0,0,0,0.4),
    inset 0 1px 0 rgba(255,255,255,0.7);
  animation: winnerPop 0.4s 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}
.winner-label {
  font-size: 2.5rem;
  font-family: 'Bebas Neue', sans-serif;
  font-weight: 400;
  color: #c8973a;
  text-align: center;
  letter-spacing: 0.12em;
}

/* ── Played card pairs (insight mode) ────────────────────── */
.played-card-pair {
  background: #0d0d14; border: 1px solid #1c1c28; border-radius: 5px;
  overflow: hidden; cursor: grab; user-select: none;
  animation: cardSlideIn 0.22s ease both;
  box-shadow: 0 2px 10px rgba(0,0,0,0.4);
  transition: box-shadow 0.15s, border-color 0.12s, transform 0.15s;
}
.played-card-pair:hover { transform: translateY(-2px); box-shadow: 0 6px 22px rgba(0,0,0,0.5); }
.played-card-pair:active { cursor: grabbing; }
.played-card-pair.selected {
  border-color: #c8973a;
  box-shadow: 0 0 0 1.5px #c8973a, 0 6px 22px rgba(200,151,58,0.18);
}
.played-card-pair .black-mini {
  background: #0d0d14; color: #ede8d8;
  padding: 0.58rem 0.75rem;
  font-size: 0.7rem; font-weight: 500;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-family: 'IBM Plex Mono', monospace;
  line-height: 1.5;
}
.played-card-pair .white-mini {
  background: #f2ead6; color: #0e0e16;
  padding: 0.58rem 0.75rem;
  font-size: 0.76rem; font-weight: 500;
  font-family: 'Lora', Georgia, serif;
  line-height: 1.5;
}
.played-card-pair .winner-name {
  font-size: 0.6rem; color: #8a8070;
  padding: 0.2rem 0.75rem; background: #e8e0c8;
  font-family: 'IBM Plex Mono', monospace;
}

/* ── Moderation items ────────────────────────────────────── */
.mod-item {
  display: flex; align-items: center; justify-content: space-between;
  background: #131319; border-radius: 3px; padding: 0.45rem 0.7rem;
  font-size: 0.78rem; gap: 0.5rem;
}
.mod-item-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ede8d8; }
.mod-item-removed { text-decoration: line-through; color: #5c5c72; }

/* ── Deck type selection buttons ─────────────────────────── */
.deck-type-btn {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; background: #0f0f16; border: 1px solid #1c1c28;
  border-radius: 4px; padding: 0.8rem 0.9rem; cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
  text-align: left;
}
.deck-type-btn > div { min-width: 0; word-break: break-word; }

@media (max-width: 480px) {
  .deck-type-btn { padding: 0.6rem 0.7rem; gap: 0.5rem; }
  .deck-type-btn .text-xl { font-size: 1rem; flex-shrink: 0; }
  .deck-type-btn .font-semibold { font-size: 0.78rem; }
  .deck-type-btn .text-xs { font-size: 0.68rem; }
  .card { padding: 0.9rem; }
  #screen-lobby .max-w-2xl { padding-left: 0.75rem; padding-right: 0.75rem; }
}
.deck-type-btn:hover { border-color: #3e3e5a; background: #131319; }
.deck-type-btn.active { border-color: #c8973a; background: rgba(200,151,58,0.05); }
.deck-check { font-size: 0.85rem; font-weight: 800; color: #c8973a; flex-shrink: 0; }

/* ── Cluster components (renderClusters) ────────────────── */
.cluster { background: #0d0d14; border: 1px solid #1c1c28; border-radius: 6px; overflow: hidden; }
.cluster-header { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.7rem 0.9rem; background: #131319; }
.cluster-title-row { display: flex; align-items: center; gap: 0.5rem; }
.cluster-vote-row { display: flex; align-items: center; gap: 0.5rem; }
.cluster-label-input {
  background: transparent; border: none; color: #ede8d8;
  font-size: 0.9rem; font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  outline: none; flex: 1; min-width: 80px;
}
.cluster-label-input:focus { border-bottom: 1px solid #c8973a; }
.cluster-tag-select {
  appearance: none; -webkit-appearance: none;
  background: #0d0d14; border: 1px solid #242430; color: #5c5c72;
  border-radius: 3px; padding: 3px 8px; font-size: 0.7rem;
  font-family: 'IBM Plex Mono', monospace; outline: none; cursor: pointer;
}
.cluster-tag-select:focus { border-color: #3e3e52; color: #ede8d8; }
.cluster-votes { display: flex; gap: 3px; align-items: center; }
.vote-dot { width: 7px; height: 7px; border-radius: 50%; }
.vote-btn {
  background: transparent; border: 1px solid #242430; color: #5c5c72;
  border-radius: 3px; padding: 3px 8px; font-size: 0.7rem;
  cursor: pointer; font-family: 'IBM Plex Mono', monospace; margin-left: auto;
}
.vote-btn:hover { border-color: #ede8d8; color: #ede8d8; background: transparent; }
.cluster-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem; padding: 0.7rem 0.9rem; min-height: 60px;
}
.cluster-actions { padding: 0.5rem 0.9rem 0.7rem; border-top: 1px solid #1c1c28; }
.action-items-list { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.6rem; }
.action-item {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.5rem; background: #131319; border-radius: 3px; padding: 0.4rem 0.6rem; font-size: 0.78rem;
}
.action-item-right { display: flex; gap: 0.5rem; flex-shrink: 0; }
.action-item-desc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ede8d8; }
.action-item-meta { color: #5c5c72; font-size: 0.7rem; white-space: nowrap; }
.add-action-form { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 0.2rem; }
.add-action-form .ai-desc { padding: 0.4rem 0.6rem; font-size: 0.8rem; border-radius: 3px; }
.add-action-sub { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.add-action-sub .input { flex: 1; min-width: 100px; padding: 0.32rem 0.5rem; font-size: 0.78rem; border-radius: 3px; }
.ai-date { color-scheme: dark; max-width: 160px; }

/* ── Custom card section collapsables ────────────────────── */
.custom-section-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 4px 0;
}
.merge-switch-row {
  display: flex; align-items: center; gap: 10px;
}
.merge-label {
  font-size: 0.7rem; color: #38384a; flex: 1; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  transition: color 0.15s;
}
.merge-label.active { color: #ede8d8; font-weight: 500; }
.merge-label.right { text-align: left; }
.merge-label:not(.right) { text-align: right; }

/* ── Custom card builder list items ──────────────────────── */
.custom-card-item {
  display: flex; align-items: flex-start; gap: 0.5rem;
  background: #131319; border-radius: 3px; padding: 0.38rem 0.5rem 0.38rem 0.7rem;
}
.custom-card-text { flex: 1; font-size: 0.78rem; line-height: 1.4; color: #ede8d8; word-break: break-word; }
.custom-card-text.black-item { font-weight: 600; }
.custom-card-del { flex-shrink: 0; font-size: 0.65rem; padding: 2px 6px; min-height: unset; opacity: 0.4; }
.custom-card-del:hover { opacity: 1; }

/* ── Rounds stepper ─────────────────────────────────────── */
.rounds-stepper {
  display: flex; align-items: center; gap: 6px;
}
.rounds-step-btn {
  width: 32px; height: 32px; flex-shrink: 0;
  background: #131319; border: 1px solid #242430; border-radius: 3px;
  color: #ede8d8; font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
  padding: 0; min-height: unset;
  font-family: 'IBM Plex Mono', monospace;
}
.rounds-step-btn:hover { background: #1c1c28; border-color: #3e3e5a; }
.rounds-step-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.rounds-input {
  width: 50px; text-align: center;
  background: #131319; border: 1px solid #242430; border-radius: 3px;
  color: #ede8d8; font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem; font-weight: 600;
  padding: 0.28rem 0.25rem; height: 32px; outline: none;
  -moz-appearance: textfield; appearance: textfield;
}
.rounds-input::-webkit-outer-spin-button,
.rounds-input::-webkit-inner-spin-button { -webkit-appearance: none; appearance: none; margin: 0; }
.rounds-input:focus { border-color: #c8973a; }

/* ── Score rows (renderFinalScores) ──────────────────────── */
.score-row {
  display: flex; justify-content: space-between; align-items: center;
  background: #0f0f16; border: 1px solid #1a1a24; border-radius: 4px;
  padding: 0.52rem 0.85rem; font-size: 0.82rem; color: #ede8d8;
  font-family: 'IBM Plex Mono', monospace;
}
.score-row:first-child {
  border-left: 2px solid #c8973a;
  background: rgba(200,151,58,0.04);
}

/* ── Droppable zones ─────────────────────────────────────── */
.droppable-zone {
  border: 1px dashed #242430; border-radius: 6px; padding: 0.6rem;
  transition: border-color 0.18s, background 0.18s;
}
.droppable-zone.drag-over {
  border-color: #c8973a; border-style: solid;
  background: rgba(200,151,58,0.03);
}

/* ── Black card ──────────────────────────────────────────── */
.black-card-wrapper { perspective: 900px; }
.black-card {
  background: linear-gradient(160deg, #111118 0%, #09090f 100%);
  color: #ede8d8; border-radius: 10px; padding: 1.5rem;
  min-width: 220px; max-width: 400px; min-height: 140px;
  border: 1px solid rgba(237,232,216,0.07);
  box-shadow:
    0 8px 40px rgba(0,0,0,0.8),
    0 2px 8px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.04),
    inset 0 -1px 0 rgba(0,0,0,0.3);
  position: relative; backface-visibility: hidden; transform-origin: center;
}
.black-card.flipping { animation: cardFlip 0.55s ease-in-out; }
.black-card-text {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.1rem; font-weight: 600; line-height: 1.65;
  color: #ede8d8;
}
.card-category {
  position: absolute; bottom: 0.7rem; right: 0.75rem;
  font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.12em;
  opacity: 0.25; color: inherit;
  font-family: 'IBM Plex Mono', monospace;
}
.pick-badge {
  position: absolute; bottom: 0.7rem; left: 0.75rem;
  font-size: 0.56rem; text-transform: uppercase; letter-spacing: 0.16em;
  font-weight: 700; color: #c8973a;
  border: 1px solid rgba(200,151,58,0.3); border-radius: 2px;
  padding: 1px 5px; background: rgba(200,151,58,0.08);
  font-family: 'IBM Plex Mono', monospace;
}

/* ── You-are-reader notice ──────────────────────────────── */
.you-are-reader {
  text-align: center; padding: 0.55rem 1rem;
  background: rgba(200,151,58,0.06); color: #c8973a;
  font-weight: 600; font-size: 0.72rem;
  border-bottom: 1px solid rgba(200,151,58,0.12);
  letter-spacing: 0.1em; text-transform: uppercase;
  font-family: 'IBM Plex Mono', monospace;
}

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 1.5px solid #242430; border-top-color: #c8973a;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}

/* ── Toasts ──────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem;
  align-items: center; pointer-events: none;
}
.toast {
  background: #131319; color: #ede8d8; border: 1px solid #242430;
  border-radius: 3px; padding: 0.52rem 1.15rem;
  font-size: 0.75rem; font-weight: 500;
  box-shadow: 0 4px 24px rgba(0,0,0,0.65);
  animation: toastIn 0.22s ease both;
  pointer-events: auto; white-space: nowrap; max-width: 90vw; text-align: center;
  font-family: 'IBM Plex Mono', monospace; letter-spacing: 0.04em;
}
.toast.error   { border-color: #c43028; background: rgba(196,48,40,0.12); }
.toast.success { border-color: #2a8c52; }

/* ── Confetti ────────────────────────────────────────────── */
#confetti-container {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; overflow: hidden; z-index: 9999;
}
.confetti-particle { position: absolute; top: -12px; border-radius: 1px; animation: confettiFall linear forwards; }

/* ── Modal content animation ─────────────────────────────── */
@keyframes modalIn {
  from { transform: scale(0.95) translateY(14px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}
#modal-skip > div,
#modal-leave > div,
#modal-insight-help > div,
#modal-cluster-name > div,
#modal-move-to-existing > div {
  animation: modalIn 0.2s cubic-bezier(0.2, 0.9, 0.4, 1) both;
}

/* ── Keyframe animations ─────────────────────────────────── */
@keyframes cardFlip {
  0%   { transform: rotateY(0deg); }
  50%  { transform: rotateY(90deg); opacity: 0.5; }
  100% { transform: rotateY(0deg); }
}
@keyframes cardReveal {
  from { transform: rotateY(90deg); opacity: 0; }
  to   { transform: rotateY(0deg);  opacity: 1; }
}
.black-card.revealing { animation: cardReveal 0.35s ease-out forwards; }
@keyframes cardSlideIn {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@keyframes winnerPop {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
@keyframes dotPulse { from { transform: scale(0.5); } to { transform: scale(1); } }
@keyframes pulse    { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes spin     { to { transform: rotate(360deg); } }
@keyframes toastIn  { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(8px); } }
@keyframes confettiFall { to { transform: translateY(105vh) rotate(720deg); opacity: 0; } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .black-card { min-width: 0; width: 100%; max-width: 100%; }
  .winner-pair { flex-direction: column; align-items: center; }
  .black-card-winner, .white-card-winner { min-width: 0; width: 100%; max-width: 320px; }
  button { min-height: 46px; }
  .btn-sm { min-height: 38px !important; }
  .btn-icon { min-height: 32px; }
  .landing-title { font-size: 2.8rem; }
  .landing-hero-cards { width: 220px; height: 165px; }
  .lc-black, .lc-white { width: 108px; height: 148px; }
  /* Prevent iOS Safari auto-zoom on input focus */
  .input, .input-sm, textarea.input { font-size: 16px; }
}
