#game-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
}

/* Opponents */
#opponents-container {
    flex: 1;
    display: flex;
    justify-content: space-evenly;
    align-items: flex-start;
    padding: 20px 2px;
    width: 100%;
    overflow: visible;
}

.opponent {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0.7;
    transition: opacity 0.3s;
    flex: 1;
    min-width: 0;
    max-width: 300px;
    position: relative;
}

/* Aktiv wird ueber Deckkraft, Fettung und Akzentfarbe markiert — kein Schein. */
.opponent.active {
    opacity: 1;
    font-weight: bold;
    color: var(--arc-accent);
    z-index: 10;
}

.opponent.eliminated {
    opacity: 0.4;
    filter: grayscale(1);
    transform: scale(0.9);
}

.opponent-avatar {
    width: 36px;
    height: 36px;
    background: #ddd;
    border-radius: 50%;
    margin-bottom: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    font-weight: bold;
    border: 2px solid white;
    flex-shrink: 0;
    font-size: 16px;
    position: relative; /* For badge positioning */
}

.opponent-count-badge {
    position: absolute;
    top: -5px;
    right: -10px;
    background: var(--color-red-deep);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
    border: 1px solid white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.opponent-draw-pile {
    width: 24px;
    height: 36px;
    position: absolute;
    bottom: -5px;
    left: -10px; 
    z-index: 5;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.5);
    transition: transform 0.2s;
    cursor: help;
}

.opponent-draw-pile .card-back {
    border-width: 1px;
    border-radius: 3px;
}

.opponent-draw-pile .card-back::before {
    background: #3949ab; /* Match personal deck color */
}

.opponent-draw-pile .card-back::after {
    font-size: 6px; 
}

.opponent-draw-pile:hover {
    transform: scale(1.5);
    z-index: 20;
}

.opponent-hand {
    display: flex;
    justify-content: center;
    align-items: center;
    transform: scale(0.45);
    transform-origin: top center;
    margin-top: 2px;
    width: 100%;
    margin-left: 0;
    height: 60px;
}

.opponent-hand .card {
    margin-right: -45px;
    transform-origin: bottom center;
    flex-shrink: 0;
}

.opponent-hand .card:last-child {
    margin-right: 0;
}

/* Play Area */
#play-area {
    flex: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    gap: 20px;
}

.card-pile {
    width: var(--card-width);
    height: var(--card-height);
    position: relative;
}

#deck {
    cursor: pointer;
}

/* Player Hand */
#player-hand-container {
    flex: 1.5;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 20px;
    overflow-x: auto; /* Allow scroll if hand is huge */
    overflow-y: hidden;
    position: relative;
}

#player-hand-count-badge {
    position: absolute;
    left: 20px;
    bottom: 120px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 800;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 200;
    pointer-events: none;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s;
}

@media (min-width: 768px) {
    #player-hand-count-badge {
        bottom: 150px;
        font-size: 20px;
    }
}

@media (min-width: 1024px) {
    #player-hand-count-badge {
        bottom: 200px;
        font-size: 24px;
        left: 40px;
    }
}

#player-hand {
    display: flex;
    justify-content: center;
    /* Negative margin for overlapping cards */
    padding: 0 40px; /* Padding for scroll ends */
    min-width: min-content;
}

#player-hand .card {
    margin-right: -20px; /* Overlap */
    transition: margin 0.2s, transform 0.2s;
    transform-origin: bottom center;
}

#player-hand .card:last-child {
    margin-right: 0;
}

#player-hand .card:hover {
    margin-right: 0px; 
    z-index: 100;
}

/* HUD & Messages */
#direction-indicator {
    position: absolute;
    font-size: 400px;
    opacity: 0.1;
    pointer-events: none;
    transition: transform 0.5s;
}

#center-message {
    position: absolute;
    top: -40px;
    background: rgba(0,0,0,0.7);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1500;
}

#uno-flash-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 100px;
    font-weight: 900;
    color: var(--color-yellow);
    /* Versetzter Kontur-Schatten fuer Lesbarkeit, kein farbiger Schein. */
    text-shadow: 4px 4px 0 rgba(0,0,0,0.75), -2px -2px 0 rgba(255,255,255,0.6);
    pointer-events: none;
    z-index: 2500;
    white-space: nowrap;
    opacity: 0;
}

#card-info-panel {
    position: fixed;
    /* Positioned dynamically above hovered card */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -100%);
    background: rgba(44, 62, 80, 0.95);
    padding: 10px 20px;
    border-radius: 8px;
    text-align: center;
    pointer-events: none;
    z-index: 1500;
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 200px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    transition: opacity 0.2s;
}

#info-title {
    color: var(--arc-accent);
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 4px;
    text-shadow: 1px 1px 0 #000;
}

#info-desc {
    color: #eee;
    font-size: 14px;
    line-height: 1.3;
}

#info-source {
    color: #94a3b8;
    font-size: 11px;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#info-credits {
    color: var(--arc-faint);
    font-size: 11px;
    margin-top: 4px;
    font-style: italic;
    font-family: monospace;
}

#color-picker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: auto;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 10px;
    gap: 10px;
    z-index: 10000;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

#number-picker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    background: rgba(44, 62, 80, 0.95);
    border-radius: 12px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 15px;
    gap: 10px;
    z-index: 10000;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
}

#player-picker {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(44, 62, 80, 0.95);
    border-radius: 12px;
    padding: 20px;
    z-index: 10000;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.2);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 90%;
}

.player-pick-btn {
    background: #2c3e50;
    color: white;
    border: 2px solid rgba(255,255,255,0.2);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    min-width: 80px;
    text-align: center;
}

.player-pick-btn:hover {
    background: var(--arc-accent);
    color: var(--arc-accent-text);
    border-color: var(--arc-line-strong);
    transform: translateY(-2px);
}

/* §4: sichtbares Druck-Feedback, kurz und auf pointerdown. */
.player-pick-btn:active {
    transform: translateY(1px) scale(0.97);
    transition-duration: 0.09s;
}

.number-btn {
    aspect-ratio: 1;
    background: white;
    color: #333;
    font-weight: 900;
    font-size: 24px;
    border-radius: 50%;
    border: 2px solid #ccc;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s, background 0.2s;
}

.number-btn:hover {
    background: var(--arc-accent);
    border-color: var(--arc-line-strong);
    color: var(--arc-accent-text);
}

.number-btn:active {
    transform: scale(0.9);
}

.color-btn {
    width: 100%;
    height: 60px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s;
    border: 2px solid rgba(0,0,0,0.1);
}

.color-btn:active { transform: scale(0.95); }

.color-btn.red { background: var(--color-red); }
.color-btn.blue { background: var(--color-blue); }
.color-btn.green { background: var(--color-green); }
.color-btn.yellow { background: var(--color-yellow); }
.color-btn.orange { background: var(--color-orange); }
.color-btn.purple { background: var(--color-purple); }
.color-btn.cyan { background: var(--color-cyan); }
.color-btn.pink { background: var(--color-pink); }

#uno-btn {
    position: absolute;
    right: 20px;
    bottom: 120px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    /* Flach statt Verlauf; dunkleres Rot, damit der weisse Ruf 4.5:1 haelt. */
    background: var(--color-red-deep);
    border: 4px solid white;
    color: white;
    font-weight: 900;
    font-size: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    cursor: pointer;
    z-index: 500;
}

/* §4: Der UNO-Ruf quittiert den Druck sofort. Die Puls-Animation muss dafuer
   pausieren — sonst gewinnt ihr transform gegen den :active-Zustand. */
#uno-btn:active {
    animation: none;
    transform: scale(0.94);
}

#exit-game-btn {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.5);
    color: #ddd;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: background 0.2s, color 0.2s;
}

#exit-game-btn:hover {
    background: var(--color-red-deep);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

#game-over-modal {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

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

#restart-btn, #menu-btn {
    padding: 10px 20px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 5px;
    border: none;
    font-weight: bold;
}

/* Genau ein Akzent pro Ansicht: Weiterspielen ist der Hauptknopf,
   "Menue" ist sekundaer (transparent mit Rand). */
#restart-btn {
    background: var(--arc-accent);
    color: var(--arc-accent-text);
}

#menu-btn {
    background: transparent;
    color: var(--arc-text);
    border: 1px solid var(--arc-line-strong);
}

#restart-btn:active,
#menu-btn:active {
    transform: translateY(1px) scale(0.98);
    transition: transform 0.09s ease;
}

/* Media Query Refactor for Game Layout */
@media (min-width: 768px) {
    #player-hand .card { margin-right: -30px; }
    
    .opponent-hand {
        transform: scale(0.65);
        width: 100%;
        margin-left: 0;
    }
}

@media (min-width: 1024px) {
    .opponent-avatar { width: 60px; height: 60px; font-size: 24px; }
    .mini-card { width: 22px; height: 32px; margin-right: -12px; }
    
    .opponent-draw-pile {
        width: 32px;
        height: 48px;
        bottom: -5px;
        left: -15px;
    }

    #player-hand { padding: 0 60px; }
    #player-hand .card { margin-right: -50px; }
    
    #center-message { font-size: 24px; padding: 10px 20px; }
    #uno-flash-text { font-size: 180px; }
    
    #card-info-panel { 
        min-width: 300px; 
        padding: 20px; 
        bottom: auto;
    }
    #info-title { font-size: 24px; }
    #info-desc { font-size: 18px; }
}