/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    color: #ffffff;
    overflow-x: hidden;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Welcome Screen */
.welcome-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem;
}

.game-title {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.game-subtitle {
    font-size: 1.5rem;
    margin-bottom: 3rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Name Input Screen */
.name-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    text-align: center;
}

.name-container h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    font-weight: 600;
}

#player-name {
    font-size: 1.5rem;
    padding: 1rem 2rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 12px;
    background: rgba(255,255,255,0.1);
    color: #ffffff;
    text-align: center;
    margin-bottom: 2rem;
    min-width: 300px;
    backdrop-filter: blur(10px);
}

#player-name::placeholder {
    color: rgba(255,255,255,0.6);
}

#player-name:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 20px rgba(255,215,0,0.3);
}

/* Buttons */
.primary-button {
    font-size: 1.3rem;
    padding: 1rem 3rem;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #1e3c72;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255,215,0,0.3);
}

.primary-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255,215,0,0.4);
}

.primary-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.reset-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    background: rgba(220, 53, 69, 0.8);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.reset-button:hover {
    background: rgba(220, 53, 69, 1);
}

/* Game Screen Layout */
#game-screen.active {
    display: block;
    padding: 1rem;
    min-height: 100vh;
}

.game-header {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.player-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.age-phase {
    display: flex;
    gap: 2rem;
    font-size: 1rem;
    opacity: 0.8;
}

.game-layout {
    display: grid;
    grid-template-columns: 400px 1fr 250px;
    gap: 1rem;
    height: calc(100vh - 120px);
}

/* Stats Panel */
.stats-panel {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.stats-section, .resources-section {
    display: flex;
    flex-direction: column;
}

.stats-section h4, .resources-section h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
    color: #ffd700;
}

.stats-grid {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.3s ease;
}

.stat-item:hover {
    background: rgba(255,255,255,0.1);
}

.stat-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.stat-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
    overflow: hidden;
}

.stat-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 4px;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 25px;
    text-align: right;
}

/* Resources */
.resources-grid {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.resource-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.3s ease;
}

.resource-item:hover {
    background: rgba(255,255,255,0.1);
}

.resource-icon {
    font-size: 1.1rem;
}

.resource-value {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Main Content */
.game-content {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.narrative-section {
    margin-bottom: 2rem;
}

.narrative-section h3 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #ffd700;
}

.narrative-section p {
    font-size: 1.1rem;
    line-height: 1.6;
    opacity: 0.9;
}

.choices-section h4 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: #ffd700;
}

.choices-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.choice-button {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    color: #ffffff;
    padding: 1.2rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    font-size: 1rem;
    backdrop-filter: blur(5px);
}

.choice-button:hover {
    border-color: #ffd700;
    background: rgba(255,215,0,0.1);
    transform: translateX(5px);
}

.choice-text {
    display: block;
    font-weight: 500;
}

/* Log Panel */
.log-panel {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.log-panel h4 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    text-align: center;
    color: #ffd700;
}

.log-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.log-entry {
    background: rgba(255,255,255,0.05);
    padding: 0.8rem;
    border-radius: 8px;
    border-left: 3px solid #ffd700;
}

.log-time {
    display: block;
    font-size: 0.8rem;
    color: #ffd700;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.log-text {
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(10px);
}

.tooltip.show {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-layout {
        grid-template-columns: 200px 1fr 200px;
    }
}

@media (max-width: 768px) {
    .game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        gap: 0.5rem;
    }
    
    .stats-panel, .log-panel {
        max-height: 200px;
    }
    
    .game-title {
        font-size: 2.5rem;
    }
    
    .primary-button {
        font-size: 1.1rem;
        padding: 0.8rem 2rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,215,0,0.6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,215,0,0.8);
}
