/* Malta-inspired color palette */
:root {
    --malta-limestone: #FAF8F4;        /* Off-white background */
    --malta-limestone-dark: #E8D4B0;   /* Sand primary */
    --malta-blue: #687864;             /* Sage green secondary */
    --malta-blue-light: #7F9278;       /* Lighter sage variant */
    --malta-terracotta: #C67651;       /* Clay accent */
    --malta-terracotta-dark: #A85E3F;  /* Darker clay */
    --malta-green: #687864;            /* Sage green for budget */
    --malta-ochre: #9B8B7E;            /* Warm grey accent */
    --malta-cream: #FFFFFF;            /* Pure white */
    --malta-text: #2F3E2E;             /* Dark green text */
    --section-max-width: 1200px;
    --section-padding-mobile: 20px;
    --section-padding-desktop: 32px;
    --section-gap: 24px;           /* vertical gap between sections */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: var(--malta-limestone);
    color: #222;
    min-height: 100vh;
    padding: 0;
}

/* Layout container (mobile-first)
   - Full width on small screens
   - Constrained and centered on tablet and desktop
*/
.container {
    width: 100%;
    max-width: var(--section-max-width);
    margin: 0 auto;
    padding: 0 var(--section-padding-mobile);
}

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--section-padding-desktop);
    }
}


.header {
    background: var(--malta-blue);
    color: #fff;
    padding: 24px 20px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 20px;
    margin-bottom: 16px;
}

#mainHeader.is-hidden {
    display: none;
}

h1 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.12em;
    opacity: 0.95;
    display: block;
    max-width: 90%;
    margin: 6px auto 0;
    line-height: 1.4;
}

.study-scope {
    margin: 14px 0 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start; /* align with intro text */
    /* use the page background and intro alignment — no separate coloured box */
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}
.study-scope-text {
    font-size: 0.95em;
    color: #2d3748;
    margin: 0; /* let the flex layout control spacing */
    flex: 1 1 60%;
}
.study-map {
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    flex: 0 0 200px; /* smaller map width on wide screens */
    max-width: 30%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.study-map img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 200px; /* smaller height so map is less dominant */
    object-fit: contain;
    border-radius: 4px;
}
.distribution-lead {
    margin: 0 0 8px 0;
    font-size: 0.95em;
    color: #33523e;
}

.distribution-examples {
    margin: 0;
    padding-left: 1.1rem;
    color: #334e3a;
    margin-bottom: 12px;
}

.distribution-examples li {
    margin-bottom: 5px;
    line-height: 1.5;
    font-size: 0.95em;
}

.survey-intro h2 {
    font-size: 1.35em;
    margin-bottom: 12px;
    color: #1f3a2c;
}

.survey-intro p {
    margin-bottom: 10px;
}

.survey-intro a {
    color: var(--malta-terracotta);
    font-weight: 600;
}

/* ── Survey Intro Card (Section 1) ── */
.survey-intro {
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid rgba(198, 118, 81, 0.25);
    border-radius: 14px;
    padding: 24px 22px;
    margin: 0 0 20px 0;
    color: var(--malta-text);
    line-height: 1.6;
    box-shadow: 0 10px 24px rgba(47, 62, 46, 0.08);
}

.survey-intro h2 {
    font-size: 1.35em;
    margin-bottom: 12px;
    color: var(--malta-blue);
}

.survey-intro p {
    margin-bottom: 10px;
}

.survey-intro a {
    color: var(--malta-terracotta);
    font-weight: 600;
}

/* Flex layout: text left, map right */
.survey-intro-content {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.survey-intro-text {
    flex: 1 1 60%;
}

/* Study-area map inside the intro card */
.study-map {
    flex: 0 0 280px;
    max-width: 35%;
    text-align: center;
}

.study-map img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(47, 62, 46, 0.10);
}

@media (max-width: 768px) {
    .survey-intro-content {
        flex-direction: column;
    }
    .survey-intro-text {
        flex: 1 1 100%;
    }
    .study-map {
        flex: none;
        max-width: 100%;
    }
}

/* ── Scenario Role-Play Callout ── */
.scenario-callout {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: linear-gradient(135deg, rgba(198, 118, 81, 0.12) 0%, rgba(232, 212, 176, 0.35) 100%);
    border-left: 5px solid var(--malta-terracotta);
    border-radius: 12px;
    padding: 20px 22px;
    margin-bottom: 28px;
    color: var(--malta-text);
    line-height: 1.5;
    font-size: 1.05em;
    text-align: justify;
    box-shadow: 0 2px 8px rgba(198, 118, 81, 0.12);
}

.scenario-callout-icon {
    font-size: 1.8em;
    flex-shrink: 0;
    margin-top: 2px;
}

.scenario-callout-body {
    flex: 1;
}

.scenario-callout-label {
    display: block;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--malta-terracotta);
    margin-bottom: 6px;
}

.scenario-callout p {
    margin: 0;
    font-style: italic;
}

/* ── Consent / Information Sheet Card ── */
.consent-card {
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid rgba(198, 118, 81, 0.25);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 24px;
    color: var(--malta-text);
    line-height: 1.3;
    font-size: 1.05em;
    text-align: justify;
}

.consent-card p {
    margin-bottom: 12px;
}

.consent-card p:last-of-type {
    margin-bottom: 16px;
}

.consent-card h3 {
    margin-top: 1.8rem;
    margin-bottom: 0.6rem;
    color: var(--malta-blue);
    font-size: 1.06rem;
}

.consent-card a {
    color: var(--malta-terracotta);
    font-weight: 600;
}

/* GDPR summary + warning */
.gdpr-summary {
    background: #f6f1e9;
    border: 1.5px solid var(--malta-terracotta);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 16px;
}
.gdpr-summary h3 {
    font-size: 1rem;
    color: var(--malta-blue);
    margin-bottom: 10px;
}
.gdpr-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 10px;
}
.gdpr-summary-item {
    background: #fff;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid rgba(104, 120, 100, 0.25);
}
.gdpr-summary-label {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--malta-terracotta-dark);
    font-weight: 700;
}
.gdpr-summary-value {
    font-size: 0.95rem;
    color: #2f3e2e;
}
.gdpr-anonymity-warning {
    background: #fff7e6;
    border: 1.5px solid #f0c040;
    border-radius: 10px;
    padding: 14px 15px;
    margin: 14px 0;
    font-size: 0.97rem;
    color: #5a4000;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    line-height: 1.6;
}
.gdpr-warn-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Bullet lists inside the consent / info card */
.consent-points {
    list-style: disc;
    padding-left: 24px;
    color: rgba(47, 62, 46, 0.7);
    font-size: 1.0em;
}

.consent-points li {
    margin-bottom: 6px;
}

/* ── Consent Checkboxes ── */
.consent-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: normal;
    font-size: inherit;
    color: var(--malta-text);
    margin-bottom: 14px;
    cursor: pointer;
}

.consent-checkbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid var(--malta-blue);
    accent-color: var(--malta-blue);
}

.consent-checkbox span {
    white-space: normal;
}

.section {
    padding: 20px;
    display: none;
    background: var(--malta-limestone);
    color: #222;
}

.section.active {
    display: block;
}

.section-title {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--malta-blue);
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 8px;
    font-size: 0.95em;
}

select,
input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    transition: border-color 0.3s;
}

select:focus,
input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.radio-option:hover,
.radio-option:focus-visible,
.radio-option:active {
    border-color: #667eea;
    background: #eef2ff;
}

@media (hover: none) {
    .radio-option:hover {
        border-color: #e2e8f0;
        background: #fff;
    }
    .radio-option:active {
        border-color: #667eea;
        background: #eef2ff;
    }
}

.radio-option input[type="radio"] {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.radio-option.selected {
    border-color: #667eea;
    background: #eef2ff;
}

.btn-primary {
    background: var(--malta-terracotta);
    color: #fff;
    border: none;
    padding: 16px;
    font-size: 1.1em;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    margin-top: 20px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

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



/* Results Section - Bar Chart */
.bar-chart {
    background: #e8f0e0;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100%;
    border: 2px solid #6b9e3e;
    box-shadow: 0 4px 12px rgba(107, 158, 62, 0.12);
}

.bar-chart h2 {
    font-size: 28px;
    margin-bottom: 1px;
    font-weight: 700;
    color: #2d5016;
}

.results-column .bar-chart {
    margin-bottom: 0;
}

.results-priority {
    margin-bottom: 28px;
}

.results-priority:last-child {
    margin-bottom: 0;
}

.results-priority-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2d3748;
    font-size: 1.1em;
}

.results-rank {
    background: #2d5016;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95em;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(45, 80, 22, 0.2);
}

.results-priority-title {
    flex: 1;
    font-weight: 600;
}

.results-bar {
    background: #f0f4ed;
    height: 44px;
    border-radius: 22px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(104, 120, 100, 0.3);
}

.results-bar-fill {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.95em;
    border-radius: 22px;
    transition: width 0.4s ease;
    padding: 0 14px;
    white-space: nowrap;
}

.results-bar-fill.narrow {
    font-size: 0.8em;
    padding: 0 10px;
}

/* Profile Section */
.profile-section {
    margin-top: 40px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    height: 100%;
}

.results-column .profile-section {
    padding: 0;
}

.profile-card h2 {
    color: #2d5016;
    font-size: 28px;
    font-weight: 700;
    text-align: center;
    margin: 0;
}

.profile-card {
    background: linear-gradient(135deg, #f8faf6 0%, #e8f0e0 100%);
    border-radius: 12px;
    padding: 30px;
    border: 2px solid #6b9e3e;
    box-shadow: 0 4px 12px rgba(107, 158, 62, 0.1);
    display: flex;
    flex-direction: column;
    gap: 22px;
    height: 100%;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: #2d5016;
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
}

.badge-emoji {
    font-size: 24px;
}

.badge-title {
    font-size: 18px;
    font-weight: 700;
}

.profile-desc {
    font-size: 18px;
    color: #333;
    line-height: 1.75;
}

.profile-desc strong {
    color: #2d5016;
}

.profile-strategy {
    background: white;
    padding: 18px;
    border-radius: 8px;
    color: #555;
    font-size: 16px;
    border-left: 4px solid #6b9e3e;
}

.profile-strategy strong {
    color: #2d5016;
}
.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--malta-limestone);
    color: var(--malta-blue);
    border: 2px solid var(--malta-blue);
    padding: 16px;
    font-size: 1.1em;
    border-radius: 12px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    margin-top: 20px;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #f7fafc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.btn-secondary:active {
    transform: scale(0.98);
}

.budget-tracker {
    background: var(--malta-blue);
    color: #fff;
    padding: 12px 18px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    /* fully rounded on all corners */
    border-radius: 20px;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Slightly enlarge the budget text while keeping other elements' relative scales */
.budget-tracker {
    /* base font-size for elements inside the tracker - keeps proportional scaling */
    font-size: 1rem; /* ~16px base */
}

.budget-content {
    margin-top: 14px;
}

.budget-heading {
    font-size: 1.2em;
    margin-bottom: 5px;
}

.budget-intro {
    color: #4a5568;
    font-size: 0.95em;
    margin-bottom: 25px;
    text-align: justify;
}

.distribution-intro {
    margin: 18px 0 22px;
}

.distribution-title {
    font-size: 1.05em;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 6px;
}

.budget-tracker .budget-amount,
.budget-tracker #remaining {
    font-size: 1.45em; /* ~1.45x the base font-size */
    font-weight: 800;
    line-height: 1;
}

.budget-tracker #allocated {
    font-size: 0.95em; /* keep allocated label slightly smaller than main amount */
}

.budget-tracker .percent-label {
    font-size: 0.95em;
}

/* Allocated / total line (small metadata under the main amount) */
.budget-tracker .budget-meta {
    /* slightly larger than previous inline size so it reads better */
    font-size: 1.02rem; /* ~16.4px on default root, keeps proportional scaling */
    color: #fff; /* ensure it remains readable on the tracker background */
}

.budget-tracker .budget-meta #allocated {
    font-size: 1.08em; /* slightly larger than the surrounding text */
    font-weight: 700;
    margin-right: 6px;
}

.budget-meta-compact {
    font-size: 0.85em;
    margin-top: 5px;
}

.budget-bar {
    position: relative;
    background: rgba(255,255,255,0.25);
    height: 26px;
    border-radius: 16px;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.3);
}

.budget-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #C67651, #E8B04B); /* Clay to golden honey - high contrast */
    color: #fff;
}

.percent-label {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    font-weight: 700;
    color: #123020;
}

.criteria-item {
    background: #fff;
    border-radius: 10px;
    padding: 12px 14px 18px; /* room for slider at bottom */
    margin: 0;
    border: 1px solid #e6eef6;
    position: relative;
    box-shadow: 0 1px 3px rgba(38, 57, 84, 0.04);
    box-sizing: border-box;
}

.criteria-item.has-value {
    border-color: #667eea;
    background: #eef2ff;
}

.criteria-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.criteria-header .criteria-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0; /* allow title to shrink/truncate */
}

.criteria-title {
    font-weight: bold;
    color: #2d3748;
    font-size: 1em;
    flex: 1;
    padding-right: 10px;
    line-height: 1.3;
}

.criteria-value {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
    white-space: nowrap;
}

.category-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: bold;
    margin-bottom: 8px;
}

.tag-equity { background: #bee3f8; color: #2c5282; }
.tag-environment { background: #c6f6d5; color: #22543d; }
.tag-urban { background: #fbd38d; color: #744210; }

.criteria-description {
    color: #4a5568;
    font-size: 0.85em;
    margin-bottom: 12px;
    line-height: 1.4;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e2e8f0;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #7C8B94; /* Blue-grey */
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #7C8B94; /* Blue-grey */
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.progress-bar {
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #48bb78, #38a169);
    transition: width 0.3s ease;
}

.warning {
    background: #fed7d7;
    color: #c53030;
    padding: 18px 22px;
    border-radius: 14px;
    font-size: 1.05em;
    font-weight: 700;
    display: none;
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.92);
    z-index: 500;
    width: min(90%, 360px);
    text-align: center;
    box-shadow: 0 18px 36px rgba(197, 48, 48, 0.28);
    opacity: 0;
    transition: opacity 180ms ease, transform 180ms ease;
    pointer-events: none;
}

.warning.show {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

@media (hover: none) {
    .warning {
        position: sticky;
        top: 120px;
        left: auto;
        transform: none;
        width: auto;
        margin: 18px 20px;
        text-align: left;
        box-shadow: none;
        opacity: 1;
        transition: none;
        pointer-events: auto;
    }

    .warning.show {
        display: block;
        transform: none;
    }
}

.warning.show { display: block; }

.scenario-preview {
    padding: 24px var(--section-padding-mobile);
    margin-left: calc(-1 * var(--section-padding-mobile));
    margin-right: calc(-1 * var(--section-padding-mobile));
    background: linear-gradient(180deg, rgba(242, 247, 240, 1) 0%, rgba(214, 232, 215, 0.78) 55%, rgba(187, 211, 191, 0.72) 100%);
    border-radius: 24px;
    box-shadow: 0 14px 34px rgba(47, 62, 46, 0.16);
}

@media (min-width: 1024px) {
    .scenario-preview {
        padding-left: var(--section-padding-desktop);
        padding-right: var(--section-padding-desktop);
        margin-left: calc(-1 * var(--section-padding-desktop));
        margin-right: calc(-1 * var(--section-padding-desktop));
    }
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    margin-bottom: 28px;
}

.results-column {
    min-width: 0;
}

.results-footer {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.results-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 720px) {
    .results-actions {
        flex-direction: row;
    }

    .results-actions .btn-primary,
    .results-actions .btn-secondary {
        flex: 1;
    }
}

@media (min-width: 920px) {
    .results-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
    }

    .results-column {
        display: flex;
    }

    .results-column > * {
        flex: 1;
    }

    .results-column .profile-section {
        margin-top: 0;
    }

    .bar-chart {
        margin-bottom: 0;
    }
}

@media (max-width: 600px) {
    .scenario-preview {
        padding: 20px var(--section-padding-mobile);
    }

    .results-grid {
        gap: 18px;
    }
}


.scenario-title {
    font-size: 1.8em;
    font-weight: 800;
    font-family: sans-serif;
    color: #1f3a2c;
    margin-bottom: 24px;
    text-align: center;
    letter-spacing: 0.8px;
}

.chart-container {
    background: #f7fafc;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.scenario-text {
  background: #f5e7cc;
  border-left: 4px solid #ded2bc;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  line-height: 1.6;
  font-size: 0.95em;
}

.success-message {
    background: var(--malta-limestone-dark);
    color: #222;
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 4em;
    margin-bottom: 20px;
}

.success-title {
    font-size: 1.5em;
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 10px;
}

.success-text {
    color: #4a5568;
    line-height: 1.6;
}

.thank-you-page {
    background: linear-gradient(180deg, rgba(242, 247, 240, 0.95) 0%, rgba(214, 232, 215, 0.88) 65%, rgba(187, 211, 191, 0.85) 100%);
    border-radius: 24px;
    padding: 32px var(--section-padding-mobile);
    margin-left: calc(-1 * var(--section-padding-mobile));
    margin-right: calc(-1 * var(--section-padding-mobile));
    color: #1f3a2c;
    box-shadow: 0 16px 40px rgba(45, 65, 50, 0.18);
    text-align: left;
    line-height: 1.7;
}

@media (min-width: 1024px) {
    .thank-you-page {
        padding-left: var(--section-padding-desktop);
        padding-right: var(--section-padding-desktop);
        margin-left: calc(-1 * var(--section-padding-desktop));
        margin-right: calc(-1 * var(--section-padding-desktop));
    }
}

.thank-you-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 325px;
    gap: 6px;
    align-items: start;
}

.thank-you-photo {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(31, 58, 44, 0.14);
    border-radius: 14px;
    padding: 10px;
    margin-top: -8px;
    margin-right: 0;
}

.thank-you-content p {
    font-size: 1.04em;
}

.thank-you-photo img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: cover;
}

.thank-you-photo figcaption {
    margin-top: 8px;
    text-align: center;
    color: #2a4d3b;
    line-height: 1.35;
}

.thank-you-photo figcaption strong {
    display: block;
}

.thank-you-photo figcaption span {
    display: block;
    font-size: 0.9em;
}

.thank-you-page h2 {
    font-size: 1.9em;
    margin-bottom: 18px;
    color: #1f3a2c;
}

.thank-you-page h3 {
    font-size: 1.2em;
    margin: 24px 0 12px;
    color: #2a4d3b;
}

.thank-you-page a {
    color: var(--malta-terracotta);
    font-weight: 600;
}

.thank-you-page .results-info {
    margin-top: 24px;
    color: rgba(31, 58, 44, 0.85);
}

.partners-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.partner-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(31, 58, 44, 0.14);
    border-radius: 12px;
    padding: 12px;
    text-decoration: none;
    color: #1f3a2c;
    text-align: center;
}

.partner-logo {
    height: 42px;
    width: auto;
    object-fit: contain;
}

.partner-name {
    font-weight: 700;
    color: #1f3a2c;
}

.partner-link {
    font-size: 0.92em;
    color: #47624f;
}

@media (max-width: 600px) {
    .partners-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .partner-logo {
        height: 36px;
    }
}

@media (max-width: 900px) {
    .thank-you-layout {
        grid-template-columns: 1fr;
    }

    .thank-you-photo {
        margin-top: 0;
        max-width: 340px;
        margin: 0 auto;
    }
}

@media (max-width: 600px) {
    .thank-you-page {
        padding: 24px var(--section-padding-mobile);
    }
}

canvas {
    max-width: 100%;
    height: auto;
}

.info-box {
    background: none;
    border: 2px solid currentColor;
    color: #222;
    font-weight: bold;
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.consent-card {
    background: #fff;
    border: 2px solid rgba(104, 120, 100, 0.35);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 24px;
    color: #2d3748;
    line-height: 1.6;
    box-shadow: 0 6px 18px rgba(40, 60, 48, 0.08);
}

.consent-card p {
    margin-bottom: 12px;
}

.consent-card p:last-of-type {
    margin-bottom: 16px;
}

.consent-statement {
    font-weight: 700;
    color: #2d4a3a;
    margin-bottom: 12px;
}

.consent-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: #2d4a3a;
    margin-bottom: 14px;
    cursor: pointer;
}

.consent-checkbox input[type="checkbox"] {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid #7f9278;
    accent-color: #7f9278;
}

.consent-checkbox span {
    font-size: 0.95em;
}

.consent-points {
    list-style: disc;
    padding-left: 24px;
    color: #475569;
    font-size: 0.95em;
}

.consent-points li {
    margin-bottom: 8px;
}

/* Grid layout: two rows of 5 columns on wide screens, responsive down */
#criteriaContainer {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    align-items: start;
}

/* Responsive breakpoints */
@media (max-width: 1200px) {
    #criteriaContainer { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
    #criteriaContainer { grid-template-columns: repeat(3, 1fr); }
    .criteria-item { height: 150px; }
}

@media (max-width: 600px) {
    #criteriaContainer { grid-template-columns: repeat(2, 1fr); }
    .criteria-item { height: 140px; }
}

@media (max-width: 380px) {
    #criteriaContainer { grid-template-columns: 1fr; }
    .criteria-item { height: auto; }
}

/* Make cards compact so more items fit without scrolling on larger screens */
.criteria-item {
    height: 140px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center; /* center children horizontally */
    text-align: center;  /* center text inside cards */
}

/* Hidden overlay description that appears on hover */

.criteria-item .criteria-description {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 54px; /* placed above the slider */
    background: rgba(45,55,72,0.95);
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85em;
    line-height: 1.3;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 160ms ease, transform 160ms ease;
    pointer-events: none;
    text-align: center; /* center description text */
}

.criteria-item:hover .criteria-description {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Mobile / touch: allow tapping to toggle description and show it in-flow */
.criteria-item.desc-visible .criteria-description {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    background: rgba(45,55,72,0.95);
    color: #fff;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.85em;
    line-height: 1.3;
    opacity: 1;
    transform: none;
    transition: none;
    pointer-events: auto;
    margin-top: 8px;
}

/* On touch devices, reveal descriptions only for focused or tapped cards */
@media (hover: none) {
    #criteriaContainer {
        grid-template-columns: 1fr;
    }

    .criteria-item {
        height: auto;
        min-height: 0;
    }

    .criteria-item .criteria-description {
        position: static;
        background: rgba(45,55,72,0.95);
        color: #fff;
        padding: 10px;
        border-radius: 8px;
        font-size: 0.85em;
        line-height: 1.3;
        opacity: 1;
        transform: none;
        transition: none;
        pointer-events: auto;
        margin-top: 8px;
        display: none;
    }

    .criteria-item.in-focus .criteria-description,
    .criteria-item.desc-visible .criteria-description {
        display: block;
    }

    .criteria-item:hover .criteria-description {
        opacity: 1;
        transform: none;
    }
}

/* Larger slider thumb on small screens for easier touch interaction */
@media (max-width: 600px) {
    input[type="range"]::-webkit-slider-thumb {
        width: 36px;
        height: 36px;
    }
    input[type="range"]::-moz-range-thumb {
        width: 36px;
        height: 36px;
    }
}

.criteria-description {
    font-size: 0.8em;
    margin-bottom: 8px;
}

.criteria-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25em;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    margin: 0;
}

.criteria-title {
    font-size: 0.95em;
    min-width: 0;
}

.slider-container {
    margin-top: 8px;
    width: 100%;
}

.priorities-container {
    background: linear-gradient(140deg, rgba(214, 232, 215, 0.92), rgba(187, 211, 191, 0.88));
    border-radius: 18px;
    padding: 24px 22px;
    margin-bottom: 26px;
    box-shadow: 0 10px 26px rgba(57, 89, 63, 0.18);
}

.priorities-container h3 {
    color: #2d3748;
    margin-bottom: 18px;
    font-size: 1.35em;
    letter-spacing: 0.4px;
}

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

.priority-rank {
    font-size: 1.4em;
    font-weight: bold;
    color: #eeeeee;
    min-width: 36px;
}

.priority-info { flex: 1; }

.priority-title {
    font-weight: bold;
    color: #2d3748;
    margin-bottom: 4px;
}

.priority-bar {
    background: #F4E7D7; /* Light limestone base */
    border: 1px solid #D4A574; /* Subtle golden border */
    height: 32px;
    border-radius: 16px;
    overflow: visible;
    position: relative;
    margin: 0;
    padding: 0;
}

.priority-bar-fill {
    background: linear-gradient(90deg, #7C5E4B 0%, #B85C3F 100%); /* Brown to terracotta */
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9em;
    padding: 0 8px;
    transition: width 0.3s ease;
    height: 100%;
    box-sizing: border-box;
    overflow: visible;
    border-radius: inherit;
}

.priority-bar-fill .priority-label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.priority-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.priority-label.compact {
    font-size: 0.75em;
    letter-spacing: 0.01em;
}

/* Results Section - Bar Chart */
/* (moved earlier in file) */

/* Profile Section */
/* (moved earlier in file) */


.impact-banner {
    padding: 22px 24px;
    background: linear-gradient(135deg, rgba(186, 219, 188, 0.95), rgba(126, 168, 132, 0.95));
    border-radius: 18px;
    color: #102417;
    font-size: 1.05em;
    line-height: 1.6;
    box-shadow: 0 12px 28px rgba(57, 89, 63, 0.2);
}

/* Preview explanatory block (appears above the bar chart in the preview) */
/* Bar chart subtitle — concise explanation shown directly under the heading */
.bar-chart-subtitle {
    margin: 6px 0 14px 0;
    color: #2f4b39;
    font-size: 1.2em;
    text-align: justify;
}

/* Concrete example lines shown under the bar chart heading */
.bar-chart-examples {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}
.bar-chart-example {
    background: rgba(255,255,255,0.85);
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(16,36,23,0.04);
    color: #123020;
    font-size: 0.95em;
}

@media (max-width: 600px) {
    .bar-chart-example { font-size: 0.92em; padding: 8px; }
}

/* Small explanatory text under each priority bar */
.results-priority-explain {
    margin-top: 8px;
    color: rgba(18,48,32,0.9);
    font-size: 0.92em;
    line-height: 1.35;
    background: rgba(255,255,255,0.9);
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(16,36,23,0.05);
}

@media (max-width: 600px) {
    .results-priority-explain { font-size: 0.88em; padding: 8px; }
}

.impact-banner span {
    display: block;
    margin-top: 6px;
    font-size: 0.92em;
    color: rgba(16, 36, 23, 0.85);
}

.allocation-determines {
    font-size: 1.2em;
    margin-top: 10px;
    margin-bottom: 25px;
    color: #3e5844;
    font-style: inherit;
    font-weight: bold;
}



/* Disabled slider styling when budget is exhausted */
input[type="range"].disabled-slider {
    opacity: 0.7;
    cursor: not-allowed;
}

input[type="range"].disabled-slider::-webkit-slider-thumb {
    cursor: not-allowed;
    background: #a0aec0; /* Grey color when disabled */
}

input[type="range"].disabled-slider::-moz-range-thumb {
    cursor: not-allowed;
    background: #a0aec0; /* Grey color when disabled */
}

/* Animate warning without overriding its positioning transform */
.warning.show {
    animation: warning-fade-scale 0.22s ease-out;
}

@keyframes warning-fade-scale {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@media (hover: none) {
    .warning.show {
        animation: warning-fade-mobile 0.2s ease-out;
    }
}

@keyframes warning-fade-mobile {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Visual feedback when trying to exceed budget */
.criteria-item.budget-exceeded input[type="range"] {
    animation: shake 0.3s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* Optional: Highlight the criteria that has remaining capacity when budget is full */
.criteria-item.can-increase {
    border-color: #48bb78;
    background: #f0fff4;
}

.malta-flag {
    display: inline-block;
    width: 40px; /* fixed width for the flag image */
    height: auto;
    margin-right: 10px;
    vertical-align: middle;
}

@media (max-width: 600px) {
    .survey-intro {
        margin-bottom: 16px;
        padding: 20px 18px;
    }
}

/* Mobile adjustments (phones / small devices) */
@media (max-width: 480px) {
    /* slightly smaller, denser header */
    .header {
        padding: 14px 12px;
        border-radius: 12px;
    }

    h1 {
        font-size: 1.15em;
        line-height: 1.2;
        margin-bottom: 8px;
    }

    .subtitle {
        font-size: 1em;
        margin-bottom: 8px;
        max-width: 100%;
    }

    /* make cards and panels more compact and touch-friendly */
    .survey-intro,
    .consent-card,
    .priorities-container,
    .profile-card {
        padding: 14px 16px;
        border-radius: 12px;
    }

    .scenario-preview,
    .thank-you-page {
        padding: 14px var(--section-padding-mobile);
        border-radius: 12px;
    }

    /* Stack header content on very small screens for better fit */
    .criteria-header {
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    /* Ensure primary controls are easy to tap */
    .btn-primary,
    .btn-secondary {
        padding: 14px;
        font-size: 1em;
        border-radius: 10px;
    }

    /* Disable sticky budget tracker on very small screens to avoid covering content */
    .budget-tracker {
        position: static;
        top: auto;
        z-index: auto;
        border-radius: 12px;
        box-shadow: none;
    }

    /* Slightly scale down the enlarged budget text on very small screens so it fits well */
    .budget-tracker {
        font-size: 0.95rem;
    }

    .budget-tracker .budget-amount,
    .budget-tracker #remaining {
        font-size: 1.3em;
    }

    /* mobile: scale the allocated/total meta line down slightly as well */
    .budget-tracker .budget-meta {
        font-size: 0.95rem;
    }

    .budget-tracker .budget-meta #allocated {
        font-size: 1.02em;
    }

    /* Reduce heavy large shadows for better performance on low-end devices */
    .header,
    .survey-intro,
    .profile-card,
    .scenario-preview,
    .thank-you-page {
        box-shadow: none;
    }

    /* Slightly larger interactive inputs */
    select,
    input[type="text"],
    .radio-option {
        font-size: 1em;
        padding: 14px;
    }

    /* Make results grid single column on small screens */
    .results-grid {
        grid-template-columns: 1fr;
    }

    /* Keep some breathing room at the edges */
    .container {
        padding-left: var(--section-padding-mobile);
        padding-right: var(--section-padding-mobile);
    }

    /* Survey step: prioritize readability and touch targets on phones */
    #criteriaContainer {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .criteria-item {
        height: auto;
        min-height: 160px;
    }
}

/* ==========================================
   Language Selection Section
   ========================================== */
.language-section.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.language-section .header {
    margin-bottom: 40px;
}

.language-selection {
    background: #fff;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
}

.language-prompt {
    font-size: 1.1em;
    color: #4a5568;
    margin-bottom: 30px;
    line-height: 1.6;
}

.language-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-language {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px 40px;
    border: 2px solid var(--malta-blue);
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.btn-language:hover {
    background: var(--malta-blue);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.lang-icon {
    font-size: 2.5em;
}

.lang-name {
    font-size: 1.2em;
    font-weight: 600;
}

@media (max-width: 480px) {
    .language-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .btn-language {
        width: 100%;
        flex-direction: row;
        justify-content: center;
        padding: 18px 24px;
    }
    
    .lang-icon {
        font-size: 2em;
    }
}
