/* ================================================================
   HeGame 在线真心话大冒险 — 样式表
   基于 HeList 设计系统（#4a90e2 蓝色主色调）
   ================================================================ */

/* ---- CSS Variables ---- */
:root {
    --bg-color: #f0f8ff;
    --text-color: #1e1e2f;
    --panel-color: #ffffff;
    --primary-color: #4a90e2;
    --primary-light: #e1f0ff;
    --primary-dark: #3a78c2;
    --secondary-color: #e8edf5;
    --border-color: #d3dde8;
    --danger-color: #e74c3c;
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --radius: 14px;
    --radius-sm: 8px;
    --radius-lg: 28px;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --card-shadow: 0 4px 20px rgba(0,0,0,0.06);
    --glow-color: rgba(74, 144, 226, 0.20);
    --grad-base: #e8edf6;
    --grad-blue: #dbeafe;
    --grad-pink: #fce4ec;
    --grad-mid: #f0f4fa;
    --font-sans: 'Segoe UI', 'SF Pro Display', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;
}

.dark-mode {
    --bg-color: #12121a;
    --text-color: #e8e8f0;
    --panel-color: #1c1c26;
    --primary-color: #5b9cf5;
    --primary-light: #2a2a3a;
    --primary-dark: #4a8ae0;
    --secondary-color: #262632;
    --border-color: #333345;
    --danger-color: #ff5e7a;
    --success-color: #4caf84;
    --warning-color: #ffb74d;
    --card-shadow: 0 4px 20px rgba(0,0,0,0.25);
    --glow-color: rgba(91, 156, 245, 0.25);
    --grad-base: #1a1a2a;
    --grad-blue: #1a2a3a;
    --grad-pink: #2a1a22;
    --grad-mid: #1e1e2e;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    background: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
    transition: background var(--transition), color var(--transition);
}

/* ---- Gradient Background ---- */
body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, var(--grad-base), var(--grad-blue), var(--grad-mid), var(--grad-pink), var(--grad-base));
    background-size: 400% 400%;
    animation: gradientFlow 20s ease infinite;
    z-index: -2;
}
body::after {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at center, transparent 30%, var(--bg-color) 80%);
    z-index: -1;
    opacity: 0.6;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ---- Layout Container ---- */
.app-container {
    max-width: 1360px;
    margin: 0 auto;
    padding: 12px 16px;
    min-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---- Panel ---- */
.panel {
    background: var(--panel-color);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    padding: 18px 20px 20px;
    transition: background var(--transition), border var(--transition), box-shadow var(--transition);
}

/* ---- Button Base ---- */
button {
    font-family: var(--font-sans);
    cursor: pointer;
    border: none;
    outline: none;
    transition: all var(--transition);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    font-weight: 600;
    border: 1.5px solid transparent;
}

.btn-primary {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 3px 12px var(--glow-color);
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-color);
    border-color: var(--border-color);
}
.btn-secondary:hover { border-color: var(--primary-color); color: var(--primary-color); }

.btn-success {
    background: var(--success-color);
    color: #fff;
}
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-danger {
    background: var(--danger-color);
    color: #fff;
}
.btn-danger:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn-warning {
    background: var(--warning-color);
    color: #fff;
}
.btn-warning:hover { filter: brightness(1.1); transform: translateY(-1px); }

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.78rem;
    border-radius: 20px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

/* ---- Input ---- */
.form-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border-color);
    background: var(--panel-color);
    color: var(--text-color);
    font-family: var(--font-sans);
    font-size: 0.88rem;
    transition: border var(--transition), box-shadow var(--transition);
    outline: none;
}
.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--glow-color);
}
.form-input::placeholder { color: var(--text-color); opacity: 0.45; }

/* ---- Header ---- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    background: var(--panel-color);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    padding: 10px 18px;
    transition: background var(--transition), border var(--transition);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-color);
}
.app-brand small {
    font-weight: 400;
    font-size: 0.75rem;
    opacity: 0.6;
    color: var(--text-color);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---- Toast ---- */
.hegame-toast {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--panel-color);
    color: var(--text-color);
    padding: 12px 24px;
    border-radius: 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    font-size: 0.85rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.hegame-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.hegame-toast.success { border-color: var(--success-color); }
.hegame-toast.error { border-color: var(--danger-color); }
.hegame-toast.info { border-color: var(--primary-color); }

/* ================================================================
   LOGIN OVERLAY
   ================================================================ */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.login-overlay.active { display: flex; }

.login-box {
    background: var(--panel-color);
    border-radius: var(--radius);
    padding: 28px 30px 32px;
    max-width: 380px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    text-align: center;
}
.login-box .login-icon {
    width: 48px; height: 48px;
    color: var(--primary-color);
    margin-bottom: 12px;
}
.login-box h2 {
    font-size: 1.15rem;
    margin-bottom: 4px;
}
.login-box p {
    font-size: 0.82rem;
    opacity: 0.6;
    margin-bottom: 18px;
}
.login-box .form-input {
    margin-bottom: 10px;
    text-align: center;
}
.login-box .btn {
    width: 100%;
    margin-top: 6px;
}
.login-box .login-error {
    color: var(--danger-color);
    font-size: 0.78rem;
    margin-top: 8px;
    display: none;
}
.login-box .login-error.show { display: block; }

/* ================================================================
   LOBBY PAGE (index.html)
   ================================================================ */
.lobby-hero {
    text-align: center;
    padding: 30px 20px 24px;
}
.lobby-hero h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 6px;
}
.lobby-hero p {
    font-size: 0.92rem;
    opacity: 0.6;
    margin-bottom: 4px;
}

.lobby-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 4px;
}
@media (max-width: 640px) {
    .lobby-cards { grid-template-columns: 1fr; }
}

.lobby-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 36px 24px;
    background: var(--panel-color);
    border-radius: var(--radius);
    border: 2px dashed var(--border-color);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.lobby-card:hover {
    border-color: var(--primary-color);
    border-style: solid;
    transform: translateY(-3px);
    box-shadow: 0 8px 30px var(--glow-color);
}
.lobby-card .card-icon {
    width: 48px; height: 48px;
    color: var(--primary-color);
}
.lobby-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
}
.lobby-card p {
    font-size: 0.82rem;
    opacity: 0.55;
}

.join-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 24px 20px;
    margin-top: 4px;
}
.join-section .join-input-row {
    display: flex;
    gap: 10px;
    width: 100%;
    max-width: 420px;
}
.join-section .join-input-row .form-input {
    flex: 1;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 4px;
    text-transform: uppercase;
    font-family: var(--font-mono);
}
.join-section .join-input-row .btn {
    flex-shrink: 0;
}
.join-error {
    color: var(--danger-color);
    font-size: 0.82rem;
    display: none;
}
.join-error.show { display: block; }

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 10px;
    border-radius: var(--radius-lg);
    background: var(--primary-light);
    border: 1px solid var(--primary-color);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-color);
}
.user-badge .user-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}
.user-badge .logout-btn {
    background: none;
    border: none;
    color: var(--text-color);
    opacity: 0.4;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.75rem;
}
.user-badge .logout-btn:hover { opacity: 0.8; }

/* ================================================================
   GAME ROOM PAGE (game.html)
   ================================================================ */

/* ---- Room Header ---- */
.room-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.room-code-display {
    display: flex;
    align-items: center;
    gap: 8px;
}
.room-code-display .code-label {
    font-size: 0.82rem;
    opacity: 0.6;
}
.room-code-display .code-value {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: 3px;
    background: var(--primary-light);
    padding: 4px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--primary-color);
    cursor: pointer;
    transition: all var(--transition);
}
.room-code-display .code-value:hover {
    background: var(--primary-color);
    color: #fff;
}
.room-header .room-players-count {
    font-size: 0.85rem;
    opacity: 0.6;
}

/* ---- Game Area (main grid) ---- */
.game-area {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 14px;
    flex: 1;
    min-height: 0;
}
/* Swipe wrapper: invisible on desktop — lets grid see children directly */
.game-area .game-swipe-wrapper {
    display: contents;
}
.game-area .swipe-page {
    display: contents;
}
@media (max-width: 820px) {
    .game-area { grid-template-columns: 1fr; }
}

/* ---- Players Panel ---- */
.players-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}
.players-panel .panel-title {
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-color);
}
.players-panel .panel-title .title-icon {
    color: var(--primary-color);
    width: 18px; height: 18px;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--secondary-color);
    border: 1.5px solid transparent;
    transition: all var(--transition);
    position: relative;
}
.player-item .player-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}
.player-item .player-name {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.player-item .player-score {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-left: auto;
    padding: 2px 6px;
    background: var(--primary-light);
    border-radius: 8px;
    flex-shrink: 0;
}
.player-item .player-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}
.player-item .badge-host { background: var(--warning-color); color: #fff; }
.player-item .badge-me { background: var(--primary-color); color: #fff; }
.player-item .badge-loser { background: var(--danger-color); color: #fff; }
.player-item .badge-questioner { background: var(--success-color); color: #fff; }

.player-item .player-number {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 800;
    min-width: 30px;
    text-align: center;
    color: var(--primary-color);
}
.player-item .player-status-icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
}

.player-item.is-host { border-color: var(--warning-color); }
.player-item.is-loser { border-color: var(--danger-color); background: rgba(231, 76, 60, 0.08); }
.player-item.is-questioner { border-color: var(--success-color); background: rgba(46, 204, 113, 0.08); }
.player-item.has-passed { opacity: 0.6; }
.player-item.me { border-color: var(--primary-color); }
.player-item.selectable {
    cursor: pointer;
    border-color: var(--border-color);
}
.player-item.selectable:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateX(3px);
}

/* ---- Game Content Panel ---- */
.game-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
}

/* ---- Waiting Room (pre-game) ---- */
.waiting-room {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 20px;
    text-align: center;
    flex: 1;
}
.waiting-room .waiting-icon {
    width: 64px; height: 64px;
    color: var(--primary-color);
    opacity: 0.5;
}
.waiting-room h2 {
    font-size: 1.2rem;
    font-weight: 700;
}
.waiting-room p {
    font-size: 0.88rem;
    opacity: 0.55;
}
.waiting-room .player-count-badge {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
}
.waiting-room .start-btn-group {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* ---- Game Phase Displays ---- */
.game-phase {
    display: none;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    min-height: 0;
}
.game-phase.active { display: flex; }

.phase-header {
    text-align: center;
    padding: 8px 0;
}
.phase-header .phase-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2px;
}
.phase-header .phase-subtitle {
    font-size: 0.82rem;
    opacity: 0.55;
}

/* ---- Number Reveal (Playing phase) ---- */
.number-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}
.number-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    border-radius: var(--radius-sm);
    background: var(--secondary-color);
    border: 1.5px solid var(--border-color);
    transition: all var(--transition);
}
.number-card .num-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
}
.number-card .num-name {
    font-size: 0.78rem;
    opacity: 0.7;
}
.number-card.is-loser {
    border-color: var(--danger-color);
    background: rgba(231, 76, 60, 0.1);
    animation: loserPulse 1s ease infinite;
}
.number-card.is-loser .num-value { color: var(--danger-color); }

@keyframes loserPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
}

/* ---- Choosing Phase ---- */
.choose-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}
.choose-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 10px;
    border-radius: var(--radius-sm);
    background: var(--secondary-color);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition);
}
.choose-card:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
    transform: translateY(-2px);
}
.choose-card .choose-avatar {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
}
.choose-card .choose-name {
    font-size: 0.82rem;
    font-weight: 600;
}

/* ---- Question / Answer Display ---- */
.message-bubble {
    padding: 16px 20px;
    border-radius: var(--radius);
    background: var(--primary-light);
    border: 1px solid var(--primary-color);
    border-left: 4px solid var(--primary-color);
    font-size: 0.92rem;
    line-height: 1.7;
}
.message-bubble .msg-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.message-bubble.question-bubble {
    background: var(--secondary-color);
    border-left-color: var(--warning-color);
    border-color: var(--border-color);
}
.message-bubble.question-bubble .msg-label { color: var(--warning-color); }
.message-bubble.answer-bubble {
    background: rgba(46, 204, 113, 0.08);
    border-left-color: var(--success-color);
    border-color: var(--success-color);
}
.message-bubble.answer-bubble .msg-label { color: var(--success-color); }

/* ---- Input Area ---- */
.input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: auto;
}
.input-area .input-row {
    display: flex;
    gap: 8px;
}
.input-area .input-row .form-input { flex: 1; }
.input-area .input-hint {
    font-size: 0.75rem;
    opacity: 0.5;
    text-align: center;
}

/* ---- Voting Area ---- */
.voting-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px;
    text-align: center;
}
.voting-area .vote-count {
    font-size: 0.88rem;
    opacity: 0.6;
}
.voting-area .vote-count strong { color: var(--primary-color); }

/* ---- Pass Question Modal ---- */
.pass-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(3px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5000;
}
.pass-modal.active { display: flex; }
.pass-modal .pass-modal-box {
    background: var(--panel-color);
    border-radius: var(--radius);
    padding: 24px 26px 28px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
}
.pass-modal .pass-modal-box h3 {
    font-size: 1.05rem;
    margin-bottom: 14px;
    text-align: center;
}

/* ---- Round Transition ---- */
.round-transition {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 8000;
    animation: fadeIn 0.3s ease;
}
.round-transition.active { display: flex; }
.round-transition .round-card {
    background: var(--panel-color);
    border-radius: var(--radius);
    padding: 40px 48px;
    text-align: center;
    max-width: 400px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.3);
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.round-transition .round-card h2 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 6px;
}
.round-transition .round-card p {
    font-size: 0.92rem;
    opacity: 0.6;
    margin-bottom: 16px;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- Game Log / History ---- */
.game-log {
    max-height: 120px;
    overflow-y: auto;
    padding: 8px 0;
}
.game-log .log-entry {
    font-size: 0.78rem;
    padding: 4px 0;
    opacity: 0.65;
    border-bottom: 1px solid var(--border-color);
}
.game-log .log-entry:last-child { border-bottom: none; }
.game-log .log-entry .log-time {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    opacity: 0.5;
    margin-right: 6px;
}

/* ---- Leave Button ---- */
.leave-btn {
    color: var(--danger-color);
    background: transparent;
    border: 1.5px solid var(--danger-color);
    padding: 6px 14px;
    border-radius: var(--radius-lg);
    font-size: 0.78rem;
    font-weight: 600;
    transition: all var(--transition);
}
.leave-btn:hover { background: var(--danger-color); color: #fff; }

/* ---- Copy Toast ---- */
.copy-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: var(--success-color);
    color: #fff;
    padding: 8px 20px;
    border-radius: 24px;
    font-size: 0.82rem;
    font-weight: 600;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Responsive ---- */

/* Tablet and below */
@media (max-width: 900px) {
    .panel { padding: 14px 16px; }
}

@media (max-width: 820px) {
    .app-container { padding: 8px 10px; gap: 10px; }
    .lobby-hero h1 { font-size: 1.6rem; }
    .room-code-display .code-value { font-size: 1rem; }
    .room-header { flex-direction: column; align-items: center; text-align: center; gap: 6px; }
    .number-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
    .choose-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
    .reveal-box { padding: 24px 20px 28px; }
    .reveal-card { width: 64px; height: 90px; }
    .reveal-card-front { font-size: 1.6rem; }
    .reveal-card-back .reveal-number { font-size: 1.3rem; }
    .reveal-card-back .reveal-name { font-size: 0.5rem; }
    .round-card { padding: 32px 28px; }
    .round-card h2 { font-size: 1.5rem; }
    .message-bubble { padding: 12px 16px; }
    .login-box { padding: 24px 20px 28px; }
    .waiting-room { padding: 24px 16px; }
}

/* Mobile */
@media (max-width: 640px) {
    .app-container { padding: 6px 8px; gap: 8px; }
    .panel { padding: 12px 12px; border-radius: 12px; }
    .app-header { padding: 8px 12px; }
    .app-brand { font-size: 1rem; gap: 6px; }
    .app-brand small { display: none; }
    .header-controls { gap: 6px; }
    .user-badge { padding: 4px 10px 4px 8px; font-size: 0.75rem; }
    .user-badge .user-avatar { width: 24px; height: 24px; font-size: 0.65rem; }
    .lobby-hero { padding: 20px 14px; }
    .lobby-hero h1 { font-size: 1.4rem; }
    .lobby-hero p { font-size: 0.82rem; }
    .lobby-card { padding: 24px 16px; gap: 8px; }
    .lobby-card .card-icon { width: 36px; height: 36px; }
    .lobby-card h3 { font-size: 1rem; }
    .join-section { padding: 16px 14px; }
    .join-section .join-input-row { flex-direction: column; gap: 8px; }
    .join-section .join-input-row .form-input { font-size: 1rem; letter-spacing: 2px; }
    .join-section .join-input-row .btn { width: 100%; }
    .waiting-room { padding: 20px 12px; gap: 10px; }
    .waiting-room .waiting-icon { width: 48px; height: 48px; }
    .waiting-room h2 { font-size: 1rem; }
    .waiting-room .player-count-badge { font-size: 1.2rem; }
    .waiting-room .start-btn-group { flex-direction: column; width: 100%; }
    .waiting-room .start-btn-group .btn { width: 100%; }
    .game-area { gap: 8px; }
    .room-code-display .code-value { font-size: 0.9rem; padding: 3px 10px; letter-spacing: 2px; }
    .number-grid { gap: 6px; }
    .number-card { padding: 10px 6px; }
    .number-card .num-value { font-size: 1.5rem; }
    .number-card .num-name { font-size: 0.7rem; }
    .choose-grid { gap: 6px; }
    .choose-card { padding: 12px 8px; gap: 6px; }
    .choose-card .choose-avatar { width: 36px; height: 36px; font-size: 0.85rem; }
    .choose-card .choose-name { font-size: 0.75rem; }
    .phase-header .phase-title { font-size: 0.95rem; }
    .phase-header .phase-subtitle { font-size: 0.75rem; }
    .message-bubble { padding: 10px 12px; font-size: 0.85rem; }
    .message-bubble .msg-label { font-size: 0.65rem; }
    .input-area .input-row { gap: 6px; }
    .input-area .input-row .btn { flex: 1; font-size: 0.78rem; padding: 8px 10px; }
    .voting-area { padding: 10px; gap: 8px; }
    .voting-area .vote-count { font-size: 0.78rem; }
    .btn-lg { padding: 10px 20px; font-size: 0.88rem; }
    .game-log { max-height: 80px; }
    .game-log .log-entry { font-size: 0.7rem; padding: 3px 0; }
    .player-item { padding: 8px 10px; gap: 8px; }
    .player-item .player-avatar { width: 30px; height: 30px; font-size: 0.75rem; }
    .player-item .player-name { font-size: 0.8rem; }
    .player-item .player-number { font-size: 0.95rem; min-width: 24px; }
    .player-item .player-badge { font-size: 0.58rem; padding: 1px 6px; }
    .players-panel .panel-title { font-size: 0.85rem; }
    .players-panel .panel-title .title-icon { width: 16px; height: 16px; }
    .leave-btn { padding: 4px 10px; font-size: 0.7rem; }
}

/* Small mobile */
@media (max-width: 480px) {
    .app-container { padding: 4px 6px; gap: 6px; }
    .panel { padding: 10px 10px; border-radius: 10px; }
    .app-header { padding: 6px 10px; }
    .app-brand { font-size: 0.9rem; }
    .app-brand small { display: none; }
    .game-area { gap: 6px; }
    .number-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 5px; }
    .number-card { padding: 8px 4px; }
    .number-card .num-value { font-size: 1.3rem; }
    .choose-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 5px; }
    .choose-card { padding: 10px 6px; }
    .choose-card .choose-avatar { width: 32px; height: 32px; font-size: 0.75rem; }
    .reveal-box { padding: 16px 12px 20px; }
    .reveal-round-label { font-size: 0.7rem; }
    .reveal-title { font-size: 1rem; }
    .reveal-cards { gap: 6px; }
    .reveal-card { width: 48px; height: 72px; }
    .reveal-card-front { font-size: 1.2rem; border-radius: 8px; }
    .reveal-card-back .reveal-number { font-size: 1rem; }
    .reveal-card-back .reveal-name { font-size: 0.45rem; }
    .reveal-loser-text { font-size: 1.2rem; }
    .reveal-status { font-size: 0.75rem; min-height: 20px; }
    .round-card { padding: 20px 16px; }
    .round-card h2 { font-size: 1.2rem; }
    .round-card p { font-size: 0.8rem; }
    .pass-modal .pass-modal-box { padding: 18px 16px 22px; }
    .pass-modal .pass-modal-box h3 { font-size: 0.9rem; }
    .login-box { padding: 20px 16px 24px; }
    .login-box .login-icon { width: 36px; height: 36px; }
    .login-box h2 { font-size: 1rem; }
    .phase-header .phase-title { font-size: 0.85rem; }
    .message-bubble { padding: 8px 10px; font-size: 0.8rem; }
    .input-area .input-row { flex-direction: column; gap: 5px; }
    .input-area .input-row .btn { width: 100%; }
    .voting-area { padding: 8px; }
    .voting-area .btn-lg { width: 100%; }
    .player-item { padding: 6px 8px; gap: 6px; }
    .player-item .player-avatar { width: 26px; height: 26px; font-size: 0.65rem; }
    .player-item .player-name { font-size: 0.75rem; }
    .player-item .player-number { font-size: 0.85rem; min-width: 20px; }
    .room-code-display { flex-direction: column; gap: 2px; }
    .room-code-display .code-label { font-size: 0.7rem; }
    .room-code-display .code-value { font-size: 0.85rem; padding: 2px 8px; letter-spacing: 1px; }
    .leave-btn { padding: 3px 8px; font-size: 0.65rem; }
    .hegame-toast { padding: 8px 16px; font-size: 0.78rem; bottom: 50px; }
    .copy-toast { padding: 6px 14px; font-size: 0.75rem; }
}

/* Extra small screens */
@media (max-width: 360px) {
    .app-container { padding: 3px 4px; gap: 4px; }
    .panel { padding: 8px 8px; }
    .reveal-card { width: 40px; height: 60px; }
    .reveal-card-front { font-size: 1rem; }
    .reveal-card-back .reveal-number { font-size: 0.85rem; }
    .reveal-card-back .reveal-name { font-size: 0.38rem; }
    .number-grid { grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); }
    .number-card .num-value { font-size: 1.1rem; }
    .choose-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
}

/* ---- SVG Icon ---- */
.emoji-icon {
    display: inline;
    vertical-align: -0.2em;
    width: 0.85em;
    height: 0.85em;
    flex-shrink: 0;
}
.icon-lg { width: 1.2em; height: 1.2em; }
.icon-xl { width: 1.5em; height: 1.5em; }
.icon-xxl { width: 2.5em; height: 2.5em; }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-color); }

/* ================================================================
   CHAT SECTION
   ================================================================ */
.chat-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}
.chat-header {
    font-size: 0.82rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-color);
    opacity: 0.7;
    flex-shrink: 0;
}
.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
    padding: 2px 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}
.chat-empty {
    text-align: center;
    opacity: 0.4;
    padding: 16px;
    font-size: 0.78rem;
}
.chat-msg {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    animation: fadeIn 0.2s ease;
}
.chat-msg.mine { flex-direction: row-reverse; }
.chat-msg-avatar { flex-shrink: 0; }
.chat-avatar-img {
    width: 28px; height: 28px;
    border-radius: 50%;
    object-fit: cover;
}
.chat-avatar-letter {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
}
.chat-msg-body {
    max-width: 80%;
    background: var(--secondary-color);
    border-radius: 12px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
}
.chat-msg.mine .chat-msg-body {
    background: var(--primary-light);
    border-color: var(--primary-color);
}
.chat-msg-name {
    font-size: 0.68rem;
    font-weight: 600;
    margin-bottom: 2px;
    opacity: 0.6;
}
.chat-msg-time {
    font-size: 0.6rem;
    opacity: 0.4;
    margin-left: 4px;
    font-weight: 400;
}
.chat-msg-text {
    font-size: 0.82rem;
    line-height: 1.4;
    word-break: break-word;
}
.chat-input-row {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.chat-input {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    font-size: 0.82rem;
    border-radius: 20px;
}

/* ---- Avatar Images ---- */
.player-avatar-img {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.choose-avatar-img {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
}

/* ---- End Game Button ---- */
.end-game-btn {
    color: var(--warning-color);
    background: transparent;
    border: 1.5px solid var(--warning-color);
    padding: 6px 14px;
    border-radius: var(--radius-lg);
    font-size: 0.78rem;
    font-weight: 600;
    transition: all var(--transition);
}
.end-game-btn:hover { background: var(--warning-color); color: #fff; }

/* ---- Close Room Button ---- */
.close-room-btn {
    color: var(--danger-color);
    background: transparent;
    border: 1.5px solid var(--danger-color);
    padding: 6px 14px;
    border-radius: var(--radius-lg);
    font-size: 0.78rem;
    font-weight: 600;
    transition: all var(--transition);
}
.close-room-btn:hover { background: var(--danger-color); color: #fff; }

/* ---- Swipe Indicator ---- */
.swipe-indicator {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 8px;
    z-index: 500;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(4px);
}
.swipe-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    transition: all 0.3s;
    cursor: pointer;
}
.swipe-dot.active { background: #fff; width: 20px; border-radius: 4px; }
@media (max-width: 820px) {
    .swipe-indicator { display: flex; }
}

/* ---- Waiting Chooser Text ---- */
.waiting-chooser-text {
    text-align: center;
    padding: 24px;
    opacity: 0.5;
}

/* ---- Truth / Dare Buttons ---- */
.btn-truth {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: #fff;
    font-weight: 700;
    border: 2px solid transparent;
    transition: all var(--transition);
    box-shadow: 0 4px 16px rgba(74, 144, 226, 0.3);
}
.btn-truth:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(74, 144, 226, 0.4);
}
.btn-dare {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: #fff;
    font-weight: 700;
    border: 2px solid transparent;
    transition: all var(--transition);
    box-shadow: 0 4px 16px rgba(231, 76, 60, 0.3);
}
.btn-dare:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(231, 76, 60, 0.4);
}
.dark-mode .btn-truth {
    background: linear-gradient(135deg, #5b9cf5, #4a8ae0);
}
.dark-mode .btn-dare {
    background: linear-gradient(135deg, #ff5e7a, #e74c3c);
}

/* ---- Challenge Type Badge ---- */
.challenge-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    vertical-align: middle;
}
.challenge-badge.truth {
    background: rgba(74, 144, 226, 0.15);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}
.challenge-badge.dare {
    background: rgba(231, 76, 60, 0.12);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}
.challenge-badge .emoji-icon { width: 0.75em; height: 0.75em; }

/* ---- Dare Photo Upload ---- */
.dare-photo-thumb {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}
.dare-photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.dare-photo-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--danger-color);
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---- Photo Gallery (Voting Phase) ---- */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    padding: 8px 0;
}
.photo-gallery-item {
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1.5px solid var(--border-color);
    cursor: pointer;
    transition: all var(--transition);
    aspect-ratio: 1;
}
.photo-gallery-item:hover {
    border-color: var(--primary-color);
    transform: scale(1.03);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.photo-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ---- Photo View Modal ---- */
.photo-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.photo-modal.active { display: flex; }
.photo-modal-backdrop {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    cursor: pointer;
}
.photo-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    animation: scaleIn 0.3s ease;
}
.photo-modal-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.5);
    object-fit: contain;
}
.photo-modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 4px 8px;
}
.photo-modal-close:hover { opacity: 1; }

/* ---- Mobile Responsive for Dare ---- */
@media (max-width: 820px) {
    .btn-truth { font-size: 1rem !important; padding: 14px 24px !important; }
    .btn-dare { font-size: 1rem !important; padding: 14px 24px !important; }
    .dare-photo-thumb { width: 64px; height: 64px; }
    .photo-gallery { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}
@media (max-width: 480px) {
    .btn-truth { font-size: 0.9rem !important; padding: 12px 20px !important; }
    .btn-dare { font-size: 0.9rem !important; padding: 12px 20px !important; }
    .dare-photo-thumb { width: 56px; height: 56px; }
    .photo-gallery { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
}

/* ---- Desktop: 3-column layout with chat sidebar ---- */
@media (min-width: 821px) {
    .game-area {
        grid-template-columns: 260px 1fr 280px;
        grid-template-rows: 1fr;
        max-height: calc(100vh - 80px);
    }
    .players-panel { grid-column: 1; grid-row: 1; min-height: 0; overflow-y: auto; }
    .game-content { grid-column: 2; grid-row: 1; min-height: 0; overflow-y: auto; }
    .chat-section {
        grid-column: 3;
        grid-row: 1;
        min-height: 0;
        max-height: none;
        border-radius: var(--radius);
        padding: 16px 16px 14px;
        gap: 10px;
    }
    .chat-section .chat-header {
        font-size: 0.9rem;
        padding-bottom: 6px;
        border-bottom: 1px solid var(--border-color);
        opacity: 0.85;
    }
    .chat-section .chat-messages {
        flex: 1;
        min-height: 0;
        gap: 8px;
        padding: 4px 2px;
    }
    .chat-section .chat-input-row {
        padding-top: 4px;
        border-top: 1px solid var(--border-color);
        padding: 8px 0 0;
    }
    .chat-section .chat-input {
        padding: 9px 14px;
        font-size: 0.85rem;
    }
    .chat-section .chat-msg-body { max-width: 90%; }
    .chat-section .chat-empty { padding: 24px 8px; font-size: 0.82rem; }
    .chat-section .btn-sm { padding: 8px 18px; font-size: 0.82rem; }
}

/* ---- Mobile Responsive Swipe (Scroll Snap — like HeList) ---- */
@media (max-width: 820px) {
    .app-container {
        height: 100vh;
        min-height: 100vh;
    }
    .game-area {
        display: block;
        overflow: hidden;
        position: relative;
        height: 100%;
        min-height: 0;
        flex: 1;
        max-height: calc(100vh - 120px);
    }
    .game-area .game-swipe-wrapper {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        height: 100%;
        max-height: 100%;
        min-height: 0;
    }
    .game-area .game-swipe-wrapper::-webkit-scrollbar { display: none; }
    .game-area .swipe-page {
        flex: 0 0 100%;
        scroll-snap-align: start;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
        min-height: 0;
        height: 100%;
        max-height: 100%;
    }
    .game-area .swipe-page .panel {
        flex-shrink: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    .game-area .swipe-page .panel:first-child {
        border-top: none;
    }
    .game-area .game-swipe-wrapper > .chat-section {
        flex: 0 0 100%;
        scroll-snap-align: start;
        height: 100%;
        max-height: 100%;
        display: flex !important;
        position: static;
        overflow: hidden;
        border-radius: 0;
    }
    .waiting-chooser-text { padding: 16px 12px; font-size: 0.82rem; }
    .chat-msg-body { max-width: 90%; }
}

/* Small mobile */
@media (max-width: 480px) {
    .waiting-chooser-text { padding: 12px 8px; font-size: 0.78rem; }
    .player-avatar-img { width: 26px; height: 26px; }
    .choose-avatar-img { width: 32px; height: 32px; }
    .chat-avatar-img { width: 24px; height: 24px; }
    .chat-avatar-letter { width: 24px; height: 24px; font-size: 0.6rem; }
    .chat-msg-body { padding: 4px 10px; font-size: 0.78rem; }
    .chat-msg-name { font-size: 0.62rem; }
    .chat-input { padding: 6px 10px; font-size: 0.78rem; }
    .chat-section { max-height: 100%; }
}
