:root {
    --paper: #e9dfcf;
    --paper-strong: #efe5d4;
    --ink: #181512;
    --ink-soft: #4d4337;
    --line: rgba(24, 21, 18, 0.14);
    --accent: #8b5e3c;
    --accent-strong: #5f3e28;
    --success: #365b46;
    --error: #7d332c;
    --shadow: 0 24px 60px rgba(16, 12, 8, 0.22);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Georgia, "Times New Roman", serif;
    color: var(--ink);
    background:
        url("fond.png") center top / cover fixed no-repeat
}

/*
background:
        linear-gradient(rgba(18, 14, 11, 0.72), rgba(18, 14, 11, 0.92)),
        url("fond.png") center top / cover fixed no-repeat
        /*radial-gradient(circle at top, rgba(255, 255, 255, 0.25), transparent 35%),
        linear-gradient(180deg, #1e1813 0%, #271e18 30%, #211913 100%);*/

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.18;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 4px 4px, 4px 4px;
    mix-blend-mode: soft-light;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 48px;
}

.hero {
    padding: 28px;
    border: 1px solid rgba(233, 223, 207, 0.2);
    background:
        linear-gradient(145deg, rgba(233, 223, 207, 0.08), rgba(233, 223, 207, 0.02)),
        rgba(17, 13, 10, 0.58);
    color: #f5ecdd;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero h1,
.hero-copy,
.hero-kicker,
.hero-meta {
    margin: 0;
}

.hero-kicker,
.eyebrow,
.media-label {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.74rem;
}

.hero h1 {
    margin-top: 10px;
    font-size: clamp(2rem, 4vw, 3.6rem);
    line-height: 1;
}

.hero-copy {
    margin-top: 16px;
    max-width: 760px;
    color: rgba(245, 236, 221, 0.85);
    line-height: 1.6;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 16px;
    margin-top: 22px;
    color: rgba(245, 236, 221, 0.72);
}

.board {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 24px;
    margin-top: 24px;
}

.timeline,
.panel {
    background:
        linear-gradient(180deg, rgba(239, 229, 212, 0.98), rgba(227, 214, 195, 0.95)),
        var(--paper);
    box-shadow: var(--shadow);
    border: 1px solid rgba(24, 21, 18, 0.08);
}

.timeline {
    padding: 22px 18px;
}

.timeline-header,
.panel-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.timeline-header h2,
.panel h2,
.final-letter h3 {
    margin: 0;
}

.timeline ol {
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.timeline-item+.timeline-item {
    margin-top: 10px;
}

.timeline-item a,
.locked-line {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 12px;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.34);
}

.timeline-item.is-current a {
    border-color: var(--accent);
    background: rgba(139, 94, 60, 0.1);
}

.timeline-item.is-done a {
    border-color: rgba(54, 91, 70, 0.35);
}

.timeline-item.is-locked .locked-line {
    opacity: 0.45;
}

.step-index,
.seal {
    display: inline-grid;
    place-items: center;
    width: 42px;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1px solid var(--line);
    font-size: 0.9rem;
}

.step-text {
    display: grid;
    gap: 2px;
}

.step-text small {
    color: var(--ink-soft);
}

.panel {
    padding: 28px;
}

.seal {
    color: var(--accent-strong);
    border-color: rgba(95, 62, 40, 0.3);
    background: rgba(139, 94, 60, 0.08);
}

.question {
    margin: 18px 0 8px;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    line-height: 1.5;
}

.helper {
    margin: 0 0 24px;
    color: var(--ink-soft);
    line-height: 1.6;
}

.flash {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-left: 4px solid;
}

.flash-success {
    background: rgba(54, 91, 70, 0.1);
    border-color: var(--success);
}

.flash-error {
    background: rgba(125, 51, 44, 0.09);
    border-color: var(--error);
}

.step-form {
    display: grid;
    gap: 16px;
    margin-top: 22px;
}

.step-form label {
    display: grid;
    gap: 8px;
}

.step-form span {
    font-size: 0.92rem;
    color: var(--ink-soft);
}

.step-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(24, 21, 18, 0.2);
    background: rgba(255, 255, 255, 0.6);
    color: var(--ink);
    font: inherit;
}

.primary-button,
.ghost-button,
.keypad-key {
    border: 0;
    cursor: pointer;
    font: inherit;
}

.primary-button {
    justify-self: start;
    padding: 12px 18px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #f8f1e8;
}

.ghost-button {
    padding: 10px 14px;
    background: transparent;
    border: 1px solid var(--line);
}

.media-card,
.calendar-card,
.image-card,
.crypto-card,
.travel-card,
.blur-card,
.secret-paper {
    margin-top: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.38);
}

.media-card,
.calendar-card,
.crypto-card {
    padding: 18px;
}

.media-card a {
    color: var(--accent-strong);
}

.calendar-months,
.travel-card,
.crypto-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.travel-card span,
.crypto-grid span {
    padding: 8px 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.5);
    font-size: 0.92rem;
}

.calendar-months {
    gap: 14px;
}

.month-card {
    flex: 1 1 260px;
    min-width: 260px;
    padding: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.48);
}

.month-card h3 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.month-grid-head {
    margin-bottom: 6px;
}

.month-grid-head span {
    text-align: center;
    font-size: 0.78rem;
    color: var(--ink-soft);
}

.day-cell {
    min-height: 54px;
    padding: 6px 4px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.62);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    text-align: center;
}

.day-cell strong {
    font-size: 0.95rem;
}

.day-cell small {
    font-size: 0.68rem;
    color: var(--accent-strong);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.day-cell.is-empty {
    background: transparent;
    border-style: dashed;
    opacity: 0.35;
}

.day-cell.is-marked {
    background: rgba(139, 94, 60, 0.14);
    border-color: rgba(95, 62, 40, 0.32);
}

.image-card img,
.blur-card img {
    display: block;
    width: 100%;
    max-height: 380px;
    object-fit: cover;
}

.blur-card canvas {
    display: block;
    width: 100%;
}

.image-placeholder,
.blur-placeholder {
    display: grid;
    place-items: center;
    gap: 10px;
    min-height: 280px;
    padding: 24px;
    color: var(--ink-soft);
    background:
        linear-gradient(135deg, rgba(139, 94, 60, 0.08), rgba(255, 255, 255, 0.35)),
        repeating-linear-gradient(45deg, rgba(24, 21, 18, 0.02) 0 12px, rgba(24, 21, 18, 0.06) 12px 24px);
}

.blur-placeholder strong {
    font-size: 4rem;
    color: rgba(24, 21, 18, 0.8);
}

.secret-paper {
    padding: 18px;
    background: #f6f1e8;
}

.secret-paper p {
    margin: 0;
    color: #f6f1e8;
    user-select: text;
}

.secret-paper p::selection {
    color: #3d2b1e;
    background: rgba(139, 94, 60, 0.35);
}

.crypto-code {
    margin-bottom: 14px;
    font-size: 1.35rem;
    letter-spacing: 0.18em;
}

.missing-city {
    font-weight: 700;
    color: var(--accent-strong);
}

.blur-card {
    position: relative;
    overflow: hidden;
}

/* blur is applied directly into canvas pixels via ctx.filter in app.js */

.blur-overlay {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: end;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
}

.blur-overlay p,
.blur-meter,
.final-clue,
.final-letter p {
    margin: 0;
}

.keypad-form {
    max-width: 420px;
}

.keypad-screen {
    text-align: center;
    letter-spacing: 0.28em;
    font-size: 1.25rem;
}

.keypad {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.keypad-key {
    padding: 16px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
}

.keypad-key.is-submit {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #f8f1e8;
}

.keypad-key.is-clear {
    color: var(--error);
}

.final-clue {
    margin-top: 14px;
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.final-letter {
    margin-top: 28px;
    padding: 22px;
    border: 1px solid rgba(54, 91, 70, 0.25);
    background: rgba(54, 91, 70, 0.08);
}

audio {
    width: 100%;
    margin-top: 10px;
}

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

    .timeline {
        order: 2;
    }

    .panel {
        order: 1;
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 20px, 1180px);
        padding-top: 18px;
    }

    .hero,
    .timeline,
    .panel {
        padding: 18px;
    }

    .panel-top,
    .timeline-header,
    .blur-overlay {
        flex-direction: column;
        align-items: flex-start;
    }
}