/* Couple Mini Games — multiplayer arcade UI */

.game-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 16px 14px 60px;
    position: relative;
}
.game-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 110px 18px 0;
}
@media (max-width: 480px) {
    .game-header { padding-right: 80px; }
}
.game-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.2s;
}
.game-back:hover { background: rgba(236, 72, 153, 0.08); }
.game-header .brand-row { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 800; }

.game-screen { display: none; }
.game-screen.active { display: block; animation: fadeUp 0.4s ease-out; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* HERO */
.game-hero {
    text-align: center;
    padding: 28px 16px 20px;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.08), rgba(168, 85, 247, 0.08));
    border-radius: 20px;
    margin-bottom: 22px;
}
.game-hero-title {
    font-size: clamp(1.5rem, 4.6vw, 2rem);
    font-weight: 900;
    margin: 0 0 10px;
    background: linear-gradient(135deg, #ec4899, #a855f7, #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.game-hero-sub {
    color: var(--text-muted);
    line-height: 1.55;
    word-break: keep-all;
    margin: 0;
}

/* Menu grid */
.game-menu-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}
@media (min-width: 520px) {
    .game-menu-grid { grid-template-columns: 1fr 1fr 1fr; }
}
.game-menu-card {
    background: var(--surface, #fff);
    border: 2px solid transparent;
    border-radius: 16px;
    padding: 22px 18px;
    text-align: left;
    cursor: pointer;
    color: inherit;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
    transition: transform 0.22s, border-color 0.22s, box-shadow 0.22s;
    font: inherit;
}
.game-menu-card:hover {
    transform: translateY(-4px);
    border-color: rgba(236, 72, 153, 0.4);
    box-shadow: 0 12px 32px rgba(236, 72, 153, 0.18);
}
.game-menu-icon { font-size: 2rem; margin-bottom: 8px; }
.game-menu-title { font-weight: 800; margin-bottom: 6px; font-size: 1rem; }
.game-menu-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
    word-break: keep-all;
}

/* Cards & buttons (재사용) */
.game-card {
    background: var(--surface, #fff);
    border-radius: 18px;
    padding: 22px 18px;
    margin-bottom: 16px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(99, 102, 241, 0.08);
}
.game-section-title { font-size: 1.15rem; font-weight: 800; margin: 0 0 8px; }
.game-section-desc { color: var(--text-muted); font-size: 0.9rem; line-height: 1.55; margin: 0 0 14px; }
.game-subsection-title { font-size: 0.95rem; font-weight: 700; margin: 8px 0 6px; }

.game-primary-btn,
.game-secondary-btn {
    display: block;
    width: 100%;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    margin: 8px 0;
    font-family: inherit;
    transition: transform 0.18s, box-shadow 0.18s;
    text-align: center;
    text-decoration: none;
}
.game-primary-btn {
    background: linear-gradient(135deg, #ec4899, #a855f7);
    color: white;
    border: none;
    box-shadow: 0 6px 18px rgba(236, 72, 153, 0.3);
}
.game-primary-btn:hover { transform: translateY(-2px); }
.game-primary-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.game-secondary-btn {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(99, 102, 241, 0.25);
}
.game-secondary-btn:hover { background: rgba(99, 102, 241, 0.05); }
.game-back-link {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 0;
    font-size: 0.9rem;
    margin-bottom: 10px;
    font-family: inherit;
}
.game-back-link:hover { color: #ec4899; }

.game-divider {
    text-align: center;
    color: var(--text-muted);
    margin: 14px 0;
    font-size: 0.78rem;
    position: relative;
}
.game-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(99, 102, 241, 0.12);
}
.game-divider span {
    background: var(--surface, #fff);
    padding: 0 12px;
    position: relative;
}

/* Lobby */
.lobby-actions { margin: 12px 0; }
.lobby-join-box {
    display: grid;
    gap: 8px;
}
.lobby-join-box label {
    font-size: 0.84rem;
    color: var(--text-muted);
    font-weight: 600;
}
.lobby-join-box input {
    padding: 12px 14px;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-align: center;
    background: var(--surface, #fff);
    color: inherit;
    font-family: 'Pretendard', monospace;
}
.lobby-join-box input:focus { border-color: #ec4899; outline: none; }

.lobby-share-box .lobby-code-display {
    display: flex;
    gap: 10px;
    align-items: center;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.08), rgba(168, 85, 247, 0.08));
    padding: 14px 16px;
    border-radius: 14px;
    margin: 12px 0;
}
.lobby-share-box .lobby-code-display span {
    flex: 1;
    font-family: 'Pretendard', monospace;
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    background: linear-gradient(135deg, #ec4899, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}
.lobby-share-box .lobby-code-display button {
    width: auto;
    padding: 8px 14px;
    margin: 0;
    font-size: 0.84rem;
}
.lobby-status {
    text-align: center;
    color: var(--text-muted);
    margin: 12px 0;
    font-size: 0.9rem;
}
.lobby-status.ready { color: #10b981; font-weight: 700; }
.game-error {
    color: #ef4444;
    font-size: 0.85rem;
    margin: 8px 0 0;
    text-align: center;
    min-height: 1.2em;
}

/* Play header */
.game-play-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 4px;
}
.game-score-row {
    display: flex;
    gap: 14px;
    font-size: 0.9rem;
}
.game-score-you strong { color: #ec4899; }
.game-score-opp strong { color: #6366f1; }
.game-help {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    margin: 12px 0;
    padding: 10px 14px;
    background: rgba(99, 102, 241, 0.04);
    border-radius: 10px;
    word-break: keep-all;
}

/* Pong */
#pong-canvas {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 2 / 3;
    height: auto;
    background: #0f172a;
    border-radius: 14px;
    margin: 0 auto;
    display: block;
    touch-action: none;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.18);
}

/* Tetris */
.tetris-boards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
}
.tetris-board-wrap { text-align: center; }
.tetris-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.tetris-boards canvas {
    width: 100%;
    aspect-ratio: 1 / 2;
    height: auto;
    background: #0f172a;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.15);
}
.tetris-controls {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-top: 12px;
}
.tetris-controls button {
    padding: 14px 0;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    color: inherit;
    font-family: inherit;
}
.tetris-controls button:active { background: rgba(236, 72, 153, 0.2); }

/* Math */
.math-problem-card {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.05), rgba(168, 85, 247, 0.05));
    border-radius: 18px;
    padding: 28px 18px;
    margin: 14px 0;
    text-align: center;
    border: 2px solid rgba(236, 72, 153, 0.18);
}
.math-question {
    font-size: clamp(1.6rem, 5vw, 2.4rem);
    font-weight: 900;
    margin-bottom: 18px;
    color: #1f2937;
    font-family: 'Pretendard', monospace;
    letter-spacing: 0.05em;
}
@media (prefers-color-scheme: dark) {
    .math-question { color: #f8fafc; }
}
.math-problem-card input {
    width: 100%;
    max-width: 280px;
    padding: 14px 16px;
    border: 2px solid rgba(99, 102, 241, 0.25);
    border-radius: 12px;
    font-size: 1.4rem;
    font-weight: 800;
    text-align: center;
    margin: 0 auto 14px;
    display: block;
    background: var(--surface, #fff);
    color: inherit;
    font-family: inherit;
}
.math-problem-card input:focus { border-color: #ec4899; outline: none; }
.math-feedback {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 10px 0 0;
    min-height: 1.5em;
}
.math-feedback.correct { color: #10b981; }
.math-feedback.wrong { color: #ef4444; }

/* Result */
.game-result-card {
    text-align: center;
    padding: 32px 22px;
}
.game-result-title {
    font-size: 1.6rem;
    font-weight: 900;
    margin: 0 0 18px;
    background: linear-gradient(135deg, #ec4899, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.game-result-score {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    font-size: 1.2rem;
    margin-bottom: 22px;
}
.game-result-score strong { font-size: 0.85rem; color: var(--text-muted); display: block; }
.game-result-vs { color: var(--text-muted); font-size: 0.95rem; }

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .game-card, .game-menu-card { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.08); }
    .game-divider span { background: #1a1a2e; }
    .lobby-join-box input, .math-problem-card input { background: rgba(255, 255, 255, 0.04); }
    .tetris-controls button { background: rgba(255, 255, 255, 0.05); }
}

/* 광고 슬롯 위치별 사이즈 */
.ad-slot--lobby,
.ad-slot--result {
    margin: 18px 0 8px;
    min-height: 90px;
}
.ad-slot--interstitial {
    margin: 14px 0;
    min-height: 250px; /* 큰 광고 단위 */
}

/* 인터스티셜 카드 */
.interstitial-card {
    text-align: center;
    padding: 28px 20px;
}
.interstitial-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0 0 14px;
    background: linear-gradient(135deg, #ec4899, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.interstitial-countdown {
    margin: 18px 0;
}
#interstitial-countdown-text {
    display: inline-block;
    font-size: 3.6rem;
    font-weight: 900;
    color: #ec4899;
    width: 80px;
    line-height: 1;
    background: linear-gradient(135deg, rgba(236,72,153,0.1), rgba(168,85,247,0.1));
    border-radius: 16px;
    padding: 16px 0;
    border: 2px solid rgba(236,72,153,0.25);
}
.interstitial-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 14px 0 8px;
    word-break: keep-all;
}

/* ============================================================
 * ⚖️ BALANCE GAME
 * ============================================================ */
.balance-cat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}
.balance-cat-btn {
    padding: 18px 14px;
    background: var(--surface, #fff);
    border: 2px solid rgba(99, 102, 241, 0.15);
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.18s, border-color 0.18s, background 0.18s;
    color: inherit;
    font-family: inherit;
    word-break: keep-all;
    text-align: center;
}
.balance-cat-btn:hover {
    transform: translateY(-3px);
    border-color: #ec4899;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.06), rgba(168, 85, 247, 0.04));
}
.balance-cat-btn:active { transform: translateY(-1px); }

/* Countdown */
.balance-countdown-card {
    text-align: center;
    padding: 36px 20px;
}
.balance-countdown-title {
    font-size: 1.3rem;
    font-weight: 900;
    margin: 0 0 10px;
    background: linear-gradient(135deg, #ec4899, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.balance-countdown-hint {
    color: var(--text-muted);
    margin: 0 0 28px;
    font-size: 0.95rem;
    word-break: keep-all;
}
.balance-countdown-num {
    font-size: 6rem;
    font-weight: 900;
    line-height: 1;
    color: #ec4899;
    width: 140px;
    height: 140px;
    margin: 0 auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(236,72,153,0.12), rgba(168,85,247,0.12));
    border: 3px solid rgba(236,72,153,0.3);
    animation: balance-pulse 1s ease infinite;
}
@keyframes balance-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

/* Question */
.balance-q-card {
    padding: 22px 18px;
}
.balance-round-label {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 16px;
}
.balance-choices {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 14px;
    align-items: stretch;
    margin-bottom: 18px;
}
.balance-choice {
    padding: 36px 18px;
    border-radius: 18px;
    border: 3px solid transparent;
    font-size: 1.15rem;
    font-weight: 900;
    cursor: pointer;
    word-break: keep-all;
    transition: transform 0.2s, border-color 0.2s;
    color: white;
    font-family: inherit;
    line-height: 1.4;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.balance-choice--a {
    background: linear-gradient(135deg, #ec4899, #f97316);
    box-shadow: 0 8px 24px rgba(236, 72, 153, 0.35);
}
.balance-choice--b {
    background: linear-gradient(135deg, #6366f1, #06b6d4);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}
.balance-choice:hover { transform: translateY(-3px); }
.balance-choice:disabled { opacity: 0.6; cursor: not-allowed; }
.balance-choice.selected {
    border-color: #fbbf24;
    transform: scale(0.97);
}
.balance-vs {
    align-self: center;
    font-weight: 900;
    font-size: 1.4rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}
.balance-timer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 700;
    margin-top: 8px;
}
.balance-wait-status {
    text-align: center;
    color: #f59e0b;
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 14px;
}

/* Round result */
.balance-roundresult-card { text-align: center; padding: 24px 20px; }
.balance-rr-title {
    font-size: 1.6rem;
    font-weight: 900;
    margin: 8px 0 18px;
}
.balance-rr-title.match { color: #10b981; }
.balance-rr-title.mismatch { color: #f59e0b; }
.balance-rr-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.balance-rr-side {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.03));
    padding: 14px 10px;
    border-radius: 14px;
    border: 1px solid rgba(99, 102, 241, 0.12);
}
.balance-rr-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 700;
}
.balance-rr-answer {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 4px;
    word-break: keep-all;
}
.balance-rr-time {
    font-size: 0.85rem;
    color: #ec4899;
    font-weight: 700;
}
.balance-rr-next {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 14px 0 0;
}

/* Final */
.balance-final-card { text-align: center; padding: 28px 20px; }
.balance-final-title {
    font-size: 1.2rem;
    font-weight: 800;
    margin: 0 0 8px;
}
.balance-final-score {
    font-size: 4.5rem;
    font-weight: 900;
    line-height: 1;
    background: linear-gradient(135deg, #ec4899, #a855f7, #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 12px 0;
}
.balance-final-stats {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 14px 0 18px;
}
.balance-final-stats p { margin: 4px 0; }
.balance-guide-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 16px 0 10px;
    background: linear-gradient(135deg, #ec4899, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.balance-guide-body {
    color: var(--text);
    line-height: 1.7;
    font-size: 0.95rem;
    word-break: keep-all;
    margin: 0 0 18px;
    padding: 14px 16px;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.05), rgba(168, 85, 247, 0.05));
    border-radius: 12px;
    border-left: 3px solid #ec4899;
    text-align: left;
}

@media (prefers-color-scheme: dark) {
    .balance-cat-btn { background: rgba(255,255,255,0.04); }
    .balance-rr-side { background: rgba(255,255,255,0.04); }
}

/* 공유 액션 버튼 영역 */
.lobby-share-actions {
    display: grid;
    gap: 8px;
    margin: 14px 0 8px;
}
.lobby-share-actions button { margin: 0; }
.lobby-share-btn { font-size: 1rem; }

/* 코드 디스플레이 — 가운데 정렬 강화 */
.lobby-share-box .lobby-code-display {
    justify-content: center;
}
