/* =============================================
   밸런스 게임 스타일
   ============================================= */

html { background: #000; }

.bg-body {
    overflow: hidden;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #f0f0f0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.bg-game {
    width: 100%;
    height: 100dvh;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: background-color 0.15s;
}

/* Top Bar */
.bg-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
    flex-shrink: 0;
}
.bg-back {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}
.bg-back:hover { color: #fff; }
.bg-info-badge {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.2);
}

/* Content */
.bg-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    overflow-y: auto;
}

/* ===== States ===== */

/* Intro */
.state-intro { background: #0f0f23; }
.state-intro .bg-content {
    justify-content: flex-start;
    padding-top: 40px;
}

.bg-intro-emoji { font-size: 72px; margin-bottom: 16px; }
.bg-intro-title {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}
.bg-intro-desc {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    margin-bottom: 24px;
    text-align: center;
}
.bg-intro-desc strong { color: #ffd700; }

.bg-best {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    padding: 10px 18px;
    margin-bottom: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.bg-btn-start {
    display: inline-block;
    padding: 16px 48px;
    background: linear-gradient(135deg, #8B5CF6, #EC4899);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.bg-btn-start:active { transform: scale(0.95); }

/* Playing */
.state-playing { background: #0f0f23; }
.state-playing .bg-content {
    justify-content: center;
    padding: 16px;
}

.bg-progress {
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
    text-align: center;
}
.bg-progress-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 8px;
}
.bg-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}
.bg-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #8B5CF6, #EC4899);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.bg-question-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 16px;
    text-align: center;
}

.bg-vs-wrap {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
}

.bg-choice-btn {
    width: 100%;
    padding: 28px 20px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    word-break: keep-all;
    line-height: 1.4;
    background: rgba(255, 255, 255, 0.04);
}
.bg-choice-a {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.3);
}
.bg-choice-b {
    background: rgba(236, 72, 153, 0.1);
    border-color: rgba(236, 72, 153, 0.3);
}
.bg-choice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
.bg-choice-a:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.6);
}
.bg-choice-b:hover {
    background: rgba(236, 72, 153, 0.2);
    border-color: rgba(236, 72, 153, 0.6);
}
.bg-choice-btn:active { transform: scale(0.97); }

.bg-vs-divider {
    text-align: center;
    font-size: 20px;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 4px;
}

/* Selected state */
.bg-choice-btn.bg-selected-a {
    background: rgba(139, 92, 246, 0.35);
    border-color: #8B5CF6;
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}
.bg-choice-btn.bg-selected-b {
    background: rgba(236, 72, 153, 0.35);
    border-color: #EC4899;
    box-shadow: 0 0 20px rgba(236, 72, 153, 0.3);
}
.bg-choice-btn.bg-disabled {
    pointer-events: none;
}

/* Result bar overlay */
.bg-result-overlay {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}
.bg-result-pct {
    font-size: 28px;
    font-weight: 900;
}
.bg-result-pct-a { color: #A78BFA; }
.bg-result-pct-b { color: #F472B6; }
.bg-result-count {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
}

.bg-bar-wrap {
    width: 100%;
    max-width: 400px;
    height: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 12px;
    display: flex;
}
.bg-bar-a {
    height: 100%;
    background: #8B5CF6;
    border-radius: 5px 0 0 5px;
    transition: width 0.8s ease;
}
.bg-bar-b {
    height: 100%;
    background: #EC4899;
    border-radius: 0 5px 5px 0;
    transition: width 0.8s ease;
}

/* Result */
.state-result { background: #0f0f23; }
.state-result .bg-content {
    justify-content: flex-start;
    padding-top: 32px;
}

.bg-result-badge {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}
.bg-result-emoji { font-size: 48px; }
.bg-result-type-label {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
}
.bg-result-type-desc {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 16px;
    text-align: center;
    line-height: 1.5;
}

.bg-result-stats {
    display: flex;
    gap: 32px;
    margin-bottom: 16px;
}
.bg-stat {
    text-align: center;
}
.bg-stat-val {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
}
.bg-stat-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.bg-summary {
    width: 100%;
    max-width: 360px;
    margin-bottom: 20px;
}
.bg-summary-title {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
    text-align: center;
}
.bg-summary-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    margin-bottom: 3px;
    background: rgba(255, 255, 255, 0.03);
}
.bg-summary-q { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bg-summary-choice {
    font-weight: 700;
    white-space: nowrap;
}
.bg-summary-majority { color: #A78BFA; }
.bg-summary-minority { color: #F472B6; }

/* Buttons */
.bg-result-btns {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
}
.bg-btn-share, .bg-btn-retry {
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.bg-btn-share:active, .bg-btn-retry:active { transform: scale(0.95); }

.bg-btn-share {
    padding: 16px 32px;
    background: #FEE500;
    color: #191919;
    font-size: 17px;
    box-shadow: 0 4px 16px rgba(254, 229, 0, 0.3);
    flex: 1;
    min-width: 160px;
    border-radius: 12px;
}
.bg-btn-retry {
    padding: 16px 24px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Ranking */
.bg-ranking-section {
    width: 100%;
    max-width: 360px;
    padding-bottom: 40px;
}
.bg-ranking-title {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    text-align: center;
}
.bg-ranking-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.bg-ranking-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    font-size: 13px;
}
.bg-ranking-pos {
    width: 28px;
    text-align: center;
    font-weight: 700;
}
.bg-ranking-label {
    flex: 1;
    color: #fff;
    font-weight: 600;
}
.bg-ranking-pct {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

/* Toast */
.bg-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    white-space: nowrap;
}
.bg-toast-show {
    opacity: 1;
    pointer-events: auto;
}
