:root {
    --bg: #20271c;
    --bg-deep: #171d15;
    --surface: #3e4437;
    --surface-dark: #293225;
    --surface-deeper: #20281d;
    --surface-soft: #4d5346;
    --paper: #f3efe4;
    --text: #f7f2e6;
    --muted: #d2cbbb;
    --muted-dark: #9f9b8d;
    --gold: #d99500;
    --gold-dark: #ae7600;
    --gold-light: #f4c354;
    --green: #dff2d8;
    --green-text: #245725;
    --red: #a93527;
    --border: rgba(246, 241, 229, .22);
    --border-strong: rgba(246, 241, 229, .38);
    --shadow: 0 22px 60px rgba(0, 0, 0, .30);
    --shadow-soft: 0 12px 34px rgba(0, 0, 0, .20);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    margin: 0;
    min-height: 100%;
    color: var(--text);
    background:
        linear-gradient(rgba(32,39,28,.965), rgba(32,39,28,.965)),
        repeating-linear-gradient(45deg, transparent 0 14px, rgba(255,255,255,.025) 14px 15px);
    font-family: "Courier New", Courier, monospace;
    line-height: 1.55;
}

a { color: inherit; }
button, input { font: inherit; }
img { max-width: 100%; }

.page-shell {
    width: min(1280px, calc(100% - 28px));
    margin: 18px auto;
    padding: 24px 26px 28px;
    border: 1px solid var(--border);
    background: rgba(62, 68, 55, .90);
    box-shadow: var(--shadow);
}

.site-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 20px;
    padding-bottom: 17px;
    border-bottom: 1px dashed var(--border);
}

.museum-brand {
    display: block;
    transition: transform .18s ease;
}
.museum-brand:hover { transform: translateY(-1px); }
.museum-brand img {
    display: block;
    width: clamp(190px, 18vw, 260px);
    max-height: none;
    object-fit: contain;
    padding: 0;
    border-radius: 0;
    background: transparent;
}
.header-copy {
    min-width: 0;
}

.header-copy h1,
.panel h2,
.section-heading h2,
.mission-copy h2,
.chapter-tile h3 {
    margin: 3px 0 6px;
    letter-spacing: .02em;
}
.header-copy h1 { font-size: clamp(1.75rem, 3.7vw, 2.75rem); }
.header-copy p, .panel p { margin: 0; color: var(--muted); }
.header-copy p { color: rgba(247,242,230,.88); }
.eyebrow {
    display: block;
    color: var(--gold-light);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.language-switch { display: flex; gap: 7px; }
.language-switch a {
    min-width: 46px;
    padding: 10px;
    text-align: center;
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--surface-dark);
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.language-switch a:hover {
    border-color: var(--gold-light);
    transform: translateY(-1px);
}
.language-switch a.active {
    border-color: var(--gold-light);
    background: var(--gold);
    color: #fff;
}

main { padding: 26px 0 0; }
.panel {
    padding: 24px;
    border: 1px solid var(--border);
    background: var(--surface-dark);
}
.notice {
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border);
}
.notice.error { background: rgba(169,53,39,.35); }
.notice.success { background: rgba(36,87,37,.45); }

/* Login */
.login-layout {
    display: grid;
    grid-template-columns: minmax(260px, .95fr) minmax(360px, 1.05fr);
    width: min(920px, 100%);
    min-height: 430px;
    margin: 34px auto;
    border: 1px solid var(--border);
    background: var(--surface-dark);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}
.login-visual {
    min-height: 430px;
    background:
        linear-gradient(180deg, rgba(20,25,17,.10), rgba(20,25,17,.76)),
        url("../../banner-missie.jpg?v=0.3a.4") center center / cover no-repeat,
        var(--surface-deeper);
}
.login-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 0;
    padding: clamp(26px, 5vw, 52px);
}
.login-card h2 { font-size: clamp(1.55rem, 3vw, 2.2rem); }
.login-card form { display: grid; gap: 12px; margin-top: 26px; }
label { font-weight: 700; }
input[type="text"] {
    width: 100%;
    min-height: 54px;
    padding: 12px 14px;
    color: #24271f;
    border: 2px solid var(--gold);
    background: #f5f1e8;
    outline: none;
    text-transform: uppercase;
}
input[type="text"]:focus { box-shadow: 0 0 0 3px rgba(244,195,84,.26); }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 11px 18px;
    border: 1px dashed rgba(255,255,255,.78);
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    transition: transform .16s ease, filter .16s ease, background .16s ease;
}
.button:hover:not(.disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
}
.button.primary { background: var(--gold); color: #fff; }
.button.secondary { background: rgba(31,54,29,.94); color: #fff; }
.button.disabled { cursor: default; color: var(--muted); background: rgba(255,255,255,.06); }
.text-button {
    padding: 8px 0;
    color: var(--muted);
    border: 0;
    border-bottom: 1px solid currentColor;
    background: transparent;
    cursor: pointer;
}

/* Cinematic mission intro */
.mission-hero {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(292px, 355px);
    min-height: 342px;
    margin-bottom: 26px;
    border: 1px solid var(--border-strong);
    overflow: hidden;
    background:
        linear-gradient(90deg, rgba(25,32,23,.98) 0%, rgba(25,32,23,.90) 48%, rgba(25,32,23,.56) 100%),
        url("../../banner-missie.jpg?v=0.3a.4") center center / cover no-repeat,
        var(--surface-dark);
    box-shadow: var(--shadow-soft);
    background-position: 58% center;
}
.mission-hero-frame {
    position: absolute;
    inset: 12px;
    border: 1px dashed rgba(255,255,255,.30);
    pointer-events: none;
}
.mission-copy,
.mission-side { position: relative; z-index: 1; }
.mission-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: clamp(34px, 5vw, 58px);
}
.mission-copy h2 {
    font-size: clamp(2rem, 5vw, 3.6rem);
    line-height: 1.04;
}
.access-owner {
    margin: 2px 0 20px;
    color: var(--muted);
}
.access-owner strong { color: var(--text); }
.mission-next {
    max-width: 680px;
    margin-top: 4px;
}
.mission-next > span {
    display: block;
    color: var(--gold-light);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.mission-next > strong {
    display: block;
    margin-top: 5px;
    font-size: clamp(1.35rem, 3vw, 2.05rem);
    line-height: 1.18;
}
.mission-next p {
    max-width: 620px;
    margin: 10px 0 0;
    color: var(--muted);
}
.hero-button {
    min-width: min(100%, 315px);
    margin-top: 22px;
}
.mission-side {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    padding: 26px 28px 26px 10px;
}
.access-meta,
.progress-summary {
    padding: 14px 16px;
    border-left: 3px solid var(--gold);
    background: rgba(18,24,16,.82);
    backdrop-filter: blur(3px);
}
.access-meta-label {
    display: block;
    margin-bottom: 7px;
    color: var(--gold-light);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.access-meta strong,
.access-meta span { display: block; }
.access-meta strong { font-size: .86rem; }
.access-meta span { color: var(--gold-light); font-size: 1.12rem; }
.progress-summary-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: .83rem;
}
.progress-summary-top strong { color: var(--gold-light); }
.progress-track {
    height: 8px;
    margin: 11px 0 8px;
    overflow: hidden;
    background: rgba(255,255,255,.13);
}
.progress-track span {
    display: block;
    height: 100%;
    background: var(--gold);
    transition: width .35s ease;
}
.progress-summary small { color: var(--muted); }

/* Chapter route */
.chapter-selector {
    padding: clamp(18px, 3vw, 30px);
    border: 1px solid var(--border);
    background: rgba(39,48,35,.68);
}
.section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 480px);
    align-items: end;
    gap: 28px;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px dashed var(--border);
}
.section-heading h2 { font-size: clamp(1.65rem, 3.2vw, 2.25rem); }
.section-heading p { margin: 0; color: var(--muted); }

.chapter-grid {
    display: grid;
    grid-template-columns: minmax(380px, 1.22fr) repeat(2, minmax(220px, .84fr));
    grid-template-rows: repeat(2, minmax(236px, 1fr));
    gap: 16px;
}
.chapter-tile {
    position: relative;
    min-width: 0;
    min-height: 254px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-dark);
    box-shadow: 0 8px 24px rgba(0,0,0,.14);
    isolation: isolate;
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.chapter-tile.is-featured {
    grid-row: 1 / span 2;
    min-height: 516px;
    border-color: rgba(244,195,84,.72);
    box-shadow: var(--shadow-soft);
}
.chapter-tile.is-unlocked:hover,
.chapter-tile.is-completed:hover {
    transform: translateY(-2px);
    border-color: var(--gold-light);
    box-shadow: 0 14px 34px rgba(0,0,0,.26);
}
.chapter-tile-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(.94) contrast(1.03);
    transition: transform .35s ease, filter .28s ease;
}
.chapter-tile:hover .chapter-tile-image { transform: scale(1.025); }
.chapter-tile-image.image-missing { visibility: hidden; }
.chapter-tile.is-locked .chapter-tile-image {
    filter: grayscale(1) brightness(.55) contrast(.95);
}
.chapter-tile.is-completed .chapter-tile-image {
    filter: grayscale(.38) brightness(.68) sepia(.10);
}
.chapter-tile-shade {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(180deg, rgba(12,16,11,.10) 18%, rgba(12,16,11,.32) 48%, rgba(12,16,11,.95) 100%),
        linear-gradient(90deg, rgba(12,16,11,.10), rgba(12,16,11,.16));
}
.is-featured .chapter-tile-shade {
    background:
        linear-gradient(180deg, rgba(12,16,11,.06) 18%, rgba(12,16,11,.22) 48%, rgba(12,16,11,.96) 100%),
        linear-gradient(90deg, rgba(12,16,11,.10), rgba(12,16,11,.18));
}
.is-locked .chapter-tile-shade { background: rgba(20,25,18,.56); }
.chapter-number {
    position: absolute;
    z-index: 3;
    left: 18px;
    top: 17px;
    color: var(--gold-light);
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 3px 18px rgba(0,0,0,.70);
}
.is-compact .chapter-number { font-size: 2rem; }
.chapter-state-mark {
    position: absolute;
    z-index: 4;
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 50%;
    color: #fff;
    background: rgba(28,36,25,.82);
    font-weight: 700;
    line-height: 1;
}
.chapter-state-mark.state-locked {
    color: transparent;
}
.chapter-state-mark.state-locked::before {
    content: "";
    position: absolute;
    left: 9px;
    top: 15px;
    width: 14px;
    height: 10px;
    border: 2px solid rgba(255,255,255,.92);
    border-radius: 2px;
}
.chapter-state-mark.state-locked::after {
    content: "";
    position: absolute;
    left: 11px;
    top: 8px;
    width: 10px;
    height: 8px;
    border: 2px solid rgba(255,255,255,.92);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
}
.is-completed .chapter-state-mark {
    color: var(--green-text);
    background: var(--green);
    border-color: var(--green);
}
.chapter-state-mark.state-open { display: none; }
.is-featured.is-unlocked .chapter-state-mark,
.is-unlocked .chapter-state-mark.state-open {
    background: var(--gold);
    border-color: rgba(255,255,255,.86);
}
.chapter-tile-content {
    position: absolute;
    inset: auto 0 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 20px;
}
.is-featured .chapter-tile-content { padding: clamp(24px, 4vw, 36px); }
.chapter-meta-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    margin-bottom: 7px;
}
.chapter-kicker {
    color: var(--gold-light);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.status-pill {
    display: inline-block;
    flex: 0 0 auto;
    padding: 5px 10px;
    border-radius: 999px;
    color: var(--green-text);
    background: var(--green);
    font-size: .72rem;
    font-weight: 700;
}
.is-unlocked:not(.is-completed) .status-pill { color: #fff; background: var(--gold); }
.is-locked .status-pill { color: var(--muted); background: rgba(255,255,255,.12); }
.chapter-tile h3 {
    max-width: 100%;
    margin: 0;
    font-size: clamp(1.2rem, 2vw, 1.62rem);
    line-height: 1.14;
    text-shadow: 0 2px 12px rgba(0,0,0,.65);
}
.is-featured h3 {
    max-width: 720px;
    font-size: clamp(1.75rem, 3.8vw, 2.75rem);
}
.chapter-subtitle {
    max-width: 660px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: .98rem;
}
.locked-help {
    margin: 11px 0 0;
    color: var(--muted);
    font-size: .82rem;
    font-style: italic;
    opacity: .92;
}
.chapter-button {
    min-width: 180px;
    margin-top: 19px;
}
.is-compact .chapter-button {
    min-width: 0;
    min-height: 40px;
    margin-top: 14px;
    padding: 8px 13px;
    font-size: .78rem;
}
.test-tools {
    width: fit-content;
    margin-top: 14px;
    color: var(--muted-dark);
    font-size: .78rem;
}
.test-tools summary {
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.test-form { margin-top: 9px; }
.test-button {
    min-height: 38px;
    padding: 8px 12px;
    color: var(--muted);
    border-color: rgba(255,255,255,.25);
    background: rgba(255,255,255,.04);
    font-size: .78rem;
}
.test-note {
    display: flex;
    gap: 12px;
    margin-top: 18px;
    padding: 14px 18px;
    border-color: rgba(244,195,84,.38);
    color: var(--muted);
    font-size: .82rem;
}
.test-note strong { color: var(--gold-light); }

.portal-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px dashed var(--border);
}
.logout-form { margin: 0; }
.powered-by,
footer {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: .78rem;
}
.powered-by img,
footer img { width: 104px; height: 30px; object-fit: contain; }
footer {
    justify-content: flex-end;
    margin-top: 30px;
    padding-top: 18px;
    border-top: 1px dashed var(--border);
}

@media (max-width: 1080px) {
    .chapter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: auto;
    }
    .chapter-tile.is-featured {
        grid-column: 1 / -1;
        grid-row: auto;
        min-height: 410px;
    }
    .chapter-tile.is-compact { min-height: 255px; }
}

@media (max-width: 900px) {
    .mission-hero { grid-template-columns: 1fr; }
    .mission-side {
        display: grid;
        grid-template-columns: 1fr 1fr;
        padding: 0 34px 34px;
    }
}

@media (max-width: 760px) {
    .page-shell {
        width: 100%;
        margin: 0;
        padding: 15px;
        border-left: 0;
        border-right: 0;
    }
    .site-header {
        grid-template-columns: 1fr auto;
        align-items: start;
        gap: 12px;
    }
    .museum-brand {
        grid-column: 1;
        grid-row: 1;
        align-self: start;
    }
    .museum-brand img { width: 136px; }
    .header-copy {
        grid-column: 1 / -1;
        margin-top: 2px;
    }
    .header-copy h1 { font-size: 1.7rem; }
    .header-copy p { font-size: .86rem; }
    .language-switch a { min-width: 39px; padding: 8px 7px; }
    main { padding-top: 19px; }

    .login-layout { grid-template-columns: 1fr; min-height: 0; margin: 20px auto; }
    .login-visual { min-height: 190px; }
    .login-card { padding: 26px 20px 30px; }

    .mission-hero {
        min-height: 0;
        background-position: 72% center;
    }
    .mission-copy { padding: 26px 22px 20px; }
    .mission-copy h2 { font-size: 2rem; }
    .mission-next > strong { font-size: 1.72rem; }
    .mission-next p { margin-top: 8px; }
    .mission-side {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 0 22px 22px;
    }
    .access-meta,
    .progress-summary { background: rgba(18,24,16,.88); }
    .hero-button { width: 100%; margin-top: 18px; }

    .chapter-selector { padding: 16px; }
    .section-heading {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-bottom: 18px;
        padding-bottom: 14px;
    }
    .section-heading p { max-width: 28ch; }
    .chapter-grid { grid-template-columns: 1fr; }
    .chapter-tile.is-featured { min-height: 360px; grid-column: auto; }
    .chapter-tile.is-compact { min-height: 272px; }
    .chapter-tile-content,
    .is-featured .chapter-tile-content { padding: 20px; }
    .is-featured h3 { font-size: 1.75rem; }
    .chapter-meta-row { align-items: flex-start; }
    .chapter-button { width: 100%; }
    .test-tools { width: 100%; }
    .test-form, .test-form .button { width: 100%; }
    .test-note { flex-direction: column; }
    .portal-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 460px) {
    .page-shell { padding: 12px; }
    .site-header { align-items: start; }
    .museum-brand img { width: 122px; }
    .header-copy p { display: block; font-size: .8rem; line-height: 1.45; }
    .language-switch { gap: 4px; }
    .language-switch a { min-width: 36px; padding: 7px 5px; }
    .mission-copy { padding: 24px 18px 18px; }
    .mission-copy h2 { font-size: 1.86rem; }
    .mission-side { padding: 0 18px 18px; }
    .chapter-tile.is-featured { min-height: 330px; }
    .chapter-tile.is-compact { min-height: 250px; }
    .chapter-number { top: 14px; left: 15px; }
    .chapter-state-mark { top: 12px; right: 12px; width: 32px; height: 32px; }
    .chapter-meta-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

@media print {
    body { background: #fff; color: #000; }
    .page-shell { width: 100%; margin: 0; border: 0; box-shadow: none; }
    .language-switch, .chapter-button, .test-note, .portal-bottom, footer { display: none !important; }
}


/* 0.3a.5 - taalnormalisatie */
.access-meta span,
.status-pill {
    white-space: nowrap;
}

.hero-button {
    white-space: nowrap;
}

html[lang="en"] .header-copy h1 {
    font-size: clamp(1.65rem, 3.3vw, 2.55rem);
}

html[lang="de"] .header-copy h1 {
    font-size: clamp(1.55rem, 3vw, 2.35rem);
}

html[lang="de"] .mission-copy h2 {
    font-size: clamp(1.9rem, 4.4vw, 3.2rem);
}

html[lang="de"] .mission-next > strong {
    font-size: clamp(1.28rem, 2.7vw, 1.88rem);
}

html[lang="de"] .is-compact h3 {
    font-size: clamp(1.08rem, 1.75vw, 1.45rem);
}

html[lang="en"] .is-compact h3 {
    font-size: clamp(1.12rem, 1.85vw, 1.52rem);
}

@media (min-width: 901px) {
    .mission-hero {
        height: 342px;
        min-height: 342px;
    }

    .mission-copy,
    .mission-side {
        min-height: 0;
    }
}

@media (max-width: 900px) {
    .mission-hero {
        background-size: auto 760px;
        background-repeat: no-repeat;
        background-color: var(--surface-dark);
    }
}

@media (max-width: 760px) {
    .hero-button {
        white-space: normal;
    }

    html[lang="de"] .header-copy h1,
    html[lang="en"] .header-copy h1 {
        font-size: 1.58rem;
    }

    html[lang="de"] .mission-copy h2 {
        font-size: 1.82rem;
    }

    html[lang="de"] .mission-next > strong,
    html[lang="en"] .mission-next > strong {
        font-size: 1.58rem;
    }

    html[lang="de"] .chapter-tile h3,
    html[lang="en"] .chapter-tile h3 {
        font-size: 1.42rem;
    }
}

@media (max-width: 460px) {
    html[lang="de"] .header-copy h1,
    html[lang="en"] .header-copy h1 {
        font-size: 1.48rem;
    }

    html[lang="de"] .mission-copy h2 {
        font-size: 1.72rem;
    }

    html[lang="de"] .mission-next > strong,
    html[lang="en"] .mission-next > strong {
        font-size: 1.48rem;
    }
}

/* Update 0.5: apparaat- en speeltijdinformatie */
.notice.info {
    background: rgba(41,75,96,.72);
    border-color: rgba(154,205,232,.42);
}
.playtime-meta {
    padding: 14px 16px;
    border-left: 3px solid var(--gold);
    background: rgba(18,24,16,.82);
    backdrop-filter: blur(3px);
}
.playtime-meta small {
    display: block;
    margin-top: 7px;
    color: var(--muted);
}
@media (max-width: 760px) {
    .playtime-meta { background: rgba(18,24,16,.88); }
}
