/* Hearts — Green Felt Theme */

:root {
    --game-primary: #1a6b3c;
    --felt-green: #1a6b3c;
    --felt-dark: #0d3d22;
    --felt-border: #2a8a50;
    --heart-red: #e74c3c;
    --gold: #f4a62a;
    --text-light: #f5f0e1;
    --text-dark: #2c1810;
    --card-bg: #fff;
    --card-shadow: rgba(0,0,0,0.15);
}

/* -- Base ---------------------------------------------------------- */

body {
    background: var(--felt-dark);
    color: var(--text-light);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* -- Player Mode --------------------------------------------------- */

.player-mode #app {
    max-width: 500px;
    margin: 0 auto;
    padding: 10px;
}

.screen { display: none; }
.screen.active { display: block; }

/* -- Join / Lobby -------------------------------------------------- */

.join-room-info {
    text-align: center;
    margin: 20px 0;
}

.join-room-code {
    font-size: 3em;
    font-weight: bold;
    color: var(--gold);
    letter-spacing: 0.15em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.join-share-url {
    color: #aaa;
    font-size: 0.9em;
    margin-top: 5px;
}

.note {
    text-align: center;
    color: #aaa;
    font-size: 0.85em;
    font-style: italic;
    margin: 8px 0;
}

#name-input {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 1.1em;
    border: 2px solid var(--felt-border);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-dark);
    margin-bottom: 12px;
    box-sizing: border-box;
}

#name-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 8px rgba(244, 166, 42, 0.4);
}

#join-btn, #start-btn {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: var(--felt-green);
    color: white;
    margin-bottom: 10px;
    transition: background 0.2s;
}

#join-btn:hover, #start-btn:hover {
    background: var(--felt-border);
}

.tv-mode-link {
    display: block;
    text-align: center;
    color: #aaa;
    font-size: 0.85em;
    margin-top: 10px;
}

.room-code-lobby {
    text-align: center;
    font-size: 1.2em;
    color: var(--gold);
    margin-bottom: 15px;
}

.room-code-display {
    text-align: center;
    font-size: 2em;
    color: var(--gold);
    margin: 20px 0;
}

#room-code {
    letter-spacing: 0.15em;
}

.subtitle {
    text-align: center;
    color: #ccc;
}

/* -- Playing Cards ------------------------------------------------- */

.playing-card {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 72px;
    margin: 3px;
    border-radius: 6px;
    background: var(--card-bg);
    border: 1px solid #ccc;
    box-shadow: 0 2px 4px var(--card-shadow);
    position: relative;
    transition: transform 0.15s, box-shadow 0.15s;
    flex-shrink: 0;
    cursor: default;
}

.playing-card .card-rank {
    font-size: 1.1em;
    font-weight: bold;
    line-height: 1;
}

.playing-card .card-suit {
    font-size: 1.3em;
    line-height: 1;
}

.playing-card .card-points {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 0.55em;
    color: var(--heart-red);
    font-weight: bold;
}

.playing-card.suit-red .card-rank,
.playing-card.suit-red .card-suit {
    color: var(--heart-red);
}

.playing-card.suit-black .card-rank,
.playing-card.suit-black .card-suit {
    color: #222;
}

/* Card states */
.playing-card.selectable {
    cursor: pointer;
}

.playing-card.selectable:hover {
    transform: translateY(-6px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

.playing-card.selected {
    transform: translateY(-8px);
    box-shadow: 0 0 12px rgba(244, 166, 42, 0.7);
    outline: 2px solid var(--gold);
}

.playing-card.dimmed {
    opacity: 0.4;
}

/* -- Scores Bar ---------------------------------------------------- */

.scores-bar {
    display: flex;
    justify-content: space-around;
    padding: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    margin-bottom: 8px;
}

.score-item {
    text-align: center;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}

.score-item.me {
    background: rgba(244, 166, 42, 0.15);
}

.score-item.active {
    border-bottom: 2px solid var(--gold);
}

.score-name {
    display: block;
    font-size: 0.75em;
    color: #ccc;
}

.score-value {
    display: block;
    font-size: 1.1em;
    font-weight: bold;
    color: var(--gold);
}

/* -- Info Bar ------------------------------------------------------ */

.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 0.85em;
}

.info-round {
    color: var(--gold);
    font-weight: bold;
}

.info-status {
    color: #ccc;
}

/* -- Game Panels --------------------------------------------------- */

.game-panel {
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}

.game-panel h3 {
    margin: 0 0 8px 0;
    font-size: 0.95em;
    color: var(--gold);
}

.hand-count {
    font-size: 0.85em;
    color: #aaa;
}

/* -- Card Rows ----------------------------------------------------- */

.card-row {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    padding: 4px;
    justify-content: center;
}

.card-row.scrollable {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 10px;
    justify-content: flex-start;
}

/* -- Passing ------------------------------------------------------- */

.pass-hint {
    color: #aaa;
    font-size: 0.85em;
    margin: 0 0 8px 0;
}

.waiting-text {
    text-align: center;
    color: #aaa;
    font-style: italic;
    padding: 16px 0;
}

/* -- Trick Area ---------------------------------------------------- */

.trick-cards {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    flex-wrap: wrap;
}

.trick-entry {
    text-align: center;
}

.trick-player-name {
    font-size: 0.7em;
    color: #ccc;
    margin-bottom: 2px;
}

/* -- Buttons ------------------------------------------------------- */

.action-btn {
    padding: 12px 20px;
    font-size: 1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin: 4px;
    transition: background 0.2s;
    display: block;
    width: 100%;
}

.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary-btn {
    background: var(--felt-green);
    color: white;
}

.primary-btn:hover:not(:disabled) {
    background: var(--felt-border);
}

/* -- Score Tables -------------------------------------------------- */

.score-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    overflow: hidden;
}

.score-table th {
    background: rgba(0,0,0,0.3);
    padding: 10px 12px;
    text-align: left;
    color: var(--gold);
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.score-table td {
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.score-table .points-bad {
    color: var(--heart-red);
    font-weight: bold;
}

.score-table .points-moon {
    color: var(--gold);
    font-weight: bold;
}

.score-table .total-col {
    font-weight: bold;
    color: var(--gold);
}

.score-table .winner-row {
    background: rgba(244, 166, 42, 0.1);
}

.moon-message {
    text-align: center;
    padding: 12px;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--gold);
    background: rgba(244, 166, 42, 0.1);
    border-radius: 8px;
    margin-top: 12px;
}

/* -- Winner Display ------------------------------------------------ */

.winner-display {
    text-align: center;
    margin: 20px 0;
}

.winner-name {
    font-size: 2em;
    color: var(--gold);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* -- Play Again ---------------------------------------------------- */

#playagain-btn {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 20px auto;
    padding: 14px;
    font-size: 1.2em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    background: var(--felt-green);
    color: white;
}

#playagain-btn:hover {
    background: var(--felt-border);
}

/* ================================================================== */
/* Display Mode                                                       */
/* ================================================================== */

.display-mode #app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

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

/* -- Display Info Bar ---------------------------------------------- */

.display-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: rgba(0,0,0,0.4);
    border-bottom: 2px solid var(--felt-green);
}

/* -- Table Layout -------------------------------------------------- */

.table-layout {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: radial-gradient(ellipse at center, var(--felt-green) 0%, var(--felt-dark) 100%);
}

.table-middle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 20px;
}

/* -- Seats --------------------------------------------------------- */

.seat {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 12px 16px;
    min-width: 160px;
    text-align: center;
    border: 2px solid transparent;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.seat.active-turn {
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(244, 166, 42, 0.3);
}

.seat-name {
    font-weight: bold;
    font-size: 1.1em;
    color: var(--text-light);
    margin-bottom: 4px;
}

.seat-info {
    font-size: 0.75em;
    color: #aaa;
    margin-bottom: 6px;
}

.seat-cards {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
}

.seat-top, .seat-bottom {
    margin: 10px 0;
}

/* -- Card Backs ---------------------------------------------------- */

.card-back-mini {
    width: 14px;
    height: 20px;
    border-radius: 2px;
    background: linear-gradient(135deg, #c0392b 0%, #8e2b1f 100%);
    border: 1px solid rgba(255,255,255,0.15);
}

/* -- Trick Center -------------------------------------------------- */

.trick-center {
    min-width: 240px;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.15);
    border-radius: 50%;
    border: 2px dashed rgba(255,255,255,0.1);
    padding: 16px;
}

.trick-center-cards {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.display-trick-entry {
    text-align: center;
}

.display-trick-name {
    font-size: 0.7em;
    color: #ccc;
    margin-bottom: 2px;
}

/* -- Display Scores ------------------------------------------------ */

.display-scores {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 10px;
    background: rgba(0,0,0,0.4);
    border-top: 1px solid var(--felt-green);
}

.display-score-item {
    padding: 8px 20px;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    text-align: center;
    transition: background 0.3s;
}

.display-score-item.active {
    background: rgba(244, 166, 42, 0.2);
    border: 1px solid var(--gold);
}

.display-score-name {
    display: block;
    font-size: 0.8em;
    color: #ccc;
}

.display-score-value {
    display: block;
    font-size: 1.3em;
    font-weight: bold;
    color: var(--gold);
}

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

@media (max-width: 500px) {
    .playing-card {
        width: 44px;
        height: 62px;
        margin: 2px;
    }

    .playing-card .card-rank {
        font-size: 0.95em;
    }

    .playing-card .card-suit {
        font-size: 1.1em;
    }

    .scores-bar {
        flex-wrap: wrap;
        gap: 4px;
    }

    .score-item {
        padding: 3px 6px;
    }
}

@media (max-width: 800px) {
    .table-middle {
        flex-direction: column;
    }

    .seat {
        min-width: 120px;
    }

    .trick-center {
        min-width: 180px;
        min-height: 100px;
    }
}
