/* ==========================================================================
   1. Variables & Base Settings
   ========================================================================== */
:root {
    --bg-color: #f4f7f6;
    --surface: #ffffff;
    --primary: #486b00;
    --primary-hover: #456600;
    --text-main: #333333;
    --text-muted: #666666;
    --error: #d9534f;
    --success: #5cb85c;
    --border: #e0e0e0;
    --radius: 12px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    padding: 20px 12px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

#app {
    background: var(--surface);
    max-width: 1080px;
    width: 100%;
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: opacity 0.15s ease-in-out, max-width 0.3s ease;
    opacity: 1;
}

#app.booting {
    opacity: 0;
    pointer-events: none;
}

@media (max-width: 600px) {
    body { padding: 10px 6px; }
    #app { padding: 18px 14px; border-radius: 8px; }
}

/* ==========================================================================
   2. Typography & Views
   ========================================================================== */
h1 {
    margin-top: 0;
    margin-bottom: 6px;
    color: var(--primary);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
}

.subtitle {
    margin-top: 0;
    margin-bottom: 24px;
    color: var(--text-muted);
}

h2 { margin-top: 0; color: var(--primary); }

#setup-heading,
#quiz-heading,
#results-heading {
    outline: none;
}

.view { display: none; }
.view.active { display: block; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0, 0, 0, 0); border: 0;
}
a.visually-hidden:focus,
a.visually-hidden:focus-visible,
button.visually-hidden:focus,
button.visually-hidden:focus-visible {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ==========================================================================
   3. Setup Form, Panel Cards & Column Separator
   ========================================================================== */
.setup-actions-row {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.btn-daily-trigger {
    background-color: #0d6efd !important;
}
.btn-daily-trigger:hover {
    background-color: #0b5ed7 !important;
}
.btn-daily-trigger.btn-daily-active {
    background-color: #6c757d !important;
}
.btn-daily-trigger.btn-daily-active:hover {
    background-color: #5c636a !important;
}

.setup-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (min-width: 768px) {
    .setup-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

.setup-card {
    background: #fafcfb;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .setup-card:first-child {
        position: relative;
    }
    .setup-card:first-child::after {
        content: "";
        position: absolute;
        top: 10%;
        bottom: 10%;
        right: -17px;
        width: 1px;
        background-color: var(--border);
    }
}

.setup-card-title {
    font-size: 1.1rem;
    color: var(--primary);
    margin-top: 0;
    margin-bottom: 18px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e8f0e6;
}

.form-group { margin-bottom: 20px; }
.form-row { display: flex; gap: 15px; }
.form-row .form-group { flex: 1; }

label, .group-label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    color: var(--text-main);
}

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    background-color: #fff;
}

.input-error {
    border-color: var(--error) !important;
    border-width: 2px !important;
}

button {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 11px 20px;
    font-size: 15px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    width: 100%;
    font-weight: bold;
}
button:hover { background-color: var(--primary-hover); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary-large {
    font-size: 17px;
    padding: 14px;
    margin-top: 10px;
}

#btn-gps {
    margin-bottom: 10px;
    background-color: #555;
}
#btn-gps:hover { background-color: #444; }

.location-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    border: none;
    padding: 0;
    min-width: 0;
}

.location-toggle-label {
    flex: 1;
    text-align: center;
    padding: 8px;
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.location-toggle input[type="radio"] {
    position: absolute; width: 1px; height: 1px; margin: -1px;
    padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

.location-toggle input[type="radio"]:checked + .location-toggle-label {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.location-toggle input[type="radio"]:focus-visible + .location-toggle-label {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.location-section { display: none; }
.location-section.active { display: block; }

.coords-row { display: flex; gap: 10px; }
.coords-group { flex: 1; margin-bottom: 0; }

select[multiple] {
    height: auto;
    padding: 6px;
}

.fieldset-reset { border: none; padding: 0; margin: 0 0 20px 0; }
.checkbox-group { display: flex; gap: 20px; margin-top: 8px; flex-wrap: wrap; }
.checkbox-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: normal; cursor: pointer; }
.checkbox-label input { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }

.quick-selectors {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.btn-quick-select {
    width: auto;
    padding: 4px 10px;
    font-size: 12px;
    background-color: var(--bg-color);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-weight: normal;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.btn-quick-select:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-quick-select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-quick-select:disabled,
.btn-quick-select.input-locked {
    opacity: 0.5;
    cursor: not-allowed !important;
    background-color: var(--bg-color) !important;
    color: var(--text-muted) !important;
    border-color: var(--border) !important;
}

/* ==========================================================================
   4. Daily Challenge Banner & Locked Inputs
   ========================================================================== */
.daily-banner {
    background: #eef6ff;
    border: 1px solid #b6d4fe;
    border-left: 5px solid #0d6efd;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.daily-banner-content {
    flex: 1;
    min-width: 250px;
}

.daily-banner-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.daily-badge {
    background: #0d6efd;
    color: #ffffff;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.daily-date {
    font-weight: bold;
    color: #084298;
    font-size: 14px;
}

.daily-completed-badge {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 10px;
    border-radius: 12px;
}

.daily-banner-text {
    margin: 0;
    font-size: 13px;
    color: #084298;
    line-height: 1.4;
}

.btn-secondary-small {
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
    background-color: #ffffff;
    color: #084298;
    border: 1px solid #b6d4fe;
    border-radius: var(--radius);
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.btn-secondary-small:hover {
    background-color: #e2eefa;
    border-color: #0d6efd;
}

.input-locked {
    opacity: 0.75;
    background-color: #f8f9fa !important;
    cursor: not-allowed !important;
    border-color: #ced4da !important;
}

/* ==========================================================================
   5. Input Helpers & Clear Buttons
   ========================================================================== */
.autocomplete-wrapper { position: relative; }
.z-high { z-index: 10; position: relative; }
.z-mid { z-index: 5; position: relative; }

.input-relative-wrapper { position: relative; display: block; }
.input-relative-wrapper input[type="text"],
.input-relative-wrapper input[type="number"] { padding-right: 40px; }

.btn-clear {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; color: var(--text-muted);
    font-size: 22px; cursor: pointer; padding: 0 5px; display: none;
    width: auto; font-weight: normal;
}
.btn-clear:hover { color: var(--error); background: transparent; }
.btn-clear:focus-visible { outline: 2px solid var(--primary); border-radius: 4px; }

.autocomplete-list {
    position: absolute; top: 100%; left: 0; right: 0;
    background: white; border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    max-height: 200px; overflow-y: auto; margin: 0; padding: 0;
    list-style: none; box-shadow: 0 4px 12px rgba(0,0,0,0.15); display: none;
}
.autocomplete-list.show { display: block; }
.autocomplete-list li { padding: 10px; cursor: pointer; border-bottom: 1px solid var(--border); }
.autocomplete-list li:hover,
.autocomplete-list li.active {
    background: var(--bg-color);
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
.autocomplete-list:not(.using-keyboard):hover li.active:not(:hover) {
    background: transparent;
    outline: none;
}
.autocomplete-list.using-keyboard li:hover:not(.active) {
    background: transparent;
    outline: none;
}

/* ==========================================================================
   6. Quiz Split Grid & Media Controls
   ========================================================================== */
.quiz-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 768px) {
    .quiz-grid {
        grid-template-columns: 1.15fr 0.85fr;
        gap: 28px;
        align-items: start;
    }
}

.progress {
    display: flex; justify-content: space-between;
    color: var(--text-muted); font-size: 15px;
    font-weight: bold;
    margin-bottom: 15px; border-bottom: 1px solid var(--border); padding-bottom: 10px;
}

.badge-container { text-align: center; margin-bottom: 15px; }
.target-badge {
    display: none;
    background-color: var(--primary); color: white;
    padding: 5px 14px; border-radius: 16px;
    font-size: 13px; font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); text-transform: capitalize;
}

.quiz-media-container {
    text-align: center; margin-bottom: 15px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    background: #111; border-radius: var(--radius); border: 1px solid var(--border);
    position: relative; padding: 15px; overflow: hidden;
}

.quiz-media-stage {
    width: 100%;
    height: clamp(300px, 45vh, 480px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
}

#quiz-image {
    display: none;
    max-width: 100%; max-height: 100%;
    border-radius: 6px; object-fit: contain;
    transition: opacity 0.2s ease; margin: 0 auto;
}
#quiz-image:hover { opacity: 0.9; }

#btn-zoom-image {
    display: none;
    background: transparent; border: none; padding: 0; width: 100%; height: 100%;
    align-items: center; justify-content: center; cursor: zoom-in;
    outline-offset: 4px; border-radius: 4px;
}
#btn-zoom-image:focus-visible { outline: 2px solid var(--primary); }

.audio-player-wrapper {
    background: #222; border: 1px solid #444; padding: 24px;
    border-radius: var(--radius); width: 100%; max-width: 450px;
    margin: 0; display: none;
    flex-direction: column; align-items: center; gap: 14px;
}
.audio-player-wrapper audio { width: 100%; }
.audio-icon { font-size: 52px; color: var(--primary); }

.media-controls {
    display: none;
    align-items: center; justify-content: center;
    gap: 15px; margin-top: 10px; width: 100%;
}
.media-controls button {
    width: auto;
    min-width: 44px;
    min-height: 44px;
    padding: 5px 15px;
    background-color: #444;
    font-size: 14px;
    border-radius: 20px;
}
.media-controls button:hover { background-color: #666; }
.media-controls button:disabled { opacity: 0.3; cursor: not-allowed; }
#media-counter { font-size: 14px; font-weight: bold; color: #ccc; min-width: 40px; text-align: center; }

.quiz-meta {
    display: none;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #ccc;
    margin-top: 10px;
    background-color: #222;
    padding: 10px 15px;
    border-radius: 10px;
    text-align: center;
    width: 100%;
}
.quiz-meta a { color: #81c784; text-decoration: none; transition: color 0.2s; }
.quiz-meta a:hover { text-decoration: underline; color: #a5d6a7; }

.attribution {
    display: none;
    font-size: 12px; 
    color: #aaa; 
    margin-top: 6px;
}

.license-link {
    color: inherit;
    text-decoration: underline;
    transition: opacity 0.2s;
}
.license-link:hover { opacity: 0.8; }

.hint-wrapper {
    margin: 12px 0 20px 0;
    text-align: center;
    width: 100%;
}

.btn-hint {
    background-color: #e8f5e9;
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 8px 18px;
    font-size: 13px;
    border-radius: 20px;
    cursor: pointer;
    width: auto;
    margin: 0 auto;
    font-weight: bold;
    transition: background-color 0.2s, color 0.2s;
}

.btn-hint:hover {
    background-color: var(--primary);
    color: #ffffff;
}

.hint-content {
    margin-top: 10px;
    padding: 14px 18px;
    background-color: #fffde7;
    border-left: 4px solid #fbc02d;
    border-radius: 6px;
    font-size: 14px;
    color: #5d4037;
    text-align: left;
    word-break: break-word;
    white-space: pre-wrap;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}

/* ==========================================================================
   7. Answer Inputs & Quiz Buttons
   ========================================================================== */
.answer-inputs-row { display: flex; gap: 10px; }
#input-rank { flex: 0 0 110px; }
#input-answer { flex: 1; }

.answer-buttons-row { display: flex; gap: 10px; margin-top: 12px; }
#btn-submit, #btn-skip { flex: 1; }
#btn-skip { display: none; background-color: #666; }
#btn-skip:hover { background-color: #555; }

#btn-retry { display: none; margin-top: 15px; background-color: #f0ad4e; }
#btn-retry:hover { background-color: #ec971f; }

#btn-skip-end { display: none; margin-top: 15px; background-color: #666; }
#btn-skip-end:hover { background-color: #555; }

#btn-next { display: none; margin-top: 15px; }

.mc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

@media (min-width: 480px) {
    .mc-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.btn-mc-option {
    background: #ffffff;
    border: 2px solid var(--border);
    color: var(--text-main);
    padding: 12px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s, transform 0.1s;
    width: 100%;
    line-height: 1.3;
}

.btn-mc-option:hover:not(:disabled) {
    border-color: var(--primary);
    background-color: #f4f8f3;
}

.btn-mc-option:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-mc-option:disabled {
    cursor: default;
    opacity: 0.85;
}

.btn-mc-option.opt-correct {
    background-color: #e8f5e9 !important;
    border-color: var(--success) !important;
    color: #1b5e20 !important;
    font-weight: bold;
}

.btn-mc-option.opt-incorrect {
    background-color: #fdeaea !important;
    border-color: var(--error) !important;
    color: #c62828 !important;
    text-decoration: line-through;
}

/* ==========================================================================
   8. Feedback & Errors
   ========================================================================== */
.inline-error { color: var(--error); font-size: 13px; font-weight: bold; margin-top: 6px; display: none; }
#form-error-message { text-align: center; margin-bottom: 15px; }

#quiz-loading {
    position: absolute;
    z-index: 5;
    background: rgba(0, 0, 0, 0.75);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    color: #ffffff;
    animation: pulse 1.5s infinite;
    pointer-events: none;
}
@keyframes pulse { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }

#quiz-error {
    display: none;
    color: var(--error); font-weight: bold;
    padding: 20px; text-align: center;
}
.error-hint { color: #aaa; font-weight: normal; }

#feedback { font-weight: bold; margin-top: 15px; padding: 12px 16px; border-radius: var(--radius); display: none; }
#feedback.correct { background-color: #e8f5e9; color: var(--success); border: 1px solid var(--success); }
#feedback.incorrect { background-color: #fdeaea; color: var(--error); border: 1px solid var(--error); }

.feedback-links {
    margin-top: 8px; padding-top: 6px; border-top: 1px dashed rgba(0, 0, 0, 0.15);
    font-size: 0.85em; font-weight: normal;
}
.feedback-links a { color: inherit; font-weight: bold; text-decoration: underline; }
.feedback-links a:hover { opacity: 0.8; }
.feedback-separator { margin: 0 4px; opacity: 0.5; }
.feedback-alias-note { font-size: 0.9em; font-weight: normal; }

/* ==========================================================================
   9. Results View & Social Actions
   ========================================================================== */
#results-heading { text-align: center; }
#final-score { text-align: center; font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 24px; }

.score-card-preview {
    background-color: #fafcfb;
    border: 2px dashed #b6d4fe;
    border-radius: var(--radius);
    padding: 16px 20px;
    margin: 0 auto 20px auto;
    max-width: 480px;
    text-align: left; /* Left-aligned for clean monospaced layout */
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.03);
}

.score-card-text {
    margin: 0;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    overflow-wrap: anywhere;
    color: var(--text-main);
    font-weight: 600;
    text-align: left;
}

.results-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.btn-share-results {
    flex: 1;
    margin: 0;
    background-color: #0d6efd !important;
}
.btn-share-results:hover {
    background-color: #0b5ed7 !important;
}

.btn-share-link {
    flex: 1;
    margin: 0;
    background-color: #555 !important;
}
.btn-share-link:hover {
    background-color: #444 !important;
}

.perfect-score-banner {
    text-align: center; padding: 20px; background: #e8f5e9;
    color: var(--success); border-radius: var(--radius);
    margin-bottom: 20px; font-weight: bold;
}

.missed-title {
    font-size: 1.1em; font-weight: bold; margin-bottom: 14px;
    color: var(--text-main); border-bottom: 2px solid var(--border); padding-bottom: 8px;
}

.missed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 5px;
    margin-bottom: 24px;
}

.missed-card {
    background: var(--bg-color); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    display: flex; flex-direction: column; font-size: 13px;
}
.missed-card-media {
    position: relative;
    width: 100%;
    height: 140px;
    background: #222;
}

.missed-card-media img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}

.media-placeholder {
    height: 140px; background: #333; display: flex;
    align-items: center; justify-content: center; color: #888;
}

.missed-card-body { padding: 12px; display: flex; flex-direction: column; flex-grow: 1; justify-content: space-between; }

.missed-card-attribution {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: rgba(0, 0, 0, 0.7); color: #ffffff;
    font-size: 10px; padding: 3px 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.missed-card-name { font-weight: bold; color: var(--text-main); line-height: 1.2; margin-bottom: 2px; }
.missed-card-sci { font-style: italic; color: var(--text-muted); font-size: 0.9em; }

.missed-card-guess {
    margin-top: 8px; font-size: 12px; color: var(--error);
    background: #fdeaea; padding: 4px 8px; border-radius: 4px;
    display: inline-block; word-break: break-word;
}
.missed-card-guess.partial-credit { background: #fff3cd; color: #856404; }

.missed-card-links { margin-top: 10px; font-size: 11px; display: flex; gap: 10px; border-top: 1px solid var(--border); padding-top: 6px; }
.missed-card-links a { color: var(--primary); text-decoration: none; font-weight: bold; }
.missed-card-links a:hover { text-decoration: underline; }

/* ==========================================================================
   10. Zoom Modal
   ========================================================================== */
.zoom-modal {
    border: none; padding: 0; background: transparent;
    width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh;
    overflow: hidden;
}
.zoom-modal::backdrop { background: rgba(0, 0, 0, 0.95); }

.zoom-loading {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #ffffff; background: rgba(0, 0, 0, 0.75);
    padding: 10px 20px; border-radius: 20px;
    font-size: 14px; font-weight: bold;
    pointer-events: none; z-index: 10;
    animation: pulse 1.5s infinite; display: none;
}

.btn-zoom-toggle {
    background: transparent; border: none; padding: 0; margin: 0;
    width: auto; display: inline-flex; align-items: center; justify-content: center;
}

.zoom-modal-content {
    width: 100%; height: 100%;
    overflow: auto; -webkit-overflow-scrolling: touch;
    display: grid; place-items: safe center;
}

.zoom-modal img {
    max-width: 100vw; max-height: 100vh;
    cursor: zoom-in; background: #111;
}

.zoom-modal img.zoomed-in {
    max-width: none; max-height: none;
    cursor: zoom-out;
}

.btn-close-modal {
    position: fixed; top: 15px; right: 15px; background: var(--error);
    color: white; border: 2px solid white; font-size: 24px;
    width: 40px; height: 40px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5); padding: 0; z-index: 20;
}
.btn-close-modal:hover { background: #c9302c; }

/* ==========================================================================
   11. Footer & License Modal
   ========================================================================== */
.app-footer {
    margin-top: 30px; padding-top: 15px; border-top: 1px solid var(--border);
    text-align: center; font-size: 12px; color: var(--text-muted);
}
.app-footer a { color: var(--primary); text-decoration: none; font-weight: bold; }
.app-footer a:hover { text-decoration: underline; }

.disabled-link { pointer-events: none; }
.enabled-link { pointer-events: auto; }

.app-footer .footer-meta {
    display: inline-block; margin-top: 6px; opacity: 0.9;
}

.license-modal {
    border: none; padding: 0; background: transparent;
    max-width: 850px; width: 92%;
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.license-modal::backdrop { background: rgba(0, 0, 0, 0.8); }

.license-modal-container {
    background: var(--surface); border-radius: var(--radius);
    padding: 24px; display: flex; flex-direction: column; max-height: 85vh;
}

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

.license-modal-header h2 { margin: 0; font-size: 1.25rem; color: var(--primary); }

.license-modal-header .btn-close-modal {
    position: static; font-size: 20px; width: 32px; height: 32px; flex-shrink: 0;
}

.license-modal-content { overflow-y: auto; max-height: 60vh; }

.license-text {
    white-space: pre-wrap; word-break: break-word;
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 13px; line-height: 1.5; margin: 0;
    background: var(--bg-color); padding: 15px;
    border-radius: var(--radius); border: 1px solid var(--border);
    color: var(--text-main);
}

.license-loading { text-align: center; padding: 20px; color: var(--text-muted); font-weight: bold; }

.btn-license-link {
    background: none; border: none; color: var(--primary);
    text-decoration: none; font-weight: bold; font-size: inherit;
    padding: 0; cursor: pointer; display: inline; width: auto;
    font-family: inherit; transition: color 0.2s;
}
.btn-license-link:hover { background: transparent; color: var(--primary-hover); text-decoration: underline; }
.btn-license-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
