:root {
    color-scheme: light;
    --bg: #eef2f5;
    --panel: #ffffff;
    --ink: #111827;
    --muted: #667085;
    --line: #d9e2ea;
    --accent: #d83b4c;
    --accent-dark: #a92735;
    --soft: #f8fafc;
}

* {
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    margin: 0;
}

a {
    color: inherit;
}

.topbar {
    align-items: center;
    background: #0f172a;
    color: #fff;
    display: flex;
    justify-content: space-between;
    min-height: 64px;
    padding: 0 28px;
}

.brand {
    font-size: 20px;
    font-weight: 900;
    text-decoration: none;
}

.topbar nav {
    align-items: center;
    display: flex;
    gap: 14px;
}

.topbar nav a {
    color: #fff;
    font-weight: 800;
    text-decoration: none;
}

.shell {
    margin: 0 auto;
    max-width: 1180px;
    padding: 28px;
}

.hero,
.panel,
.case-card,
.auth-card,
.clue-card,
.suspect-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.hero {
    margin-bottom: 24px;
    padding: 30px;
}

.hero.compact {
    padding: 22px 26px;
}

.eyebrow {
    color: var(--accent);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0;
    margin: 0 0 8px;
    text-transform: uppercase;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

.hero h1 {
    font-size: 42px;
    line-height: 1.05;
    margin-bottom: 14px;
    max-width: 760px;
}

.hero p {
    color: var(--muted);
    font-size: 17px;
    max-width: 780px;
}

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

.case-card {
    display: grid;
    gap: 12px;
    min-height: 260px;
    padding: 22px;
}

.case-card p,
.clue-card p,
.suspect-panel p {
    color: var(--muted);
    line-height: 1.55;
}

.pill {
    background: #edf2f7;
    border-radius: 999px;
    color: #334155;
    display: inline-flex;
    font-size: 12px;
    font-weight: 900;
    margin-right: 6px;
    padding: 5px 9px;
}

.pill.premium {
    background: #fff1d6;
    color: #8a5600;
}

.pill.muted {
    background: #f3e8ff;
    color: #6d28d9;
}

.button {
    align-items: center;
    align-self: end;
    background: var(--accent);
    border: 0;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    text-decoration: none;
}

.button.secondary {
    background: #263244;
}

.button.danger {
    background: #9f1239;
}

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
}

.auth-card {
    max-width: 420px;
    padding: 30px;
    width: 100%;
}

form {
    display: grid;
    gap: 14px;
}

label {
    display: grid;
    font-weight: 800;
    gap: 7px;
}

input,
select,
textarea {
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    min-height: 42px;
    padding: 10px 12px;
    width: 100%;
}

textarea {
    resize: vertical;
}

.alert,
.notice {
    border-radius: 8px;
    font-weight: 800;
    margin-bottom: 14px;
    padding: 12px 14px;
}

.alert {
    background: #fff1f2;
    color: #9f1239;
}

.notice {
    background: #ecfdf3;
    color: #027a48;
}

.case-layout {
    align-items: start;
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) 320px;
}

.case-main,
.suspect-panel,
.panel {
    padding: 24px;
}

.clue-list {
    display: grid;
    gap: 12px;
    margin-bottom: 26px;
}

.clue-card {
    padding: 18px;
}

.suspect-panel {
    position: sticky;
    top: 18px;
}

.suspect-panel article {
    border-top: 1px solid var(--line);
    padding: 14px 0;
}

.question-form fieldset {
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 16px;
}

.question-form legend {
    font-size: 17px;
    font-weight: 900;
    padding: 0 8px;
}

.option-row {
    align-items: center;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    gap: 10px;
    padding: 10px 12px;
}

.option-row input,
.check input {
    height: 16px;
    min-height: 0;
    width: 16px;
}

.score-box {
    align-items: baseline;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: 8px;
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    padding: 16px;
}

.score-box strong {
    color: #c2410c;
    font-size: 30px;
}

.metric-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
}

.metric {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}

.metric span {
    color: var(--muted);
    display: block;
    font-weight: 800;
    margin-bottom: 8px;
}

.metric strong {
    font-size: 30px;
}

.admin-actions {
    display: flex;
    gap: 12px;
}

.admin-layout {
    display: grid;
    gap: 18px;
}

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

.admin-form .wide {
    grid-column: 1 / -1;
}

.admin-form .check {
    align-items: center;
    display: flex;
    gap: 8px;
}

.admin-stack {
    display: grid;
    gap: 16px;
}

.admin-item-form,
.admin-create-form,
.admin-nested {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.admin-button-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.option-admin-list {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
}

.option-admin-row {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: 80px minmax(0, 1fr) 90px auto auto;
}

.option-create-row {
    background: #fff;
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 10px;
}

.table {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.row {
    align-items: center;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 180px 120px 120px;
    padding: 12px 14px;
}

.row:last-child {
    border-bottom: 0;
}

.empty {
    background: var(--panel);
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    font-weight: 800;
    padding: 20px;
}

@media (max-width: 900px) {
    .case-grid,
    .metric-grid,
    .admin-form,
    .case-layout {
        grid-template-columns: 1fr;
    }

    .suspect-panel {
        position: static;
    }

    .hero h1 {
        font-size: 34px;
    }

    .row {
        grid-template-columns: 1fr;
    }

    .option-admin-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
        padding: 14px 18px;
    }

    .shell {
        padding: 18px;
    }

    .hero h1 {
        font-size: 28px;
    }
}

/* CaseGame player redesign */
.player-app {
    background: #f3efe7;
    color: #151515;
}

.player-topbar {
    background: rgba(21, 21, 21, 0.96);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    z-index: 20;
}

.brand {
    align-items: center;
    display: inline-flex;
    gap: 10px;
}

.brand-mark {
    border-radius: 10px;
    height: 34px;
    width: 34px;
}

.player-shell {
    max-width: 1220px;
}

.player-hero {
    align-items: stretch;
    background: #151515;
    border: 1px solid #26211d;
    border-radius: 8px;
    color: #fff;
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(0, 1fr) 430px;
    margin-bottom: 26px;
    min-height: 420px;
    overflow: hidden;
}

.player-hero-copy {
    align-content: center;
    display: grid;
    padding: 42px;
}

.player-hero h1 {
    font-size: 48px;
    line-height: 1.02;
    margin-bottom: 16px;
    max-width: 760px;
}

.player-hero p:not(.eyebrow) {
    color: #d8d0c5;
    font-size: 18px;
    line-height: 1.6;
    max-width: 680px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.case-board-preview {
    background: #2f251d;
    min-height: 420px;
    position: relative;
}

.board-strip {
    background: #c63f32;
    height: 100%;
    left: 36px;
    position: absolute;
    top: 0;
    width: 8px;
}

.evidence-note,
.evidence-photo,
.evidence-chip {
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
    position: absolute;
}

.evidence-note {
    background: #f3efe7;
    border-radius: 8px;
    color: #151515;
    display: grid;
    gap: 8px;
    left: 78px;
    padding: 18px;
    top: 70px;
    width: 240px;
}

.evidence-note.primary {
    background: #fff7dd;
    left: 126px;
    top: 190px;
}

.evidence-note span,
.case-card-footer span,
.section-heading > span {
    color: #7c6b5a;
    font-size: 13px;
    font-weight: 900;
}

.evidence-photo {
    background: linear-gradient(135deg, #242424, #5b4238 52%, #c63f32);
    border: 10px solid #f3efe7;
    border-radius: 8px;
    height: 126px;
    right: 44px;
    top: 92px;
    transform: rotate(4deg);
    width: 118px;
}

.evidence-chip {
    background: #25594d;
    border-radius: 999px;
    bottom: 54px;
    color: #fff;
    font-weight: 900;
    padding: 10px 14px;
    right: 56px;
}

.evidence-line {
    background: rgba(243, 239, 231, 0.48);
    height: 2px;
    position: absolute;
    transform-origin: left center;
}

.evidence-line.one {
    left: 166px;
    top: 178px;
    transform: rotate(-18deg);
    width: 150px;
}

.evidence-line.two {
    left: 160px;
    top: 286px;
    transform: rotate(16deg);
    width: 174px;
}

.section-heading {
    align-items: end;
    display: flex;
    justify-content: space-between;
    margin: 10px 0 16px;
}

.section-heading h2 {
    font-size: 28px;
    margin: 0;
}

.compact-heading {
    margin-top: 30px;
}

.player-case-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.player-case-card {
    border-color: #ded2c1;
    box-shadow: 0 14px 34px rgba(21, 21, 21, 0.08);
    gap: 16px;
    min-height: 300px;
}

.player-case-card h2 {
    font-size: 28px;
    margin: 0;
}

.player-case-card p {
    color: #5e554c;
    line-height: 1.65;
}

.case-card-top,
.case-card-footer {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
}

.player-case-layout {
    gap: 22px;
    grid-template-columns: minmax(0, 1fr) 340px;
}

.player-case-layout .case-main,
.player-case-layout .suspect-panel {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}

.case-brief,
.player-case-layout .question-form fieldset,
.player-case-layout .suspect-panel,
.player-case-layout .score-box {
    background: #fffdf8;
    border: 1px solid #ded2c1;
    border-radius: 8px;
    box-shadow: 0 14px 34px rgba(21, 21, 21, 0.06);
}

.case-brief {
    padding: 30px;
}

.case-brief h1 {
    font-size: 42px;
    line-height: 1.06;
    margin-bottom: 14px;
}

.case-brief p:not(.eyebrow) {
    color: #5e554c;
    font-size: 17px;
    line-height: 1.7;
}

.brief-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.brief-stats span {
    background: #ece4d8;
    border-radius: 999px;
    color: #4b4036;
    font-size: 13px;
    font-weight: 900;
    padding: 8px 12px;
}

.evidence-timeline {
    position: relative;
}

.evidence-timeline .clue-card {
    align-items: start;
    background: #fffdf8;
    border-color: #ded2c1;
    display: grid;
    gap: 14px;
    grid-template-columns: 42px minmax(0, 1fr);
}

.clue-marker {
    align-items: center;
    background: #151515;
    border-radius: 999px;
    color: #fff;
    display: inline-flex;
    font-weight: 900;
    height: 34px;
    justify-content: center;
    width: 34px;
}

.clue-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}

.player-case-layout .suspect-panel {
    padding: 22px;
}

.player-case-layout .suspect-panel article {
    border-color: #ded2c1;
}

.player-case-layout .option-row {
    background: #f7f0e6;
    border-color: #ded2c1;
}

.player-case-layout .option-row:hover {
    border-color: #c63f32;
}

.admin-password-panel {
    margin-top: 18px;
}

@media (max-width: 980px) {
    .player-hero,
    .player-case-layout,
    .player-case-grid {
        grid-template-columns: 1fr;
    }

    .case-board-preview {
        min-height: 300px;
    }

    .player-case-layout .suspect-panel {
        position: static;
    }
}

@media (max-width: 620px) {
    .player-topbar nav {
        width: 100%;
    }

    .player-hero-copy,
    .case-brief {
        padding: 24px;
    }

    .player-hero h1,
    .case-brief h1 {
        font-size: 34px;
    }

    .section-heading {
        align-items: start;
        flex-direction: column;
        gap: 6px;
    }

    .case-card-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .case-card-footer .button {
        width: 100%;
    }
}

/* CaseGame gameplay polish */
.case-progress {
    background: #ece4d8;
    border: 1px solid #ded2c1;
    border-radius: 8px;
    display: grid;
    gap: 12px;
    margin-top: 18px;
    padding: 14px;
}

.case-progress strong,
.case-progress span {
    display: block;
}

.case-progress span {
    color: #6b6259;
    font-size: 13px;
    margin-top: 4px;
}

.progress-track {
    background: rgba(21, 21, 21, 0.12);
    border-radius: 999px;
    height: 9px;
    overflow: hidden;
}

.progress-track i {
    background: #c63f32;
    display: block;
    height: 100%;
    transition: width 180ms ease;
    width: 0;
}

.interactive-clue {
    transition: opacity 160ms ease, transform 160ms ease;
}

.interactive-clue.is-locked {
    opacity: 0.58;
}

.interactive-clue.is-opened {
    border-color: #c63f32;
}

.clue-content {
    min-width: 0;
}

.clue-body p {
    white-space: normal;
}

.clue-locked-note {
    color: #8a6a3d;
    font-weight: 800;
    margin: 8px 0;
}

.clue-open-button {
    margin-top: 10px;
}

.clue-open-button:disabled,
.final-solution.is-locked .question-form {
    cursor: not-allowed;
    opacity: 0.5;
}

.final-locked-message {
    background: #fff7dd;
    border: 1px solid #ead19b;
    border-radius: 8px;
    color: #74521b;
    font-weight: 900;
    margin-bottom: 14px;
    padding: 14px;
}

.question-form fieldset {
    margin-top: 18px;
}

.question-form legend {
    align-items: center;
    background: #fffdf8;
    border-radius: 999px;
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    line-height: 1.25;
    max-width: 100%;
    padding: 4px 12px;
}

.question-form legend small {
    color: #c63f32;
    font-size: 13px;
}

.option-row span {
    overflow-wrap: anywhere;
}

.suspect-panel small {
    color: #3e3933;
    display: block;
    line-height: 1.45;
    margin-top: 10px;
}

@media (max-width: 620px) {
    .evidence-timeline .clue-card {
        grid-template-columns: 34px minmax(0, 1fr);
        padding: 14px;
    }

    .clue-marker {
        height: 30px;
        width: 30px;
    }

    .question-form legend {
        border-radius: 8px;
        display: grid;
        width: 100%;
    }
}
