* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #0f5132 0%, #198754 100%);
    color: white;
    min-height: 100vh;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Welcome Screen */
#welcome-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f5132 0%, #198754 100%);
    z-index: 2000;
    transition: opacity 0.5s ease-out;
}

.welcome-content {
    text-align: center;
    animation: fadeInUp 1s ease-out;
}

.welcome-content h1 {
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    animation: pulse 2s infinite;
}

.welcome-content p {
    font-size: 1.3em;
    margin-bottom: 40px;
    opacity: 0.9;
}

.welcome-animation {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.card-icon {
    font-size: 3em;
    animation: bounce 2s infinite;
    animation-delay: var(--delay, 0s);
}

.card-icon:nth-child(1) { --delay: 0s; color: #333; }
.card-icon:nth-child(2) { --delay: 0.2s; color: #dc3545; }
.card-icon:nth-child(3) { --delay: 0.4s; color: #dc3545; }
.card-icon:nth-child(4) { --delay: 0.6s; color: #333; }

#start-button, #resume-button {
    margin: 30px auto 0 auto;
    padding: 15px 30px;
    font-size: 1.2em;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: fadeInUp 1s ease-out 2s both;
    display: block;
    text-align: center;
}

#start-button {
    background: #28a745;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

#start-button:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

#resume-button {
    background: #007bff;
    box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
    margin-top: 10px;
}

#resume-button:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 123, 255, 0.4);
}

.welcome-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.welcome-buttons button {
    padding: 10px 20px;
    font-size: 0.9em;
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(23, 162, 184, 0.3);
    animation: fadeInUp 1s ease-out 2.5s both;
}

.welcome-buttons button:hover {
    background: #138496;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.4);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

#game-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 260px; /* Espaço para player-area + controles */
    position: relative;
    height: calc(100vh - 40px);
}

#header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

#header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#game-info {
    display: none;
    justify-content: center;
    gap: 30px;
    font-size: 1.1em;
}

#table {
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: auto;
    z-index: 50;
}

#center-pile {
    display: flex;
    gap: 30px;
    align-items: center;
}

#discard-pile {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#discard-stack {
    position: relative;
    width: 80px;
    height: 120px;
    margin-bottom: 10px;
}

.pile-label {
    font-size: 0.9em;
    color: rgba(255,255,255,0.8);
    text-align: center;
}

.discard-card {
    position: absolute;
    width: 80px;
    height: 120px;
    background: white;
    border: 2px solid #333;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1em;
    transform-origin: center;
    transition: transform 0.5s ease-out, opacity 0.3s ease-out; /* Simplified transitions */
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    will-change: transform, opacity; /* Optimize for animation */
}

.discard-card.red {
    color: #dc3545;
}

.discard-card:not(.red) {
    color: #333;
}

.discard-card.animating {
    z-index: 1000;
}

.player-indicator {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    white-space: nowrap;
}

.card {
    width: 50px;
    height: 80px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease-out;
    color: #333;
    font-weight: bold;
    font-size: 1.1em;
    will-change: transform; /* Optimize for animation */
    backface-visibility: hidden; /* Prevent flickering */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.card:hover {
    transform: translate3d(0, -5px, 0); /* Use 3D transform for GPU acceleration */
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.card.red {
    color: #dc3545;
}

.card.playable {
    box-shadow: 0 0 15px #ffd700;
    border-color: #ffd700;
}

.card.selectable {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card.selectable:hover {
    transform: translateY(-3px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.card.selected {
    transform: translate3d(0, -10px, 0) scale(1.05); /* Use 3D transform */
    box-shadow: 0 8px 25px rgba(0, 255, 0, 0.6), 0 0 0 3px #00ff00;
    border-color: #00ff00;
    border-width: 3px;
    z-index: 10;
}

.card-back {
    width: 80px;
    height: 120px;
    background: #003d82;
    border: 2px solid #333;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8em;
    text-align: center;
}

.rank {
    font-size: 1.2em;
    font-weight: bold;
}

.suit {
    font-size: 1.5em;
    margin-top: 5px;
}

#player-area {
    margin: 0;
    text-align: center;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: transparent;
    padding: 20px;
    z-index: 100;
    transition: all 0.3s ease;
}

/* Sinalização quando é a vez do jogador - sem animação */
#player-area.player-turn {
    background: rgba(255, 215, 0, 0.1);
    border: 3px solid #ffd700;
    border-radius: 15px;
    padding: 20px;
}

#player-area.player-turn::before {
    content: "🎯 SUA VEZ!";
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffd700;
    color: #333;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9em;
}

/* Sistema de Medalhas de Ranking */
.player-medal {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8em;
    text-align: center;
    line-height: 1.2;
    z-index: 10;
    border: 3px solid;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

/* Medalha Presidente - Ouro */
.player-medal.presidente {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #333;
    border-color: #B8860B;
}

.player-medal.presidente::before {
    content: "1º";
}

/* Medalha Vice-Presidente - Prata */
.player-medal.vice-presidente {
    background: linear-gradient(45deg, #C0C0C0, #A8A8A8);
    color: #333;
    border-color: #808080;
}

.player-medal.vice-presidente::before {
    content: "2º";
}

/* Medalha Vice-Olho - Bronze */
.player-medal.vice-olho {
    background: linear-gradient(45deg, #CD7F32, #B87333);
    color: white;
    border-color: #8B4513;
}

.player-medal.vice-olho::before {
    content: "3º";
}

/* Medalha Olho do Cu - Cinza/Vermelho */
.player-medal.olho-cu {
    background: linear-gradient(45deg, #696969, #DC143C);
    color: white;
    border-color: #2F4F4F;
}

.player-medal.olho-cu::before {
    content: "4º";
}

/* Animação de entrada da medalha */
.player-medal.show {
    animation: medalShow 0.6s ease-out;
}

@keyframes medalShow {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Medalhas responsivas */
@media (max-width: 768px) {
    .player-medal {
        width: 50px;
        height: 50px;
        font-size: 0.7em;
        top: -12px;
        right: -12px;
    }
}

@media (max-width: 480px) {
    .player-medal {
        width: 45px;
        height: 45px;
        font-size: 0.6em;
        top: -10px;
        right: -10px;
    }
}

/* Título das cartas do jogador - ao lado dos controles */
#player-cards-title {
    display: inline-block;
    margin-right: 20px;
    font-size: 1em;
    font-weight: bold;
    color: #ffd700;
    align-self: center;
}

#hand-cards {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

#game-controls {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

button {
    padding: 12px 24px;
    font-size: 1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px; /* Minimum touch target size */
    min-width: 44px;
}

.card-placeholder {
    width: 160px;
    height: 120px;
    background: rgba(255,255,255,0.2);
    border: 2px dashed #fff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1em;
    text-align: center;
}

.sequence-info {
    width: 160px;
    height: 120px;
    background: rgba(255,215,0,0.3);
    border: 2px solid #ffd700;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9em;
}

.play-message {
    width: 160px;
    height: 120px;
    background: rgba(0,123,255,0.3);
    border: 2px solid #007bff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9em;
    text-align: center;
    padding: 10px;
}

.message-content {
    line-height: 1.4;
}
    text-align: center;
    font-weight: bold;
}

#pass-turn {
    background: #6c757d;
    color: white;
    padding: 12px 24px;
    font-size: 1em;
    min-width: 120px;
    min-height: 44px;
    border: none;
    border-radius: 8px;
    box-sizing: border-box;
}

#pass-turn:hover {
    background: #5a6268;
}

#new-game {
    background: #28a745;
    color: white;
    padding: 12px 24px;
    font-size: 1em;
    min-width: 120px;
    min-height: 44px;
    border: none;
    border-radius: 8px;
    box-sizing: border-box;
    display: none; /* Hidden during matches */
}

#new-game:hover {
    background: #218838;
}

#end-session {
    background: #dc3545;
    color: white;
    padding: 12px 24px;
    font-size: 1em;
    min-width: 120px;
    min-height: 44px;
    border: none;
    border-radius: 8px;
    box-sizing: border-box;
}

#end-session:hover {
    background: #c82333;
}

#play-cards {
    background: #007bff;
    color: white;
    padding: 12px 24px;
    font-size: 1em;
    min-width: 120px;
    min-height: 44px;
    border: none;
    border-radius: 8px;
    box-sizing: border-box;
}

#play-cards:hover {
    background: #0056b3;
}

#clear-selection {
    background: #ffc107;
    color: #333;
    padding: 12px 24px;
    font-size: 1em;
    min-width: 120px;
    min-height: 44px;
    border: none;
    border-radius: 8px;
    box-sizing: border-box;
}

#clear-selection:hover {
    background: #ffb300;
}

#table {
    position: relative;
}

.opponent {
    position: absolute;
    width: 200px;
    text-align: center;
}

/* Positioning for opponents */
.opponent-left {
    left: 20px;
    top: 50%;
    transform: translateY(-50%) rotate(90deg);
}

.opponent-top {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1; /* Ensure it's above other elements */
    margin-bottom: 20px; /* Extra space to prevent overlap */
}

.opponent-right {
    right: 20px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
}

.opponent {
    background: rgba(255,255,255,0.1);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 2px solid rgba(255,255,255,0.1);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.opponent-played-cards {
    position: relative;
    height: 45px;
    margin-top: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    overflow: visible;
}

.opponent-card {
    width: 25px;
    height: 35px;
    background: white;
    border: 1px solid #333;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 0.6em;
    font-weight: bold;
    position: relative;
    transform-origin: center;
    transition: all 0.3s ease-in-out;
}

.opponent-card.red {
    color: #dc3545;
}

.opponent-card:not(.red) {
    color: #333;
}

.opponent-card .rank {
    font-size: 0.8em;
}

.opponent-card .suit {
    font-size: 1em;
    margin-top: 2px;
}

/* Card back styles */
.opponent-card.card-back {
    background: linear-gradient(45deg, #dc3545, #c82333);
    color: white;
    border: 2px solid #721c24;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
}

.card-back-pattern {
    font-size: 0.6em;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.7);
    letter-spacing: 0.5px;
    font-weight: bold;
}

.opponent-hand-card {
    position: absolute;
    transition: transform 0.3s ease;
}

.opponent-hand-card:hover {
    transform: translateY(-5px) !important;
}



.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

.modal-content {
    background: white;
    color: #333;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
}

.modal-content h2 {
    margin-bottom: 20px;
    color: #28a745;
}

.modal-buttons {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-content button {
    background: #28a745;
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
}

.modal-content button:hover {
    background: #218838;
}

.modal-content button:first-child {
    background: #007bff;
}

.modal-content button:first-child:hover {
    background: #0056b3;
}

/* Tutorial Styles */
.tutorial-content {
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.tutorial-step {
    text-align: left;
    margin: 20px 0;
}

.tutorial-step h3 {
    color: #28a745;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.tutorial-step p {
    margin: 10px 0;
    line-height: 1.6;
}

.card-hierarchy {
    font-family: monospace;
    background: rgba(0,0,0,0.1);
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    color: #ffd700;
}

.tutorial-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.1);
}

#tutorial-progress {
    font-weight: bold;
    color: #666;
}

/* Side Panels */
.side-panel {
    position: fixed;
    top: 20px;
    right: -320px;
    width: 300px;
    height: calc(100vh - 40px);
    background: rgba(15, 81, 50, 0.95);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 10px 0 0 10px;
    transition: transform 0.3s ease; /* Use transform instead of right for better performance */
    transform: translateX(0);
    z-index: 100;
    backdrop-filter: blur(10px);
    will-change: transform;
}

.side-panel.open {
    transform: translateX(-320px); /* Use transform for smooth animation */
}

.panel-header {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    margin: 0;
    color: white;
    font-size: 1.1em;
}

.panel-header button {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
}

.panel-header button:hover {
    background: rgba(255,255,255,0.2);
}

/* History Panel */
#history-content {
    padding: 15px;
    height: calc(100% - 60px);
    overflow-y: auto;
}

.history-empty {
    color: rgba(255,255,255,0.6);
    text-align: center;
    margin-top: 50px;
    font-style: italic;
}

.history-item {
    background: rgba(255,255,255,0.1);
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
    border-left: 3px solid #ffd700;
}

.history-player {
    font-weight: bold;
    color: #ffd700;
}

.history-action {
    color: white;
    margin-top: 3px;
}

.history-time {
    font-size: 0.8em;
    color: rgba(255,255,255,0.6);
    float: right;
}

/* Statistics Panel */
#stats-content {
    padding: 15px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.stat-label {
    color: white;
}

.stat-value {
    color: #ffd700;
    font-weight: bold;
}

/* Hamburger Menu */
#hamburger-menu {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

#hamburger-btn {
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 15px;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(23, 162, 184, 0.3);
}

#hamburger-btn:hover {
    background: #138496;
    transform: scale(1.05);
}

.hamburger-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(15, 81, 50, 0.95);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 10px;
    padding: 10px;
    min-width: 180px;
    display: none;
    flex-direction: column;
    gap: 8px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    margin-top: 5px;
}

.hamburger-dropdown.show {
    display: flex;
}

.hamburger-dropdown button {
    background: #17a2b8;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 15px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    width: 100%;
}

.hamburger-dropdown button:hover {
    background: #138496;
    transform: translateX(3px);
}

/* History and Statistics Modals */
#history-modal .modal-content {
    max-width: 500px;
    max-height: 70vh;
    overflow-y: auto;
}

#stats-modal .modal-content {
    max-width: 98vw;
    max-height: 98vh;
    width: 1400px;
    overflow-y: auto;
    margin: 10px;
}

#history-modal-content,
#stats-modal-content {
    margin: 20px 0;
    text-align: left;
}

.history-item {
    background: rgba(0,0,0,0.05);
    padding: 10px;
    margin: 8px 0;
    border-radius: 5px;
    border-left: 3px solid #ffd700;
}

.history-player {
    font-weight: bold;
    color: #28a745;
    margin-bottom: 3px;
}

.history-action {
    color: #333;
    margin-bottom: 3px;
}

.history-time {
    font-size: 0.8em;
    color: #666;
    float: right;
}

.history-empty {
    text-align: center;
    color: #666;
    font-style: italic;
    padding: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.stat-label {
    color: white;
    font-weight: 500;
}

.stat-value {
    color: #28a745;
    font-weight: bold;
}

/* Card Exchange Modal */
#card-exchange-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3500;
}

.exchange-content {
    background: white;
    color: #333;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    margin: 20px;
}

#exchange-player-cards {
    margin: 20px 0;
}

#exchange-hand-cards {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 15px 0;
    min-height: 120px;
}

.exchange-card {
    width: 70px;
    height: 100px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    font-size: 0.9em;
    color: black;
}

.exchange-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.exchange-card.red {
    color: #dc3545;
}

.exchange-card.selected-for-exchange {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 165, 0, 0.6), 0 0 0 3px #ffa500;
    border-color: #ffa500;
    border-width: 3px;
}

#exchange-selection-info {
    background: rgba(0,0,0,0.05);
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

#selection-count {
    font-weight: bold;
    color: #28a745;
    margin-bottom: 5px;
}

#exchange-rule-text {
    font-size: 0.9em;
    color: #666;
    font-style: italic;
}

#confirm-exchange:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#auto-exchange {
    background: #ffc107;
    color: #333;
}

#auto-exchange:hover {
    background: #ffb300;
}

/* Game Mode Selection Modal */
#game-mode-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
}

#game-mode-modal .modal-content {
    background: white;
    color: #333;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
}

.game-mode-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 20px 0;
    max-height: 60vh;
    overflow-y: auto;
}

.game-mode-option {
    background: rgba(0,0,0,0.05);
    border: 2px solid rgba(40, 167, 69, 0.3);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.game-mode-option:hover {
    background: rgba(40, 167, 69, 0.1);
    border-color: #28a745;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.2);
}

.game-mode-option h3 {
    color: #28a745;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.game-mode-option p {
    margin-bottom: 15px;
    color: #666;
    line-height: 1.4;
}

.game-mode-option ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.game-mode-option li {
    color: #555;
    margin: 8px 0;
    padding-left: 20px;
    position: relative;
    font-size: 0.9em;
}

.game-mode-option li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #28a745;
    font-weight: bold;
}

/* Practice Mode Hints */
.practice-hint {
    box-shadow: 0 0 15px #00ff88 !important;
    border-color: #00ff88 !important;
    border-width: 2px !important;
}

.practice-hint:after {
    content: "JOGÁVEL";
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    background: #00ff88;
    color: #333;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.6em;
    font-weight: bold;
    white-space: nowrap;
}

/* Tablet and medium screens optimization */
@media (min-width: 769px) and (max-width: 1199px) {
    #game-container {
        max-width: 1000px;
        padding: 25px;
        padding-bottom: 260px;
        position: relative;
        height: calc(100vh - 50px);
    }
    
    #header h1 {
        font-size: 2.2em;
    }
    
    #game-info {
        display: flex;
        font-size: 1.1em;
        gap: 40px;
    }
    
    .card {
        width: 65px;
        height: 105px;
        font-size: 1.1em;
    }
    
    .discard-card {
        width: 85px;
        height: 125px;
        font-size: 1.1em;
    }
    
    .card-placeholder, .sequence-info, .play-message {
        width: 170px;
        height: 125px;
        font-size: 1em;
    }
    
    button {
        padding: 14px 28px;
        font-size: 1.05em;
    }
    
    .opponent {
        width: 220px;
        padding: 18px;
    }
    
    .opponent-top {
        top: 12px;
    }
    
    .opponent-left {
        left: 30px;
    }
    
    .opponent-right {
        right: 30px;
    }
}

/* Responsive typography scaling */
@media (min-width: 400px) {
    body {
        font-size: 16px;
    }
}

@media (min-width: 600px) {
    body {
        font-size: 17px;
    }
}

@media (min-width: 900px) {
    body {
        font-size: 18px;
    }
}

@media (min-width: 1200px) {
    body {
        font-size: 19px;
    }
}

/* Enhanced tablet landscape */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    #game-container {
        padding: 15px;
    }
    
    #header {
        margin-bottom: 20px;
    }
    
    #header h1 {
        font-size: 1.8em;
        margin-bottom: 10px;
    }
    
    #table {
        /* Centered positioning maintained */
    }
    
    .opponent-top {
        top: 8px;
    }
    
    #center-pile {
        gap: 25px;
    }
    
    #game-controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        margin: 20px 0;
    }
    
    button {
        min-width: 140px;
        font-size: 0.95em;
        padding: 12px 20px;
    }
    
    .opponent {
        width: 180px;
        padding: 12px;
    }
    
    .opponent-left {
        left: 15px;
    }
    
    .opponent-right {
        right: 15px;
    }
    
    /* Optimize side panels for landscape tablets */
    .side-panel {
        width: 50%;
        right: -50%;
    }
    
    .side-panel.open {
        transform: translateX(-50%);
    }
}


@media (max-width: 768px) {
    #game-container {
        padding: 5px;
        max-width: 100%;
        padding-bottom: 200px; /* Espaço para área do jogador fixa */
    }
    
    #header h1 {
        font-size: 1.8em;
        margin-bottom: 5px;
    }
    
    #game-info {
        flex-direction: column;
        gap: 8px;
        font-size: 1em;
    }
    
    #table {
        /* Centered positioning maintained */
    }
    
    .opponent-top {
        top: 5px;
        width: 140px;
        padding: 6px;
        font-size: 0.8em;
    }
    
    .opponent-left {
        left: 5px;
        width: 120px;
        padding: 6px;
        font-size: 0.8em;
        top: 40%;
    }
    
    .opponent-right {
        right: 5px;
        width: 120px;
        padding: 6px;
        font-size: 0.8em;
        top: 40%;
    }
    
    #center-pile {
        flex-direction: column;
        gap: 15px;
    }
    
    #discard-stack {
        width: 70px;
        height: 100px;
    }
    
    .discard-card {
        width: 70px;
        height: 100px;
        font-size: 1em;
    }
    
    .card-placeholder, .sequence-info, .play-message {
        width: 140px;
        height: 100px;
        font-size: 0.8em;
    }
    
    #hand-cards {
        gap: 3px;
        margin: 15px 0;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .card {
        width: 45px;
        height: 70px;
        font-size: 0.75em;
    }
    
    .card .rank {
        font-size: 1em;
    }
    
    .card .suit {
        font-size: 1.2em;
        margin-top: 3px;
    }
    
    #game-controls {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 8px;
        margin: 15px 0;
        flex-wrap: wrap;
    }
    
    button {
        width: auto;
        min-width: 80px;
        padding: 10px 16px;
        font-size: 0.9em;
    }
    
    #opponents {
        grid-template-columns: 1fr;
        gap: 10px;
        margin: 20px 0;
    }
    
    /* Ajustar sinalização para mobile */
    #player-area {
        padding: 8px;
        bottom: 35px; /* Menos espaço para controles menores */
    }
    
    #player-area.player-turn {
        padding: 8px;
        bottom: 35px;
    }
    
    /* Game controls ajustados para mobile */
    #game-controls {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 6px;
        margin: 8px 0;
        flex-wrap: wrap;
    }
    
    /* Título em primeira linha no mobile */
    #player-cards-title {
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
        order: -1;
    }
    
    #game-controls button {
        padding: 6px 12px;
        font-size: 0.75em;
        min-width: 70px;
        border-radius: 4px;
        min-height: 32px;
    }
    
    #player-area.player-turn::before {
        font-size: 0.7em;
        padding: 3px 10px;
        top: -10px;
    }
    
    /* Título das cartas em mobile */
    #player-cards-title {
        font-size: 0.9em;
        margin-right: 15px;
    }
    
    .opponent {
        padding: 10px;
    }
    
    .opponent h4 {
        font-size: 0.9em;
    }
    
    .opponent-played-cards {
        height: 50px;
    }
    
    .opponent-card {
        width: 35px;
        height: 50px;
        font-size: 0.6em;
    }
    
    #rankings {
        padding: 15px;
        margin-top: 20px;
    }
    
    #rankings h3 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
    
    #rank-list li {
        font-size: 1em;
        padding: 3px 0;
    }
    
    /* Modal adjustments for mobile */
    .modal-content {
        padding: 20px;
        margin: 10px;
        max-width: 90%;
        max-height: 80vh;
        overflow-y: auto;
    }
    
    .tutorial-content {
        max-height: 70vh;
    }
    
    #game-mode-modal .modal-content {
        padding: 20px;
        margin: 10px;
        max-width: 95%;
    }
    
    .game-mode-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        max-height: 50vh;
    }
    
    .game-mode-option {
        padding: 15px;
    }
    
    .game-mode-option h3 {
        font-size: 1.1em;
    }
    
    .game-mode-option p {
        font-size: 0.9em;
    }
    
    .game-mode-option li {
        font-size: 0.8em;
    }
    
    /* Side panels for mobile */
    .side-panel {
        width: 100%;
        right: -100%;
        top: 0;
        height: 100vh;
        border-radius: 0;
    }
    
    .side-panel.open {
        transform: translateX(-100%);
    }
    
    /* Practice hints for mobile */
    .practice-hint:after {
        font-size: 0.5em;
        padding: 1px 4px;
        top: -15px;
    }
    
    /* Card Exchange Modal for mobile */
    .exchange-content {
        padding: 20px;
        margin: 10px;
        max-width: 95%;
        max-height: 85vh;
    }
    
    .exchange-card {
        width: 60px;
        height: 85px;
        font-size: 0.8em;
    }
    
    #exchange-hand-cards {
        gap: 8px;
        min-height: 100px;
    }
    
    /* Better touch targets */
    .card.selectable {
        min-width: 45px;
        min-height: 70px;
    }
    
    /* Adjust player message for mobile */
    .player-message {
        font-size: 16px !important;
        padding: 12px 20px !important;
        max-width: 90% !important;
        word-wrap: break-word !important;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    #header h1 {
        font-size: 1.5em;
    }
    
    #game-info {
        font-size: 0.9em;
    }
    
    .card {
        width: 50px;
        height: 75px;
        font-size: 0.7em;
    }
    
    .card .rank {
        font-size: 0.9em;
    }
    
    .card .suit {
        font-size: 1.1em;
    }
    
    button {
        font-size: 0.8em;
        padding: 8px 12px;
    }
    
    /* Título das cartas em telas muito pequenas */
    #player-cards-title {
        font-size: 0.8em;
        margin-right: 10px;
    }
    
    .modal-content {
        padding: 15px;
        margin: 5px;
    }
    
    .tutorial-content {
        font-size: 0.9em;
    }
    
    .game-mode-option {
        padding: 12px;
    }
    
    .discard-card {
        width: 60px;
        height: 85px;
        font-size: 0.9em;
    }
    
    .card-placeholder, .sequence-info, .play-message {
        width: 120px;
        height: 85px;
        font-size: 0.7em;
    }
}

/* Landscape orientation adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    #game-container {
        padding: 5px;
    }
    
    #header {
        margin-bottom: 15px;
    }
    
    #header h1 {
        font-size: 1.6em;
        margin-bottom: 5px;
    }
    
    #table {
        /* Centered positioning maintained */
    }
    
    #center-pile {
        flex-direction: row;
        gap: 20px;
    }
    
    #game-controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 5px;
    }
    
    button {
        width: auto;
        min-width: 120px;
        font-size: 0.8em;
        padding: 8px 12px;
    }
    
    #opponents {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        margin: 15px 0;
    }
    
    .side-panel {
        width: 60%;
        right: -60%;
    }
    
    .side-panel.open {
        transform: translateX(-60%);
    }
    
    /* Welcome screen mobile adjustments */
    .welcome-content h1 {
        font-size: 2em;
    }
    
    .welcome-content p {
        font-size: 1.1em;
    }
    
    .card-icon {
        font-size: 2.5em;
    }
    
    .welcome-animation {
        gap: 15px;
    }
}

/* Welcome screen for very small devices */
@media (max-width: 480px) {
    .welcome-content h1 {
        font-size: 1.8em;
        margin-bottom: 15px;
    }
    
    .welcome-content p {
        font-size: 1em;
        margin-bottom: 30px;
    }
    
    .card-icon {
        font-size: 2em;
    }
    
    .welcome-animation {
        gap: 10px;
        margin-top: 20px;
    }
    
    #start-button, #resume-button {
        font-size: 1em;
        padding: 12px 24px;
        margin: 20px auto 0 auto;
        display: block;
    }
    
    #resume-button {
        margin-top: 10px;
    }
    
    .welcome-buttons {
        gap: 10px;
        margin-top: 20px;
    }
    
    .welcome-buttons button {
        font-size: 0.8em;
        padding: 8px 16px;
    }
    
    /* Hamburger menu mobile adjustments */
    #hamburger-menu {
        top: 5px;
        right: 5px;
    }
    
    #hamburger-btn {
        padding: 10px 12px;
        font-size: 1.1em;
    }
    
    .hamburger-dropdown {
        min-width: 160px;
        padding: 8px;
    }
    
    .hamburger-dropdown button {
        padding: 8px 12px;
        font-size: 0.8em;
    }
    
    /* History and Stats modals for mobile */
    #history-modal .modal-content {
        max-width: 95%;
        max-height: 80vh;
        margin: 10px;
        padding: 20px;
    }
    
    #stats-modal .modal-content {
        max-width: 99vw;
        max-height: 95vh;
        margin: 5px;
        padding: 15px;
        width: auto;
    }
    
    .history-item {
        padding: 8px;
        margin: 5px 0;
    }
    
    .history-player {
        font-size: 0.9em;
    }
    
    .history-action {
        font-size: 0.85em;
    }
    
    .history-time {
        font-size: 0.7em;
    }
    
    .stat-item {
        padding: 8px 0;
        font-size: 0.9em;
    }
}

/* Desktop enhancements for larger screens */
@media (min-width: 1200px) {
    #game-container {
        max-width: 1400px;
        padding: 30px;
        padding-bottom: 260px;
    }
    
    #header h1 {
        font-size: 3em;
    }
    
    #game-info {
        display: flex;
        font-size: 1.2em;
        gap: 50px;
    }
    
    .card {
        width: 70px;
        height: 110px;
        font-size: 1.2em;
    }
    
    .discard-card {
        width: 90px;
        height: 130px;
        font-size: 1.2em;
    }
    
    .card-placeholder, .sequence-info, .play-message {
        width: 180px;
        height: 130px;
        font-size: 1.1em;
    }
    
    button {
        padding: 15px 30px;
        font-size: 1.1em;
    }
    
    #table {
        /* Centered positioning maintained */
    }
    
    .opponent-top {
        top: 15px;
    }
    
    .opponent {
        width: 250px;
        padding: 20px;
    }
    
    .opponent-left {
        left: 40px;
    }
    
    .opponent-right {
        right: 40px;
    }
    
    /* Desktop-specific hover effects */
    .card:hover {
        transform: translate3d(0, -8px, 0);
    }
    
    .card.selected {
        transform: translate3d(0, -15px, 0) scale(1.08);
    }
}

/* Keyboard navigation hints */
.keyboard-hint {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.8em;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.keyboard-hint.show {
    opacity: 1;
}

.keyboard-hint kbd {
    background: #333;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

/* Enhanced History and Stats Modal Styles */
.history-modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    overflow-y: auto;
}

.stats-modal-content {
    max-width: 98vw;
    max-height: 98vh;
    width: 1400px;
    overflow-y: auto;
    margin: 10px;
}

.history-tabs, .stats-tabs {
    display: flex;
    border-bottom: 2px solid #28a745;
    margin-bottom: 20px;
}

.tab-button {
    background: transparent;
    border: none;
    color: white;
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background: rgba(255,255,255,0.1);
}

.tab-button.active {
    border-bottom-color: #28a745;
    background: rgba(40,167,69,0.2);
}

.history-tab, .stats-tab {
    display: none;
}

.history-tab.active, .stats-tab.active {
    display: block;
}

/* Games List */
.games-list {
    max-height: 400px;
    overflow-y: auto;
}

.game-item {
    background: rgba(255,255,255,0.1);
    margin-bottom: 10px;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-item:hover {
    background: rgba(255,255,255,0.2);
    transform: translateY(-2px);
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.game-id {
    font-weight: bold;
    color: #28a745;
}

.game-mode {
    background: rgba(40,167,69,0.3);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
}

.game-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
}

.game-status.completed {
    background: #28a745;
}

.game-status.active {
    background: #ffc107;
    color: #000;
}

.game-status.abandoned {
    background: #dc3545;
}

.game-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    font-size: 0.9em;
    opacity: 0.8;
}

/* Search Controls */
.search-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.search-controls input {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px;
    background: rgba(255,255,255,0.9);
    color: #333;
}

.search-controls button {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

/* Game Details */
.game-details {
    max-height: 500px;
    overflow-y: auto;
}

.game-details-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
}

.game-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 10px;
    font-size: 0.9em;
    opacity: 0.8;
}

.rounds-list {
    max-height: 400px;
    overflow-y: auto;
}

.round-item {
    background: rgba(255,255,255,0.1);
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 8px;
}

.round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.round-meta {
    display: flex;
    gap: 15px;
    align-items: center;
}

.small-btn {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}

.round-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.player-result {
    background: rgba(255,255,255,0.1);
    padding: 10px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-result.winner {
    background: rgba(40,167,69,0.3);
    border: 1px solid #28a745;
}

.position {
    font-weight: bold;
    color: #28a745;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.stat-title {
    font-size: 0.9em;
    opacity: 0.8;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 2em;
    font-weight: bold;
    color: #28a745;
}

.game-modes-stats {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 8px;
}

.mode-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.mode-stat {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
}

/* Detailed Stats */
.stat-section {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Recent Rounds */
.rounds-list {
    max-height: 300px;
    overflow-y: auto;
}

.round-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    border-left: 4px solid #666;
}

.round-item.winner {
    border-left-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.round-item.loser {
    border-left-color: #f44336;
    background: rgba(244, 67, 54, 0.1);
}

.round-item.neutral {
    border-left-color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
}

.round-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.round-title {
    font-weight: bold;
    color: #FFD700;
}

.round-position {
    font-size: 0.9em;
    color: #ccc;
}

.round-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85em;
    color: #aaa;
}

/* Mobile portrait very small screens */
@media (max-width: 480px) {
    #game-container {
        padding-bottom: 180px; /* Espaço para área do jogador fixa em telas pequenas */
    }
    .opponent-top {
        top: 2px;
        width: 120px;
        padding: 4px;
        font-size: 0.7em;
    }
    
    .opponent-left {
        left: 2px;
        width: 100px;
        padding: 4px;
        font-size: 0.7em;
        top: 35%;
    }
    
    .opponent-right {
        right: 2px;
        width: 100px;
        padding: 4px;
        font-size: 0.7em;
        top: 35%;
    }
    
    #player-area {
        padding: 6px;
        bottom: 30px;
    }
    
    #player-area.player-turn {
        padding: 6px;
        bottom: 30px;
    }
    
    /* Controles ainda menores em telas muito pequenas */
    #game-controls {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 4px;
        margin: 5px 0;
        flex-wrap: wrap;
    }
    
    /* Título centralizado em telas muito pequenas */
    #player-cards-title {
        width: 100%;
        text-align: center;
        margin-bottom: 6px;
        order: -1;
    }
    
    #game-controls button {
        padding: 4px 8px;
        font-size: 0.7em;
        min-width: 60px;
        border-radius: 3px;
        min-height: 28px;
    }
    
    #table {
        /* Centered positioning maintained */
    }
}

/* Mobile-specific performance optimizations */
@media (max-width: 768px) {
    /* GPU acceleration for smooth scrolling */
    body {
        -webkit-overflow-scrolling: touch;
        overflow-scrolling: touch;
    }
    
    /* Optimize transforms for mobile */
    .card, .discard-card, .opponent-card {
        backface-visibility: hidden;
        perspective: 1000px;
    }
    
    /* Touch feedback */
    .card.selectable:active {
        transform: translate3d(0, -5px, 0) scale(0.98);
    }
    
    button:active {
        transform: scale(0.98);
    }
    
    /* Improve tap targets */
    .hamburger-dropdown button {
        min-height: 48px;
        padding: 12px 16px;
    }
    
    /* Swipe indicators */
    .swipe-hint {
        position: fixed;
        bottom: 60px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0,0,0,0.7);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 0.8em;
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
        z-index: 1001;
    }
    
    .swipe-hint.show {
        opacity: 1;
    }
    
    /* Long press visual feedback */
    .long-press-active {
        background: rgba(255, 255, 255, 0.1) !important;
        transform: scale(0.95);
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .card, .discard-card {
        border-width: 1px;
    }
    
    .card.selected {
        border-width: 2px;
    }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .card.selected {
        transform: translate3d(0, -10px, 0);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .modal-content {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .modal-content h2 {
        color: #48bb78;
    }
    
    .tab-button {
        color: #e2e8f0;
    }
    
    .search-controls input {
        background: #4a5568;
        color: #e2e8f0;
        border: 1px solid #718096;
    }
}

/* CSS Variables for dynamic theming */
:root {
    --primary-color: #198754;
    --secondary-color: #28a745;
    --accent-color: #ffd700;
    --text-color: #ffffff;
    --background-gradient: linear-gradient(135deg, #0f5132 0%, #198754 100%);
    --card-shadow: 0 2px 8px rgba(0,0,0,0.3);
    --border-radius: 10px;
    --transition-speed: 0.3s;
    --base-font-size: 16px;
}

.round-mode {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
}

.no-data, .loading {
    text-align: center;
    color: #666;
    padding: 20px;
    font-style: italic;
}

/* Players Table */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

.players-table {
    width: 100%;
    min-width: 700px;
    border-collapse: collapse;
    background: rgba(255,255,255,0.1);
    border-radius: 8px;
    overflow: hidden;
}

.players-table th,
.players-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.2);
    font-size: 0.95em;
}

.players-table th:first-child,
.players-table td:first-child {
    font-weight: bold;
}

.players-table th {
    background: rgba(40,167,69,0.3);
    font-weight: bold;
}

.players-table tr.first-place {
    background: rgba(255,215,0,0.2);
}

.players-table tr:hover {
    background: rgba(255,255,255,0.1);
}

/* Score styling */
.positive-score {
    color: #28a745;
    font-weight: bold;
}

.negative-score {
    color: #dc3545;
    font-weight: bold;
}

.neutral-score {
    color: #6c757d;
    font-weight: normal;
}

/* Round Moves Modal */
.round-moves-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.moves-content {
    background: #198754;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    width: 90%;
}

.moves-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.move-item {
    background: rgba(255,255,255,0.1);
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    display: grid;
    grid-template-columns: 80px 120px 1fr;
    gap: 10px;
    align-items: center;
}

.move-time {
    font-size: 0.8em;
    opacity: 0.8;
}

.move-player {
    font-weight: bold;
    color: #28a745;
}

.move-action {
    font-size: 0.9em;
}

/* Responsive Design for New Features */
@media (max-width: 768px) {
    .history-modal-content {
        width: 95vw;
        max-height: 85vh;
    }
    
    .stats-modal-content {
        width: 99vw;
        max-height: 95vh;
        margin: 5px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .game-info {
        grid-template-columns: 1fr;
    }
    
    .round-results {
        grid-template-columns: 1fr;
    }
    
    .players-table {
        font-size: 0.8em;
    }
    
    .players-table th,
    .players-table td {
        padding: 8px 4px;
    }
    
    .move-item {
        grid-template-columns: 1fr;
        gap: 5px;
    }
    
    .moves-content {
        padding: 20px;
    }
}

/* Estilos para o Modal Fim da Rodada Melhorado */
.game-over-content {
    min-width: 600px;
    max-width: 800px;
}

.round-ranking {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.round-ranking h3 {
    text-align: center;
    margin-bottom: 15px;
    color: #ffd700;
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ranking-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.ranking-item:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(5px);
}

.ranking-item.first-place {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    font-weight: bold;
    border: 2px solid #ffd700;
}

.ranking-item.second-place {
    background: linear-gradient(135deg, #c0c0c0, #e5e5e5);
    color: #333;
    font-weight: bold;
}

.ranking-item.third-place {
    background: linear-gradient(135deg, #cd7f32, #daa520);
    color: white;
    font-weight: bold;
}

.ranking-item.fourth-place {
    background: linear-gradient(135deg, #8B4513, #A0522D);
    color: white;
}

.position {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 60px;
}

.position-icon {
    font-size: 1.5em;
}

.position-number {
    font-weight: bold;
    font-size: 1.1em;
}

.player-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0 15px;
}

.player-name {
    font-size: 1.1em;
    font-weight: bold;
}

.player-title {
    font-size: 0.9em;
    opacity: 0.8;
    margin-top: 2px;
}

.cards-remaining {
    font-size: 0.9em;
    opacity: 0.7;
    text-align: right;
    min-width: 80px;
}

/* Estilos para os botões do modal */
.modal-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.primary-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.primary-btn:hover {
    background: linear-gradient(135deg, #218838, #1ea687);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.secondary-btn {
    background: linear-gradient(135deg, #6c757d, #868e96);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    background: linear-gradient(135deg, #5a6268, #727b84);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.danger-btn {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.danger-btn:hover {
    background: linear-gradient(135deg, #c82333, #dc2626);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
}