/* ============================================================
   CSETMath tool-specific styles.
   ------------------------------------------------------------
   Shared layout rules (header, footer, container, typography,
   .big-btn / .body-link / .signout-link) still come from
   /css/sbcss-tool.css. This file overrides the theme palette
   to a periwinkle look that stands apart from SBCSS branding,
   plus CSETMath-specific UI (login, dashboard, quiz).
   ============================================================ */

/* --- Header height override --- */
/* The shared .site-header is only ~70px tall; with the logo removed and the
   title absolutely positioned, it wasn't tall enough to visibly contain the
   title on this tool. Give it a min-height so the centered title has room.
   The .container inside must also stretch — without this, it collapses to
   its content height and the absolutely-positioned title centers within
   that small strip at the top of the header instead of the full header. */
.site-header {
    min-height: 50px;
}

.site-header .container {
    min-height: inherit;
    position: relative;  /* so the absolutely-positioned menu attaches here */
}

/* The logo (176×176) is much taller than the 50px header strip — it
 * deliberately overflows downward into the page area below. Push the main
 * content down so it doesn't slide behind the logo. */
main#main {
    padding-top: 130px;
}
@media (max-width: 600px) {
    main#main { padding-top: 86px; }   /* mobile logo is smaller */
}

/* Compress the title block so it fits the slim 50px header. */
.site-header .header-text h1 {
    font-size: 1.1rem;
    margin: 0;
}
.site-header .header-text .subtitle {
    font-size: 0.75rem;
    margin: 2px 0 0;
    line-height: 1.3;
}

/* Narrow screens: title text and menu button collide. Compact the header:
 * shrink the title, hide the subtitle, and reduce the menu to an icon-only
 * button so it doesn't crowd the title. */
@media (max-width: 600px) {
    .site-header .header-text h1 {
        font-size: 0.92rem;
    }
    .site-header .header-text .subtitle {
        display: none;
    }
    .nav-menu-label { display: none; }
    .nav-menu > summary { padding: 0 10px; }
}

/* Shared sbcss-tool.css flips .header-text to position:static at ≤900px
 * (and .container to flex-direction:column), which makes the slate header
 * grow tall to fit the title in flow. We want it to stay 50px slim on
 * EVERY screen size, so override those rules. */
@media (max-width: 900px) {
    .site-header .container {
        flex-direction: row;
    }
    .site-header .header-text {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: none;
        padding: 0 20px;
        text-align: center;
        width: 100%;
    }
}

/* ============================================================
 * Brand logo (top-left of every signed-in CSETMath page)
 * ============================================================ */
/* Logo pinned to the upper-left corner of the page, on top of everything.
 * Uniquely named (cset-brand-*) so it doesn't collide with shared
 * sbcss-tool.css's .header-logo rule (52px tall, used by other tools). */
.cset-brand-link {
    position: absolute;
    /* Offsets compensate for the PNG's internal whitespace AND drop the
     * visible logo down so its top edge lines up with the menu button
     * (which sits at top: 7px). At 176px logo, PNG whitespace is ~32px,
     * so element top = 7 - 32 = -25px. */
    top: -25px;
    left: -16px;
    margin: 0;
    padding: 0;
    z-index: 100;
    display: block;
    line-height: 0;
}
.cset-brand-img {
    width: 176px;
    height: 176px;
    margin: 0;
    padding: 0;
    display: block;
    object-fit: contain;
}
@media (max-width: 600px) {
    /* Same alignment math, but at 120px logo (PNG whitespace ~22px). */
    .cset-brand-link { top: -15px; left: -10px; }
    .cset-brand-img  { width: 120px; height: 120px; }
}

.site-header {
    position: relative;
    z-index: 2;
}

/* ============================================================
 * Top-RIGHT navigation menu (used on every signed-in page)
 * ============================================================ */
.nav-menu {
    position: absolute;
    top: 7px;        /* vertically centered in the 50px header */
    right: 18px;
    z-index: 50;
}
/* Dropdown panel anchors to the right edge so it doesn't overflow */
.nav-menu-items {
    left: auto !important;
    right: 0;
}
.nav-menu > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 12px;
    border-radius: 6px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background-color 0.15s, border-color 0.15s;
}
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu > summary:hover,
.nav-menu > summary:focus-visible {
    background: rgba(255,255,255,0.22);
    border-color: rgba(255,255,255,0.4);
}
.nav-menu[open] > summary {
    background: rgba(255,255,255,0.28);
    border-color: rgba(255,255,255,0.5);
}
.nav-menu-icon {
    font-size: 1.25rem;
    line-height: 1;
}
.nav-menu-label {
    font-size: 0.88rem;
}

/* Dropdown panel */
.nav-menu-items {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    list-style: none;
    margin: 0;
    padding: 6px 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid var(--sbcss-border);
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.15);
    color: var(--sbcss-text);
}
.nav-menu-items li { margin: 0; }
.nav-menu-link {
    display: block;
    padding: 9px 16px;
    color: var(--sbcss-text);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: background-color 0.1s;
}
.nav-menu-link:hover,
.nav-menu-link:focus {
    background: #f2eef8;
    color: var(--sbcss-blue);
    text-decoration: none;
}
.nav-menu-current {
    color: var(--sbcss-blue);
    font-weight: 700;
    background: #f7f4fb;
    border-left: 3px solid var(--sbcss-blue);
    padding-left: 13px;  /* offset for the 3px border */
}
.nav-menu-divider {
    height: 1px;
    background: var(--sbcss-border);
    margin: 4px 0;
    list-style: none;
}
.nav-menu-signout {
    color: #b03030;
}
.nav-menu-signout:hover { background: #fceaea; color: #c0392b; }
.nav-menu-preview-exit {
    color: #8a5a00;
}
.nav-menu-preview-exit:hover { background: #fff7e6; color: #6a4500; }

/* --- Theme override: Purple / Ice --- */
/* Re-binds the --sbcss-* variables that sbcss-tool.css uses under the hood
   so every shared rule (.site-header gradient, .site-footer, h2 underline,
   .big-btn, etc.) picks up the new colors without needing to edit the
   shared file. Only CSETMath is affected — other tools keep SBCSS blue. */
:root {
    --sbcss-blue:      #5b6f8c;   /* Slate Blue — primary */
    --sbcss-blue-dark: #3d4f6b;   /* darker slate (gradient end / footer) */
    --sbcss-yellow:    #c08593;   /* Dusty Rose — accent (replaces the yellow slot) */
    --sbcss-bg:        #fbf8f3;   /* warm cream — page background */
    --sbcss-white:     #ffffff;   /* white — interior surfaces */
    --sbcss-card:      #ffffff;   /* white — standard cards (no card tint with this palette) */
    --sbcss-text:      #1f2937;
    --sbcss-muted:     #5a6877;
    --sbcss-border:    #d4d8de;   /* neutral border */
}

/* ---- Login page ---- */
.login-main {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: stretch;
    max-width: 720px;
    margin: 0 auto;
}

.login-card {
    background: var(--sbcss-white);
    border-radius: 10px;
    padding: 28px 26px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-top: 4px solid var(--sbcss-blue);
}

.login-card h2 {
    margin-top: 0;
}

.google-btn-wrap {
    margin: 18px 0 12px;
    display: flex;
    justify-content: center;
}

/* "or" divider between Google button and local-login section. */
.login-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 8px;
    color: var(--sbcss-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--sbcss-border);
}

/* Local-login section is a <details>/<summary> so it stays out of the way
   until needed — the Google flow is still the primary path. */
.local-login {
    margin: 4px 0 8px;
}
.local-login > summary {
    cursor: pointer;
    display: inline-block;
    padding: 8px 4px;
    font-size: 0.95rem;
    color: var(--sbcss-blue);
    list-style: none;
    user-select: none;
}
.local-login > summary::-webkit-details-marker { display: none; }
.local-login > summary:hover { text-decoration: underline; }
.local-login > summary::before {
    content: '+ ';
    font-weight: 700;
    margin-right: 2px;
}
.local-login[open] > summary::before {
    content: '\2212  '; /* en-dash style "minus" */
}

.local-login-form {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding: 14px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid var(--sbcss-border);
}
.local-login-form label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--sbcss-muted);
}
.local-login-form input {
    padding: 9px 11px;
    font-size: 1rem;
    border: 1px solid var(--sbcss-border);
    border-radius: 6px;
    background: var(--sbcss-white);
    font-family: inherit;
}
.local-login-form input:focus {
    outline: none;
    border-color: var(--sbcss-blue);
    box-shadow: 0 0 0 3px rgba(2, 106, 176, 0.18);
}
.local-login-btn {
    margin-top: 6px;
    padding: 10px 14px;
    background: var(--sbcss-blue);
    color: var(--sbcss-white);
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.local-login-btn:hover { background: var(--sbcss-blue-dark, #02497a); }
.local-login-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(2, 106, 176, 0.32);
}

.login-spinner {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sbcss-muted);
    font-size: 0.9rem;
}

.login-spinner[hidden] {
    display: none;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 3px solid #e8f0f7;
    border-top-color: var(--sbcss-blue);
    border-radius: 50%;
    animation: cset-spin 0.9s linear infinite;
}

@keyframes cset-spin {
    to { transform: rotate(360deg); }
}

.login-msg {
    color: #c0392b;
    font-size: 0.9rem;
    margin: 6px 0;
    min-height: 1em;
}

.login-note {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--sbcss-border);
    font-size: 0.82rem;
    color: var(--sbcss-muted);
}

.login-features {
    background: var(--sbcss-white);
    border-radius: 12px;
    padding: 28px 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-top: 4px solid var(--sbcss-yellow);
}

.login-features h3 {
    margin: 0 0 4px;
    font-size: 1.4rem;
    color: var(--sbcss-blue-dark, #163a5a);
}

.login-features-sub {
    margin: 0 0 4px;
    color: var(--sbcss-muted, #5b6776);
    font-size: 0.95rem;
}

/* Stat tiles row across the top of the features card. */
.login-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 18px 0 22px;
}

@media (max-width: 600px) {
    .login-stats { grid-template-columns: repeat(2, 1fr); }
}

.login-stat {
    background: linear-gradient(135deg, #f3f5f9 0%, #d8dde8 100%);
    border: 1px solid #b8bfc9;
    border-radius: 10px;
    padding: 14px 8px 12px;
    text-align: center;
}

.login-stat-accent {
    background: linear-gradient(135deg, #f7e8eb 0%, #f3dde0 100%);
    border-color: #c08593;
}

.login-stat-num {
    display: block;
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--sbcss-blue, #1f4e79);
    line-height: 1;
    letter-spacing: -0.02em;
}

.login-stat-accent .login-stat-num {
    color: #b07a00;
}

.login-stat-label {
    display: block;
    font-size: 0.74rem;
    color: var(--sbcss-muted, #5b6776);
    margin-top: 5px;
    line-height: 1.25;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

/* Checkmark feature list. Uses .login-features .login-features-list to win
 * specificity over any prior .login-features ul rules. */
.login-features .login-features-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.login-features .login-features-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 14px;
    line-height: 1.5;
    font-size: 0.96rem;
}

.login-features .login-features-list li:last-child {
    margin-bottom: 0;
}

.login-features-list .check {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--sbcss-blue, #1f4e79);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin-top: 1px;
}

/* ---- Dashboard ---- */
.dashboard-summary {
    background: var(--sbcss-white);
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-top: 4px solid var(--sbcss-blue);
    margin-bottom: 24px;
}

.dashboard-summary h2 {
    margin-top: 0;
}

.recent-list {
    padding-left: 1.2rem;
    margin: 0.5rem 0;
}

.recent-list li {
    margin-bottom: 6px;
    font-size: 0.92rem;
}

.muted {
    color: var(--sbcss-muted);
    font-size: 0.92rem;
}

.dashboard-domains {
    margin-top: 12px;
}

/* Domain section — heading + cards underneath, separated by a divider. */
.domain-section {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--sbcss-border, #d0bdf4);
}
.domain-section:first-of-type {
    margin-top: 12px;
    padding-top: 0;
    border-top: 0;
}

.domain-heading {
    margin: 0 0 10px;
    font-size: 1.05rem;
    color: var(--sbcss-blue, #1f4e79);
}

/* Each standard now gets its own card, laid out 2-up in a responsive grid. */
.standard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
@media (max-width: 720px) {
    .standard-grid { grid-template-columns: 1fr; }
}

.standard-card {
    background: var(--sbcss-card, #f7f4fb);
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-top: 4px solid var(--sbcss-yellow);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

.domain-code {
    color: var(--sbcss-muted);
    font-weight: 400;
    font-size: 0.88rem;
}

.standard-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}

.standard-list li {
    margin: 6px 0;
}

.standard-link {
    display: block;
    padding: 10px 12px;
    background: var(--sbcss-white);
    border: 1px solid var(--sbcss-border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--sbcss-text);
    font-weight: 700;
    transition: border-color 0.15s, background-color 0.15s;
}

.standard-link:hover,
.standard-link:focus {
    border-color: var(--sbcss-blue);
    background-color: #e8f1f9;
    text-decoration: underline;
}

.standard-code {
    font-weight: 700;
    color: var(--sbcss-blue);
    font-size: 0.85rem;
    margin-right: 6px;
}

.standard-name {
    font-size: 0.92rem;
}

.standard-card .skill-list {
    list-style: none;
    padding: 0;
    margin: 6px 0 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skill-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border: 1px solid var(--sbcss-border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--sbcss-text);
    background: var(--sbcss-white);
    font-size: 0.88rem;
    transition: border-color 0.15s, background-color 0.15s;
}

.skill-link:hover,
.skill-link:focus {
    border-color: var(--sbcss-blue);
    background-color: #eef2f7;
    text-decoration: underline;
}

.skill-name {
    flex: 1;
}

.skill-count {
    color: var(--sbcss-muted);
    font-size: 0.78rem;
    white-space: nowrap;
}

.skill-link-unlimited .skill-count {
    color: var(--sbcss-blue);
    font-weight: 600;
}

.skill-tag {
    margin: 4px 0 0;
    font-size: 0.95rem;
    color: var(--sbcss-blue-dark);
}

/* ---- Bundle + atomic sub-skills (one move at a time) ---- */
/* A "bundle" is a combined skill (e.g. "Add/subtract fractions"). Below it we
 * show the atomic moves a learner can drill on their own first. Visually the
 * bundle gets a subtle accent so it reads as a parent, and the atomics indent
 * beneath it with a connector line so the hierarchy is obvious. */
.skill-li-bundle {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.skill-link-bundle {
    border-color: var(--sbcss-blue);
    background: #f4f8fc;
    font-weight: 600;
}
.skill-link-bundle .bundle-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--sbcss-blue-dark);
    background: var(--sbcss-white);
    border: 1px solid var(--sbcss-blue);
    border-radius: 999px;
    text-transform: lowercase;
    letter-spacing: 0.02em;
}
.skill-sublist {
    list-style: none;
    padding: 0;
    margin: 4px 0 2px 18px;
    border-left: 2px solid var(--sbcss-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.skill-sublist li {
    padding-left: 10px;
    position: relative;
}
.skill-sublist li::before {
    /* tiny connector tick from the vertical rail to the child link */
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 8px;
    height: 0;
    border-top: 2px solid var(--sbcss-border);
}
.skill-link-atomic {
    font-size: 0.84rem;
    padding: 5px 9px;
    background: #fbfbfd;
}
.skill-link-atomic:hover,
.skill-link-atomic:focus {
    background: #eef2f7;
}

/* ---- Quiz page ---- */
.quiz-back-link {
    max-width: 1100px;
    margin: 4px auto 0;
    padding: 0 20px;
    font-size: 0.88rem;
}

.quiz-main {
    padding-top: 12px;
}

.quiz-back {
    margin-bottom: 12px;
}

.question-svg {
    margin: 14px 0 18px;
    text-align: center;
}
.question-svg svg {
    max-width: 100%;
    height: auto;
}

.quiz-intro h2 {
    margin-top: 0;
}

.empty-state {
    background: var(--sbcss-white);
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    text-align: center;
}

.scoreboard {
    display: flex;
    gap: 10px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.score-box {
    background: var(--sbcss-blue-dark);
    color: var(--sbcss-yellow);
    padding: 10px 16px;
    border-radius: 8px;
    min-width: 120px;
    text-align: center;
    border: 2px solid var(--sbcss-blue);
}

.score-label {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.85);
    font-weight: 600;
}

.score-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.quiz-stage {
    background: var(--sbcss-white);
    border-radius: 10px;
    padding: 24px 26px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-top: 4px solid var(--sbcss-yellow);
}

.quiz-question h3 {
    color: var(--sbcss-text);
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 0;
    line-height: 1.45;
}

.choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.choice-btn {
    background: var(--sbcss-bg);
    border: 2px solid var(--sbcss-border);
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    color: var(--sbcss-text);
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.choice-btn:hover:not(:disabled),
.choice-btn:focus-visible:not(:disabled) {
    background-color: #e3eff9;
    border-color: var(--sbcss-blue);
}

.choice-btn:disabled {
    cursor: default;
}

.choice-letter {
    font-weight: 700;
    color: var(--sbcss-blue);
    margin-right: 6px;
}

.choice-btn.correct {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
    font-weight: 600;
}

.choice-btn.correct .choice-letter {
    color: #155724;
}

.choice-btn.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.choice-btn.incorrect .choice-letter {
    color: #721c24;
}

.choice-btn.faded {
    opacity: 0.55;
}

.feedback {
    margin-top: 18px;
    padding: 14px 18px;
    border-radius: 8px;
    background: #faf6ee;
    border-left: 5px solid var(--sbcss-yellow);
}

.feedback.correct {
    background: #e8f7ec;
    border-left-color: #28a745;
}

.feedback.incorrect {
    background: #fdecee;
    border-left-color: #dc3545;
}

.feedback-headline {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--sbcss-blue-dark);
}

.feedback.correct .feedback-headline  { color: #1e7e34; }
.feedback.incorrect .feedback-headline { color: #a71d2a; }

.feedback-explanation {
    margin: 0 0 12px;
    line-height: 1.55;
}

/* Optional bonus line shown ~20% of the time after a correct answer.
 * Italic, slightly muted — clearly a reward, not the main feedback. */
.feedback-joke {
    margin: 0 0 14px;
    padding: 8px 12px;
    background: rgba(192, 133, 147, 0.08);
    border-left: 3px solid var(--sbcss-yellow, #c08593);
    font-style: italic;
    font-size: 0.92rem;
    color: var(--sbcss-text);
    border-radius: 4px;
    line-height: 1.5;
}
.feedback-joke[hidden] { display: none; }

.quiz-results {
    background: var(--sbcss-white);
    border-radius: 10px;
    padding: 24px 26px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border-top: 4px solid var(--sbcss-blue);
    text-align: center;
}

.quiz-results h2 {
    margin-top: 0;
}

.final-score {
    font-size: 1.25rem;
    margin: 1rem 0;
}

.final-score strong {
    color: var(--sbcss-blue);
    font-size: 1.6rem;
}

.result-actions {
    margin-top: 18px;
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================================
 * Diagnostic test additions
 * ============================================================ */

/* "I don't know" choice — visually softer than A–D so it doesn't compete. */
.choice-btn.choice-idk {
    background: #f5f5f5;
    border-style: dashed;
    color: #555;
    font-style: italic;
}
.choice-btn.choice-idk .choice-letter {
    color: #777;
}
.choice-btn.choice-idk:hover:not(:disabled),
.choice-btn.choice-idk:focus-visible:not(:disabled) {
    background-color: #ececec;
    border-color: #999;
}

/* Neutral feedback box when learner picks "I don't know". */
.feedback.dont-know {
    background: #eef2f7;
    border-left-color: #6b7785;
}
.feedback.dont-know .feedback-headline { color: #3b4c5d; }

/* "Take initial test" / "Retake" row inside each standard card. */
.diagnostic-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin: 6px 0 10px;
}
.diagnostic-cta {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    background: var(--sbcss-blue, #1f4e79);
    color: #fff !important;
    font-weight: 600;
    font-size: 0.92rem;
    text-decoration: none;
    border: 1px solid var(--sbcss-blue, #1f4e79);
}
.diagnostic-cta:hover { background: #163a5a; }
.diagnostic-cta-retake {
    background: transparent;
    color: var(--sbcss-blue, #1f4e79) !important;
}
.diagnostic-cta-retake:hover {
    background: #eef2f7;
}
.diagnostic-hint {
    font-size: 0.85rem;
}
.diagnostic-allgood {
    font-size: 0.9rem;
    color: #1e7e34;
    margin: 4px 0 12px;
}

/* "Looking strong! Retake to update your status" nudge.
 * Surfaces when the student has been practicing well since their last
 * diagnostic on this standard (3+ attempts at 75%+ average). */
.retake-nudge {
    background: #e8f7ec;
    border: 1px solid #28a745;
    border-left: 4px solid #28a745;
    border-radius: 6px;
    padding: 8px 12px;
    margin: 0 0 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #155724;
}
.retake-nudge strong { color: #1e7e34; }

/* When nudging, give the Retake button a touch more emphasis. */
.diagnostic-cta-nudge {
    background: #1e7e34 !important;
    color: #fff !important;
    border-color: #1e7e34 !important;
    box-shadow: 0 1px 4px rgba(30, 126, 52, 0.3);
}
.diagnostic-cta-nudge:hover { background: #166228 !important; }

/* "Areas to strengthen" panel below the standard's diagnostic CTA. */
.weak-skills-panel {
    background: #f7e8eb;
    border: 1px solid #c08593;
    border-radius: 8px;
    padding: 10px 14px;
    margin: 4px 0 12px;
}
.weak-skills-title {
    margin: 0 0 8px;
    font-size: 0.95rem;
    color: #7a4750;
}
.weak-skills-pills {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.weak-skill-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 1px solid #c08593;
    color: #7a4750;
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.88rem;
    text-decoration: none;
}
.weak-skill-pill:hover {
    background: #f3dde0;
    border-color: #a96e7e;
}
.weak-skill-score {
    font-size: 0.78rem;
    background: #c08593;
    color: #fff;
    padding: 1px 7px;
    border-radius: 999px;
}

/* Subtle decorations on the standard's normal skill list, when a diagnostic
 * has been taken — so weak/strong status is visible there too. */
.skill-link-weak {
    box-shadow: inset 4px 0 0 #ef4444;
}
.skill-link-partial {
    box-shadow: inset 4px 0 0 #f3d774;
}
.skill-link-strong {
    box-shadow: inset 4px 0 0 #22c55e;
}

/* Skill list collapsed under a <details> toggle so each standard card is
 * compact by default. Click "Practice individual skills" to reveal the list. */
.skill-list-toggle {
    margin-top: 8px;
}
.skill-list-toggle > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid var(--sbcss-border, #d0bdf4);
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--sbcss-blue, #1f4e79);
    background: #fff;
    user-select: none;
    transition: background-color 0.15s;
}
.skill-list-toggle > summary::-webkit-details-marker { display: none; }
.skill-list-toggle > summary:hover,
.skill-list-toggle > summary:focus-visible {
    background: #eef2f7;
}
.skill-list-toggle > summary::before {
    content: "▸";
    margin-right: 6px;
    transition: transform 0.15s;
}
.skill-list-toggle[open] > summary::before { transform: rotate(90deg); }
.skill-list-count {
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--sbcss-muted, #5b6776);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.skill-list-toggle .skill-list {
    margin-top: 8px;
}

/* Tighten internal spacing inside each standard card. */
.standard-card .diagnostic-row { margin: 0; }
.standard-card .weak-skills-panel { margin: 0; padding: 10px 12px; }
.standard-card .diagnostic-allgood { margin: 0; font-size: 0.85rem; }
.standard-card .diagnostic-hint { font-size: 0.78rem; }
.standard-card .standard-link { padding: 8px 10px; font-size: 0.95rem; }
.standard-card .skill-list-toggle { margin-top: 0; }

/* Diagnostic results page — per-skill report list. */
.skill-report {
    margin-top: 24px;
    text-align: left;
}
.skill-report-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 24px;
}
.skill-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 12px;
    margin: 4px 0;
    border-radius: 6px;
    background: #fafafa;
    border: 1px solid #eee;
}
.skill-row-needs_practice {
    background: #fdecee;
    border-color: #f5c2c7;
}
.skill-row-strong {
    background: #e8f7ec;
    border-color: #c3e6cb;
}
.skill-row .skill-name { font-weight: 600; flex: 1; }
.skill-row .skill-score { color: #555; font-size: 0.9rem; }
.skill-badge {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: #ddd;
    color: #333;
}
.skill-row-needs_practice .skill-badge { background: #dc3545; color: #fff; }
.skill-row-strong         .skill-badge { background: #28a745; color: #fff; }

.weak-skills-section {
    margin-top: 18px;
    padding: 12px 16px;
    background: #f7e8eb;
    border: 1px solid #c08593;
    border-radius: 8px;
}
.weak-skills-section h3 {
    margin: 0 0 6px;
    color: #7a4750;
}
.weak-skills-list {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
}
.weak-skills-list li { margin: 6px 0; }
.weak-skill-link {
    display: inline-block;
    background: #fff;
    color: #7a4750;
    border: 1px solid #c08593;
    border-radius: 6px;
    padding: 6px 12px;
    text-decoration: none;
    font-weight: 600;
}
.weak-skill-link:hover {
    background: #f3dde0;
    border-color: #a96e7e;
}

/* ============================================================
 * Progress page
 * ============================================================ */

.progress-heading-link {
    color: var(--sbcss-blue, #1f4e79);
    text-decoration: none;
}
.progress-heading-link:hover { text-decoration: underline; }

.progress-summary,
.progress-mastery,
.progress-breakdown,
.progress-activity {
    background: var(--sbcss-white, #fff);
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}
.progress-summary { border-top: 4px solid var(--sbcss-blue, #1f4e79); }
.progress-mastery { border-top: 4px solid #c08593; }
.progress-breakdown { border-top: 4px solid var(--sbcss-yellow, #c08593); }
.progress-activity { border-top: 4px solid #888; }

.progress-summary h2,
.progress-mastery h2,
.progress-breakdown h2,
.progress-activity h2 { margin: 0 0 6px; }

/* Top-line stat tiles. */
.progress-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 14px;
}
@media (max-width: 760px) {
    .progress-stats { grid-template-columns: repeat(2, 1fr); }
}
.progress-stat {
    background: linear-gradient(135deg, #f3f5f9 0%, #d8dde8 100%);
    border: 1px solid #b8bfc9;
    border-radius: 10px;
    padding: 14px 8px;
    text-align: center;
}
.progress-stat-num {
    display: block;
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--sbcss-blue, #1f4e79);
    line-height: 1;
}
.progress-stat-label {
    display: block;
    font-size: 0.74rem;
    color: var(--sbcss-muted, #5b6776);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.progress-stat.pct-strong .progress-stat-num { color: #1e7e34; }
.progress-stat.pct-ok     .progress-stat-num { color: #b07a00; }
.progress-stat.pct-weak   .progress-stat-num { color: #c0392b; }

/* Skill mastery bar (3 segments: strong / weak / unassessed). */
.mastery-bar {
    display: flex;
    height: 18px;
    border-radius: 9px;
    overflow: hidden;
    background: #eee;
    border: 1px solid #ddd;
    margin-top: 12px;
}
.mastery-seg { height: 100%; }
.mastery-strong   { background: #22c55e; }
.mastery-weak     { background: #ef4444; }
.mastery-unassess { background: #c8c8c8; }

.mastery-legend {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    font-size: 0.92rem;
}
.legend-dot {
    display: inline-block;
    width: 14px; height: 14px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}
.legend-strong {
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><polygon points='50,5 61,38 96,38 68,58 79,93 50,70 21,93 32,58 4,38 39,38' fill='%2322c55e' stroke='%2322c55e' stroke-width='4' stroke-linejoin='round'/></svg>") center/contain no-repeat;
    background-color: transparent;
    border-radius: 0;
}
.legend-weak {
    background: transparent;
    border: 2px solid #ef4444;
    box-sizing: border-box;
}
.legend-unassess { background: #c8c8c8; }

/* Per-domain block. */
.domain-block {
    border: 1px solid #e6e6e6;
    border-radius: 10px;
    padding: 16px 18px;
    margin-top: 14px;
    background: #fcfcfc;
}
.domain-block-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
}
.domain-block-header h3 { margin: 0; font-size: 1.15rem; }
.domain-block-stats { font-size: 0.92rem; }
.domain-stat-pct {
    font-weight: 700;
    font-size: 1.05rem;
    margin-right: 4px;
}

/* Color variants for percentage values. */
.pct-strong { color: #1e7e34; }
.pct-ok     { color: #b07a00; }
.pct-weak   { color: #c0392b; }
.pct-none   { color: #888; }

/* Slim progress bar for a domain. */
.prog-bar {
    background: #eee;
    border-radius: 4px;
    height: 6px;
    margin-top: 8px;
    overflow: hidden;
}
.prog-bar-fill { height: 100%; }
.prog-bar-fill.pct-strong { background: #28a745; }
.prog-bar-fill.pct-ok     { background: #facc15; }
.prog-bar-fill.pct-weak   { background: #dc3545; }

/* Standard block inside a domain. */
.standard-block {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed #e0e0e0;
}
.standard-block:first-of-type { border-top: 0; padding-top: 6px; }
.standard-block-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
}
.standard-block-header .standard-code {
    background: var(--sbcss-blue, #1f4e79);
    color: #fff;
    padding: 1px 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.82rem;
    margin-right: 6px;
}
.standard-block-header .standard-name { font-weight: 600; }
.standard-block-stats {
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* Small percent pill (used in standard headers and recent activity). */
.pct-pill {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: #eee;
    color: #333;
}
.pct-pill.pct-strong { background: #d4edda; color: #155724; }
.pct-pill.pct-ok     { background: #fff3cd; color: #856404; }
.pct-pill.pct-weak   { background: #f8d7da; color: #721c24; }

/* Per-skill list inside each standard block. */
.skill-progress-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
}
.skill-progress-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    border-top: 1px solid #f0f0f0;
    flex-wrap: wrap;
}
.skill-progress-row:first-child { border-top: 0; }

.diag-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}
/* Shape + color per status (movie-rating metaphor):
 *   strong   = full gold star        (perfect)
 *   partial  = half-filled gold star (passed, but not perfect)
 *   weak     = open red ring         (needs practice — outline only, no fill)
 *   unassess = dashed gray circle    (not yet assessed) */
.diag-dot-strong {
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><polygon points='50,5 61,38 96,38 68,58 79,93 50,70 21,93 32,58 4,38 39,38' fill='%2322c55e' stroke='%2322c55e' stroke-width='4' stroke-linejoin='round'/></svg>") center/contain no-repeat;
    background-color: transparent;
    border-radius: 0;
}
.diag-dot-partial {
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><polygon points='50,5 61,38 96,38 68,58 79,93 50,70 21,93 32,58 4,38 39,38' fill='none' stroke='%23ffd700' stroke-width='10' stroke-linejoin='round'/><polygon points='50,5 39,38 4,38 32,58 21,93 50,70' fill='%23ffd700'/></svg>") center/contain no-repeat;
    background-color: transparent;
    border-radius: 0;
}
.diag-dot-weak {
    background: transparent;
    border: 2px solid #ef4444;
    box-sizing: border-box;
}
.diag-dot-unassess { background: #c8c8c8; border: 1px dashed #999; box-sizing: border-box; }

.skill-progress-name { flex: 1; font-size: 0.94rem; }
.skill-progress-name a { color: var(--sbcss-text, #222); text-decoration: none; }
.skill-progress-name a:hover { text-decoration: underline; }

.skill-progress-stats {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.84rem;
    flex-wrap: wrap;
}
.micro-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    margin-right: 2px;
}
.micro-num { font-weight: 600; }

/* Recent activity timeline. */
.activity-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
}
.activity-row {
    display: grid;
    grid-template-columns: 130px 90px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 8px 0;
    border-top: 1px solid #f0f0f0;
    font-size: 0.92rem;
}
.activity-row:first-child { border-top: 0; }
@media (max-width: 720px) {
    .activity-row {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 12px 0;
    }
}
.activity-when { color: #666; font-size: 0.86rem; }
.activity-kind {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    text-align: center;
}
.kind-diagnostic { background: #e3f0fb; color: #1f4e79; }
.kind-practice   { background: #efefef; color: #555; }
.activity-score { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* "Show N more attempts" toggle. Uses native <details>/<summary> — no JS. */
.activity-more { margin-top: 10px; }
.activity-more > summary {
    cursor: pointer;
    list-style: none;
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid var(--sbcss-border, #d0bdf4);
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--sbcss-blue, #1f4e79);
    background: #fff;
    user-select: none;
    transition: background-color 0.15s;
}
.activity-more > summary::-webkit-details-marker { display: none; }
.activity-more > summary:hover,
.activity-more > summary:focus-visible {
    background: #eef2f7;
}
.activity-more > summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.15s;
}
.activity-more[open] > summary::before { transform: rotate(90deg); }
.activity-more[open] > summary { margin-bottom: 6px; }

/* Empty state inside main. */
.empty-state {
    background: #fff;
    border-radius: 10px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin: 24px 0;
}
.empty-state h2 { margin-top: 0; }

/* ============================================================
 * Instructor page + class-invitation surfaces
 * ============================================================ */

/* Generic status banner used by dashboard + instructor pages. */
.status-banner {
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 18px;
    font-size: 0.95rem;
    border: 1px solid;
}
.status-info    { background: #eef2f7; border-color: #c8d4ed; color: #3d4f6b; }
.status-success { background: #e8f7ec; border-color: #28a745; color: #155724; }
.status-error   { background: #fdecee; border-color: #dc3545; color: #721c24; }
.status-preview {
    background: #fff7e6;
    border-color: #f5c97e;
    color: #6a4500;
}
.status-preview a { color: #6a4500; font-weight: 600; margin-left: 8px; text-decoration: underline; }
.status-preview a:hover { color: #4a3000; }

/* "You've been invited…" panel on the student dashboard. */
.invitation-panel {
    background: #f7e8eb;
    border: 1px solid #c08593;
    border-left: 5px solid #c08593;
    border-radius: 8px;
    padding: 16px 22px;
    margin-bottom: 22px;
}
.invitation-panel h2 {
    margin: 0 0 4px;
    font-size: 1.15rem;
    color: #7a4750;
}
.invitation-panel p { margin: 0 0 10px; }
.invitation-list { list-style: none; padding: 0; margin: 6px 0 0; }
.invitation-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 0;
    border-top: 1px solid #e8c5cf;
}
.invitation-row:first-child { border-top: 0; padding-top: 0; }
.invitation-text strong { color: var(--sbcss-text); }
.invitation-actions { display: flex; gap: 8px; }
.invitation-actions .small-btn {
    padding: 6px 14px;
    font-size: 0.88rem;
}

/* Instructor page sections + roster table. */
.instructor-section {
    background: var(--sbcss-white, #fff);
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 24px;
}
.instructor-roster { border-top: 4px solid var(--sbcss-blue); }
.instructor-invite { border-top: 4px solid var(--sbcss-yellow); }
.instructor-pending { border-top: 4px solid #888; }
.instructor-section h2 { margin: 0 0 8px; }

.roster-table-wrap { overflow-x: auto; }
.roster-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}
.roster-table thead th {
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--sbcss-muted);
    padding: 8px 10px;
    border-bottom: 2px solid var(--sbcss-border);
}
.roster-table tbody td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.92rem;
    vertical-align: middle;
}
.roster-table tbody tr:hover { background: #f8fafc; }
.roster-table .diag-dot {
    display: inline-block;
    margin-right: 4px;
    vertical-align: middle;
}

/* Invite form on instructor page. */
.invite-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
    align-items: center;
}
.invite-form input[type="email"] {
    flex: 1;
    min-width: 220px;
    padding: 10px 12px;
    border: 1px solid var(--sbcss-border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}
.invite-form input[type="email"]:focus {
    outline: none;
    border-color: var(--sbcss-blue);
    box-shadow: 0 0 0 2px rgba(91, 111, 140, 0.2);
}

/* Pending invitations list on instructor page. */
.pending-list { list-style: none; padding: 0; margin: 8px 0 0; }
.pending-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 0;
    border-top: 1px solid #f0f0f0;
}
.pending-row:first-child { border-top: 0; }
.pending-email { font-weight: 600; flex: 1; }

.inline-form { display: inline; margin: 0; }
.small-btn { font-size: 0.85rem; padding: 5px 12px; }

/* Visually hidden — keeps the input label accessible to screen readers
 * without cluttering the visual layout. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
