/* 핀볼 랜덤 추첨기 - 전용 스타일 */
.pb-app {
  --pb-bg: #0B0E1A;
  --pb-panel: #141826;
  --pb-line: rgba(255,255,255,0.08);
  --pb-cyan: #4FD8E8;
  --pb-purple: #9B7BE8;
  --pb-gold: #FFD34E;
  --pb-text: #EDEFF7;
  --pb-muted: #8A90A8;
  font-family: var(--font-body, sans-serif);
  color: var(--pb-text);
  background: var(--pb-bg);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}

.pb-layout {
  display: grid;
  grid-template-columns: 280px 1fr 280px;
  min-height: 640px;
}
@media (max-width: 980px) {
  .pb-layout { grid-template-columns: 1fr; }
  .pb-side { display: none; }
  .pb-side.pb-open { display: block; }
}

.pb-side { background: var(--pb-panel); padding: 18px; overflow-y: auto; max-height: 78vh; }
.pb-side h4 { font-family: var(--font-display, sans-serif); font-weight: 800; font-size: 13px; margin: 18px 0 8px; color: var(--pb-cyan); }
.pb-side h4:first-child { margin-top: 0; }

.pb-mobile-toggles { display: none; gap: 8px; padding: 10px 14px; background: var(--pb-panel); border-bottom: 1px solid var(--pb-line); }
@media (max-width: 980px) { .pb-mobile-toggles { display: flex; } }
.pb-mobile-toggles button {
  flex: 1; padding: 9px; border-radius: 10px; border: 1px solid var(--pb-line); background: transparent; color: var(--pb-text); font-size: 12.5px; cursor: pointer;
}
.pb-mobile-toggles button.active { background: var(--pb-cyan); color: #0B0E1A; font-weight: 700; }

.pb-textarea {
  width: 100%; min-height: 120px; background: rgba(255,255,255,0.04); border: 1px solid var(--pb-line);
  border-radius: 12px; color: var(--pb-text); padding: 10px 12px; font-size: 13px; resize: vertical;
  font-family: 'Courier New', monospace;
}
.pb-textarea:focus { outline: none; border-color: var(--pb-cyan); }

.pb-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 8px 0; font-size: 13px; }
.pb-row label { color: var(--pb-muted); }
.pb-row select, .pb-row input[type=number] {
  background: rgba(255,255,255,0.06); border: 1px solid var(--pb-line); color: var(--pb-text);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; max-width: 110px;
}
.pb-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.pb-toggle input { accent-color: var(--pb-cyan); }

.pb-stat-pair { display: flex; gap: 8px; margin: 10px 0; }
.pb-stat-pair div { flex: 1; background: rgba(255,255,255,0.05); border-radius: 10px; padding: 8px 10px; text-align: center; }
.pb-stat-pair b { display: block; font-family: var(--font-display, sans-serif); font-size: 16px; color: var(--pb-cyan); }
.pb-stat-pair span { font-size: 10.5px; color: var(--pb-muted); }

.pb-participant-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; margin-top: 6px; }
.pb-participant-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; background: rgba(255,255,255,0.03); font-size: 12.5px; }
.pb-participant-row .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.pb-participant-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-participant-row .del { cursor: pointer; color: var(--pb-muted); font-size: 11px; }
.pb-participant-row .del:hover { color: #FF6B6B; }
.pb-errors { font-size: 11.5px; color: #FF8A8A; margin-top: 6px; line-height: 1.6; }

.pb-btn {
  width: 100%; padding: 11px; border-radius: 999px; border: none; font-weight: 800; font-size: 13.5px;
  cursor: pointer; margin-top: 8px; font-family: var(--font-display, sans-serif);
  transition: transform 0.08s;
}
.pb-btn:active { transform: scale(0.97); }
.pb-btn-primary { background: linear-gradient(120deg, var(--pb-cyan), var(--pb-purple)); color: #0B0E1A; }
.pb-btn-ghost { background: transparent; border: 1px solid var(--pb-line); color: var(--pb-text); }
.pb-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pb-btn-row { display: flex; gap: 6px; }
.pb-btn-row .pb-btn { margin-top: 0; }

.pb-center { position: relative; background: #05070E; display: flex; flex-direction: column; }
.pb-stage-wrap { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; padding: 12px; }
.pb-stage {
  position: relative; width: 100%; max-width: 620px; aspect-ratio: 3/4;
  border-radius: 18px; overflow: hidden; background: radial-gradient(circle at 50% 0%, #1A2140, #05070E 75%);
  box-shadow: inset 0 0 0 1px var(--pb-line);
}
.pb-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pb-app:fullscreen .pb-stage-wrap { padding: 0; }
.pb-app:fullscreen .pb-stage { max-width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }
.pb-app:-webkit-full-screen .pb-stage-wrap { padding: 0; }
.pb-app:-webkit-full-screen .pb-stage { max-width: 100%; height: 100%; aspect-ratio: auto; border-radius: 0; }

.pb-topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.pb-topbar .pb-meta { font-size: 11.5px; color: var(--pb-muted); display: flex; gap: 10px; flex-wrap: wrap; }
.pb-icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--pb-line); background: rgba(255,255,255,0.05);
  color: var(--pb-text); cursor: pointer; font-size: 14px;
}

.pb-countdown {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  font-family: var(--font-display, sans-serif); font-size: 96px; font-weight: 800; color: var(--pb-gold);
  text-shadow: 0 0 30px rgba(255,211,78,0.6); z-index: 20; background: rgba(5,7,14,0.4);
}
.pb-countdown.show { display: flex; }

.pb-winner-banner {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(120deg, #FFD34E, #FFB000); color: #3A2600; font-weight: 800;
  font-family: var(--font-display, sans-serif); padding: 10px 22px; border-radius: 999px; font-size: 14px;
  opacity: 0; transition: opacity 0.25s, transform 0.25s; z-index: 15; white-space: nowrap;
  box-shadow: 0 8px 20px rgba(255,180,0,0.35);
}
.pb-winner-banner.show { opacity: 1; transform: translateX(-50%) translateY(4px); }

.pb-empty-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 10px; color: var(--pb-muted); font-size: 13px; text-align: center; padding: 30px;
}

.pb-result-overlay {
  position: absolute; inset: 0; background: rgba(5,7,14,0.92); z-index: 30;
  display: none; flex-direction: column; align-items: center; justify-content: center; padding: 24px; text-align: center;
}
.pb-result-overlay.show { display: flex; }
.pb-result-overlay h3 { font-family: var(--font-display, sans-serif); font-size: 20px; margin: 0 0 14px; color: var(--pb-gold); }
.pb-result-list { list-style: none; padding: 0; margin: 0 0 16px; width: 100%; max-width: 320px; }
.pb-result-list li {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 10px;
  background: rgba(255,255,255,0.06); margin-bottom: 6px; font-size: 13.5px;
}
.pb-result-list li b { color: var(--pb-gold); font-family: var(--font-display, sans-serif); min-width: 26px; }
.pb-result-meta { font-size: 11px; color: var(--pb-muted); margin-bottom: 14px; }
.pb-result-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 380px; }
.pb-result-actions .pb-btn { width: auto; padding: 9px 16px; margin-top: 0; font-size: 12px; }

.pb-rank-list { display: flex; flex-direction: column; gap: 5px; }
.pb-rank-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,0.03); font-size: 12.5px; }
.pb-rank-row .n { width: 18px; text-align: center; color: var(--pb-cyan); font-weight: 800; }
.pb-rank-row .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.pb-finish-list li, .pb-winner-list li { font-size: 12.5px; padding: 5px 8px; }

.pb-map-options { display: grid; grid-template-columns: 1fr; gap: 6px; }
.pb-map-option {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--pb-line); cursor: pointer; font-size: 12.5px;
}
.pb-map-option.active { border-color: var(--pb-cyan); background: rgba(79,216,232,0.08); }

.pb-crown { position: absolute; font-size: 14px; pointer-events: none; transform: translate(-50%, -140%); }

/* 긴 세로형 코스와 카메라 연출 */
.pb-stage { aspect-ratio: 9/16; max-width: 520px; }
.pb-stage::after {
  content:""; position:absolute; inset:0; pointer-events:none;
  box-shadow: inset 0 0 70px rgba(0,0,0,.55), inset 0 0 0 1px rgba(79,216,232,.12);
}
.pb-center { min-width:0; }
@media (min-width:981px) { .pb-layout { min-height:820px; } }
@media (max-width:980px) { .pb-stage { max-width:430px; } }

/* 자동 카메라 상태 표시 */
.pb-camera-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 14;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(79,216,232,.35);
  background: rgba(5,7,14,.72);
  color: #DDFBFF;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.pb-camera-badge.show { opacity: 1; transform: translateY(0); }


/* 2026-08 fullscreen / readability / long-course fixes */
.pb-layout { grid-template-columns: 320px minmax(0, 1fr) 320px; min-height: 860px; }
.pb-side { padding: 20px; max-height: none; font-size: 15px; }
.pb-side h4 { font-size: 16px; margin: 20px 0 10px; }
.pb-textarea { min-height: 140px; font-size: 16px; line-height: 1.5; }
.pb-row { font-size: 15px; margin: 10px 0; }
.pb-row select, .pb-row input[type=number] { font-size: 15px; padding: 8px 11px; }
.pb-stat-pair b { font-size: 22px; }
.pb-stat-pair span { font-size: 13px; }
.pb-participant-row, .pb-rank-row, .pb-finish-list li, .pb-winner-list li { font-size: 15px; padding: 8px 10px; }
.pb-participant-row .del { font-size: 14px; }
.pb-btn { font-size: 15px; padding: 13px; }
.pb-map-option { font-size: 15px; padding: 11px 12px; }
.pb-topbar .pb-meta { font-size: 14px; }
.pb-camera-badge { font-size: 14px; padding: 8px 13px; }
.pb-empty-hint { font-size: 16px; }
.pb-center { min-width: 0; min-height: 0; overflow: hidden; }
.pb-stage-wrap { min-height: 0; overflow: hidden; }
.pb-stage { height: 100%; width: auto; max-width: 100%; max-height: 100%; aspect-ratio: 9/16; }

.pb-app:fullscreen,
.pb-app:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  overflow: hidden;
}
.pb-app:fullscreen .pb-layout,
.pb-app:-webkit-full-screen .pb-layout {
  width: 100%;
  height: 100%;
  min-height: 0;
  grid-template-columns: 340px minmax(0,1fr) 340px;
}
.pb-app:fullscreen .pb-side,
.pb-app:-webkit-full-screen .pb-side {
  height: 100%;
  max-height: none;
  overflow-y: auto;
}
.pb-app:fullscreen .pb-center,
.pb-app:-webkit-full-screen .pb-center { height: 100%; min-height: 0; }
.pb-app:fullscreen .pb-stage-wrap,
.pb-app:-webkit-full-screen .pb-stage-wrap { flex: 1 1 auto; min-height: 0; padding: 8px; }
.pb-app:fullscreen .pb-stage,
.pb-app:-webkit-full-screen .pb-stage {
  height: 100%;
  width: auto;
  max-height: 100%;
  max-width: 100%;
  aspect-ratio: 9/16;
  border-radius: 10px;
}
.pb-app:fullscreen .pb-topbar,
.pb-app:-webkit-full-screen .pb-topbar { flex: 0 0 auto; padding: 10px 16px; }
.pb-app:fullscreen .pb-center > div:last-child,
.pb-app:-webkit-full-screen .pb-center > div:last-child { flex: 0 0 auto; padding: 8px 14px 10px !important; }

@media (max-width: 1180px) and (min-width: 981px) {
  .pb-layout { grid-template-columns: 270px minmax(0,1fr) 270px; }
  .pb-side { padding: 14px; }
}


/* 참가자별 실제 남은 공 세로 목록 */
.pb-remaining-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 10px;
  padding: 11px 12px;
  border: 1px solid rgba(79,216,232,0.28);
  border-radius: 11px;
  background: rgba(79,216,232,0.08);
  color: #F5FCFF;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
}

.pb-remaining-summary strong {
  color: var(--pb-cyan);
  font-size: 21px;
  font-weight: 900;
  white-space: nowrap;
}

.pb-remaining-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 3px;
}

.pb-remaining-row {
  display: grid;
  grid-template-columns: 13px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  background: rgba(255,255,255,0.045);
  color: #FFFFFF;
}

.pb-remaining-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pb-remaining-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.pb-remaining-count {
  color: #FFFFFF;
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
}

.pb-remaining-empty {
  padding: 10px 4px;
  color: var(--pb-muted);
  font-size: 15px;
  font-weight: 700;
}

.pb-app:fullscreen .pb-remaining-summary,
.pb-app:-webkit-full-screen .pb-remaining-summary {
  font-size: 19px;
}

.pb-app:fullscreen .pb-remaining-name,
.pb-app:-webkit-full-screen .pb-remaining-name {
  font-size: 18px;
}

.pb-app:fullscreen .pb-remaining-count,
.pb-app:-webkit-full-screen .pb-remaining-count {
  font-size: 19px;
}


/* 게임 진행 중 오른쪽 목록이 줄어도 중앙 경기장이 함께 줄어들지 않게 고정 */
.pb-layout {
  height: clamp(760px, 82vh, 980px);
  min-height: 760px;
  align-items: stretch;
}

.pb-center {
  height: 100%;
  min-height: 0;
}

.pb-stage-wrap {
  flex: 1 1 0;
  height: auto;
  min-height: 0;
}

.pb-stage {
  flex: 0 1 auto;
  height: 100%;
  min-height: 0;
}

/* 좌우 패널의 내용량은 전체 앱 높이에 영향을 주지 않고 내부에서만 스크롤 */
.pb-side {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

/* 전체화면은 화면 높이를 정확히 고정 */
.pb-app:fullscreen .pb-layout,
.pb-app:-webkit-full-screen .pb-layout {
  height: 100vh !important;
  min-height: 0 !important;
  max-height: 100vh !important;
}

/* 작은 화면에서도 최소 플레이 영역을 확보 */
@media (max-height: 820px) and (min-width: 981px) {
  .pb-layout {
    height: calc(100vh - 24px);
    min-height: 620px;
  }
}
