/* The Organiser's Notebook - Stylesheet */
/* Mobile-first, portrait 390×844 */

:root {
    --bg-primary: #f5f1e8;
    --bg-secondary: #ffffff;
    --bg-paper: #fffef9;
    --text-primary: #2c2c2c;
    --text-secondary: #666;
    --border-color: #d4c5a9;
    --accent-color: #c74440;
    --accent-hover: #a33632;
    --success-color: #4a7c59;
    --warning-color: #d4841c;
    --meter-bg: #e8e3d6;
    --meter-legitimacy: #4a7c59;
    --meter-readiness: #3b5998;
    --meter-support: #d4841c;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-paper: #242424;
    --text-primary: #e8e8e8;
    --text-secondary: #aaa;
    --border-color: #444;
    --accent-color: #e85c5c;
    --accent-hover: #ff7070;
    --meter-bg: #333;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    max-width: 390px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header / Top Bar */
#top-bar {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    padding: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

#top-bar h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.icon-btn {
    background: none;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-primary);
}

.icon-btn:hover {
    background: var(--bg-primary);
}

/* Meters */
.meters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.meter {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meter-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    font-family: 'Arial', sans-serif;
}

.meter-bar {
    height: 8px;
    background: var(--meter-bg);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.meter-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 3px;
}

#legitimacy-fill {
    background: var(--meter-legitimacy);
}

#readiness-fill {
    background: var(--meter-readiness);
}

#support-fill {
    background: var(--meter-support);
}

.meter-value {
    font-size: 10px;
    text-align: center;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    color: var(--text-secondary);
}

/* Calendar */
#calendar {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.day-badge {
    text-align: center;
    padding: 6px 4px;
    font-size: 11px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-paper);
    font-family: 'Arial', sans-serif;
    color: var(--text-secondary);
}

.day-badge.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    font-weight: bold;
}

.day-badge.completed {
    background: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

/* Tabs */
#tabs {
    display: flex;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
    position: sticky;
    top: 120px;
    z-index: 50;
}

.tab {
    flex: 1;
    padding: 12px 8px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tab:hover {
    background: var(--bg-primary);
}

.tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
    font-weight: 700;
}

/* Main Content */
#content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.tab-content h3 {
    font-size: 16px;
    margin: 16px 0 8px;
    color: var(--text-secondary);
}

/* Briefing */
.briefing-header {
    margin-bottom: 16px;
}

.day-display {
    font-size: 14px;
    color: var(--text-secondary);
    font-style: italic;
}

.briefing-text {
    background: var(--bg-paper);
    padding: 16px;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    margin-bottom: 16px;
    line-height: 1.8;
    white-space: pre-wrap;
}

/* Tasks */
.task-info {
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-size: 14px;
}

.selection-count {
    font-weight: bold;
    margin-bottom: 12px;
    color: var(--accent-color);
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.task-card {
    background: var(--bg-paper);
    border: 2px solid var(--border-color);
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.task-card:hover {
    border-color: var(--accent-color);
    box-shadow: var(--shadow);
}

.task-card.selected {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 2px var(--accent-color);
}

.task-card.locked {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--meter-bg);
}

.task-card.completed {
    opacity: 0.6;
    background: var(--meter-bg);
    cursor: default;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 8px;
}

.task-title {
    font-weight: bold;
    font-size: 15px;
    color: var(--text-primary);
}

.task-cost {
    font-family: 'Courier New', monospace;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 14px;
}

.task-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.task-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: 'Arial', sans-serif;
}

.task-time, .task-chance {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Contacts */
.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-card {
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.contact-card:hover {
    box-shadow: var(--shadow);
    border-color: var(--accent-color);
}

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

.contact-name {
    font-weight: bold;
    font-size: 15px;
}

.contact-role {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.trust-bar {
    height: 6px;
    background: var(--meter-bg);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.trust-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--success-color));
    transition: width 0.5s ease;
}

.trust-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Budget */
.budget-summary {
    background: var(--bg-paper);
    border: 2px solid var(--border-color);
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.budget-line {
    display: flex;
    justify-content: space-between;
    font-size: 18px;
    font-weight: bold;
}

.budget-value {
    font-family: 'Courier New', monospace;
    color: var(--text-primary);
}

.budget-value.negative {
    color: var(--accent-color);
}

.ledger {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ledger-entry {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    background: var(--bg-paper);
    border-left: 3px solid var(--border-color);
    font-size: 13px;
}

.ledger-entry.income {
    border-left-color: var(--success-color);
}

.ledger-entry.expense {
    border-left-color: var(--accent-color);
}

.ledger-amount {
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.ledger-amount.positive {
    color: var(--success-color);
}

.ledger-amount.negative {
    color: var(--accent-color);
}

/* Press */
.press-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.press-item {
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 6px;
}

.press-headline {
    font-weight: bold;
    font-size: 15px;
    margin-bottom: 6px;
}

.press-text {
    font-size: 13px;
    color: var(--text-secondary);
}

.press-date {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    font-style: italic;
}

.empty-state {
    color: var(--text-secondary);
    font-style: italic;
    text-align: center;
    padding: 32px;
}

/* Buttons */
.actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.primary-btn, .secondary-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Arial', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.primary-btn {
    background: var(--accent-color);
    color: white;
    flex: 1;
}

.primary-btn:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.secondary-btn:hover {
    background: var(--bg-primary);
}

/* Overlays */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.overlay.hidden {
    display: none;
}

.menu-content, .night-content, .event-content, .contact-content, .ending-content, .slots-content {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.close-btn:hover {
    color: var(--accent-color);
}

/* Menu */
.menu-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.menu-options button {
    padding: 12px;
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.menu-options button:hover {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.lang-toggle, .theme-toggle {
    padding: 12px;
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.lang-toggle select {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    margin-left: 8px;
}

/* Night Screen */
.front-page {
    background: var(--bg-paper);
    border: 2px solid var(--border-color);
    padding: 20px;
    margin: 16px 0;
}

.newspaper-header {
    text-align: center;
    border-bottom: 3px double var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.newspaper-header h3 {
    font-family: 'Georgia', serif;
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.newspaper-date {
    font-size: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

.headline {
    font-size: 20px;
    font-weight: bold;
    line-height: 1.3;
    margin-bottom: 12px;
    text-align: center;
}

.headline-bullets {
    list-style-position: inside;
    padding-left: 0;
}

.headline-bullets li {
    margin-bottom: 8px;
    font-size: 14px;
}

.summary-text {
    background: var(--bg-paper);
    padding: 12px;
    border-left: 3px solid var(--accent-color);
    margin: 16px 0;
    font-size: 14px;
}

.meter-changes {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 16px 0;
    padding: 12px;
    background: var(--bg-paper);
    border-radius: 6px;
}

.meter-change {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.change-positive {
    color: var(--success-color);
    font-weight: bold;
}

.change-negative {
    color: var(--accent-color);
    font-weight: bold;
}

/* Event Screen */
.event-text {
    margin: 16px 0;
    line-height: 1.8;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.choice-btn {
    padding: 12px;
    background: var(--bg-paper);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.choice-btn:hover {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
    transform: translateX(4px);
}

/* Contact Screen */
.dialogue-text {
    margin: 16px 0;
    line-height: 1.8;
    font-style: italic;
}

.trust-display {
    background: var(--bg-paper);
    padding: 12px;
    border-radius: 6px;
    margin: 16px 0;
}

/* Ending Screen */
.ending-title {
    font-size: 24px;
    text-align: center;
    color: var(--accent-color);
    margin: 16px 0;
}

.ending-text {
    line-height: 1.8;
    margin: 16px 0;
}

.final-stats {
    background: var(--bg-paper);
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin: 16px 0;
}

.final-stats h3 {
    margin-bottom: 12px;
}

.stat-line {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-color);
}

.stat-line:last-child {
    border-bottom: none;
}

/* Save Slots */
.slots-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.slot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--bg-paper);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.slot-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.slot-details {
    font-size: 12px;
    color: var(--text-secondary);
}

.slot-btn {
    padding: 8px 16px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.slot-btn:hover {
    background: var(--accent-hover);
}

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

    .meters {
        grid-template-columns: repeat(3, 1fr);
    }

    #top-bar h1 {
        font-size: 22px;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.task-card, .contact-card, .press-item {
    animation: fadeIn 0.3s ease;
}

/* ===== QUALITY ENHANCEMENTS ===== */

/* Custom Modal System */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.custom-modal {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
}

.custom-modal h2 {
    margin-bottom: 16px;
    color: var(--text-primary);
    font-size: 20px;
}

.custom-modal p {
    margin-bottom: 20px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.modal-buttons button {
    flex: 1;
    min-width: 100px;
}

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

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--border-color);
    font-size: 14px;
    z-index: 400;
    max-width: 350px;
    text-align: center;
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

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

.toast-success {
    border-color: var(--success-color);
    background: var(--success-color);
    color: white;
}

.toast-error {
    border-color: var(--accent-color);
    background: var(--accent-color);
    color: white;
}

.toast-warning {
    border-color: var(--warning-color);
    background: var(--warning-color);
    color: white;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.loading-overlay p {
    color: white;
    font-size: 16px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error Screen */
.error-screen {
    padding: 40px 20px;
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.error-screen h1 {
    color: var(--accent-color);
    margin-bottom: 20px;
}

.error-screen ul {
    text-align: left;
    margin: 20px 0;
    padding-left: 20px;
}

.error-screen li {
    margin: 8px 0;
}

.error-detail {
    font-family: 'Courier New', monospace;
    background: var(--bg-paper);
    padding: 12px;
    border-radius: 4px;
    margin: 16px 0;
    font-size: 12px;
    color: var(--accent-color);
}

/* Budget Warnings */
.budget-warning {
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(212, 132, 28, 0.1);
    border: 1px solid var(--warning-color);
    border-radius: 4px;
    font-size: 12px;
    color: var(--warning-color);
    font-weight: bold;
}

.cost-warning {
    color: var(--warning-color) !important;
    font-weight: bold;
}

.task-card.unaffordable {
    opacity: 0.6;
    cursor: not-allowed;
    border-color: var(--warning-color);
}

.task-card.unaffordable:hover {
    border-color: var(--warning-color);
    transform: none;
}

/* Trust Hints */
.trust-hint {
    font-size: 11px;
    color: var(--success-color);
    margin-left: 4px;
}

.favor-hint {
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
    margin: 12px 0;
    padding: 8px;
    background: var(--bg-paper);
    border-radius: 4px;
}

/* Accessibility - Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus States for Keyboard Navigation */
.task-card:focus,
.contact-card:focus,
.choice-btn:focus,
button:focus,
.tab:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

.task-card:focus-visible,
.contact-card:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Improved Button States */
button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

button:not(:disabled):active {
    transform: translateY(1px);
}

/* ARIA Selected States */
.tab[aria-selected="true"] {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

.task-card[aria-pressed="true"] {
    border-color: var(--accent-color);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 2px var(--accent-color);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000;
        --accent-color: #c00;
    }

    [data-theme="dark"] {
        --border-color: #fff;
        --accent-color: #f44;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .spinner {
        animation: none;
        border-top-color: transparent;
    }
}

/* Touch Target Improvements (Mobile) */
@media (hover: none) and (pointer: coarse) {
    button,
    .tab,
    .task-card,
    .contact-card,
    .choice-btn {
        min-height: 44px;
        padding: 12px;
    }

    .slot-btn {
        min-height: 44px;
        min-width: 88px;
    }
}

/* Dark Mode Specific Adjustments */
[data-theme="dark"] .toast {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .custom-modal {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .budget-warning {
    background: rgba(212, 132, 28, 0.2);
}

/* Print Styles */
@media print {
    .overlay,
    #menu-btn,
    #tabs,
    button {
        display: none !important;
    }

    body {
        max-width: 100%;
    }

    .final-stats,
    .ending-text {
        page-break-inside: avoid;
    }
}

/* ===== Splash Screen ===== */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease;
}

.splash-screen.hidden {
    display: none;
}

.splash-content {
    text-align: center;
    padding: 40px 20px;
    max-width: 350px;
}

.splash-title {
    font-size: 32px;
    margin-bottom: 16px;
    color: var(--accent-color);
    font-weight: bold;
    line-height: 1.2;
}

.splash-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 40px;
    line-height: 1.5;
}

.large-btn {
    font-size: 20px;
    padding: 16px 48px;
    min-height: 56px;
}

.splash-footer {
    margin-top: 32px;
    font-size: 13px;
    color: var(--text-secondary);
    font-style: italic;
}

/* ===== Instructions Overlay ===== */
.instructions-content {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.instructions-body {
    margin: 20px 0;
}

.instruction-section {
    margin-bottom: 24px;
}

.instruction-section h3 {
    color: var(--accent-color);
    margin-bottom: 8px;
    font-size: 18px;
}

.instruction-section ul {
    list-style: none;
    padding-left: 0;
}

.instruction-section li {
    padding: 8px 0 8px 24px;
    position: relative;
}

.instruction-section li:before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

.instructions-content button {
    margin: 8px 4px;
}

/* ===== Tutorial Overlay ===== */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tutorial-overlay.hidden {
    display: none;
}

.tutorial-box {
    background: var(--bg-secondary);
    border: 3px solid var(--accent-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: relative;
    animation: slideUp 0.3s ease;
}

.tutorial-step-counter {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: bold;
}

.tutorial-box h3 {
    color: var(--accent-color);
    margin-bottom: 12px;
    font-size: 20px;
}

.tutorial-box p {
    margin-bottom: 20px;
    line-height: 1.6;
}

.tutorial-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
}

.tutorial-pointer {
    position: fixed;
    width: 100px;
    height: 100px;
    border: 4px solid var(--accent-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 401;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 var(--accent-color);
    transition: all 0.3s ease;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.7;
    }
}

.tutorial-highlight {
    position: relative;
    z-index: 402 !important;
    box-shadow: 0 0 0 4px var(--accent-color), 0 0 20px rgba(199, 68, 64, 0.6) !important;
}

.text-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    text-decoration: underline;
    padding: 8px;
    cursor: pointer;
    font-size: 14px;
}

.text-btn:hover {
    color: var(--text-primary);
}

.secondary-btn {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.secondary-btn:hover {
    background: var(--border-color);
}


/* ===== NEW FEATURES CSS ===== */

/* Morale Meter (4th meter) */
:root {
    --meter-morale: #9b59b6;
}

[data-theme="dark"] {
    --meter-morale: #bb7bdb;
}

#morale-fill {
    background: var(--meter-morale);
}

.meter:nth-child(4) .meter-fill {
    background: var(--meter-morale);
}

/* Low morale warning */
.morale-low {
    animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Photo Documentation Section */
.photo-section {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.photo-section h3 {
    margin-bottom: 12px;
    color: var(--accent-color);
}

.photo-counter {
    margin-bottom: 16px;
    font-size: 16px;
    font-weight: bold;
}

.photo-counter strong {
    color: var(--accent-color);
    font-size: 20px;
}

.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.photo-item {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.photo-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.photo-item.high-impact {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(199, 68, 64, 0.2);
}

.photo-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.photo-title {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
}

.photo-impact {
    font-size: 11px;
    color: var(--text-secondary);
}

.photo-impact.high {
    color: var(--accent-color);
    font-weight: bold;
}

/* Headlines Section */
.headlines-section {
    margin-top: 24px;
}

.headlines-section h3 {
    margin-bottom: 12px;
    color: var(--accent-color);
}

.headline-item {
    background: var(--bg-paper);
    border-left: 4px solid var(--border-color);
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 4px;
}

.headline-item.positive {
    border-left-color: var(--success-color);
}

.headline-item.negative {
    border-left-color: var(--warning-color);
}

.headline-date {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.headline-text {
    font-family: 'Georgia', serif;
    font-size: 15px;
    font-weight: bold;
    line-height: 1.4;
}

/* Achievements System */
.achievements-content {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.achievements-desc {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-style: italic;
}

.achievements-list {
    display: grid;
    gap: 12px;
}

.achievement-item {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 16px;
    align-items: center;
    transition: all 0.3s ease;
}

.achievement-item.locked {
    opacity: 0.5;
    filter: grayscale(80%);
}

.achievement-item.unlocked {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(199, 68, 64, 0.1);
}

.achievement-item.just-unlocked {
    animation: achievement-unlock 0.6s ease-out;
}

@keyframes achievement-unlock {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.achievement-icon {
    font-size: 40px;
    min-width: 50px;
    text-align: center;
}

.achievement-info {
    flex: 1;
}

.achievement-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 4px;
}

.achievement-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.achievement-reward {
    margin-top: 6px;
    font-size: 12px;
    color: var(--success-color);
    font-weight: bold;
}

.achievement-item.locked .achievement-reward {
    color: var(--text-secondary);
}

/* Arrest & Injury Status */
.organizer-status {
    background: var(--warning-color);
    color: white;
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 12px;
}

.organizer-status.arrested {
    background: #c0392b;
}

.organizer-status.injured {
    background: var(--warning-color);
}

.status-icon {
    font-size: 24px;
}

.status-text {
    flex: 1;
}

.status-days {
    font-size: 20px;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 12px;
    border-radius: 4px;
}

/* Morale Warning in Briefing */
.morale-warning {
    background: rgba(155, 89, 182, 0.1);
    border: 2px solid var(--meter-morale);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.morale-warning-icon {
    font-size: 28px;
}

.morale-warning-text {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
}

/* Task difficulty indicator when morale is low */
.task-card.morale-penalty {
    opacity: 0.8;
    position: relative;
}

.task-card.morale-penalty::after {
    content: "⚠️ Low Morale";
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(155, 89, 182, 0.9);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
}

/* Photo notification toast */
.toast.photo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

/* Achievement notification toast */
.toast.achievement {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    font-weight: bold;
}


/* ===== METER CHANGE ANIMATIONS ===== */
.meter-value.meter-increase {
    animation: meter-flash-green 0.6s ease;
}

.meter-value.meter-decrease {
    animation: meter-flash-red 0.6s ease;
}

@keyframes meter-flash-green {
    0% {
        color: var(--text-primary);
        transform: scale(1);
    }
    30% {
        color: var(--success-color);
        transform: scale(1.3);
        font-weight: bold;
    }
    100% {
        color: var(--text-primary);
        transform: scale(1);
    }
}

@keyframes meter-flash-red {
    0% {
        color: var(--text-primary);
        transform: scale(1);
    }
    30% {
        color: var(--warning-color);
        transform: scale(1.3);
        font-weight: bold;
    }
    100% {
        color: var(--text-primary);
        transform: scale(1);
    }
}

/* ===== CALENDAR TOOLTIPS ===== */
.day-badge {
    position: relative;
}

.day-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    min-width: 200px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 8px;
}

.day-badge:hover .day-tooltip {
    opacity: 1;
}

.day-tooltip h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: var(--accent-color);
}

.day-tooltip-item {
    font-size: 12px;
    margin: 4px 0;
    line-height: 1.4;
}

.day-tooltip-item.positive {
    color: var(--success-color);
}

.day-tooltip-item.negative {
    color: var(--warning-color);
}

/* Arrow for tooltip */
.day-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-color);
}

/* ===== PWA INSTALL PROMPT ===== */

.pwa-install-content {
    background: var(--bg-color);
    border-radius: 12px;
    padding: 32px 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.pwa-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.pwa-install-content h2 {
    margin: 0 0 8px 0;
    color: var(--accent-color);
    font-size: 24px;
}

.pwa-subtitle {
    margin: 0 0 24px 0;
    color: var(--text-muted);
    font-size: 16px;
}

.pwa-benefits {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 24px 0;
    text-align: left;
}

.pwa-benefit {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--border-color);
    border-radius: 8px;
}

.benefit-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.pwa-benefit strong {
    display: block;
    color: var(--text-color);
    margin-bottom: 4px;
    font-size: 14px;
}

.pwa-benefit p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.4;
}

.pwa-instructions {
    margin: 24px 0;
    text-align: left;
}

.platform-instructions {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.platform-instructions h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--accent-color);
}

.platform-instructions ol {
    margin: 0;
    padding-left: 20px;
}

.platform-instructions li {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
}

.ios-share-icon,
.install-icon {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 16px;
}

.pwa-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.pwa-actions .primary-btn,
.pwa-actions .secondary-btn {
    width: 100%;
    padding: 14px;
    font-size: 16px;
}

.pwa-actions .text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: color 0.2s;
}

.pwa-actions .text-btn:hover {
    color: var(--text-color);
}

/* Dark mode adjustments */
body.dark-mode .pwa-install-content {
    background: var(--bg-color);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

body.dark-mode .pwa-benefit {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .platform-instructions {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Responsive: Stack platform instructions on mobile */
@media (max-width: 480px) {
    .pwa-install-content {
        padding: 24px 16px;
    }

    .pwa-icon {
        font-size: 48px;
    }

    .pwa-install-content h2 {
        font-size: 20px;
    }

    .pwa-subtitle {
        font-size: 14px;
    }

    .benefit-icon {
        font-size: 24px;
    }
}
