.admin-join { color: var(--muted); border-color: var(--line); font-size: 12px; padding: 6px 10px; }
.draw-page { padding-top: 24px; padding-bottom: calc(48px + var(--safe-bottom)); }
.draw-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.draw-head h1 { background: var(--gold-text); -webkit-background-clip: text; background-clip: text; color: transparent; margin: 4px 0 6px; font-size: clamp(24px, 4vw, 34px); line-height: 1.15; }
.draw-head .lead { margin-bottom: 0; }
.draw-actions { display: flex; gap: 8px; }
.status-bar { margin: 18px 0; padding: 12px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--card-border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 600; min-height: 52px; }
.status-bar.ok { border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.08); }
.status-bar.wait { border-color: rgba(255, 197, 49, 0.45); background: rgba(255, 197, 49, 0.08); }
.status-bar .grow { flex: 1; min-width: 200px; }
.progress { height: 6px; border-radius: 6px; background: var(--surface2); overflow: hidden; min-width: 120px; flex: 0 0 160px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); transition: width 0.4s; }

.draw-layout { display: grid; grid-template-columns: 1fr 320px; gap: 22px; align-items: start; }
@media (max-width: 900px) { .draw-layout { grid-template-columns: 1fr; } }
.deck { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; perspective: 1200px; }
@media (max-width: 520px) { .deck { gap: 10px; } }

.dcard { position: relative; aspect-ratio: 5 / 7; border: 0; padding: 0; background: none; cursor: default; -webkit-tap-highlight-color: transparent; }
.dcard .inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1); }
.dcard.up .inner { transform: rotateY(180deg); }
.dcard .face { position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; display: grid; place-items: center; box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45); }
.dcard .back {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.06) 0 8px, transparent 8px 16px),
    linear-gradient(160deg, #ff8a1f, #e2401c 60%, #a61d1d);
  border: 3px solid rgba(255, 220, 150, 0.6);
}
.dcard .back::before { content: ''; position: absolute; inset: 8px; border: 1.5px solid rgba(255, 230, 180, 0.55); border-radius: 10px; }
.dcard .back .logo { text-align: center; color: #fff; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); }
.dcard .back .logo .q { font-size: clamp(30px, 6vw, 54px); font-weight: 800; line-height: 1; }
.dcard .back .logo .t { font-size: clamp(8px, 1.4vw, 11px); font-weight: 800; letter-spacing: 0.2em; margin-top: 6px; opacity: 0.9; }
.dcard .front { transform: rotateY(180deg); background: linear-gradient(180deg, #7a2d12, #4e1a0a); border: 2px solid var(--line2); flex-direction: column; align-content: center; gap: 10px; padding: 10px; }
.dcard.assigned .front { border-color: rgba(255, 197, 49, 0.55); }
.dcard.pending .front { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255, 197, 49, 0.25), 0 12px 28px rgba(0, 0, 0, 0.45); animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px rgba(255, 197, 49, 0.12), 0 12px 28px rgba(0, 0, 0, 0.45); } }
.dcard .lbl { font-size: clamp(10px, 1.5vw, 12px); color: var(--muted); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; text-align: center; }
.dcard .who { font-weight: 800; text-align: center; font-size: clamp(12px, 2vw, 16px); line-height: 1.25; min-height: 2.5em; display: grid; place-items: center; word-break: break-word; }
.dcard .who.wait { color: var(--gold); font-weight: 600; font-size: clamp(11px, 1.6vw, 13px); }

.pball { width: clamp(54px, 10vw, 92px); aspect-ratio: 1; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: var(--c); position: relative; box-shadow: inset -8px -10px 18px rgba(0, 0, 0, 0.35), 0 8px 20px rgba(0, 0, 0, 0.4); }
.pball::before { content: ''; position: absolute; top: 14%; left: 22%; width: 26%; height: 18%; border-radius: 50%; background: rgba(255, 255, 255, 0.55); filter: blur(1px); }
.pball span { width: 52%; aspect-ratio: 1; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-weight: 800; font-size: clamp(16px, 3vw, 28px); }

body.is-admin .dcard.can-pick { cursor: pointer; }
body.is-admin .dcard.can-pick:hover .inner { transform: translateY(-6px) rotate(-1.5deg); }
body.is-admin .dcard.can-edit { cursor: pointer; }
.dcard.can-pick:focus-visible, .dcard.can-edit:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; border-radius: 16px; }

.draw-side { display: grid; gap: 16px; }
.seed-list { display: grid; gap: 6px; }
.seed-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--inset); border: 1px solid var(--card-border); }
.seed-row .mini { width: 28px; height: 28px; border-radius: 50%; background: var(--c); display: grid; place-items: center; flex: none; box-shadow: inset -3px -4px 6px rgba(0, 0, 0, 0.3); }
.seed-row .mini span { width: 16px; height: 16px; border-radius: 50%; background: #fff; color: #111; font-size: 10px; font-weight: 800; display: grid; place-items: center; }
.seed-row .nm { font-weight: 600; }
.seed-row .nm.empty { color: var(--dim); font-style: italic; font-weight: 500; }
.pairs { display: grid; gap: 8px; }
.pair { display: grid; grid-template-columns: 36px 1fr; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--inset); border: 1px solid var(--card-border); }
.pair b { color: #4ade80; font-size: 13px; }
.pair div { font-size: 13.5px; line-height: 1.35; }
.pair .vs { color: var(--dim); font-size: 11px; margin: 0 4px; }
.pair .ph { color: var(--dim); font-style: italic; }

.chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.chip { min-width: 0; border: 1px solid var(--line2); background: var(--inset); border-radius: 12px; padding: 12px 10px; font-weight: 700; text-align: left; display: flex; align-items: center; gap: 10px; }
.chip:hover { border-color: var(--gold); }
.chip.sel { border-color: var(--gold); background: rgba(255, 197, 49, 0.12); }
.chip .avatar { flex: none; }
.chip:disabled { opacity: 0.35; cursor: not-allowed; }
.assign-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.assign-head .pball { width: 64px; margin: 0; }
.assign-head .pball span { font-size: 20px; }

/* Don't rely on backface-visibility alone (some renderers ignore it): swap faces at mid-flip */
.dcard .front { visibility: hidden; transition: visibility 0s linear 0.3s; }
.dcard .back { transition: visibility 0s linear 0.3s; }
.dcard.up .front { visibility: visible; }
.dcard.up .back { visibility: hidden; }
/* first paint: show already-revealed cards without replaying the flip */
.deck.init .inner, .deck.init .face { transition: none !important; }

@media (max-width: 380px) {
  .deck { gap: 7px; }
  .dcard .face { border-radius: 11px; }
  .dcard .front { padding: 6px; gap: 6px; }
  .chips { grid-template-columns: 1fr; }
}
@media (min-width: 521px) and (max-width: 900px) { .draw-side { grid-template-columns: 1fr 1fr; } }
@media (max-height: 520px) and (orientation: landscape) { .deck { grid-template-columns: repeat(8, 1fr); } }

/* Card contents scale with the card itself (not the viewport), so nothing overflows
   whether the deck is 4 columns (portrait) or 8 columns (landscape phone). */
.dcard { container-type: inline-size; }
.dcard .front { padding: 8cqw 6cqw; gap: 5cqw; }
.dcard .lbl { font-size: clamp(7px, 9cqw, 12px); letter-spacing: 0.06em; white-space: nowrap; }
.dcard .pball { width: 60cqw; }
.dcard .pball span { font-size: 22cqw; }
.dcard .who {
  font-size: clamp(9px, 12.5cqw, 16px); line-height: 1.2; min-height: 2.4em; width: 100%;
  overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; word-break: normal; overflow-wrap: anywhere;
}
.dcard .who.wait { font-size: clamp(8px, 10cqw, 13px); }
.dcard .back .logo .q { font-size: 40cqw; }
.dcard .back .logo .t { font-size: clamp(6px, 9cqw, 11px); letter-spacing: 0.14em; }
.dcard .back::before { inset: 6cqw; }
@media (max-height: 520px) and (orientation: landscape) {
  .draw-page { padding-top: 12px; }
  .draw-head h1 { font-size: 22px; }
  .draw-head .lead { display: none; }
  .status-bar { margin: 10px 0; padding: 8px 12px; min-height: 0; font-size: 14px; }
  .deck { gap: 8px; }
}
