/* Study progress, practice and review controls. Kept apart from style.css. */
.progress-detail, .progress-note {
    font-size: 0.9rem;
    text-align: center;
    margin: 0.2rem 0;
}

.progress-note:empty, .progress-detail:empty {
    display: none;
}

.topic-status {
    font-size: 0.85rem;
    margin-top: 0.4rem;
    opacity: 0.85;
}

.topic-status:empty {
    display: none;
}

.topic-status[data-state="reviewed"] {
    font-weight: bold;
}

.topic-progress-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1rem;
    width: 95%;
    align-self: center;
}

.topic-progress-actions .button {
    flex: 1 1 10rem;
}

.button[aria-pressed="true"], .button[data-active="true"] {
    background-color: var(--selected-bg);
    color: var(--selected-text);
    box-shadow: inset 0 0 0 0.15rem var(--accent);
}

.button:focus-visible, .collection:focus-visible, .topic:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.collection-progress {
    font-size: 0.85rem;
    margin-top: 0.4rem;
    opacity: 0.85;
}

.collection-resume {
    align-self: stretch;
    width: auto;
    margin-top: 0.4rem;
}

.study-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem;
    margin: 0.6rem 0 1rem;
}

#study-section[data-practicing] .study-browse {
    display: none !important;
}

.practice-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.practice-panel[hidden], .practice-card[hidden], .practice-answer-box[hidden], .practice-panel .button[hidden] {
    display: none;
}

.practice-panel h2 {
    color: var(--text);
    font-family: 'Source Sans 3', sans-serif;
    margin: 0.4rem 0;
    text-align: center;
}

.practice-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    border: 0.15rem var(--surface) solid;
    border-radius: 0.8rem;
    padding: 1rem;
}

.practice-topic, .practice-label {
    font-size: 0.9rem;
    font-weight: bold;
    opacity: 0.85;
}

.practice-question {
    font-size: 1.25rem;
    margin: 0;
    overflow-wrap: anywhere;
}

.practice-answer {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.practice-answer-box {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border-top: 0.15rem var(--surface) dashed;
    padding-top: 0.6rem;
}

.practice-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.practice-actions .button {
    flex: 1 1 9rem;
    min-height: 2.75rem;
}

#practice-reveal {
    align-self: stretch;
    width: auto;
    min-height: 2.75rem;
}

.practice-summary-list {
    margin: 0;
    padding-left: 1.2rem;
    color: var(--text);
    font-family: 'Source Sans 3', sans-serif;
}

.review-box {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 0.15rem var(--surface) solid;
    border-radius: 0.8rem;
    padding: 0.8rem;
    margin: 0.6rem 0 0;
    text-align: center;
}

.review-box p {
    margin: 0.4rem 0 0;
}

.study-actions .button[hidden] {
    display: none;
}

.collection-copy {
    align-self: stretch;
    width: auto;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    padding: 0.5rem;
}

.generation-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 0.8rem;
}

.generation-panel p {
    margin: 0.3rem 0;
}

.generation-confirm {
    width: 100%;
    border: 0.15rem var(--surface) solid;
    border-radius: 0.8rem;
    padding: 0.6rem;
}

.generation-confirm[hidden] {
    display: none;
}

#invalid-download[hidden], .draft-panel[hidden] {
    display: none;
}

.draft-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    border: 0.15rem var(--accent) solid;
    border-radius: 0.8rem;
    padding: 0.8rem;
    margin-bottom: 1.2rem;
}

.draft-panel h2 {
    color: var(--text);
    font-family: 'Source Sans 3', sans-serif;
    margin: 0;
}

.draft-preview p, .draft-preview li, .draft-preview summary {
    color: var(--text);
    font-family: 'Source Sans 3', sans-serif;
    overflow-wrap: anywhere;
}

.draft-preview summary {
    cursor: pointer;
    font-weight: bold;
}

.draft-name {
    font-weight: bold;
    font-size: 1.2rem;
}

.draft-content {
    white-space: pre-wrap;
}

.draft-topics {
    padding-left: 1.2rem;
}

.draft-panel .study-actions .button {
    flex: 1 1 9rem;
    text-align: center;
    text-decoration: none;
}
#refresh-balance[hidden], #draft-edit[hidden] { display: none; }

.collection-offline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.collection-offline-status {
    display: block;
    flex: 1 1 100%;
    font-size: 0.8rem;
    opacity: 0.85;
}

.collection-offline .button {
    flex: 1 1 auto;
    font-size: 0.8rem;
    padding: 0.5rem;
}

.collection-offline .button[hidden] {
    display: none;
}

.offline-banner {
    width: min(40rem, 92vw);
    margin: 0.6rem auto;
    padding: 0.6rem 0.8rem;
    border: 0.15rem solid var(--accent);
    border-radius: 0.8rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text);
}

.offline-banner[hidden] {
    display: none;
}

/* Collection and topic tiles are buttons; keep their original look. */
.collection-open, button.topic {
    font: inherit;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.collection-open {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
}

button.topic span {
    pointer-events: none;
}

.collection-open:focus-visible, #collection-title:focus-visible, #topic-view:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 0.4rem;
}

#collection-title:focus:not(:focus-visible), #topic-view:focus:not(:focus-visible) {
    outline: none;
}

.topic[aria-current="true"] {
    border-color: var(--accent);
}

/* Math notation (KaTeX, see math.js). Wide display formulas scroll instead of widening the page. */
.math-display {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
}

.math-display .katex-display {
    margin: 0.6em 0;
}

/* The global span rule (fonts, 1rem size, transitions) must not reach KaTeX's own spans. */
.katex span {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    transition: none;
}

.ai-button[hidden], #explain-panel[hidden] { display: none; }
