/* Debug section. Colours from theme.css. */

kbd {
    font: 600 11px ui-monospace, Consolas, monospace; padding: 1px 5px; margin-left: 4px;
    border: 1px solid rgba(20, 34, 47, .4); border-bottom-width: 2px; border-radius: 4px;
}
.difficulty { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.difficulty.d1 { background: rgba(143, 214, 148, .16); color: var(--ok); }
.difficulty.d2 { background: rgba(255, 212, 59, .16); color: var(--py-yellow-light); }
.difficulty.d3 { background: rgba(255, 143, 143, .16); color: var(--error); }

/* --- Index ----------------------------------------------------------------- */
.debug-sections { display: grid; gap: 22px; }
.debug-section { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.debug-section-head {
    display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 16px 18px;
    border-bottom: 1px solid var(--border); border-left: 5px solid var(--py-yellow);
}
.debug-section-icon { font-size: 34px; line-height: 1; }
.debug-section-head h2 { margin: 0; font-size: 20px; color: #fff; }
.debug-section-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; max-width: 70ch; }
.debug-section-progress { margin-left: auto; min-width: 160px; font-size: 13px; color: var(--muted); }
.debug-section-progress .meter { margin-top: 6px; }
.meter { height: 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--py-blue); }
.problem-list {
    list-style: none; margin: 0; padding: 6px; display: grid; gap: 4px;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.topic-title {
    margin: 0; padding: 12px 18px 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--py-yellow-light);
}
.topic-title span { color: var(--muted); font-weight: 400; margin-left: 6px; }
.topic-title + .problem-list { padding-top: 2px; }
.expected-output {
    margin: 0; padding: 10px 12px; background: var(--panel-2); border-radius: 6px; overflow-x: auto;
    border-left: 3px solid var(--py-blue); font: 13px/1.5 ui-monospace, Consolas, monospace; color: var(--text);
    tab-size: 8;
}
.brief-note { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.problem-row {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
    color: var(--text); text-decoration: none; border: 1px solid transparent;
}
.problem-row:hover { background: var(--raised); border-color: var(--control-border); }
.problem-status {
    width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; flex: none;
    border: 2px solid var(--control-border); font-size: 12px; font-weight: 800;
}
.problem-row.solved .problem-status { background: var(--ok); border-color: var(--ok); color: var(--on-yellow); }
.problem-row.started .problem-status { border-color: var(--py-yellow); color: var(--py-yellow); }
.problem-title { flex: 1; min-width: 0; }

/* --- Problem page -------------------------------------------------------------------- */
.debug-main { padding: 0; }
.debug-layout {
    display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(300px, 380px);
    height: calc(100vh - 57px); min-height: 520px;
}
.debug-brief { overflow: auto; padding: 16px 18px 24px; background: var(--panel); border-right: 1px solid var(--border); }
.crumbs { font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--link); }
.debug-brief h1 { margin: 6px 0 8px; font-size: 22px; color: #fff; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.badges .tag { font-size: 11px; background: rgba(75, 139, 190, .22); color: #cfe0ef; border-radius: 999px; padding: 2px 9px; }
.badge-solved { font-size: 11px; font-weight: 800; background: var(--ok); color: var(--on-yellow); border-radius: 999px; padding: 2px 9px; }
.brief-text { line-height: 1.55; margin: 0 0 14px; }
.brief-block { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.brief-block h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 8px; }
.test-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.test-list li { display: flex; gap: 8px; }
.test-icon { width: 16px; text-align: center; color: var(--muted); }
.test-list li.pass .test-icon { color: var(--ok); }
.test-list li.fail .test-icon { color: var(--error); }
.hint-list { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 6px; color: var(--py-yellow-light); }
.answer-code {
    margin: 0 0 10px; padding: 10px 12px; background: var(--panel-2); border-radius: 6px; overflow-x: auto;
    border-left: 3px solid var(--ok); font: 13px/1.5 ui-monospace, Consolas, monospace; color: var(--text);
}
.reveal-confirm, .inline-confirm { font-size: 13px; color: var(--muted); }
.reveal-actions { display: flex; gap: 8px; margin-top: 8px; }
.inline-confirm { display: inline-flex; gap: 8px; align-items: center; }
.notice.small { font-size: 13px; margin-top: 16px; }

.debug-code { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.debug-toolbar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 8px 12px;
    background: var(--panel); border-bottom: 1px solid var(--border);
}
.debug-toolbar .status { margin-left: auto; font-size: 13px; color: var(--muted); }
.status[data-kind="busy"] { color: var(--warn); }
.status[data-kind="running"] { color: var(--ok); font-weight: 600; }
.debug-editor { flex: 1; min-height: 0; }

.debug-results {
    position: relative; overflow: auto; padding: 14px 16px 20px; background: var(--panel);
    border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px;
}
.summary { padding: 12px 14px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); font-weight: 600; }
.summary.good { border-color: var(--ok); color: var(--ok); background: rgba(143, 214, 148, .08); }
.summary.bad { border-color: var(--error); color: #ffd0d0; background: rgba(255, 143, 143, .07); }
.error-box { border-left: 3px solid var(--error); background: rgba(255, 143, 143, .08); border-radius: 6px; padding: 8px 10px; }
.error-box pre { margin: 0; white-space: pre-wrap; word-break: break-word; color: #ffd0d0; font: 13px/1.45 ui-monospace, Consolas, monospace; }
.error-goto {
    background: none; border: 0; padding: 0 0 6px; color: var(--py-yellow-light); text-decoration: underline;
    cursor: pointer; font: inherit; font-size: 13px;
}
.results-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.results-list li { padding: 8px 10px; border-radius: 6px; background: var(--panel-2); display: grid; grid-template-columns: 20px 1fr; gap: 4px 8px; }
.result-icon { font-weight: 800; }
.results-list li.pass .result-icon { color: var(--ok); }
.results-list li.fail .result-icon { color: var(--error); }
.result-message {
    grid-column: 2; margin: 0; white-space: pre-wrap; word-break: break-word; color: var(--muted);
    font: 12px/1.45 ui-monospace, Consolas, monospace;
}
.next-box { display: flex; gap: 10px; flex-wrap: wrap; }
.results-sub { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 8px 0 0; }
.output {
    margin: 0; min-height: 60px; padding: 8px 10px; background: var(--panel-2); border-radius: 6px;
    white-space: pre-wrap; word-break: break-word; font: 13px/1.45 ui-monospace, Consolas, monospace;
}
/* Players must stay in the visible area (browsers pause hidden iframes), so
   they fill the results panel underneath everything, fully transparent. */
.debug-stage { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.debug-stage .player-frame { opacity: 0 !important; pointer-events: none !important; }

@media (max-width: 1000px) {
    .debug-layout { grid-template-columns: 1fr; height: auto; }
    .debug-brief { border-right: 0; border-bottom: 1px solid var(--border); }
    .debug-code { height: 60vh; }
    .debug-results { border-left: 0; }
}
