/* Canonical owner: progressive navigation, steps, and progress ribbon. */
.casefile-progress {
    position: sticky;
    top: var(--casefile-progress-sticky-top, 0);
    z-index: 100;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: .75rem;
    width: 100%;
    margin: 0;
    padding: .45rem .75rem;
    background: rgba(10, 10, 10, .97);
    border-bottom: 1px solid rgba(200, 167, 93, .3);
    box-shadow: 0 8px 18px rgba(0, 0, 0, .26);
    backdrop-filter: blur(6px);
}

.casefile-progress-label { display: flex; align-items: center; gap: .75rem; min-width: 0; margin: 0; color: #fff; font-weight: 700; line-height: 1.2; }
.casefile-progress-phase { color: #fff; font-weight: 800; white-space: nowrap; }
.casefile-progress-meta { color: rgba(255,255,255,.72); font-size: .86rem; font-weight: 600; white-space: nowrap; }
.casefile-progress-segments { display: flex; flex: 1 1 220px; min-width: 160px; gap: .2rem; margin: 0; padding: 0; list-style: none; }
.casefile-progress-segments li { flex: 1; min-width: 0; }
.casefile-progress-segments button {
    position: relative;
    width: 100%;
    min-height: 32px;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}
.casefile-progress-segments button::before {
    content: "";
    position: absolute;
    inset: 50% 0 auto;
    height: .35rem;
    border-radius: 999px;
    background: rgba(255,255,255,.24);
    transform: translateY(-50%);
}
.casefile-progress-segments button:hover::before { background: rgba(255,255,255,.48); }
.casefile-progress-segments button.is-complete::before { background: rgba(200,167,93,.82); }
.casefile-progress-segments button.is-current::before { height: .55rem; background: #b12222; }
.casefile-progress-segments button:focus-visible { outline: 2px solid #fff; outline-offset: 1px; border-radius: .4rem; }
.casefile-progress-tools { display: flex; align-items: center; gap: .35rem; }
.casefile-progress-tool,
.casefile-tools-toggle { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(245,212,154,.35); border-radius: 999px; background: rgba(255,255,255,.07); color: #fff; }
.casefile-progress-tool:hover, .casefile-progress-tool:focus-visible, .casefile-tools-toggle:hover, .casefile-tools-toggle:focus-visible { background: rgba(177,34,34,.92); outline: 2px solid #fff; outline-offset: 2px; }
.casefile-tools-toggle { display: none; width: auto; padding: 0 .8rem; gap: .4rem; }
.casefile-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
    margin: 1.5rem 0 0;
    padding: 1rem 0 0;
    border-top: 1px solid rgba(200, 167, 93, .28);
}
.casefile-navigation .casefile-back {
    margin: 1.1rem;
}
.casefile-progressive-ready > .casefile-step { display: none; }
.casefile-progressive-ready > .casefile-step.is-active { display: block; }
.casefile-progressive-ready > .casefile-step.is-active > .panel,
.casefile-progressive-ready > .casefile-step.is-active.hero { animation: casefile-step-enter .24s ease-out; }
@keyframes casefile-step-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 991.98px) {
    .casefile-progress-label { flex-wrap: wrap; gap: .25rem .55rem; }
    .casefile-progress-phase,
    .casefile-progress-meta { white-space: normal; overflow-wrap: anywhere; }
}

@media (max-width: 767.98px) {
    .casefile-progress { grid-template-columns: 1fr auto; gap: .3rem .5rem; padding: .35rem .55rem; }
    .casefile-progress-label { flex-wrap: wrap; gap: .25rem .55rem; font-size: .88rem; }
    .casefile-progress-phase, .casefile-progress-meta { white-space: normal; }
    .casefile-progress-segments { grid-column: 1 / -1; min-width: 100%; }
    .casefile-progress-segments button { min-height: 44px; }
    .casefile-tools-toggle { display: inline-flex; }
    .casefile-progress-tools { display: none; grid-column: 1 / -1; justify-content: flex-end; padding-bottom: .25rem; }
    .casefile-progress-tools.is-open { display: flex; }
    .casefile-navigation { flex-direction: column; align-items: stretch; gap: .75rem; }
    .casefile-navigation .btn { width: 100%; }
    .casefile-navigation .casefile-back {
        width: calc(100% - 2.2rem);
        align-self: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .casefile-progressive-ready > .casefile-step.is-active > .panel,
    .casefile-progressive-ready > .casefile-step.is-active.hero { animation: none; }
}

.ccf-detective-notebook { background: #080808; border-color: rgba(157,26,1,.7); }
.ccf-notebook-page {
    position: relative; max-width: 980px; margin: 0 auto; padding: clamp(1rem, 4vw, 3rem);
    color: #241d18; background: linear-gradient(90deg, transparent 2.65rem, rgba(157,26,1,.22) 2.7rem, transparent 2.75rem), repeating-linear-gradient(#eee6d5 0 31px, #d6cbb5 32px);
    border: 1px solid #b9aa8c; border-radius: 4px; box-shadow: 0 22px 65px rgba(0,0,0,.55);
}
.ccf-notebook-heading { padding-left: 2.5rem; border-bottom: 3px double #9d1a01; }
.ccf-notebook-heading p { margin: 0; color: #761806; font: 700 .75rem/1.4 monospace; letter-spacing: .12em; text-transform: uppercase; }
.ccf-notebook-heading h2 { margin: .2rem 0; color: #17110e; font-family: Georgia,serif; font-size: clamp(2rem,6vw,3.5rem); }
.ccf-notebook-heading span { display: block; margin-bottom: 1rem; font-weight: 700; }
.ccf-notebook-scorecard {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
    margin: 1.25rem 0 0 2.5rem;
    padding: 1rem;
    color: #f7eee1;
    background: #17110e;
    border-left: 6px solid #9d1a01;
}
.ccf-notebook-scorecard div { min-width: 0; }
.ccf-notebook-scorecard span { display: block; color: #d8c7ad; font: 700 .72rem/1.4 monospace; letter-spacing: .08em; text-transform: uppercase; }
.ccf-notebook-scorecard strong { display: block; margin-top: .2rem; color: #fff; font-family: Georgia, serif; font-size: clamp(1.15rem, 2.5vw, 1.65rem); overflow-wrap: anywhere; }
.ccf-notebook-section { padding: 1.25rem 0 0 2.5rem; }
.ccf-notebook-section h3,.ccf-case-closed h3 { color: #761806; font-family: Georgia,serif; font-size: 1.35rem; }
.ccf-notebook-answer-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; margin: 0; }
.ccf-notebook-answer { min-width: 0; padding: .8rem; background: rgba(255,252,242,.72); border-left: 3px solid #9d1a01; }
.ccf-notebook-answer dt { font-weight: 800; }
.ccf-notebook-answer dd { margin: .25rem 0 0; overflow-wrap: anywhere; }
.ccf-transcription-map { overflow: hidden; border: 1px solid #9b8c72; background: rgba(255,252,242,.78); }
.ccf-transcription-row { display: grid; grid-template-columns: minmax(9rem,.8fr) minmax(0,1.2fr); gap: 1rem; padding: .75rem; border-bottom: 1px solid #c8bda7; }
.ccf-transcription-row:last-child { border-bottom: 0; }
.ccf-transcription-row span { font-weight: 800; }
.ccf-transcription-row code { white-space: pre-wrap; overflow-wrap: anywhere; color: #641604; }
.ccf-notebook-note { font-style: italic; }
.ccf-notebook-review { margin-top: 1rem; padding: .75rem 1rem; background: #fff4d8; border: 1px solid #9d1a01; }
.ccf-code-reveal { margin: 1.5rem 0 0 2.5rem; padding: 1.25rem; color: #f7eee1; background: #17110e; border: 2px solid #9d1a01; box-shadow: 0 16px 38px rgba(0,0,0,.28); }
.ccf-code-reveal h3 { color: #fff; font-family: Georgia, serif; }
.ccf-code-reveal__status { display: inline-block; margin-bottom: .65rem; padding: .3rem .65rem; background: #9d1a01; color: #fff; font: 800 .75rem/1.2 monospace; letter-spacing: .1em; text-transform: uppercase; }
.ccf-code-reveal .ccf-transcription-map { color: #241d18; }
.ccf-case-closed { margin: 1.5rem 0 0 2.5rem; padding: 1rem; color: #f7eee1; background: #17110e; border-left: 6px solid #9d1a01; }
@media (max-width: 575.98px) {
    .ccf-notebook-page { padding: 1rem .8rem; background: repeating-linear-gradient(#eee6d5 0 31px,#d6cbb5 32px); }
    .ccf-notebook-heading,.ccf-notebook-section { padding-left: 0; }
    .ccf-notebook-scorecard { grid-template-columns: 1fr; margin-left: 0; }
    .ccf-notebook-answer-grid { grid-template-columns: 1fr; }
    .ccf-transcription-row { grid-template-columns: 1fr; gap: .25rem; }
    .ccf-code-reveal { margin-left: 0; }
    .ccf-case-closed { margin-left: 0; }
}
