:root {
    --ink: #141414;
    --paper: #f6f3ee;
    --card: #fff;
    --red: #9e1b21;
    --red2: #c4272f;
    --line: #ded8cf;
    --muted: #6d6861;
    --green: #197447;
    --shadow: 0 18px 50px rgba(25,20,15,.08)
}

* {
    box-sizing: border-box
}

html {
    font-family: Inter,Segoe UI,Arial,sans-serif;
    background: var(--paper);
    color: var(--ink)
}

body {
    margin: 0
}

.site-header {
    height: 76px;
    background: #111;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 max(24px,calc((100vw - 1180px)/2));
    border-bottom: 4px solid var(--red)
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    color: #fff;
    text-decoration: none;
    letter-spacing: .08em
}

.brand-mark {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

    .brand-mark > img {
        width: 50px !important;
        height: 50px !important;
        max-width: 50px !important;
        max-height: 50px !important;
        object-fit: contain;
    }

.brand small {
    display: block;
    font-size: 10px;
    color: #bbb;
    letter-spacing: .13em;
    margin-top: 2px
}
.brand-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

    .brand-title strong {
        display: block;
        font-size: 1.35rem;
        font-weight: 800;
        letter-spacing: 0.14em;
        line-height: 1.1;
    }

    .brand-title small {
        display: block;
        margin-top: 5px;
        font-size: 0.9rem;
        letter-spacing: 0.08em;
    }

.link-button {
    border: 0;
    background: none;
    color: #ddd;
    cursor: pointer;
    font: inherit
}

.page-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: 38px 24px 70px
}

.site-footer {
    text-align: center;
    padding: 25px;
    color: #777;
    font-size: 12px;
    letter-spacing: .2em
}

.eyebrow {
    font-size: 11px;
    letter-spacing: .18em;
    font-weight: 800;
    color: var(--red);
    margin: 0 0 8px
}

h1 {
    font-size: clamp(32px,5vw,54px);
    letter-spacing: -.035em;
    margin: 0 0 14px;
    line-height: 1.03
}

h2 {
    font-size: 24px;
    margin: 0 0 14px
}

h3 {
    margin: 4px 0 12px
}

.muted {
    color: var(--muted);
    line-height: 1.6
}

.panel, .auth-card, .quiz-card, .feedback-card {
    background: var(--card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    border-radius: 18px;
    padding: 30px
}

.auth-card {
    max-width: 760px;
    margin: 35px auto
}

.auth-narrow {
    max-width: 520px
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 28px
}

    .form-grid.single {
        grid-template-columns: 1fr
    }

    .form-grid label {
        font-size: 13px;
        font-weight: 700
    }

    .form-grid input, .form-grid select {
        width: 100%;
        margin-top: 7px;
        padding: 13px 14px;
        border: 1px solid #cfc8bd;
        border-radius: 9px;
        background: #fff;
        font: inherit
    }

    .form-grid .full {
        grid-column: 1/-1
    }

.validation, .field-validation-error {
    color: #a5171d;
    font-size: 12px
}

.check {
    display: flex !important;
    align-items: center;
    gap: 8px
}

    .check input {
        width: auto;
        margin: 0
    }

.primary, .secondary, .question-counts button {
    appearance: none;
    border: 0;
    border-radius: 10px;
    padding: 14px 18px;
    font: 700 15px inherit;
    cursor: pointer
}

.primary {
    background: var(--red);
    color: #fff
}

    .primary:hover {
        background: var(--red2)
    }

.secondary {
    background: #eee8df;
    color: #222
}

.button-link {
    display: inline-block;
    text-decoration: none;
    text-align: center
}

.auth-link {
    text-align: center;
    color: #666;
    margin-top: 22px
}

    .auth-link a {
        color: var(--red);
        font-weight: 700
    }

.hero {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    align-items: center;
    margin: 12px 0 28px
}

    .hero h1 {
        font-size: 44px
    }

    .hero p {
        font-size: 17px
    }

.target-badge {
    background: #111;
    color: white;
    padding: 16px 22px;
    border-radius: 999px;
    font-weight: 800;
    border-bottom: 4px solid var(--red)
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4,1fr);
    gap: 14px;
    margin-bottom: 22px
}

.stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px
}

    .stat span {
        display: block;
        color: #777;
        font-size: 12px
    }

    .stat strong {
        font-size: 31px;
        display: block;
        margin-top: 8px
    }

.start-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 35px;
    margin-bottom: 22px
}

.question-counts {
    display: grid;
    grid-template-columns: repeat(4,90px);
    gap: 9px
}

    .question-counts button {
        background: #f0ece6;
        color: #222
    }

        .question-counts button.featured {
            background: var(--red);
            color: #fff
        }

    .question-counts small {
        display: block;
        font-size: 10px;
        font-weight: 500;
        margin-top: 4px;
        opacity: .7
    }

.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px
}

.performance, .history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 0;
    border-top: 1px solid #eee8df
}

    .performance small, .history-row small {
        display: block;
        color: #888;
        margin-top: 3px
    }

.history-row {
    text-decoration: none;
    color: inherit
}

.quiz-shell {
    max-width: 780px;
    margin: 20px auto
}

.quiz-top {
    display: flex;
    justify-content: space-between;
    color: #6c665f;
    font-size: 13px;
    margin-bottom: 10px
}

.progress {
    height: 5px;
    background: #ddd7ce;
    border-radius: 20px;
    margin-bottom: 22px;
    overflow: hidden
}

    .progress i {
        display: block;
        height: 100%;
        background: var(--red)
    }

.quiz-card h1 {
    font-size: 34px;
    margin-bottom: 26px
}

.stance-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    display: block;
    margin: 10px auto 28px;
    object-fit: contain;
    border-radius: 12px;
}
@media (max-width: 800px) {
    .stance-image {
        max-width: 260px;
    }
}
.answers {
    display: grid;
    gap: 11px
}

.answer-option {
    display: block;
    position: relative;
    cursor: pointer
}

    .answer-option input {
        position: absolute;
        opacity: 0
    }

    .answer-option span {
        display: block;
        border: 2px solid #e3ddd4;
        border-radius: 12px;
        padding: 16px 18px;
        font-size: 16px
    }

    .answer-option input:checked + span {
        border-color: var(--red);
        background: #fff4f4
    }

.answers .primary {
    margin-top: 8px
}

.feedback-card {
    text-align: center;
    padding: 45px
}

    .feedback-card.correct {
        border-top: 6px solid var(--green)
    }

    .feedback-card.incorrect {
        border-top: 6px solid var(--red)
    }

.feedback-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 0 auto 20px;
    background: #eee;
    font-size: 38px;
    font-weight: 900
}

.correct .feedback-icon {
    background: #e7f4ed;
    color: var(--green)
}

.incorrect .feedback-icon {
    background: #fdebec;
    color: var(--red)
}

.feedback-card h1 {
    font-size: 35px
}

.explanation {
    font-size: 18px;
    color: #555
}

.score-line {
    display: flex;
    justify-content: center;
    gap: 28px;
    padding: 22px 0;
    margin: 22px 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee
}

    .score-line strong {
        display: block;
        font-size: 22px
    }

.result-hero {
    text-align: center;
    padding: 40px 20px 50px
}

    .result-hero h1 {
        font-size: 88px;
        color: var(--red)
    }

    .result-hero p {
        font-size: 20px
    }

.review-list {
    max-width: 880px;
    margin: 0 auto
}

    .review-list article {
        padding: 22px 0;
        border-top: 1px solid #eee8df
    }

.wrong-answer {
    color: #a31e24
}

.right-answer {
    color: var(--green);
    font-weight: 700
}

.perfect {
    text-align: center;
    max-width: 700px;
    margin: auto
}

@media(max-width:800px) {
    .page-shell {
        padding: 25px 16px 55px
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr
    }

    .start-panel {
        display: block
    }

    .question-counts {
        grid-template-columns: 1fr 1fr;
        margin-top: 20px
    }

    .two-column {
        grid-template-columns: 1fr
    }

    .hero {
        align-items: flex-start;
        flex-direction: column
    }

    .form-grid {
        grid-template-columns: 1fr
    }

        .form-grid .full {
            grid-column: auto
        }

    .quiz-card, .feedback-card, .panel {
        padding: 22px
    }

    .score-line {
        gap: 12px
    }


    .target-badge {
        font-size: 13px
    }
}

/* =========================================================
   HEADER NAVIGATION
   ========================================================= */

.header-nav {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-left: auto;
}

    .header-nav form {
        display: flex;
        margin: 0;
    }

    .header-nav .nav-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        padding: 8px 0;
        border: 0;
        background: none;
        color: #ddd;
        text-decoration: none;
        font: inherit;
        font-size: 14px;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
    }

        .header-nav .nav-link:hover {
            color: #fff;
        }

.account-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 12px 0 28px
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0,1.4fr) minmax(320px,.8fr);
    gap: 22px
}

.notice {
    padding: 13px 16px;
    border-radius: 10px;
    margin: 0 0 18px;
    font-weight: 650
}

    .notice.success {
        background: #e8f5ed;
        color: #17663f;
        border: 1px solid #b9dfc9
    }

    .notice.error {
        background: #fdebec;
        color: #9b1b20;
        border: 1px solid #efbfc2
    }

.grade-note {
    margin: 0;
    padding: 12px 14px;
    border-left: 4px solid var(--red);
    background: #f8f5f0;
    color: #625c55;
    font-size: 13px;
    line-height: 1.5
}

/* =========================================================
   RESPONSIVE HEADER
   ========================================================= */

@media (max-width: 900px) {

    .site-header {
        height: auto;
        min-height: 76px;
        flex-wrap: wrap;
        align-items: center;
        padding: 10px 16px 0;
        gap: 10px;
    }

    /*
       Keep the Ren Shin Kai branding on its own row.
    */
    .brand {
        flex: 0 0 100%;
        width: 100%;
    }

    /*
       Navigation becomes a full-width second row.
    */
    .header-nav {
        flex: 0 0 calc(100% + 32px);
        width: calc(100% + 32px);
        margin: 0 -16px;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

        .header-nav form {
            width: 100%;
            margin: 0;
        }

        .header-nav .nav-link {
            width: 100%;
            min-height: 46px;
            padding: 10px 6px;
            justify-content: center;
            font-size: 14px;
            text-align: center;
        }

        .header-nav > a:not(:first-child),
        .header-nav > form {
            border-left: 1px solid rgba(255, 255, 255, 0.10);
        }

    .account-header {
        align-items: flex-start;
        flex-direction: column;
    }

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


/* =========================================================
   SMALL PHONE HEADER
   ========================================================= */

@media (max-width: 520px) {

    .brand {
        gap: 10px;
    }

    .brand-mark {
        width: 46px;
        height: 46px;
        flex: 0 0 46px;
    }

        .brand-mark > img {
            width: 46px !important;
            height: 46px !important;
            max-width: 46px !important;
            max-height: 46px !important;
        }

    .brand-title strong {
        font-size: 1rem;
        letter-spacing: 0.12em;
    }

    .brand-title small {
        margin-top: 4px;
        font-size: 0.76rem;
        letter-spacing: 0.06em;
    }

    .header-nav .nav-link {
        min-height: 44px;
        padding: 9px 4px;
        font-size: 13px;
    }
}
