/* ===================================
   BASE STYLES
   =================================== */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body {
    font-family: Arial, sans-serif;
    background: #1a1a1a;
    color: #fff;
    padding: 20px;
}

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

/* ===================================
   HEADER & STATS
   =================================== */
.header { 
    background: #2a2a2a; 
    padding: 20px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
}

.header h1 { 
    font-size: 24px; 
    margin-bottom: 10px; 
}

.stats { 
    display: flex; 
    gap: 20px; 
    flex-wrap: wrap; 
    font-size: 14px; 
}

.stat { 
    background: #333; 
    padding: 8px 16px; 
    border-radius: 4px; 
}

.stat strong { 
    color: #4CAF50; 
}

.stress-tokens {
    margin-top: 10px;
}

.stress-token { 
    width: 20px; 
    height: 20px; 
    background: #f44336; 
    border-radius: 50%; 
    display: inline-block; 
    margin-right: 5px; 
}

/* ===================================
   GAME LAYOUT
   =================================== */
.game-area { 
    display: grid; 
    grid-template-columns: 1fr 2fr 1fr; 
    gap: 20px; 
    margin-bottom: 20px; 
}

.section { 
    background: #2a2a2a; 
    padding: 15px; 
    border-radius: 8px; 
}

.section h2 { 
    font-size: 16px; 
    margin-bottom: 12px; 
    color: #4CAF50; 
}

/* ===================================
   CARD STYLES
   =================================== */

.task-card-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center; 
}

.f-card-area {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.card { 
    border: 2px solid #555; 
    border-radius: 8px; 
    padding: 0; 
    margin-bottom: 0; 
    cursor: pointer; 
    transition: all 0.2s ease-in-out; 
    background: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    overflow: hidden; 
    
    position: relative;
    background-size: cover;
    background-position: center;
}

.card:hover:not(.selected) { 
    border-color: #4CAF50; 
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.3);
}

.card.selected { 
    border-color: #4CAF50; 
    background-color: #1a3a1a; 
    transform: translateY(-5px) scale(1.03); 
    box-shadow: 0 0 15px 3px rgba(76, 175, 80, 0.6), 0 5px 10px rgba(0, 0, 0, 0.3);
}

/* === Task Card HTML Structure === */

.task-card {
    width: 100%;
    max-width: 280px;
    min-height: 390px; 
    display: flex;
    flex-direction: column;
    padding: 10px;
    color: white;
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8); 
}

.task-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 0; 
}

.card-header, .card-content-middle, .card-effect {
    position: relative; 
    z-index: 1;
}

.card-header {
    background: rgba(0,0,0,0.5);
    padding: 8px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.2);
}

.card-title {
    font-size: 18px;
    margin-bottom: 5px;
    color: #fff;
}

.card-cost {
    font-size: 16px;
    color: #ff9800; 
}
.card-cost .base-cost {
    text-decoration: line-through;
    opacity: 0.7;
    color: #fff;
    font-size: 14px;
}
.card-cost .mod-arrow {
    color: #f44336;
    margin: 0 4px;
}
.card-cost .mod-cost {
    color: #f44336; 
    font-size: 18px;
}

.card-content-middle {
    flex-grow: 1; 
    display: flex;
    flex-direction: column;
    justify-content: center; 
    padding: 10px 0;
}

.card-time {
    align-self: flex-start;
    background: rgba(0,0,0,0.5);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    color: #ccc;
}

.card-flavor {
    font-style: italic;
    font-size: 14px;
    font-weight: normal;
    color: #ccc;
    text-align: center;
    padding: 10px;
    line-height: 1.4;
    margin-top: 10px;
}

.card-effect {
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(2px);
    color: #4CAF50; 
    font-size: 14px;
    padding: 10px;
    text-align: center;
    line-height: 1.3;
    border-top: 1px solid #4CAF50;
    border-radius: 0 0 5px 5px;
    margin: 0 -10px -10px -10px; 
}


/* === F-Card HTML Structure === */
.f-card { 
    min-height: 140px; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center; 
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

.f-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3); 
    z-index: 0; 
}

.f-card-symbol {
    font-size: 3em;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.f-card-label {
    font-size: 14px;
    margin-top: 10px;
    position: relative;
    z-index: 1;
}

.f-card.physical { 
    border-color: #b71c1c; 
}
.f-card.social { 
    border-color: #0d47a1; 
}
.f-card.mental { 
    border-color: #e65100; 
}

/* ===================================
   BUTTONS
   =================================== */
.buttons { 
    display: flex; 
    gap: 10px; 
    flex-wrap: wrap; 
    margin-top: 15px; 
}

button { 
    background: #4CAF50; 
    color: white; 
    border: none; 
    padding: 12px 20px; 
    border-radius: 6px; 
    cursor: pointer; 
    font-size: 14px; 
    font-weight: bold; 
    transition: background 0.2s; 
}

button:hover:not(:disabled) { 
    background: #45a049; 
}

button:disabled { 
    background: #666; 
    cursor: not-allowed; 
}

button.secondary { 
    background: #666; 
}

button.secondary:hover:not(:disabled) {
    background: #777;
}

/* ===================================
   MESSAGES
   =================================== */
.message { 
    background: #1a3a1a; 
    border: 2px solid #4CAF50; 
    padding: 15px; 
    border-radius: 8px; 
    margin-bottom: 20px; 
    font-size: 14px; 
}

.message.error { 
    background: #3a1a1a; 
    border-color: #f44336; 
}

.message.warning { 
    background: #3a2a1a; 
    border-color: #ff9800; 
}

/* ===================================
   COMPLETED TASKS
   =================================== */
.completed-task { 
    background: #1a3a1a; 
    border: 1px solid #4CAF50; 
    padding: 8px; 
    margin-bottom: 5px; 
    border-radius: 4px; 
    font-size: 12px; 
}

/* ===================================
   SETUP & GAME OVER SCREENS
   =================================== */
.game-over, 
.setup-screen { 
    background: #2a2a2a; 
    padding: 40px; 
    border-radius: 12px; 
    border: 3px solid #4CAF50; 
    text-align: center; 
    max-width: 800px; 
    margin: 0 auto 40px; 
}

.mode-select {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin: 20px 0;
}
.mode-select .condition-option { 
    padding: 20px 15px;
    font-size: 14px;
}

.rules { 
    margin-top: 20px; 
    padding: 15px; 
    background: #333; 
    border-radius: 8px; 
    font-size: 13px; 
    line-height: 1.6; 
    text-align: left; 
}

.rules h3 {
    margin-bottom: 10px;
    color: #4CAF50;
}

.rules ul { 
    margin-left: 20px; 
    margin-top: 10px; 
}

.rules li { 
    margin-bottom: 8px; 
}

/* ===================================
   CONDITION SELECTION
   =================================== */
.condition-select { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 15px; 
    margin: 20px 0; 
}

.condition-option { 
    background: #333; 
    border: 2px solid #555; 
    border-radius: 8px; 
    padding: 15px; 
    cursor: pointer; 
    transition: all 0.2s; 
}

.condition-option:hover:not(.selected) { 
    border-color: #4CAF50; 
    transform: translateY(-2px); 
}

.condition-option.selected { 
    border-color: #4CAF50; 
    background: #1a3a1a;
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.condition-option h3 { 
    font-size: 16px; 
    margin-bottom: 8px; 
    color: #4CAF50; 
}

.condition-option p { 
    font-size: 12px; 
    color: #ccc; 
    line-height: 1.4; 
}

/* ===================================
   AGREEMENT CHECKBOX
   =================================== */
.agreement { 
    margin: 20px 0; 
    padding: 15px; 
    border: 1px solid #4CAF50; 
    border-radius: 6px; 
    font-size: 13px; 
    background: #1a3a1a; 
    display: flex; 
    align-items: flex-start; 
    gap: 10px; 
    text-align: left; 
}

.agreement input[type="checkbox"] { 
    margin-top: 2px; 
    cursor: pointer; 
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.agreement label {
    cursor: pointer;
}

.footer-note { 
    text-align: center; 
    margin-top: 30px; 
    font-size: 11px; 
    color: #555; 
    line-height: 1.6; 
}

/* ===================================
   FEEDBACK SECTION
   =================================== */
.feedback-section {
    background: #2a2a2a;
    padding: 40px 20px;
    margin-top: 40px;
    border-radius: 8px;
    text-align: center;
}

.feedback-section h2 {
    color: #4CAF50;
    margin-bottom: 20px;
}

.feedback-container {
    max-width: 800px;
    margin: 0 auto;
    background: #333;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    min-height: 1500px;
}

.feedback-container iframe {
    width: 100%;
    min-height: 1500px;
    border: none;
}

/* ===================================
   RULES REMINDER
   =================================== */
.rules-reminder {
    background: #333;
    border: 1px solid #555;
    border-left: 3px solid #ff9800; 
    padding: 10px 10px 10px 15px; 
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 12px;
    color: #ccc;
    line-height: 1.5;
}

.rules-reminder ul {
    list-style-position: inside; 
    padding-left: 5px;
}

.rules-reminder li {
    margin-bottom: 5px;
}

.rules-reminder li:last-child {
    margin-bottom: 0;
}

.rules-reminder strong {
    color: #ff9800;
    font-weight: 600;
}

/* ===================================
   CONDITION REMINDERS
   =================================== */
.condition-reminders {
    margin-bottom: 20px;
}

.condition-reminder {
    background: #333;
    border: 1px solid #555;
    border-left: 3px solid #4CAF50;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.condition-reminder h3 {
    font-size: 14px;
    color: #4CAF50;
    margin-bottom: 4px;
}

.condition-reminder p {
    font-size: 12px;
    color: #ccc;
    line-height: 1.4;
}

/* ===================================
   STRESS-BASED UI CHANGES
   =================================== */

.section h2.stress-warning {
    color: #ff9800; 
}
.section h2.stress-danger {
    color: #f44336; 
}

.completed-tasks.warning .completed-task {
    background: #3a2a1a; 
    border-color: #ff9800;
    color: #ff9800;
}
.completed-tasks.danger .completed-task {
    background: #3a1a1a; 
    border-color: #f44336;
    color: #f44336;
}

/* === NEW: Burntout State === */
.header.burnt-out {
    border: 2px solid #f44336;
    background-image: linear-gradient(rgba(0,0,0,0), rgba(100,0,0,0.5));
}
.header.burnt-out h1 {
    color: #f44336;
    animation: pulse 1.5s infinite;
}

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

/* ===================================
   LINGERING TASKS
   =================================== */
.lingering-tasks-area {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    background: #111;
    padding: 8px 10px;
    border-radius: 6px;
    margin: 15px 0 10px 0;
    border: 1px solid #333;
}

.lingering-deck {
    flex: 1;
    min-width: 0;
}

.lingering-label {
    font-size: 11px;
    font-weight: bold;
    color: #888;
    margin-bottom: 5px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-card-pile {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    min-height: 12px;
    justify-content: center;
}

.mini-task-card {
    width: 15px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid #000;
    background-color: #555;
}

.mini-task-card.morning { background-color: #ff9800; }
.mini-task-card.midday { background-color: #4CAF50; }
.mini-task-card.afternoon { background-color: #f44336; }
.mini-task-card.evening { background-color: #1976d2; }

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 900px) {
    .game-area { 
        grid-template-columns: 1fr; 
    }
}

@media (max-width: 600px) {
    body { 
        padding: 10px; 
    }
    
    .header h1 { 
        font-size: 18px; 
    }
    
    .stats { 
        font-size: 12px; 
        gap: 10px; 
    }

    .lingering-tasks-area {
        flex-wrap: wrap;
    }
    .lingering-deck {
        flex-basis: 45%; 
    }
    
    .section { 
        padding: 10px; 
    }
    
    .buttons { 
        flex-direction: column; 
    }
    
    button { 
        width: 100%; 
    }
    
    .mode-select {
        grid-template-columns: 1fr;
    }
    
    .condition-select { 
        grid-template-columns: 1fr; 
    }
    
    .setup-screen, 
    .game-over { 
        padding: 20px; 
        max-width: 95%; 
        margin: 0 auto 20px; 
    }
    
    .feedback-section { 
        padding: 20px 10px; 
    }

    .f-card-area {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
}
