/* Skitgubbe Game-Specific Styles */

body {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.back-to-games {
    position: absolute;
    left: 0;
    top: 10px;
    padding: 10px 16px;
    background: rgba(255,255,255,0.95);
    color: #1e3c72;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.back-to-games:hover {
    background: white;
    transform: translateY(-2px);
}

.game-screen.active {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 10;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    padding: 20px;
}

h1 {
    color: white;
    font-size: 48px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* Language Buttons */
.lang-btn {
    padding: 10px 12px;
    background: #f0f0f0;
    color: #333;
    border: 2px solid #e8e8e8;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
}

.lang-btn:hover {
    background: #e0e0e0;
}

.lang-btn.active {
    background: #1e3c72;
    color: white;
    border-color: #1e3c72;
}


/* Rules Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    color: #1e3c72;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f0f0f0;
}

.rules-content h3 {
    color: #1e3c72;
    margin-top: 20px;
    margin-bottom: 10px;
}

.rules-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
}

.rules-content li {
    margin-bottom: 8px;
    line-height: 1.6;
}

.rules-content p {
    margin-bottom: 10px;
    line-height: 1.6;
}

.btn-rules {
    padding: 10px 16px;
    background: #ff9800;
    white-space: nowrap;
}

.btn-rules:hover {
    background: #f57c00;
}

/* Welcome Screen */
.welcome-screen {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    max-width: 500px;
    margin: 50px auto;
}

.welcome-screen h2 {
    color: #1e3c72;
    margin-bottom: 30px;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e8e8e8;
    border-radius: 8px;
    font-size: 16px;
}

input[type="text"]:focus {
    outline: none;
    border-color: #1e3c72;
}

.divider {
    text-align: center;
    margin: 20px 0;
    color: #999;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #ddd;
}

.divider::before { left: 0; }
.divider::after { right: 0; }

/* Game Screen */
.game-screen {
    display: none;
}

.game-screen.active {
    display: block;
}

.hidden {
    display: none !important;
}

/* Menu Button */
.menu-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.95);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

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

.menu-btn span {
    width: 25px;
    height: 3px;
    background: #1e3c72;
    border-radius: 2px;
    transition: all 0.3s;
}

.menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Side Menu */
.side-menu {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 12px rgba(0,0,0,0.2);
    z-index: 99;
    transition: right 0.3s;
    overflow-y: auto;
    padding: 80px 30px 30px 30px;
}

.side-menu.active {
    right: 0;
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 98;
    display: none;
}

.menu-overlay.active {
    display: block;
}

.menu-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e8e8e8;
}

.menu-section:last-child {
    border-bottom: none;
}

.menu-section h3 {
    color: #1e3c72;
    margin-bottom: 15px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.menu-info-item {
    margin-bottom: 10px;
}

.menu-info-label {
    font-size: 11px;
    color: #999;
    text-transform: uppercase;
    margin-bottom: 3px;
}

.menu-info-value {
    font-size: 18px;
    font-weight: bold;
    color: #1e3c72;
}

.menu-players {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-player {
    padding: 12px;
    background: #f5f5f5;
    border-radius: 6px;
    border-left: 3px solid #e8e8e8;
}

.menu-player.active {
    border-left-color: #4CAF50;
    background: #e8f5e9;
}

.menu-player.current-user {
    border-left-color: #2196F3;
}

.menu-player-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.menu-player-cards {
    font-size: 12px;
    color: #666;
}

.menu-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (max-width: 768px) {
    .side-menu {
        width: 100%;
        right: -100%;
    }

    .menu-btn {
        top: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
    }
}

/* Turn Indicator */
.turn-indicator {
    background: rgba(255,255,255,0.95);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-weight: bold;
    font-size: 14px;
    max-width: 1400px;
    margin: 0 auto 15px;
    text-align: center;
}

.turn-indicator.your-turn {
    background: #4CAF50;
    color: white;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.turn-indicator.waiting {
    background: rgba(255,255,255,0.95);
    color: #666;
}

.desktop-header {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 20px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.desktop-header .menu-btn {
    position: static;
}

.mobile-only {
    display: none;
}

.player-info-badge {
    background: rgba(255,255,255,0.95);
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    font-weight: bold;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Desktop Top Info Layout */
.top-info-row {
    display: flex;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto 20px;
    padding: 0 20px;
}

.top-info-section {
    flex: 1;
    background: rgba(255,255,255,0.95);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.top-info-section h3 {
    color: #1e3c72;
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: bold;
}

/* Opponents Display - Desktop inline */
.opponents-display {
    font-size: 13px;
}

.opponents-display:empty {
    display: none;
}

/* Mobile wrapper - hidden on desktop */
.opponents-wrapper {
    display: none;
}

.opponents-wrapper:empty {
    display: none;
}

.opponents-wrapper .opponent-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.opponents-wrapper .opponent-item:last-child {
    border-bottom: none;
}

.opponent-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.opponent-item:last-child {
    border-bottom: none;
}

.opponent-name {
    font-weight: bold;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.opponent-name.active {
    color: #4CAF50;
}

.win-badge {
    background: #FFD700;
    color: #1e3c72;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    white-space: nowrap;
}

.opponent-cards {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: #666;
    flex-wrap: wrap;
    align-items: center;
}

.card-badge {
    background: #f5f5f5;
    padding: 3px 8px;
    border-radius: 4px;
    font-weight: bold;
    white-space: nowrap;
}

.card-badge.hand {
    background: #e3f2fd;
    color: #1976d2;
}

.opponent-face-up-cards {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* Game Area */
.game-area {
    padding: 15px 10px;
    margin-bottom: 15px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
}

/* Desktop: hide piles in game area, show in top-info */
.game-area .piles-container {
    display: none;
}

.piles-container {
    display: flex;
    gap: 15px;
    justify-content: space-around;
    align-items: stretch;
}

.pile-area {
    text-align: center;
    flex: 1;
}

.pile-label {
    color: #1e3c72;
    font-size: 14px;
    margin-bottom: 10px;
    font-weight: bold;
}

.pile {
    min-height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    border: 3px dashed rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 15px;
    background: rgba(0,0,0,0.05);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.pile:hover {
    border-color: rgba(0,0,0,0.3);
    background: rgba(0,0,0,0.08);
}

.pile-empty {
    color: rgba(0,0,0,0.4);
    font-size: 16px;
    font-style: italic;
}

.top-info-section .pile-empty {
    color: rgba(0,0,0,0.4);
}

.pile-count {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255,255,255,0.9);
    color: #1e3c72;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.pile-viewer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.pile-viewer p {
    width: 100%;
    text-align: center;
    color: #999;
    font-style: italic;
}

.deck-pile {
    min-height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    border: 3px dashed rgba(0,0,0,0.2);
    border-radius: 12px;
    padding: 15px;
    background: rgba(0,0,0,0.05);
    position: relative;
}

.deck-pile .card {
    margin-left: -60px;
}

.deck-pile .card:first-child {
    margin-left: 0;
}

.deck-empty {
    color: rgba(255,255,255,0.6);
    font-size: 18px;
    font-style: italic;
}

/* Your Cards Area */
.your-cards {
    background: rgba(255,255,255,0.95);
    padding: 15px;
    border-radius: 12px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 20px;
}

.cards-layout {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.cards-section {
    flex: 1;
    min-width: 250px;
}

.cards-section h3 {
    color: #1e3c72;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: bold;
}

.cards-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    min-height: 120px;
    padding: 10px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
}

.stacked-cards-section {
    flex: 0 0 auto;
    min-width: 350px;
}

.stacked-cards-container {
    position: relative;
    min-height: 140px;
    min-width: 300px;
}

.card-layer {
    position: absolute;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.card-layer.face-down-layer {
    top: 0;
    left: 0;
    z-index: 1;
}

.card-layer.face-up-layer {
    top: 20px;
    left: 0;
    z-index: 2;
}

/* Controls */
.controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.controls .btn {
    padding: 12px;
    font-size: 14px;
}

.btn-new-game {
    background: #2196F3;
    width: 100%;
    margin-top: 20px;
    font-size: 18px;
    padding: 15px;
}

.btn-new-game:hover {
    background: #0b7dda;
}

.game-over-info {
    text-align: center;
    background: rgba(255,255,255,0.95);
    padding: 20px;
    border-radius: 12px;
    margin: 20px auto;
    max-width: 500px;
}

.game-over-info h2 {
    color: #1e3c72;
    margin-bottom: 15px;
}

.btn-pickup {
    background: #ff9800;
    flex: 1;
}

.btn-pickup:hover {
    background: #f57c00;
}

.btn-start {
    background: #4CAF50;
}

.btn-start:hover {
    background: #45a049;
}

.btn-leave {
    background: #f44336;
}

.btn-leave:hover {
    background: #d32f2f;
}

/* Status Messages */
.status-message {
    background: rgba(255,255,255,0.95);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
    font-weight: bold;
}

.status-message.info {
    background: rgba(33, 150, 243, 0.95);
    color: white;
}

.status-message.success {
    background: rgba(76, 175, 80, 0.95);
    color: white;
}

.status-message.warning {
    background: rgba(255, 152, 0, 0.95);
    color: white;
}

/* Win/Lose Overlays */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.game-over-overlay.active {
    display: flex;
}

.win-overlay {
    background: rgba(255, 215, 0, 0.95);
}

.lose-overlay {
    background: rgba(0, 0, 0, 0.95);
}

.game-over-message {
    text-align: center;
    font-size: 72px;
    font-weight: bold;
    color: white;
    text-shadow: 4px 4px 8px rgba(0,0,0,0.5);
    animation: bounceIn 1s ease-out;
    position: relative;
}

.close-overlay-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s;
}

.close-overlay-btn:hover {
    transform: scale(1.1);
    background: white;
}

.overlay-hint {
    font-size: 18px;
    margin-top: 30px;
    opacity: 0.8;
    font-weight: normal;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-200px);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    z-index: 10000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    max-width: 80%;
    text-align: center;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(-50%) translateY(-200px);
    opacity: 0;
}

@keyframes bounceIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.skull {
    font-size: 200px;
    animation: shake 0.5s infinite;
    display: block;
    margin-bottom: 30px;
}

@keyframes shake {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #f0f;
    top: -20px;
    animation: confetti-fall 3s linear forwards;
    pointer-events: none;
}

@keyframes confetti-fall {
    to {
        transform: translateY(calc(100vh + 40px)) rotate(var(--rotate, 720deg));
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 {
        font-size: 28px;
        margin-bottom: 10px;
    }

    .back-to-games {
        position: static;
        display: inline-block;
        margin-bottom: 15px;
        font-size: 12px;
        padding: 8px 12px;
    }

    .game-over-message {
        font-size: 36px;
    }

    .skull {
        font-size: 100px;
    }

    .turn-indicator {
        top: 10px;
        left: 10px;
        font-size: 11px;
        padding: 6px 10px;
    }

    /* Hide desktop header and top info on mobile */
    .desktop-header {
        display: none;
    }

    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: flex;
    }

    .top-info-row {
        display: none;
    }

    /* Turn indicator on mobile - fixed */
    .turn-indicator {
        position: fixed;
        top: 10px;
        left: 10px;
        right: 10px;
        margin: 0;
        z-index: 50;
        font-size: 12px;
        padding: 8px 12px;
    }

    /* Show mobile inline opponents */
    .opponents-wrapper {
        display: block;
        background: rgba(255,255,255,0.95);
        padding: 10px;
        border-radius: 8px;
        margin: 60px 10px 10px;
        font-size: 11px;
    }

    /* Show piles in game area on mobile */
    .game-area .piles-container {
        display: flex !important;
    }

    .opponent-cards {
        gap: 3px;
        font-size: 9px;
    }

    .opponent-item {
        padding: 6px 0;
    }

    .card-badge {
        padding: 2px 5px;
        font-size: 9px;
    }

    .game-area {
        padding: 10px 5px;
        margin-bottom: 10px;
    }

    .piles-container {
        gap: 10px;
        flex-wrap: nowrap;
    }

    .pile-area {
        padding: 8px 5px;
        min-width: 0;
        flex: 1;
    }

    .pile-label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .pile, .deck-pile {
        min-height: 100px;
        padding: 10px 5px;
    }

    .deck-pile .card {
        margin-left: -50px;
    }

    .your-cards {
        padding: 10px;
        margin-bottom: 15px;
    }

    .cards-section h3 {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .cards-container {
        min-height: 90px;
        padding: 8px;
        gap: 8px;
    }

    .stacked-cards-container {
        min-height: 110px;
        min-width: 150px;
    }

    .card-layer.face-up-layer {
        top: 15px;
    }

    .controls {
        margin-top: 10px;
        gap: 8px;
    }

    .controls .btn {
        padding: 10px;
        font-size: 13px;
    }

    .piles-container {
        gap: 15px;
    }

    .cards-layout {
        gap: 15px;
    }

    .btn-new-game {
        font-size: 16px;
        padding: 12px;
    }

    .game-over-info {
        margin: 15px 10px;
        padding: 15px;
    }

    .saved-rooms-section {
        margin-top: 20px;
    }

    .saved-room-item {
        padding: 10px;
    }

    .saved-room-name {
        font-size: 14px;
    }

    .saved-room-code {
        font-size: 11px;
    }

    .saved-room-date {
        font-size: 10px;
    }

    .btn-rejoin {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* Saved Rooms Styles */
.saved-rooms-section {
    margin-top: 30px;
}

.saved-room-item {
    background: rgba(255,255,255,0.95);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.saved-room-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.saved-room-info {
    flex: 1;
}

.saved-room-name {
    font-size: 18px;
    font-weight: bold;
    color: #1e3c72;
    margin-bottom: 5px;
}

.saved-room-code {
    font-size: 14px;
    color: #666;
    margin-bottom: 3px;
}

.saved-room-date {
    font-size: 12px;
    color: #999;
}

.saved-room-actions {
    display: flex;
    gap: 8px;
}

.btn-rejoin {
    padding: 8px 16px;
    background: #1e3c72;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-rejoin:hover {
    background: #2a5298;
    transform: translateY(-1px);
}

.btn-delete {
    padding: 8px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.btn-delete:hover {
    background: #c82333;
    transform: scale(1.1);
}

.btn-save-room,
.btn-change-password {
    margin-bottom: 10px;
}

/* Modal Enhancements for Saved Rooms */
.modal-body {
    padding: 20px;
}

.modal-body p {
    margin-bottom: 20px;
    color: #666;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
