:root {
    --bg-color: #0b0c10;
    --acc-gold: #d4af37;
    --acc-copper: #b87333;
    --text-main: #c5c6c7;
    --text-light: #ffffff;
    --glass-bg: rgba(30, 30, 35, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --danger: #9e1a1a;
    --timeline-gap: rgba(212, 175, 55, 0.2);
}

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

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 0%, #1f2026 0%, #0b0c10 70%);
    color: var(--text-main);
    font-family: 'Lora', serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: 'Cinzel', serif;
    color: var(--acc-gold);
}

.screen {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
}

.screen.active {
    display: flex;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    justify-content: center;
    align-items: center;
    background: rgba(11, 12, 16, 0.85);
    backdrop-filter: blur(8px);
}

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
}

#setup-screen .glass-panel {
    max-width: 100vw;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 50% 50%, rgba(30, 30, 35, 0.9) 0%, #0b0c10 100%);
    box-sizing: border-box;
}

#setup-screen h1 {
    font-size: 4rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 15px rgba(212, 175, 55, 0.5);
}

#setup-screen h1 span {
    font-size: 0.3em;
    letter-spacing: 10px;
    display: block;
    margin-top: 10px;
}

.player-select {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.name-inputs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.glass-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    padding: 10px 15px;
    color: var(--text-light);
    font-family: 'Lora', serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s, box-shadow 0.3s;
    width: 100%;
    box-sizing: border-box;
}

.glass-input:focus {
    border-color: var(--acc-gold);
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.4);
}

.glass-panel h1 span {
    color: var(--text-light);
    font-size: 0.6em;
    letter-spacing: 4px;
    text-transform: uppercase;
}

.btn {
    background: linear-gradient(135deg, var(--acc-gold), var(--acc-copper));
    border: none;
    color: #0b0c10;
    padding: 12px 24px;
    margin: 10px;
    font-family: 'Cinzel', serif;
    font-weight: bold;
    font-size: 1.1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.btn.btn-danger {
    background: linear-gradient(135deg, var(--danger), #631212);
    color: #fff;
}

.btn.btn-danger:hover {
    box-shadow: 0 4px 15px rgba(158, 26, 26, 0.4);
}

.btn:disabled {
    filter: grayscale(1);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#game-screen {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.board-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.instruction {
    margin-bottom: 20px;
    font-style: italic;
    color: #a0a0a0;
}

.timeline {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    min-height: 270px;
    width: 100%;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px dashed var(--glass-border);
}

.timeline::-webkit-scrollbar {
    display: none;
}
.timeline {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--acc-gold);
    font-family: 'Cinzel', serif;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 10px 15px;
    cursor: pointer;
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
    transition: all 0.3s ease;
    white-space: nowrap;
    opacity: 0.8;
}
.nav-btn:hover {
    opacity: 1;
    transform: scale(1.05);
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.9);
}
.nav-btn:active {
    transform: scale(0.95);
}

.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    width: 160px;
    height: 220px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    transition: transform 0.3s, background 0.3s;
    user-select: none;
    outline: none;
}

.card:focus, .card:active {
    outline: none;
}

.card.selected {
    border-color: var(--acc-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.6);
    transform: translateY(-10px);
}

.card-text {
    font-size: 1rem;
    font-weight: bold;
}

.card-date {
    margin-top: 15px;
    font-family: 'Cinzel', serif;
    color: var(--acc-gold);
    font-size: 1.2rem;
    display: none; /* Hidden by default */
}

/* Show dates when timeline is challenged */
.show-dates .card-date {
    display: block;
    animation: fadeIn 0.5s forwards;
}

.gap {
    width: 40px;
    height: 200px;
    border: 2px dashed var(--timeline-gap);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap:hover, .gap.drag-over {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--acc-gold);
}

.gap::after {
    content: '+';
    color: var(--timeline-gap);
    font-size: 2rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.gap:hover::after, .gap.drag-over::after {
    opacity: 1;
    color: var(--acc-gold);
}

.hand-area {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.hand {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.hand .card {
    cursor: pointer;
}

.hand .card:hover {
    transform: translateY(-5px);
    background: rgba(40, 40, 45, 0.9);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-50px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-drop {
    animation: dropIn 0.5s forwards;
}

/* Utility to mark correct/incorrect cards during reveal */
.card-correct {
    border-color: #2e8b57;
    box-shadow: 0 0 15px rgba(46, 139, 87, 0.6) inset;
}

.card-incorrect {
    border-color: #ba1e1e;
    box-shadow: 0 0 15px rgba(186, 30, 30, 0.6) inset;
}

/* Feedback Modal Styles */
.feedback-panel {
    animation: dropIn 0.5s ease-out forwards;
}

#feedback-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.feedback-success {
    border-color: #2e8b57;
    box-shadow: 0 0 30px rgba(46, 139, 87, 0.4);
}
.feedback-success #feedback-icon::before {
    content: "✓";
    color: #2e8b57;
}
.feedback-success #feedback-title {
    color: #2e8b57;
}

.feedback-error {
    border-color: #ba1e1e;
    box-shadow: 0 0 30px rgba(186, 30, 30, 0.4);
}
.feedback-error #feedback-icon::before {
    content: "✗";
    color: #ba1e1e;
}
.feedback-error #feedback-title {
    color: #ba1e1e;
}

@keyframes kenBurns {
    0% { background-position: 0% 50%; background-size: 110%; }
    50% { background-position: 100% 50%; background-size: 130%; }
    100% { background-position: 0% 50%; background-size: 110%; }
}

@media (max-width: 768px) {
    body {
        animation: kenBurns 60s infinite ease-in-out;
    }

    #setup-screen h1 {
        font-size: 2.5rem;
    }
    
    .game-header .header {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }
    
    .game-header > .header > div {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .nav-btn {
        font-size: 0.8rem;
        padding: 5px 8px;
    }
    
    .glass-input {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .timeline {
        gap: 5px;
        padding: 5px;
    }
    
    .card {
        width: 85px;
        height: 140px;
        padding: 5px;
    }
    
    .timeline .card {
        width: 140px;
        height: 220px;
        flex-shrink: 0;
    }
    
    .gap {
        width: 20px;
        height: 130px;
    }
    
    .card-text {
        font-size: 0.70rem;
    }
    
    .card h4 {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }
}

@keyframes glowPulse {
    0% { box-shadow: 0 0 5px rgba(212, 175, 55, 0.4); border-color: rgba(255,255,255,0.1); }
    50% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.9); border-color: var(--acc-gold); }
    100% { box-shadow: 0 0 5px rgba(212, 175, 55, 0.4); border-color: rgba(255,255,255,0.1); }
}

.glow-active {
    animation: glowPulse 1.5s infinite;
    background: linear-gradient(135deg, var(--acc-gold), #8a6c1c) !important;
    color: #fff !important;
}
