/* Cat Spades CSS - Modern Rich Glassmorphism Design */
:root {
    --bg-dark: #0a0c16;
    --bg-card-table: radial-gradient(circle at center, #1b263b 0%, #0d111e 100%);
    --card-bg: rgba(22, 28, 45, 0.75);
    --border-color: rgba(255, 255, 255, 0.12);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --accent-pink: #ff007f;
    --accent-pink-glow: rgba(255, 0, 127, 0.4);
    --accent-gold: #fbbf24;
    --accent-blue: #38bdf8;
    --accent-green: #34d399;
    --shadow-lg: 0 20px 30px rgba(0, 0, 0, 0.5);
    --font-heading: 'Fredoka', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 0;
    pointer-events: none;
}

.glow-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255, 0, 127, 0.15), transparent 70%);
    top: -100px;
    left: -100px;
}

.glow-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.12), transparent 70%);
    bottom: -150px;
    right: -150px;
}

.app-container {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.app-header {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1.25rem;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    margin-bottom: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-game-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    width: 100%;
}

.header-game-info span {
    font-weight: 600;
}

.info-divider {
    opacity: 0.4;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    text-shadow: 0 0 12px var(--accent-pink-glow);
}

.header-actions {
    display: flex;
    gap: 0.6rem;
}

/* Buttons */
.btn {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;

}

.btn-primary {
    background: linear-gradient(135deg, #ff007f 0%, #d9006c 100%);
    color: white;
    box-shadow: 0 4px 15px var(--accent-pink-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 127, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

/* Main Layout Grid */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1rem;
    flex: 1;
}

@media (max-width: 960px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .app-container {
        padding: 0.5rem;
    }

    .app-header {
        padding: 0.75rem 0.8rem;
    }

    .header-top-row {
        flex-direction: column;
        align-items: center;
        gap: 0.6rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .header-actions {
        width: 100%;
        display: flex;
        justify-content: space-between;
        gap: 0.4rem;
    }

    .header-actions .btn {
        flex: 1;
        padding: 0.5rem 0.25rem;
        font-size: 0.85rem;
        justify-content: center;
        text-align: center;
        white-space: nowrap;
    }

    .header-game-info {
        font-size: 0.75rem;
        gap: 0.4rem;
    }

    .bidding-options {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Table Area */
.game-table {
    background: var(--bg-card-table);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.8), var(--shadow-lg);
    min-height: 580px;
}

/* Pawprints Jumping/Bouncing Loading UI */
.dealing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 24px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.dealing-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.pawprints-loader {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.8rem;
}

.pawprint {
    font-size: 2.2rem;
    display: inline-block;
    animation: bouncePaw 0.75s infinite ease-in-out alternate;
    filter: drop-shadow(0 4px 8px rgba(255, 0, 127, 0.5));
}

.paw-1 { animation-delay: 0s; color: var(--accent-pink); }
.paw-2 { animation-delay: 0.15s; color: var(--accent-gold); }
.paw-3 { animation-delay: 0.3s; color: var(--accent-blue); }
.paw-4 { animation-delay: 0.45s; color: var(--accent-green); }

@keyframes bouncePaw {
    0% {
        transform: translateY(0) scale(1);
    }
    100% {
        transform: translateY(-22px) scale(1.18) rotate(-6deg);
    }
}

.dealing-text {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.5px;
}

/* Status Bar */
.status-bar {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.6rem 1rem;
    margin-bottom: 0.8rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 500;
}

.turn-text {
    color: var(--accent-gold);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resume-badge {
    background: rgba(52, 211, 153, 0.2);
    color: var(--accent-green);
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    border: 1px solid rgba(52, 211, 153, 0.3);
}

/* Players Display Layout */
.opponents-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cat-player-card {
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transition: border-color 0.3s;
}

.cat-player-card.active-turn {
    border-color: var(--accent-pink);
    box-shadow: 0 0 15px var(--accent-pink-glow);
}

.cat-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-gold);
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.cat-name {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0.3rem;
}

.cat-team-tag {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    margin-top: 0.1rem;
    font-weight: 600;
}

.team-user {
    background: rgba(56, 189, 248, 0.2);
    color: var(--accent-blue);
}

.team-opponents {
    background: rgba(255, 0, 127, 0.2);
    color: var(--accent-pink);
}

.cat-bids-tricks {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* Speech Bubble */
.cat-speech-bubble {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 12px;
    background: rgba(255, 255, 255, 0.98);
    color: #0f172a;
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.35;
    padding: 0.55rem 0.85rem;
    border-radius: 14px;
    white-space: normal;
    width: max-content;
    max-width: min(340px, 85vw);
    word-break: break-word;
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    overflow: visible;
}

.cat-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -7px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px 7px 0;
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.98) transparent;
    display: block;
    width: 0;
}

.cat-speech-bubble.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

/* Center Trick Table */
.trick-table-center {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
    align-items: center;
    justify-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 20px;
    border: 1px dashed rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
    min-height: 180px;
    position: relative;
}

.played-card-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.played-player-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Card Graphic Component */
.card-component {
    width: 80px;
    height: 116px;
    border-radius: 10px;
    background: #ffffff;
    color: #1e293b;
    border: 2px solid #cbd5e1;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0.35rem 0.4rem;
    position: relative;
    user-select: none;
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.card-component.red-suit {
    color: #e11d48;
}

.card-component.black-suit {
    color: #0f172a;
}

.card-top-corner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 0.95;
    z-index: 2;
}

.card-bottom-corner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 0.95;
    transform: rotate(180deg);
    align-self: flex-end;
    z-index: 2;
}

.card-rank {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
}

.card-suit-symbol {
    font-size: 0.85rem;
}

.card-center-art {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    height: 70%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-center-art img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.card-component.card-back-style {
    background-image: url('/static/img/card_back.png');
    background-size: cover;
    background-position: center;
    border-color: #475569;
}

/* Player Hand */
.user-hand-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hand-label {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.cards-container {
    display: flex;
    justify-content: center;
    gap: -20px;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    max-width: 315px;
    margin: 0 auto;
}

.cards-container .card-component {
    cursor: pointer;
    margin: 0 -12px;
}

.cards-container .card-component:hover {
    transform: translateY(-16px) scale(1.05);
    z-index: 20;
    box-shadow: 0 10px 25px rgba(255, 0, 127, 0.4);
}

.cards-container .card-component.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(80%);
}

.cards-container .card-component.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Sidebar / Feed & Scores */
.sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.glass-panel {
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 1rem;
    box-shadow: var(--shadow-lg);
}

.score-board-header {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.scores-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
}

.score-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.6rem;
    text-align: center;
}

.score-card-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.score-card-val {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 0.2rem;
}

.score-card-details {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* Feed Log */
.feed-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    max-height: 420px;
    position: relative;
}

.feed-header {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-copy-log {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem 0.55rem;
    font-size: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    user-select: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.btn-copy-log:hover {
    background: rgba(255, 0, 127, 0.2);
    border-color: var(--accent-pink);
    color: #fff;
}

.btn-copy-log:active {
    transform: scale(0.94);
}

.btn-copy-log.copied {
    background: rgba(52, 211, 153, 0.25);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.feed-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 0.2rem;
    -webkit-overflow-scrolling: touch;
}

.feed-list::-webkit-scrollbar {
    width: 6px;
}

.feed-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 4px;
}

.feed-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.feed-list::-webkit-scrollbar-thumb:hover {
    background: var(--accent-pink);
}

.feed-item {
    font-size: 0.8rem;
    line-height: 1.4;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid var(--accent-blue);
}

.feed-item.chat-item {
    border-left-color: var(--accent-pink);
    background: rgba(255, 0, 127, 0.06);
}

.feed-item.trick-item {
    border-left-color: var(--accent-gold);
}

.feed-speaker {
    font-weight: 700;
    color: var(--accent-pink);
}

/* Modal Overlay (Cribbage Architecture) */
.modal, .modal-backdrop {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(8, 12, 22, 0.85);
    z-index: 99999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    touch-action: manipulation;
}

.modal.hidden, .modal-backdrop.hidden {
    display: none !important;
}

.modal.show, .modal-backdrop.show {
    display: flex !important;
}

/* Special Bidding Modal Mode */
.modal-backdrop.bidding-modal-mode {
    background: rgba(0, 0, 0, 0.35);
    align-items: flex-start;
    padding-top: 2rem;
}

.modal-backdrop.bidding-modal-mode .modal-content-box {
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid var(--accent-pink);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 25px var(--accent-pink-glow);
    max-width: 520px;
}

.modal-content-box {
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    max-width: 560px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.5rem;
    box-shadow: 0 25px 50px rgba(0,0,0,0.7);
    position: relative;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.6rem;
}

.modal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    padding: 0.3rem 0.6rem;
    line-height: 1;
    transition: color 0.15s ease;
}

.modal-close-btn:hover {
    color: white;
}

.bidding-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.bid-btn {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    padding: 0.75rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    color: white;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.15s ease;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.bid-btn:hover {
    background: var(--accent-pink);
    border-color: var(--accent-pink);
    transform: translateY(-2px);
}

.bid-btn:active {
    transform: scale(0.94);
    background: #d9006c;
}

.games-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.games-list a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    transition: background 0.2s;
}

.games-list a:hover {
    background: rgba(255, 0, 127, 0.2);
    border-color: var(--accent-pink);
}

.game-favicon {
    width: 20px;
    height: 20px;
}

/* Setup Options Modal */
.setup-option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.6rem;
}

.setup-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 0.6rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    user-select: none;
    touch-action: manipulation;
}

.setup-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.setup-card.selected {
    background: rgba(255, 0, 127, 0.18);
    border-color: var(--accent-pink);
    box-shadow: 0 0 12px var(--accent-pink-glow);
}

.setup-card-title {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
}

.setup-card-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}


/* Sound / Mute Toggle Button */
.sound-toggle-btn, #sound-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-sizing: border-box;
}
@media (max-width: 600px) {
  .sound-toggle-btn, #sound-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    font-size: 0.85rem;
  }
}

/* Clear visual distinction for Muted state */
.sound-toggle-btn.muted, #sound-btn.muted {
  opacity: 0.55 !important;
  background: rgba(20, 20, 25, 0.7) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
}
