.game-container {
    width: min(96vw, var(--game-container-width));
    margin: 0 auto 24px;
}

.arena-layout {
    position: relative;
    display: grid;
    grid-template-columns: clamp(130px, 15vw, 180px) 1fr clamp(130px, 15vw, 180px);
    column-gap: clamp(14px, 3vw, 22px);
    align-items: stretch;
    min-height: 620px;
    padding: clamp(18px, 2.5vw, 28px);
    background: rgba(255, 255, 255, 0.96);
    border-radius: 28px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.25);
}

.players-rail {
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    gap: 14px;
    padding: 10px 6px;
    min-height: 100%;
}

.players-rail.right {
    align-items: flex-end;
}

.player-seat {
    position: relative;
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    border: 2px solid transparent;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.player-seat.active {
    border-color: #ffd166;
    box-shadow: 0 12px 30px rgba(255, 209, 102, 0.35);
    transform: translateX(2px);
}

.players-rail.right .player-seat.active {
    transform: translateX(-2px);
}

.player-avatar {
    width: 46px;
    height: 46px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    color: #2d1f4a;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.7), 0 8px 18px rgba(0, 0, 0, 0.15);
}

.player-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.player-name-rail {
    font-weight: 700;
    color: #2d1f4a;
}

.player-status-rail {
    font-size: 0.85em;
    color: #555;
}

.player-seat .hand-count {
    font-size: 0.9em;
    color: #6b6b6b;
}

.spectator-panel {
    margin-top: 10px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 2px dashed rgba(102, 126, 234, 0.45);
    background: rgba(247, 245, 255, 0.85);
    display: flex;
    gap: 10px;
    flex-direction: column;
}

.spectator-panel-header {
    font-weight: 700;
    color: #2d1f4a;
    margin-bottom: 4px;
}

.spectator-panel-desc {
    font-size: 0.88em;
    color: #4b4765;
    margin: 0 0 8px;
}

.spectator-section {
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.spectator-section-title {
    font-weight: 600;
    color: #3b2f5c;
}

.spectator-hands {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding-right: 4px;
}

.spectator-hand-row {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.spectator-player-name {
    font-weight: 600;
    color: #2d1f4a;
}

.spectator-hand-cards,
.spectator-deck {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.spectator-card {
    padding: 2px 6px;
    border-radius: 6px;
    background: #fff;
    border: 1px solid rgba(102, 126, 234, 0.4);
    font-size: 0.8em;
    color: #2d1f4a;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.spectator-deck {
    max-height: 120px;
    overflow-y: auto;
    padding-right: 4px;
}

.spectator-btn {
    margin-top: 8px;
    width: 100%;
}

.chat-dock.spectator-mode .chat-input textarea,
.chat-dock.spectator-mode .chat-input button {
    opacity: 0.5;
    cursor: not-allowed;
}

.player-bubble {
    position: absolute;
    top: 50%;
    left: calc(100% + 10px);
    transform: translateY(-50%);
    background: #fff5d9;
    border: 1px solid #ffd166;
    border-radius: 12px;
    padding: 8px 10px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    max-width: 200px;
    font-size: 0.9em;
    animation: bubble-pop 0.25s ease, bubble-fade 4s forwards;
    pointer-events: none;
}

.players-rail.right .player-bubble {
    left: auto;
    right: calc(100% + 10px);
}

@keyframes bubble-pop {
    from { transform: translateY(-50%) scale(0.8); opacity: 0; }
    to { transform: translateY(-50%) scale(1); opacity: 1; }
}

@keyframes bubble-fade {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; }
}

.arena-center {
    position: relative;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: visible;
    min-width: 0;
}

.board-top {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    flex-wrap: wrap;
}

.round-chip {
    background: #2d1f4a;
    color: #fff;
    padding: 10px 16px;
    border-radius: 14px;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 10px 20px rgba(45, 31, 74, 0.25);
}

.round-pool-pill {
    background: #f5f0ff;
    color: #3b2f5c;
    padding: 10px 14px;
    border-radius: 12px;
    border: 2px dashed rgba(102, 126, 234, 0.5);
    flex: 1;
    min-width: 240px;
}

.badge-timer {
    margin-left: auto;
}

.table-stage {
    position: relative;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: radial-gradient(circle at 50% 40%, rgba(255, 242, 199, 0.6), rgba(255, 255, 255, 0));
    border-radius: 18px;
}

.animation-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
    z-index: 4;
}

.center-table {
    position: relative;
    z-index: 2;
    width: min(460px, 90%);
    min-height: 220px;
    border-radius: 22px;
    background: linear-gradient(135deg, #fffaf1 0%, #f3edff 100%);
    border: 3px dashed rgba(102, 126, 234, 0.35);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    padding: 16px;
}

.table-label {
    position: absolute;
    top: 12px;
    right: 16px;
    color: #7a6da7;
    font-weight: 700;
    font-size: 0.95em;
}

.table-cards {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.table-card {
    padding: 12px 14px;
    background: #fff;
    border-radius: 10px;
    border: 2px solid #ffd166;
    min-width: 60px;
    text-align: center;
    font-weight: 800;
    color: #2d1f4a;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
}

.table-meta {
    color: #7a6da7;
    font-weight: 600;
}

.flying-card {
    position: absolute;
    background: #fff;
    border: 2px solid #ffd166;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 700;
    color: #2d1f4a;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.95;
    transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.5s ease;
}

.flying-card.fly {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1);
    opacity: 0.2;
}

.score-strip {
    display: none;
}

.score-item {
    min-width: 130px;
    padding: 10px 12px;
    background: #f6f7ff;
    border-radius: 12px;
    text-align: center;
    box-shadow: inset 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.score-item span:first-child {
    font-weight: 700;
    color: #2d1f4a;
}

.score-item span.current-player {
    color: #ff6b6b;
    font-weight: 800;
    animation: pulse-glow 1.5s infinite;
}

@keyframes pulse-glow {
    0%, 100% { text-shadow: 0 0 6px rgba(255, 107, 107, 0.4); }
    50% { text-shadow: 0 0 16px rgba(255, 107, 107, 0.9); }
}

.score-item span:last-child {
    font-size: 1.2em;
    font-weight: 700;
    color: #667eea;
}

.history-strip {
    background: #f8f8ff;
    border-radius: 16px;
    padding: 10px 12px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.history-title {
    font-weight: 700;
    color: #2d1f4a;
    margin-bottom: 8px;
}

.play-history-list {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    max-height: none;
}

.play-history-list.compact .play-history-item {
    margin: 0;
}

.play-history-item {
    flex: 0 0 160px;
    min-width: 140px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    font-size: 0.85em;
}

.play-history-item.player-action {
    border-left-color: #28a745;
    background: #d4edda;
}

.play-history-item.skip-action {
    border-left-color: #ffc107;
    background: #fff3cd;
}

.play-history-item .player-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.play-history-item .action-type {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 4px;
}

.play-history-item .cards-display {
    font-family: monospace;
    background: white;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
    display: inline-block;
    font-weight: 600;
}

.chat-dock {
    width: 320px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}

.chat-header {
    font-weight: 700;
    color: #2d1f4a;
}

.chat-messages {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 120px;
    background: #f7f8ff;
    border-radius: 12px;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

.chat-message {
    padding: 10px 12px;
    border-radius: 12px;
    background: #f3f4ff;
    border: 1px solid #e0e2ff;
    font-size: 0.9em;
    color: #333;
    max-width: 100%;
}

.chat-message.self {
    background: #e0f7e9;
    border-color: #b3e2c5;
    align-self: flex-end;
}

.chat-message .chat-meta {
    font-size: 0.75em;
    color: #666;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.chat-message .chat-text {
    word-break: break-word;
    white-space: pre-wrap;
}

.chat-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

.chat-input textarea {
    resize: none;
    border: 1px solid #d5d5d5;
    border-radius: 10px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 0.95em;
    min-height: 60px;
}

.chat-input textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.chat-input .btn {
    width: 100%;
}

.chat-action-row {
    display: flex;
    gap: 10px;
}

.chat-action-row .btn {
    flex: 1;
    width: auto;
}

.quick-message-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    border: 1px solid #d5d5d5;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    max-height: 190px;
    overflow-y: auto;
    font-size: 0.9em;
}

.quick-message-list[hidden] {
    display: none;
}

.quick-message-item {
    border: none;
    border-radius: 8px;
    padding: 8px 10px;
    text-align: left;
    background: #f3f4ff;
    color: #2d1f4a;
    cursor: pointer;
    transition: background 0.2s ease;
    font: inherit;
}

.quick-message-item:hover {
    background: #e0e7ff;
}

.quick-message-empty {
    text-align: center;
    color: #666;
    font-size: 0.85em;
}

.chat-floating-bubble {
    position: fixed;
    left: 24px;
    top: calc(50% - 28px);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
    cursor: grab;
    z-index: 60;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.chat-floating-bubble:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

.chat-floating-bubble.dragging {
    cursor: grabbing;
    box-shadow: 0 20px 35px rgba(0, 0, 0, 0.35);
}

.chat-floating-bubble.active {
    box-shadow: 0 18px 36px rgba(118, 75, 162, 0.45);
}

.bottom-band {
    position: relative;
    display: flex;
    gap: 20px;
    align-items: flex-end;
    justify-content: center;
    flex-wrap: wrap;
    overflow: visible;
    z-index: 30;
}

.hand-section {
    flex: 1;
    width: 100%;
    max-width: min(680px, 95vw);
    min-width: min(480px, 90vw);
    background: rgba(255, 255, 255, 0.95);
    border-radius: 18px;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.18);
    padding: 14px 16px 18px;
    position: relative;
    overflow: visible;
    margin: 0 auto;
    z-index: 40;
}

.hand-label {
    text-align: center;
    font-weight: 800;
    color: #2d1f4a;
    margin-bottom: 10px;
}

.hand-cards {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 4px auto 14px;
    min-height: 90px;
    padding-top: 18px;
    overflow: visible;
    z-index: 3;
}

.hand-cards.rail {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 6px;
}

.card-item {
    position: relative;
    width: 70px;
    height: 96px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.2s;
    user-select: none;
    transform-origin: center bottom;
    z-index: 45;
}

.card-item:hover {
    border-color: #ffca3a;
    transform: translateY(-16px);
    box-shadow: 0 10px 24px rgba(102, 126, 234, 0.25);
    z-index: 50;
}

.card-item.selected {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-20px) scale(1.03);
    box-shadow: 0 12px 28px rgba(102, 126, 234, 0.35);
    z-index: 60;
}

.card-item.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    filter: grayscale(40%);
    transform: none;
    box-shadow: none;
}

.play-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 10px;
}

.play-actions .btn {
    min-width: 120px;
}

.player-bubble.self-bubble {
    left: 50%;
    transform: translate(-50%, -130%);
    right: auto;
}

.timer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
}

.timer-circle {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 1.8em;
    font-weight: bold;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    animation: pulse 1s infinite;
}

.timer-circle.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: pulse-fast 0.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes pulse-fast {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.choice-section {
    text-align: center;
}

.choice-prompt {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #333;
}

.choices {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.choice-btn {
    flex: 1;
    min-width: 120px;
    padding: 20px;
    border: 3px solid #e0e0e0;
    border-radius: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.choice-btn:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.3);
}

.choice-btn:active {
    transform: translateY(-2px);
}

.choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.choice-btn.selected {
    border-color: #667eea;
    background: #f0f4ff;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.choice-btn .emoji {
    font-size: 3em;
}

.choice-btn span:last-child {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.result-display {
    text-align: center;
    margin-top: 30px;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 15px;
}

.result-display h3 {
    margin-bottom: 20px;
    color: #333;
}

.choices-display {
    display: flex;
    justify-content: space-around;
    margin: 20px 0;
}

.choice-display-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.choice-emoji {
    font-size: 4em;
}

#resultMessage {
    margin-top: 15px;
    font-size: 1.2em;
    font-weight: 600;
    color: #667eea;
}

.winner-display {
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    color: white;
    font-size: 1.5em;
    font-weight: bold;
}

.final-scores {
    margin: 30px 0;
    display: flex;
    justify-content: space-around;
}

.final-score-item {
    text-align: center;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 10px;
    min-width: 150px;
}

.final-score-item span:first-child {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
}

.final-score-item span:last-child {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
}

.game-info {
    margin: 0;
    text-align: center;
}

.win-condition-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.win-condition-display h4 {
    margin: 0 0 8px 0;
    font-size: 1.1em;
}

.win-condition-display p {
    margin: 0;
    font-size: 0.9em;
    opacity: 0.9;
}

@media (min-width: 821px) {
    #chatDock {
        position: fixed;
        width: min(320px, 90vw);
        max-height: min(480px, 80vh);
        overflow: hidden;
        z-index: 55;
        display: none;
        box-shadow: 0 16px 35px rgba(0, 0, 0, 0.28);
    }

    #chatDock.chat-visible {
        display: flex;
    }

    #chatDock .chat-messages {
        max-height: calc(80vh - 170px);
    }

    #gameScreen .chat-floating-bubble {
        display: flex;
    }
}

@media (max-width: 820px) {
    #chatDock {
        position: static;
    }

    .chat-floating-bubble {
        display: none !important;
    }
}
