/* ============================================================
   HINT SYSTEM — v2/challenge.html #ch-help-panel
   All rules scoped to body[data-v2-challenge] so they do not
   bleed into the lesson player or hub.
   ============================================================ */

/* ── PANE: HELP ─────────────────────────────────────────────── */
body[data-v2-challenge] #ch-help-panel {
    background: var(--bg);
}

/* overflow: hidden only needed for mobile absolute-position pane stack;
   .ch-pane already provides this at (0,1,0) — this rule locks it at
   (1,1,0) so no hint-system rule can accidentally override it on mobile. */
@media (max-width: 1023px) {
    body[data-v2-challenge] #ch-help-panel { overflow: hidden; }
}

/* ── STATE A — empty card (no hints revealed yet) ────────────── */
.ch-help-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    min-height: 0;
}

.ch-help-card {
    background: var(--hint-bg);
    border: 2px solid var(--hint-border);
    border-radius: var(--radius);
    padding: 28px 24px;
    max-width: 320px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: center;
}

.ch-help-prompt {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.55;
    color: var(--text);
}

.ch-help-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Primary: Review Lesson */
.ch-help-review-btn {
    height: 48px;          /* ≥44px tap target */
    min-height: 44px;
    padding: 0 18px;
    background: var(--primary);
    color: var(--text-inverse);
    border: none;
    border-bottom: 3px solid var(--primary-dark);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 800;
    transition: filter 0.15s, transform 0.1s, border-bottom-width 0.1s;
}

.ch-help-review-btn:hover  { filter: brightness(1.05); }
.ch-help-review-btn:active {
    transform: translateY(1px);
    border-bottom-width: 2px;
    filter: brightness(0.92);
}

/* Secondary: Show me a hint */
.ch-help-hint-btn {
    height: 48px;
    min-height: 44px;
    padding: 0 18px;
    background: transparent;
    color: var(--text);
    border: 2px solid var(--hint-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    transition: background 0.15s, border-color 0.15s;
}

.ch-help-hint-btn:hover {
    background: var(--hint-bg);
    border-color: var(--hint-border);
}

/* ── STATE B — scroll container with revealed hints ──────────── */
.ch-help-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 16px 16px 0;
    gap: 12px;
}

.ch-hints-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Individual hint card */
.ch-hint-item {
    background: var(--hint-item-bg);
    border: 1px solid var(--hint-item-border);
    border-left: 4px solid var(--hint-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.ch-hint-num {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hint-border);
    margin-bottom: 8px;
}

.chl-slide-content,
.help-hint__item,
.ch-hint-body {
    overflow-wrap: break-word;
    word-break: break-word;
}

.ch-hint-body {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text);
}

/* Inline code within rendered markdown hints */
.ch-hint-body code {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    padding: 1px 5px;
    font-family: var(--mono);
    font-size: 0.88em;
}

/* Fenced code blocks within rendered markdown hints */
.ch-hint-body pre {
    background: var(--hint-code-bg);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
    margin: 8px 0 0;
}

.ch-hint-body pre code {
    background: transparent;
    border: none;
    padding: 0;
    font-size: 13px;
    color: var(--hint-code-text);
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* ── Solution block (hint index 3) ───────────────────────────── */
/* Visually distinct via shape (thick striped top border + dark bg)
   so the warning does not rely on colour alone (deuteranopia-safe). */
.ch-hint-solution {
    background: var(--hint-solution-bg);
    border: 2px solid var(--hint-solution-border);
    border-radius: var(--radius-sm);
    /* Repeating diagonal stripe on top signals "answer" without colour */
    border-top: 6px solid var(--hint-solution-border);
    overflow: hidden;
}

.ch-hint-solution-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--hint-solution-label);
    padding: 10px 14px 4px;
}

.ch-hint-solution-code {
    display: block;
    font-family: var(--mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--hint-code-text);
    padding: 0 14px 14px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: 0;
}

/* ── Hint counter + next button footer ───────────────────────── */
.ch-hint-counter {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-align: center;
    padding: 8px 0;
    flex-shrink: 0;
}

.ch-hint-next-btn {
    display: block;
    width: calc(100% - 32px);
    margin: 4px 16px 16px;
    height: 48px;
    min-height: 44px;
    background: transparent;
    color: var(--text);
    border: 2px solid var(--hint-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
}

.ch-hint-next-btn:hover {
    background: var(--hint-bg);
}

/* "Show me the answer" step — visually distinct (shape + text signal) */
.ch-hint-answer-btn {
    background: var(--hint-bg);
    border-color: var(--hint-solution-border);
    color: var(--text);
    font-weight: 800;
    /* Dashed border signals elevated stakes without relying on colour */
    border-style: dashed;
}

.ch-hint-answer-btn:hover {
    background: var(--hint-bg);
    border-style: solid;
}

/* ── RESPONSIVE: narrow phones (≤ 320px) ────────────────────── */
@media (max-width: 320px) {
    .ch-help-card {
        padding: 20px 16px;
    }

    .ch-hint-next-btn {
        width: calc(100% - 24px);
        margin-left: 12px;
        margin-right: 12px;
    }
}
