:root {
    --felt-bg: radial-gradient(circle at 50% 50%, #1e5e3a 0%, #0d3b22 75%, #082414 100%);
    --wood-rim: linear-gradient(135deg, #451a03 0%, #78350f 50%, #291003 100%);
    --gold: #f59e0b;
    --gold-hover: #d97706;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    --card-lift-shadow: 0 12px 24px rgba(0, 0, 0, 0.45);
}

body {
    background-color: #0f172a;
    color: #f8fafc;
    font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background-color: #0b1120;
    border-bottom: 2px solid #1e293b;
    padding: 0.6rem 1.5rem;
}
.navbar-brand {
    font-weight: 800;
    font-size: 1.35rem;
    color: #fbbf24 !important;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nav-link {
    color: #94a3b8 !important;
    transition: color 0.2s;
}
.nav-link:hover {
    color: #fbbf24 !important;
}

/* Common Layout */
.main-container {
    flex: 1;
    padding: 1.5rem 1rem;
}

/* Auth Cards */
.auth-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 1rem;
    padding: 2.2rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    max-width: 480px;
    margin: 2rem auto;
}
.auth-card h2 {
    color: #fbbf24;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}
.form-control, .form-select {
    background-color: #0f172a !important;
    border: 1px solid #475569 !important;
    color: #f8fafc !important;
    border-radius: 0.5rem;
}
.form-control:focus, .form-select:focus {
    border-color: #fbbf24 !important;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25) !important;
}

/* Avatar Preview */
.avatar-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #fbbf24;
    object-fit: cover;
    background: #0f172a;
}
.avatar-lg {
    width: 80px;
    height: 80px;
    border-width: 3px;
}
.avatar-sm {
    width: 36px;
    height: 36px;
    border-width: 1.5px;
}

/* ==========================================================================
   WAITING ROOM (Warteraum) STYLES
   ========================================================================== */
.waiting-room-container {
    max-width: 1100px;
    margin: 0 auto;
}
.room-header {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1.25rem 1.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
.seats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.seat-card {
    background: #1e293b;
    border: 2px solid #334155;
    border-radius: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.seat-card.ready {
    border-color: #22c55e;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.35);
}
.seat-card.me {
    border-color: #3b82f6;
}
.role-badge {
    position: absolute;
    top: 10px;
    left: 12px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fbbf24;
}
.dealer-badge {
    position: absolute;
    top: 10px;
    right: 12px;
    background: #eab308;
    color: #000000;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
}
.config-card, .history-card {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.config-switch-label {
    font-weight: 600;
    cursor: pointer;
}
.table-custom {
    color: #f1f5f9;
}
.table-custom th {
    background: #0f172a;
    color: #fbbf24;
    border-bottom: 2px solid #334155;
}
.table-custom td {
    border-bottom: 1px solid #334155;
}

/* ==========================================================================
   SKAT TABLE (Spieltisch) STYLES
   ========================================================================== */
.table-wrapper {
    max-width: 1380px;
    margin: 0 auto;
    position: relative;
    padding-bottom: 2rem;
}
.skat-felt-table {
    background: var(--felt-bg);
    border: 14px solid #3d1c06;
    border-radius: 42px;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.7), 0 16px 40px rgba(0, 0, 0, 0.6);
    min-height: 800px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.75rem 2.25rem;
    overflow: hidden;
}

/* Table Header HUD */
.table-hud {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 0.6rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    color: #e2e8f0;
}
.hud-title {
    font-weight: 700;
    color: #fbbf24;
    font-size: 1.1rem;
}
.hud-game-info {
    font-weight: 600;
    font-size: 0.95rem;
    color: #ffffff;
}

/* Opponent Seats Area */
.opponents-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 3rem;
    margin-bottom: 1.25rem;
    z-index: 5;
}
.player-seat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(15, 23, 42, 0.65);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 0.85rem 1.4rem;
    min-width: 200px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
}
.player-seat-box.active-turn {
    border-color: #fbbf24;
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
    transform: scale(1.03);
}
.player-seat-box.declarer {
    border-color: #ef4444;
}
.seat-name {
    font-weight: 700;
    font-size: 1rem;
    color: #ffffff;
    margin-top: 0.4rem;
}
.seat-status-sub {
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Opponent Mini Cards */
.mini-cards-fan {
    display: flex;
    gap: -15px;
    margin-top: 0.5rem;
}
.mini-card-back {
    width: 26px;
    height: 38px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    margin-left: -12px;
}
.mini-card-back:first-child {
    margin-left: 0;
}

/* Center Trick Area */
.center-trick-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    position: relative;
    margin: 1.25rem 0;
    z-index: 5;
}
.trick-cards-container {
    position: relative;
    width: 320px;
    height: 220px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.35s ease, transform 0.35s ease;
}
.trick-card-slot {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.25s ease, z-index 0.25s ease;
}
.trick-card-slot img {
    width: 96px;
    height: 144px;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    display: block;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* Triangle positions for the 3 players with natural overlap */
.trick-card-slot.pos-left {
    top: 6px;
    left: 20px;
    transform: rotate(-6deg);
    z-index: 2;
}
.trick-card-slot.pos-right {
    top: 6px;
    right: 20px;
    transform: rotate(6deg);
    z-index: 2;
}
.trick-card-slot.pos-bottom,
.trick-card-slot.pos-me {
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;
}

/* Winning card highlight */
.trick-card-slot.winning-card {
    z-index: 10 !important;
}
.trick-card-slot.winning-card img {
    box-shadow: 0 0 26px #fbbf24, 0 8px 24px rgba(0, 0, 0, 0.7);
    border: 2px solid #fbbf24;
    transform: scale(1.05);
}

/* Winner Banner between Opponents (Above Trick Cards) */
.trick-winner-banner {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #0f172a;
    font-weight: 800;
    font-size: 1rem;
    padding: 0.45rem 1.6rem;
    border-radius: 24px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.7), 0 0 14px rgba(251, 191, 36, 0.5);
    z-index: 25;
    white-space: nowrap;
    border: 2px solid #fde68a;
}
.clearing-trick {
    opacity: 0 !important;
    transform: scale(0.9) translateY(-15px) !important;
    transition: all 0.35s ease-out !important;
}

/* Bottom Player Area (My Seat) - ALWAYS ON TOP, NEVER BLURRED */
.bottom-player-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 200;
    position: relative;
    margin-top: 1rem;
    padding-top: 0.75rem;
    padding-bottom: 0.5rem;
    pointer-events: auto;
    transition: opacity 0.3s ease;
}
.round-ended-active .bottom-player-area {
    opacity: 0.12;
    pointer-events: none !important;
}
.my-hud-bar {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: rgba(15, 23, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 0.5rem 1.5rem;
    margin-bottom: 1.25rem;
}

/* Hand Cards Fan */
.hand-cards-fan {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 0.5rem;
    min-height: 165px;
}
.hand-card-wrapper {
    margin-left: -24px;
    transition: all 0.22s ease-out;
    cursor: pointer;
    position: relative;
}
.hand-card-wrapper:first-child {
    margin-left: 0;
}
.hand-card-wrapper img {
    width: 104px;
    height: 156px;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    display: block;
    transition: transform 0.2s, filter 0.2s;
}
.hand-card-wrapper:hover {
    transform: translateY(-26px) scale(1.08);
    z-index: 50;
}
.hand-card-wrapper.legal:hover img {
    box-shadow: 0 0 18px #fbbf24, var(--card-lift-shadow);
}
.hand-card-wrapper.illegal {
    cursor: not-allowed;
}
.hand-card-wrapper.selected {
    transform: translateY(-30px);
}
.hand-card-wrapper.selected img {
    box-shadow: 0 0 20px #ef4444;
}

/* Dialogs & Overlays - NO BLUR SO HAND CARDS REMAIN 100% VISIBLE */
.skat-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 29, 0.45);
    /* NO backdrop-filter: blur! */
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 3rem;
    z-index: 100;
    padding-left: 1rem;
    padding-right: 1rem;
    pointer-events: none;
}
.skat-modal-box {
    background: #1e293b;
    border: 2px solid #fbbf24;
    border-radius: 1rem;
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
    padding: 1.75rem 2rem;
    max-width: 580px;
    width: 100%;
    color: #f8fafc;
    pointer-events: auto;
    max-height: calc(100% - 220px);
    overflow-y: auto;
}
.skat-overlay.round-end-overlay {
    position: absolute;
    inset: 0;
    z-index: 1000 !important;
    pointer-events: auto !important;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(10, 15, 29, 0.92) !important;
}
.skat-overlay.round-end-overlay .skat-modal-box {
    position: relative;
    z-index: 1010 !important;
    pointer-events: auto !important;
    max-height: 88vh;
    max-width: 680px;
    overflow-y: auto;
    border: 2px solid #fbbf24;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
}
.skat-modal-box h3 {
    color: #fbbf24;
    font-weight: 800;
    margin-bottom: 1rem;
}

/* Buttons */
.btn-skat {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #0f172a;
    font-weight: 700;
    border: none;
    border-radius: 0.5rem;
    padding: 0.6rem 1.4rem;
    transition: all 0.2s;
}
.btn-skat:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}
.btn-skat-outline {
    background: transparent;
    color: #fbbf24;
    border: 2px solid #fbbf24;
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.5rem 1.2rem;
}
.btn-skat-outline:hover {
    background: #fbbf24;
    color: #0f172a;
}
