/* Bonaken Game Styles */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    --primary-color: #2e7d32;
    --primary-dark: #1b5e20;
    --secondary-color: #ff9800;
    --background: #1a472a;
    --table-color: #2d5a3d;
    --card-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    --text-light: #fff;
    --text-dark: #333;
    --hearts-color: #e53935;
    --diamonds-color: #e53935;
    --clubs-color: #212121;
    --spades-color: #212121;
}

/* ========================================
   Viewport and App Setup
   ======================================== */
#app {
    width: 800px;
    height: 800px;
    position: relative;
}


#viewport-wrapper {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

#viewport {
    width: 800px;
    height: 800px;
    overflow: hidden;
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    /* transform will be set by JS: translate(-50%, -50%) scale(...) */
}

@media (hover: none) and (min-width: 601px) {
    html, body {
        width: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    #viewport-wrapper {
        width: 100vw;
        height: 100dvh;
    }
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text-light);
}

/* ========================================
   Screens
   ======================================== */
.screen {
    display: none;
    height: 100%;
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Setup Screen */
#setup-screen {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--background) 0%, var(--table-color) 100%);
}

.setup-container {
    text-align: center;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
}

.setup-container h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 2rem;
}

.player-select {
    margin-bottom: 1.5rem;
}

.player-select label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.player-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.player-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--secondary-color);
    background: transparent;
    color: var(--text-light);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.player-btn:hover, .player-btn.active {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.name-input {
    margin-bottom: 2rem;
}

.name-input label {
    display: block;
    margin-bottom: 0.5rem;
}

.name-input input {
    width: 100%;
    padding: 0.75rem;
    border-radius: 8px;
    border: none;
    font-size: 1rem;
    text-align: center;
}

.primary-btn {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    background: var(--secondary-color);
    border: none;
    border-radius: 8px;
    color: var(--text-dark);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

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

.rules-link {
    margin-top: 2rem;
}

.rules-link a {
    color: var(--secondary-color);
    text-decoration: none;
}

/* Game Screen */
#game-screen {
    background: radial-gradient(circle at center, #356846 0%, #1b422a 100%);
}

.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(0, 0, 0, 0.2);
}

.game-info {
    display: flex;
    gap: 1rem;
}

.game-info span {
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-size: 0.9rem;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Score Screen */
#score-screen, #gameover-screen {
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--background) 0%, var(--table-color) 100%);
}

.score-container, .gameover-container {
    text-align: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    max-width: 700px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.score-table {
    margin: 1.5rem 0;
}

.score-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.score-row.header {
    font-weight: bold;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
}

.final-results {
    margin: 1.5rem 0;
}

.result-item {
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

.result-item.eruit {
    background: rgba(76, 175, 80, 0.3);
}

.result-item.erin {
    background: rgba(255, 153, 0, 0.511);
}

.result-item.loser {
    background: rgba(234, 55, 43, 0.42);
}

/* ========================================
   Game Table and Layout
   ======================================== */
/* Game Table - Circular Layout */
.game-table {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: url('../assets/table.png') no-repeat center center;
    background-size: auto;
}

/* Play Area (Center) */
.play-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 300px;
    border-radius: 50%;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Let clicks pass through to cards */
}

.play-area.active-drop-zone {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    animation: active-drop-zone-pulse 2s infinite;
}

/* Trick Area */
.trick-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 100px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    min-width: 200px;
}

.trick-area.active {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.trick-area.drag-over {
    background-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.6);
}

.trick-area .card {
    cursor: default;
    pointer-events: none;
}

.trick-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.trick-card .player-label {
    font-size: 0.7rem;
    margin-top: 0.25rem;
    opacity: 0.8;
}

.trick-card.winner .card {
    box-shadow: 0 0 20px gold;
}

/* Table Cards (Blind/Open) - Top Right Corner */
.table-cards {
    position: absolute;
    display: flex;
    gap: 10px;
    z-index: 20;
    transform: none; /* Remove centering transform */
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.table-cards .card {
    cursor: default;
    pointer-events: none;
}

.table-cards .blind-card {
    background-image: url('../assets/back.svg');
}

/* Hand Container (for layout logic) */
.hand-container {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.card-back-mini:first-child {
    margin-left: 0;
}

/* Center Area */
.center-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* ========================================
   Players and Positions
   ======================================== */
/* Player Positions */
.player-position {
    position: absolute;
    /* Position will be set by JS */
    width: 120px;
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.active-turn .player-info-box {
    box-shadow: 0 0 25px rgba(255, 152, 0, 0.6);
}

.player-info-box {
    background: rgba(0, 0, 0, 0.6);
    width: 100px;
    padding: 5px 10px;
    border-radius: 5px;
    text-align: center;
    margin-bottom: 5px;
    z-index: 10;
}

#player-pos-0 > div.player-info-box {
    position: relative;
    left: 260px;
    top: 0px;
}

.player-name {
    font-weight: bold;
    font-size: 0.9rem;
    display: block;
}

.player-status {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin: 8px;
    display: inline-block;
}

.player-status.SUF { background: #607d8b; }
.player-status.KROM { background: #f44336; }
.player-status.RECHT { background: #4caf50; }
.player-status.WIP { background: #ff9800; }
.player-status.ERUIT { background: #2196f3; }
.player-status.ERIN { background: #9c27b0; }

.player-bid {
    font-size: 0.8rem;
    color: var(--secondary-color);
    display: block;
    margin-top: 2px;
    font-weight: bold;
}

/* Player Area */
.player-area {
    flex: 0 0 auto;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px 8px 0 0;
}

.player-info {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.player-info .player-name {
    font-weight: bold;
}

.player-info .player-status {
    padding: 0.15rem 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    font-size: 0.8rem;
}

.player-hand {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem;
    min-height: 100px;
}

/* ========================================
   Cards
   ======================================== */
.card {
    width: 80px;
    height: 115px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    position: absolute;
    transform-origin: center bottom;
    transition: transform 0.3s ease, top 0.3s ease, left 0.3s ease;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 18px;
    user-select: none;
    background-size: cover;
    background-position: center;
    pointer-events: auto;
    /* Use variables for transform, with defaults */
    transform: rotate(var(--rotation, 0deg)) translateY(var(--y-offset, 0px));
}

.card.valid:hover {
    transform: rotate(var(--rotation, 0deg)) translateY(-15px);
}

.card.selected {
    box-shadow: 0 0 10px rgba(255, 255, 0, 0.5);
    /* Use variables for selected state */
    transform: translate(var(--translate-x, 0px), var(--translate-y, 0px)) rotate(var(--rotation, 0deg));
    cursor: pointer;
    pointer-events: none;
}

.card.invalid {
    cursor: not-allowed;
}

.card.invalid::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(128, 128, 128, 0.4);
    border-radius: 8px;
}

.card.hearts, .card.diamonds { color: #e74c3c; }
.card.clubs, .card.spades { color: #2c3e50; }

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.card-rank { font-size: 1.4em; }
.card-suit { font-size: 1.8em; }

/* Card Back */
.card.back {
    background-image: url('../assets/back.svg');
    border: 2px solid #fff;
}

/* Played Cards (in center) */
.card.played {
    transform: translate(-50%, -50%);
    z-index: 50;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

.card.card-played {
    animation: playCard 0.5s ease-out;
}

.card.dragging {
    transition: none !important;
    z-index: 1000 !important;
    pointer-events: none; /* Let events pass through to drop zone */
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
}

.card.flying {
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 500;
}

.card.fade-out {
    opacity: 0;
}

.card.dealing {
    animation: dealCard 0.3s ease-out;
}

.player-hand .card:hover {
    /* Lift the card by modifying the translateY component */
    transform: rotate(var(--rotation, 0deg)) translateY(calc(var(--y-offset, 0px) - 30px));
    z-index: 1000 !important; /* Ensure it's on top */
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.5);
}

.card.selected:hover {
    transform: translate(var(--translate-x, 0px), var(--translate-y, 0px)) rotate(var(--rotation, 0deg));
    z-index: 1000 !important;
}

/* Ensure cards have transitions for rearranging */
.hand-container .card {
    transition: transform 0.3s ease-out, left 0.3s ease-out, top 0.3s ease-out;
}

/* ========================================
   Status Display (Trump+Bid)
   ======================================== */
.status-display {
    z-index: 120;
    position: absolute;
    left: 30px;
    bottom: 120px;
    width: 120px;
    background: rgba(0,0,0,0.45);
    border-radius: 6px;
}

.trump-indicator {
    padding: 20px;
    border-radius: 8px;
    transition: opacity 0.3s, transform 0.2s;
    /* center the trump card inside the indicator */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.trump-indicator.hidden {
    opacity: 0;
    transform: translateY(8px);
}

.trump-indicator .trump-card {
    width: 80px;
    height: 115px;
    background-color: white;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border-radius: 6px;
    box-shadow: var(--card-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    margin: 0 auto; /* ensure horizontal centering if container changes */
}

.bid-display {
    padding: 6px 10px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--text-light);
    text-align: center;
    pointer-events: auto; /* allow interactions if needed */
}

.bid-display.visible {
    opacity: 1;
}

.stop-game-btn {
    z-index: 120;
    position: absolute;
    padding: 8px;
    font-size: 0.9rem;
    left: 30px;
    bottom: 30px;
    width: 120px;
}

/* ========================================
   Action Area
   ======================================== */
.action-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10;
}

.bid-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    padding: 0.75rem;
    max-height: 220px;
    overflow-y: auto;
}

.bid-btn {
    padding: 0.75rem 1.25rem;
    min-width: 64px;
    background: var(--primary-color);
    border: none;
    border-radius: 8px;
    color: var(--text-light);
    cursor: pointer;
    transition: background 0.2s, transform 0.12s;
    font-size: 1.05rem;
    font-weight: 600;
}

.bid-btn:hover {
    background: var(--primary-dark);
}

.bid-btn.pass {
    background: #f44336;
}

.bid-btn.special {
    background: var(--secondary-color);
    color: var(--text-dark);
}

.trump-selection {
    text-align: center;
    padding: 1rem;
}

.trump-selection h3 {
    margin: 0 0 1rem 0;
}

.trump-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.trump-btn {
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.trump-btn:hover {
    transform: scale(1.05);
}

.trump-btn[data-suit="Hearts"],
.trump-btn[data-suit="Diamonds"] {
    background: #ffebee;
    color: var(--hearts-color);
}

.trump-btn[data-suit="Clubs"],
.trump-btn[data-suit="Spades"] {
    background: #eceff1;
    color: var(--clubs-color);
}

.discard-area {
    text-align: center;
    padding: 1rem;
}

.discard-area h3 {
    margin: 0 0 1rem 0;
}

/* ========================================
   Message Log
   ======================================== */
.message-log {
    position: absolute;
    top: 50px;
    right: 0;
    width: 300px;
    max-height: 80%;
    background: rgba(0, 0, 0, 0.85);
    padding: 1rem;
    overflow-y: auto;
    z-index: 200;
    transform: translateX(0); /* Visible by default on desktop */
    transition: transform 0.3s ease-in-out;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
}

.message-log.open {
    transform: translateX(0);
}

/* Desktop: Hidden by default */
@media (min-width: 768px) {
    .message-log.closed {
        transform: translateX(100%);
    }
}

/* Mobile: hide message log by default and show when `.open` is added */
@media (max-width: 600px) {
    .message-log {
        transform: translateX(100%);
    }
    .message-log.open {
        transform: translateX(0);
    }
}

#messages {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    animation: messageIn 0.3s ease-out;
    font-size: 0.9rem;
    border-left: 3px solid var(--secondary-color);
}

/* ========================================
   Modal
   ======================================== */
.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: 1000;
}

.modal.hidden {
    display: none;
}

.last-trick-content .card {
    cursor: default !important;
    pointer-events: none !important;
}

.modal-content {
    background: var(--table-color);
    padding: 2rem;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

/* Keep the desktop rules dialog inside the available viewport. Mobile keeps
   its existing modal layout, which already fits that screen size well. */
@media (min-width: 601px) {
    #rules-modal {
        box-sizing: border-box;
        padding: 1rem;
    }

    #rules-modal .modal-content {
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        /* The whole game UI uses a fixed logical 800x800 canvas which is then
           scaled to the desktop viewport. Keep this limit in those logical
           pixels so it is scaled exactly once together with the table. */
        max-height: calc(800px - 2rem);
        overflow: hidden;
    }

    #rules-modal .modal-content > h2 {
        flex: 0 0 auto;
        margin-top: 0;
        padding-right: 2.5rem;
    }

    #rules-modal .rules-content {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-right: 0.5rem;
        scrollbar-gutter: stable;
    }
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 2rem;
    cursor: pointer;
}

.rules-content h3 {
    color: var(--secondary-color);
    margin-top: 1.5rem;
}

.rules-content ul {
    text-align: left;
    padding-left: 1.5rem;
}

.rules-content li {
    margin-bottom: 0.5rem;
}

.rules-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--background);
    border-radius: 8px;
    overflow: hidden;
}

.rules-content th, .rules-content td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 0.5rem;
    text-align: center;
}

.rules-content th {
    background: var(--primary-color);
    color: var(--text-light);
    font-weight: bold;
}

.rules-content td {
    color: var(--text-light);
}

/* Score Table */
.score-table-content {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    background: var(--background);
    border-radius: 8px;
    overflow: hidden;
}

.score-table-content th, .score-table-content td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.75rem 0.5rem;
    text-align: center;
}

.score-table-content th {
    background: var(--primary-color);
    color: var(--text-light);
    font-weight: bold;
}

.score-table-content td {
    color: var(--text-light);
}

.score-table-content td.last-status {
    background: var(--secondary-color);
    color: var(--text-dark);
    font-weight: bold;
    animation: highlightPulse 0.6s ease-out;
}

@keyframes highlightPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 152, 0, 0);
    }
    50% {
        transform: scale(1.15);
        box-shadow: 0 0 15px rgba(255, 152, 0, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 152, 0, 0);
    }
}

/* ========================================
   Hidden and Utility Classes
   ======================================== */
.hidden {
    display: none !important;
}

/* ========================================
   Touch-friendly Adjustments
   ======================================== */
@media (hover: none) {
    .player-hand .card:hover {
        transform: none;
    }
    
    .card.touched {
        transform: translateY(-10px);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    }
}

/* ========================================
   Mobile Layout Tuning
   ======================================== */
@media (max-width: 600px) {
    html, body {
        width: 100%;
        height: 100dvh;
        overflow: hidden;
    }

    #viewport-wrapper {
        width: 100vw;
        height: 100dvh;
    }

    #viewport {
        left: 0;
        top: 0;
        width: 100vw;
        height: 100dvh;
        transform: none !important;
        transform-origin: top left;
    }

    #app {
        width: 100%;
        height: 100%;
    }

    .info-bar {
        padding: 0.4rem 0.55rem;
        gap: 0.45rem;
        align-items: flex-start;
        background: rgba(0, 0, 0, 0.42);
        backdrop-filter: blur(4px);
    }

    .game-info {
        gap: 0.4rem;
        flex-wrap: wrap;
    }

    .info-bar > div:last-child {
        align-items: flex-start;
    }

    .game-info span {
        font-size: 0.8rem;
        padding: 0.2rem 0.55rem;
        background: rgba(0, 0, 0, 0.38);
        border: 1px solid rgba(255, 255, 255, 0.12);
        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    }

    .icon-btn {
        width: 34px;
        height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .icon-btn img {
        width: 1rem !important;
        height: 1rem !important;
    }

    .player-position {
        width: 120px;
        height: 140px;
    }

    .player-info-box {
        width: 100px;
        padding: 5px 8px;
        background: rgba(0, 0, 0, 0.72);
        border: 1px solid rgba(255, 255, 255, 0.08);
        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.6);
        font-size: 0.9rem;
    }

    #player-pos-0 > div.player-info-box {
        left: 0;
        top: 0;
    }

    .player-name {
        font-size: 1em;
    }

    .player-status {
        font-size: 0.72em;
        margin: 4px 0 0;
    }

    .player-bid {
        font-size: 0.8em;
    }

    .status-display {
        left: 12px;
        bottom: 122px;
        width: 118px;
    }

    .trump-indicator {
        padding: 12px;
    }

    .stop-game-btn {
        left: 12px;
        bottom: 12px;
        width: 118px;
        padding: 7px 10px;
        font-size: 0.86rem;
    }

    #stop-spel-btn {
        display: none !important;
    }

    .action-area {
        padding: 0.35rem 0.35rem 0.4rem;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(4px);
    }

    .bid-options {
        gap: 0.35rem;
        padding: 0.35rem;
        max-height: 180px;
    }

    .bid-btn {
        padding: 0.65rem 0.9rem;
        min-width: 54px;
        font-size: 0.92rem;
        border-radius: 8px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
    }

    .trump-selection {
        padding: 0.75rem 0.5rem;
    }

    .trump-selection h3 {
        margin-bottom: 0.65rem;
        font-size: 1rem;
        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    }

    .trump-buttons {
        gap: 0.4rem;
    }

    .trump-btn {
        padding: 0.85rem 1rem;
        font-size: 1rem;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
    }

    .discard-area {
        padding: 0.75rem 0.5rem;
    }

    .discard-area h3 {
        font-size: 1rem;
        text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
    }

    .message-log {
        width: min(300px, 84vw);
        top: 48px;
        max-height: calc(100% - 58px);
    }

    .score-container, .gameover-container,
    .modal-content {
        width: 94%;
        padding: 1.1rem;
    }

    .setup-container {
        padding: 1.1rem 0.9rem;
        width: 94%;
    }

    .setup-container h1 {
        font-size: 2.3rem;
    }

    .card {
        width: 126px;
        height: 180px;
        font-size: 22px;
    }

    .card-rank {
        font-size: 1.5em;
    }

    .card-suit {
        font-size: 2.05em;
    }

    .trick-area .card {
        width: var(--mobile-play-card-width, 75px);
        height: var(--mobile-play-card-height, 108px);
        font-size: 19px;
    }

    .trump-indicator .trump-card {
        width: var(--mobile-play-card-width, 75px);
        height: var(--mobile-play-card-height, 108px);
    }
}

@media (max-width: 400px) {
    #player-pos-0 .hand-container .card {
        width: 118px;
        height: 169px;
        font-size: 20px;
    }
}

@media (max-width: 600px) {
    .game-table.phone-opponent-strip + .status-display,
    .status-display {
        left: 12px;
        top: 184px;
        bottom: auto;
        width: min(144px, 40vw);
    }

    .game-table.phone-opponent-strip {
        padding-top: 104px;
    }

    .game-table.phone-opponent-strip .play-area {
        top: calc(50% - 26px);
        width: 238px;
        height: 238px;
    }

    .game-table.phone-opponent-strip .player-position.phone-opponent-position {
        align-items: center;
        justify-content: flex-start;
        z-index: 110;
        pointer-events: none;
    }

    .game-table.phone-opponent-strip .phone-opponent-position .player-info-box {
        width: min(72px, 100%);
        padding: 3px 5px;
        margin-bottom: 0;
        border-radius: 5px;
        z-index: 115;
        background: rgba(0, 0, 0, 0.78);
        font-size: 0.9rem;
    }

    .game-table.phone-opponent-strip .phone-opponent-position .player-name,
    .game-table.phone-opponent-strip .phone-opponent-position .player-bid,
    .game-table.phone-opponent-strip .phone-opponent-position .player-status {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .game-table.phone-opponent-strip .phone-opponent-position .player-name {
        font-size: 1em;
        line-height: 1.05;
    }

    .game-table.phone-opponent-strip .phone-opponent-position .player-status {
        font-size: 0.72em;
        margin-top: 2px;
        padding: 1px 4px;
    }

    .game-table.phone-opponent-strip .phone-opponent-position .hand-container {
        top: 16px;
        left: 0;
        width: 100%;
        height: 56px;
        overflow: visible;
        z-index: 105;
    }

    .game-table.phone-opponent-strip .phone-opponent-position .hand-container .card {
        width: 36px;
        height: 52px;
        border-width: 1px;
        border-radius: 4px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.42);
        transform-origin: center bottom;
        font-size: 14px;
    }

    .game-table.phone-opponent-strip .phone-opponent-position .hand-container .card .card-rank {
        font-size: 1.3em;
    }

    .game-table.phone-opponent-strip .phone-opponent-position .hand-container .card .card-suit {
        font-size: 1.5em;
    }

    .game-table.phone-opponent-strip .table-cards {
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: calc(100% - 24px);
        padding: 0.25rem 0.4rem;
        margin-bottom: 0;
        gap: var(--mobile-play-card-gap, 0.25rem);
        flex-wrap: nowrap;
        align-items: center;
        justify-content: center;
        z-index: 140;
        background: rgba(0, 0, 0, 0.24);
        border-radius: 10px;
        backdrop-filter: blur(3px);
    }

    .game-table.phone-opponent-strip .table-cards .card {
        width: var(--mobile-play-card-width, 75px);
        height: var(--mobile-play-card-height, 108px);
        border-width: 1px;
        border-radius: 5px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.38);
        flex: 0 0 auto;
    }

    .game-table.phone-opponent-strip .card.played {
        width: var(--mobile-play-card-width, 75px);
        height: var(--mobile-play-card-height, 108px);
    }

    .game-table.phone-opponent-strip .card.selected {
        width: var(--mobile-play-card-width, 75px);
        height: var(--mobile-play-card-height, 108px);
        border-width: 1px;
        border-radius: 5px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.38);
    }

    .game-table.phone-opponent-strip .table-cards .blind-card {
        opacity: 0.95;
    }
}

/* ========================================
   Animations
   ======================================== */
@keyframes active-drop-zone-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes playCard {
    0% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0); }
}

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

@keyframes dealCard {
    from {
        opacity: 0;
        transform: translateY(-50px) rotate(10deg);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}

@keyframes active-drop-zone-pulse {
    0%, 100% { border-color: rgba(255, 255, 255, 0.2); }
    50% { border-color: rgba(255, 255, 255, 0.5); }
}

/* Collapsible sections */
.collapsible {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.collapsible::after {
    content: " ▼";
    font-size: 0.8em;
    margin-left: 5px;
}

.collapsible.expanded::after {
    content: " ▲";
}

.collapsible-content {
    display: none;
    margin-top: 10px;
}

.collapsible-content.expanded {
    display: block;
}
