/* ═══════ 꼴밸런스 CSS ═══════ */
:root {
  --bal-bg: #0f172a;
  --bal-surface: #1e293b;
  --bal-a: #f97316;
  --bal-b: #3b82f6;
  --bal-vs: #fbbf24;
  --bal-text: #f1f5f9;
  --bal-muted: #94a3b8;
  --bal-border: #334155;
  --bal-radius: 12px;
}

/* ─── 공통 ─── */
.bal-wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.bal-btn { display: inline-block; padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: opacity .2s; }
.bal-btn:hover { opacity: .85; }
.bal-btn-ghost { background: transparent; color: var(--bal-a); border: 1.5px solid var(--bal-a); }

/* ─── 로비 Hero ─── */
.bal-hero { text-align: center; padding: 0; margin-bottom: 24px; }
.bal-hero-image { display: block; width: 100%; max-width: 100%; height: auto; margin: 0 auto; border-radius: 18px; }
.bal-title { font-size: 28px; font-weight: 800; color: var(--bal-vs); margin: 0 0 8px; }
.bal-sub { font-size: 15px; color: var(--bal-muted); margin: 0 0 16px; }
.bal-hero-actions { margin-top: 12px; }
.bal-create-cta-wrap { margin: -8px 0 24px; }
.bal-create-cta { display: block; width: 100%; box-sizing: border-box; padding: 14px 16px; border: 0; border-radius: 12px; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; text-align: center; text-decoration: none; font-size: 15px; font-weight: 800; cursor: pointer; }
.bal-create-cta:hover { color: #fff; opacity: .92; }

.bal-lobby-section { margin-bottom: 28px; }
.bal-section-head { font-size: 18px; font-weight: 700; color: #1e293b; margin: 0 0 12px; padding-left: 4px; }

/* ─── 로비 카드 ─── */
.bal-lobby-list { display: flex; flex-direction: column; gap: 10px; }
.bal-lobby-card { display: flex; gap: 12px; padding: 12px; background: #fff; border-radius: var(--bal-radius); border: 1px solid #e2e8f0; text-decoration: none; color: #1e293b; transition: box-shadow .2s; }
.bal-lobby-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.bal-lobby-thumb { width: 80px; height: 80px; flex-shrink: 0; border-radius: 8px; overflow: hidden; background: #f1f5f9; }
.bal-lobby-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bal-lobby-thumb-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--bal-muted); background: linear-gradient(135deg, var(--bal-bg), #1a1a2e); }
.bal-lobby-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.bal-lobby-title-row { display: flex; align-items: baseline; gap: 8px; }
.bal-lobby-title { font-size: 15px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bal-lobby-desc { font-size: 13px; color: #64748b; margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bal-lobby-meta { display: flex; gap: 10px; font-size: 12px; color: var(--bal-muted); margin-top: 6px; }
.bal-lobby-bottom { display: flex; justify-content: flex-end; margin-top: 4px; }
.bal-lobby-cta { font-size: 13px; font-weight: 600; color: var(--bal-a); }

.bal-list-more-wrap { text-align: center; padding: 16px 0; }

.bal-comments-panel { margin-top: 16px; }
.bal-creator-hero { padding: 20px 4px 18px; }
.bal-creator-hero h1 { font-size: 22px; line-height: 1.35; color: #1e293b; margin: 10px 0 4px; font-weight: 400; }
.bal-creator-hero h1 strong { font-weight: 800; }
.bal-creator-hero p { margin: 0; font-size: 13px; color: #94a3b8; }
.bal-back-link { display: inline-flex; align-items: center; min-height: 32px; font-size: 13px; font-weight: 700; color: #f97316; text-decoration: none; }
.bal-empty-panel { padding: 28px 12px; border: 1px solid #e2e8f0; border-radius: var(--bal-radius); background: #fff; color: #94a3b8; text-align: center; font-size: 14px; }

/* ═══════ 작가방 / 작가 랭킹 ═══════ */
.creator-room-wrap,
.creator-ranking-wrap { max-width: 860px; }
.creator-room-hero,
.creator-ranking-hero { padding: 20px 4px 18px; }
.creator-ranking-cta-wrap { margin: 14px 0 24px; }
.creator-ranking-create-cta { display: flex; align-items: center; justify-content: center; gap: 8px; }
.creator-ranking-create-cta svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; fill: none; flex-shrink: 0; }
.creator-room-topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.creator-rank-link { display: inline-flex; align-items: center; min-height: 32px; font-size: 13px; font-weight: 800; color: #2563eb; text-decoration: none; }
.creator-room-profile { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.creator-avatar { width: 44px; height: 44px; border-radius: 999px; overflow: hidden; background: #e0f2fe; color: #0369a1; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border: 1px solid #dbeafe; font-weight: 900; }
.creator-avatar-lg { width: 76px; height: 76px; font-size: 28px; }
.creator-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.creator-room-titlebox { min-width: 0; }
.creator-room-titlebox h1,
.creator-ranking-hero h1 { margin: 0; color: #111827; font-size: 28px; line-height: 1.2; font-weight: 900; letter-spacing: 0; word-break: keep-all; }
.creator-room-stats,
.creator-ranking-hero p { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 8px; color: #64748b; font-size: 13px; line-height: 1.5; }
.creator-room-stats span { display: inline-flex; align-items: center; min-height: 22px; }
.creator-room-rank-stat strong { display: inline-flex; align-items: center; gap: 4px; color: #111827; font-weight: 900; }
.creator-room-section { margin: 8px 0 24px; }
.creator-test-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.creator-test-card { display: flex; gap: 12px; padding: 12px; border: 1px solid #e2e8f0; border-radius: var(--bal-radius); background: #fff; color: #111827; text-decoration: none; transition: box-shadow .2s, transform .2s; }
.creator-test-card:hover { box-shadow: 0 6px 18px rgba(15,23,42,.08); transform: translateY(-1px); }
.creator-test-thumb { width: 88px; height: 88px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: #f1f5f9; }
.creator-test-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.creator-test-thumb-fallback { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 8px; text-align: center; font-size: 13px; font-weight: 900; color: #475569; background: #e2e8f0; }
.creator-test-body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.creator-test-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.creator-type-badge { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; min-height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 900; background: #f1f5f9; color: #334155; }
.creator-type-balance { background: #ffedd5; color: #c2410c; }
.creator-type-quiz { background: #dbeafe; color: #1d4ed8; }
.creator-test-title { min-width: 0; margin: 0; font-size: 16px; line-height: 1.35; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.creator-test-desc { margin: 5px 0 0; color: #64748b; font-size: 13px; line-height: 1.45; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.creator-test-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 7px; color: #94a3b8; font-size: 12px; }
.creator-create-cta-wrap { margin: 10px 0 24px; }
.creator-ranking-list { display: grid; gap: 10px; }
.creator-rank-row { display: flex; align-items: center; gap: 12px; min-height: 74px; padding: 12px; border: 1px solid #e2e8f0; border-radius: var(--bal-radius); background: #fff; color: #111827; text-decoration: none; transition: box-shadow .2s, transform .2s; }
.creator-rank-row:hover { box-shadow: 0 6px 18px rgba(15,23,42,.08); transform: translateY(-1px); }
.creator-rank-num { width: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; text-align: center; font-size: 18px; line-height: 1; font-weight: 900; color: #64748b; flex-shrink: 0; }
.rank-1 .creator-rank-num { color: #d97706; }
.rank-2 .creator-rank-num { color: #64748b; }
.rank-3 .creator-rank-num { color: #b45309; }
.creator-medal { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; flex-shrink: 0; }
.creator-medal svg { display: block; width: 100%; height: 100%; }
.creator-medal-ribbon { fill: #ef4444; }
.creator-medal-disc { fill: currentColor; }
.creator-medal-mark { fill: rgba(255,255,255,.92); }
.creator-medal-1 { color: #f59e0b; }
.creator-medal-2 { color: #94a3b8; }
.creator-medal-3 { color: #b45309; }
.creator-rank-main { min-width: 0; flex: 1; }
.creator-rank-name { font-size: 16px; line-height: 1.35; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.creator-rank-meta { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 4px; color: #64748b; font-size: 12px; }

@media (min-width: 720px) {
  .creator-test-list { grid-template-columns: 1fr; }
}

/* ═══════ 플레이 페이지 ═══════ */
.bal-play-wrap { max-width: 720px; margin: 0 auto; padding: 0 12px 40px; }

/* 인트로 */
.bal-play-intro { text-align: center; padding: 32px 0; }
.bal-play-cover { width: 200px; height: 200px; object-fit: cover; border-radius: 16px; margin-bottom: 20px; }
.bal-play-title { font-size: 24px; font-weight: 800; color: #1e293b; margin: 0 0 8px; }
.bal-play-desc { font-size: 14px; color: #64748b; margin: 0 0 16px; }
.bal-play-info { display: flex; justify-content: center; gap: 16px; font-size: 13px; color: var(--bal-muted); margin-bottom: 24px; }
.bal-play-start-btn { padding: 14px 48px; font-size: 18px; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--bal-a), #ea580c); border: none; border-radius: 50px; cursor: pointer; transition: transform .15s, box-shadow .15s; box-shadow: 0 4px 16px rgba(249,115,22,.3); }
.bal-play-start-btn:hover { transform: scale(1.03); box-shadow: 0 6px 20px rgba(249,115,22,.4); }

/* 진행바 */
.bal-play-progress { height: 6px; background: #e2e8f0; border-radius: 3px; margin-bottom: 16px; overflow: hidden; }
.bal-play-progress-bar { height: 100%; background: linear-gradient(90deg, var(--bal-a), var(--bal-vs)); border-radius: 3px; transition: width .4s ease; width: 0; }

.bal-play-qnum { text-align: center; font-size: 14px; font-weight: 600; color: var(--bal-muted); margin-bottom: 8px; }
.bal-play-qtext { text-align: center; font-size: 20px; font-weight: 700; color: #1e293b; margin-bottom: 16px; line-height: 1.4; }
.bal-play-qimage { text-align: center; margin-bottom: 12px; }
.bal-play-qimage img { max-width: 100%; max-height: 200px; border-radius: 8px; }

/* 선택지 */
.bal-play-choices { display: flex; align-items: stretch; gap: 12px; margin-bottom: 12px; }
.bal-choice { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 12px; border-radius: var(--bal-radius); border: 2.5px solid #e2e8f0; background: #fff; cursor: pointer; transition: all .25s; min-height: 120px; }
.bal-choice:hover { transform: translateY(-2px); }
.bal-choice-a { border-color: var(--bal-a); }
.bal-choice-a:hover, .bal-choice-a.selected { background: var(--bal-a); color: #fff; box-shadow: 0 4px 16px rgba(249,115,22,.3); }
.bal-choice-b { border-color: var(--bal-b); }
.bal-choice-b:hover, .bal-choice-b.selected { background: var(--bal-b); color: #fff; box-shadow: 0 4px 16px rgba(59,130,246,.3); }
.bal-choice.dimmed { opacity: .4; transform: scale(.95); }
.bal-choice-label { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.bal-choice-a .bal-choice-label { color: var(--bal-a); }
.bal-choice-b .bal-choice-label { color: var(--bal-b); }
.bal-choice.selected .bal-choice-label { color: #fff; }
.bal-choice-text { font-size: 15px; font-weight: 600; text-align: center; word-break: keep-all; line-height: 1.4; }
.bal-choice-img { max-width: 100%; max-height: 80px; border-radius: 6px; margin-top: 8px; }

.bal-play-vs { display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 900; color: var(--bal-vs); flex-shrink: 0; }

/* 투표 결과 바 */
.bal-play-vote-result { margin-top: 8px; }
.bal-vote-bar-wrap { display: flex; height: 36px; border-radius: 18px; overflow: hidden; background: #e2e8f0; }
.bal-vote-bar { display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; color: #fff; transition: width .6s ease; min-width: 30px; }
.bal-vote-bar-a { background: var(--bal-a); }
.bal-vote-bar-b { background: var(--bal-b); }

/* ═══════ 결과 ═══════ */
.bal-play-result { text-align: center; padding: 32px 0 20px; }
.bal-result-badge { font-size: 48px; margin-bottom: 8px; }
.bal-result-type { font-size: 24px; font-weight: 800; color: #1e293b; margin-bottom: 6px; }
.bal-result-desc { font-size: 14px; color: #64748b; margin-bottom: 20px; line-height: 1.5; }

.bal-result-summary { text-align: left; margin-bottom: 24px; }
.bal-summary-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; margin-bottom: 4px; font-size: 13px; }
.bal-summary-row.majority { background: #f0fdf4; }
.bal-summary-row.minority { background: #fef2f2; }
.bal-summary-q { font-weight: 700; color: var(--bal-muted); width: 28px; flex-shrink: 0; }
.bal-summary-choice { flex: 1; color: #334155; }
.bal-summary-pct { font-weight: 700; width: 40px; text-align: right; }
.bal-summary-row.majority .bal-summary-pct { color: #16a34a; }
.bal-summary-row.minority .bal-summary-pct { color: #dc2626; }

.bal-result-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.bal-btn-like { background: #fee2e2; color: #dc2626; }
.bal-btn-like.liked { background: #dc2626; color: #fff; }
.bal-btn-share { background: #e0f2fe; color: #0284c7; }
.bal-btn-retry { background: #f1f5f9; color: #475569; }

/* 추천 */
.bal-play-recommend { margin-top: 28px; padding-top: 20px; border-top: 1px solid #e2e8f0; }
.bal-play-recommend h3 { font-size: 16px; font-weight: 700; color: #1e293b; margin: 0 0 12px; }
.bal-creator-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.bal-creator-head h3 { min-width: 0; }
.bal-creator-more { flex-shrink: 0; font-size: 13px; font-weight: 700; color: #f97316; text-decoration: none; }
.bal-recommend-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.bal-recommend-card { display: flex; flex-direction: column; align-items: center; padding: 12px; background: #f8fafc; border-radius: 10px; text-decoration: none; color: #1e293b; transition: box-shadow .2s; }
.bal-recommend-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.bal-recommend-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; margin-bottom: 8px; }
.bal-recommend-fallback { width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 32px; background: linear-gradient(135deg, var(--bal-bg), #1a1a2e); border-radius: 8px; margin-bottom: 8px; color: var(--bal-muted); }
.bal-recommend-title { font-size: 13px; font-weight: 600; text-align: center; }
.bal-recommend-meta { font-size: 11px; color: var(--bal-muted); margin-top: 2px; }
.bal-recommend-gauge { width: 100%; margin-top: 8px; }
.bal-recommend-gauge-bar { display: flex; width: 100%; height: 12px; overflow: hidden; border-radius: 999px; background: #e2e8f0; }
.bal-recommend-gauge-a,
.bal-recommend-gauge-b { overflow: hidden; transition: width .3s ease; }
.bal-recommend-gauge-a { background: linear-gradient(90deg, #f87171, #ef4444); }
.bal-recommend-gauge-b { background: linear-gradient(90deg, #60a5fa, #3b82f6); }
.bal-recommend-list-single { grid-template-columns: 1fr; }
.bal-recommend-list-single .bal-recommend-card { flex-direction: row; align-items: center; gap: 12px; text-align: left; padding: 12px; }
.bal-recommend-list-single .bal-recommend-card img,
.bal-recommend-list-single .bal-recommend-fallback { width: 80px; height: 80px; aspect-ratio: auto; flex-shrink: 0; margin-bottom: 0; }
.bal-recommend-list-single .bal-recommend-title { flex: 1; min-width: 0; text-align: left; font-size: 14px; line-height: 1.35; }
.bal-recommend-list-single .bal-recommend-gauge { width: 96px; flex-shrink: 0; margin-top: 0; }
.bal-recommend-list-single .bal-recommend-meta { width: 48px; flex-shrink: 0; text-align: right; margin-top: 0; }

/* ─── 반응형 ─── */
@media (max-width: 480px) {
  .bal-play-choices { flex-direction: column; }
  .bal-play-vs { padding: 4px 0; }
  .bal-choice { min-height: 80px; }
  .bal-recommend-list { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .bal-recommend-card { padding: 8px; }
  .bal-recommend-title { font-size: 12px; line-height: 1.35; word-break: keep-all; }
  .bal-recommend-list-single { grid-template-columns: 1fr; gap: 8px; }
  .bal-recommend-list-single .bal-recommend-card { padding: 10px; gap: 10px; }
  .bal-recommend-list-single .bal-recommend-card img,
  .bal-recommend-list-single .bal-recommend-fallback { width: 68px; height: 68px; }
  .bal-recommend-list-single .bal-recommend-title { font-size: 13px; }
  .bal-recommend-list-single .bal-recommend-gauge { width: 72px; }
  .bal-recommend-list-single .bal-recommend-meta { width: 38px; font-size: 10px; }
}
