/* CodeBhavya — Advanced Data Structures */
.ads-page {
    background: #f4f7fb;
    color: #0f172a;
}

/* ================================================================
   LEVEL 20 — ADVANCED GRAPH ALGORITHMS
   ================================================================ */

.graphs-page .graph-controls,
.graphs-page .graph-tracer-loader {
    display: grid;
    grid-template-columns: minmax(300px, 2.2fr) 100px 100px minmax(210px, 1fr) auto;
    gap: 14px;
    align-items: end;
    margin: 22px 0 16px;
}

.graphs-page .graph-controls label,
.graphs-page .graph-tracer-loader label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
    color: #173967;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.graphs-page .graph-controls input,
.graphs-page .graph-controls select,
.graphs-page .graph-tracer-loader input,
.graphs-page .graph-tracer-loader select {
    width: 100%;
    min-width: 0;
    height: 58px;
    padding: 0 15px;
    border: 1px solid #c9d9ec;
    border-radius: 12px;
    background: #ffffff;
    color: #0c2f63;
    font: 700 15px/1.2 inherit;
    box-sizing: border-box;
}

.graphs-page .graph-controls input:focus,
.graphs-page .graph-controls select:focus,
.graphs-page .graph-tracer-loader input:focus,
.graphs-page .graph-tracer-loader select:focus {
    border-color: #2563eb;
    outline: 3px solid rgba(37, 99, 235, 0.13);
}

.graphs-page .graph-controls .primary-button,
.graphs-page .graph-tracer-loader .primary-button {
    min-width: 190px;
    height: 58px;
    padding: 0 22px;
    border: 0;
    border-radius: 12px;
    background: #2563eb;
    color: #ffffff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 9px 20px rgba(37, 99, 235, 0.2);
}

.graphs-page .graph-visualizer-result,
.graphs-page .graph-tracer-result {
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid #cbdced;
    border-radius: 15px;
    background: #ffffff;
}

.graphs-page .graph-viz-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(300px, 0.7fr);
    gap: 16px;
    padding: 16px;
    background: #f8fbff;
}

.graphs-page .graph-canvas-panel,
.graphs-page .graph-stat-panel {
    min-width: 0;
    padding: 14px;
    border: 1px solid #cbdced;
    border-radius: 14px;
    background: #ffffff;
}

.graphs-page .graph-canvas-panel > h3,
.graphs-page .graph-stat-panel > h3 {
    margin: 0 0 13px;
    color: #0b3b75;
    font-size: 19px;
}

.graphs-page .graph-svg-wrap,
.graphs-page .graph-trace-svg-wrap {
    overflow: auto;
    border: 1px solid #c8d9ed;
    border-radius: 13px;
    background-color: #fbfdff;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px);
    background-size: 30px 30px;
}

.graphs-page #graphSvg {
    display: block;
    width: 100%;
    min-width: 650px;
    height: 430px;
}

.graphs-page #graphTraceSvg {
    display: block;
    width: 100%;
    min-width: 430px;
    height: 330px;
}

.graphs-page .graph-edge {
    stroke: #8ba3c3;
    stroke-width: 3;
    transition: stroke 0.2s, stroke-width 0.2s;
}

.graphs-page .graph-edge.is-selected {
    stroke: #16a34a;
    stroke-width: 5;
}

.graphs-page .graph-edge.is-rejected {
    stroke: #ef4444;
    stroke-dasharray: 8 6;
    opacity: 0.5;
}

.graphs-page .graph-edge.is-active {
    stroke: #f59e0b;
    stroke-width: 6;
}

.graphs-page .graph-arrow-head { fill: #617a9c; }

.graphs-page .graph-edge-label {
    paint-order: stroke;
    stroke: #ffffff;
    stroke-width: 6px;
    fill: #173967;
    font-size: 14px;
    font-weight: 900;
    text-anchor: middle;
}

.graphs-page .graph-node circle {
    fill: #ffffff;
    stroke: #17457b;
    stroke-width: 3;
}

.graphs-page .graph-node.is-frontier circle {
    fill: #dbeafe;
    stroke: #2563eb;
}

.graphs-page .graph-node.is-settled circle {
    fill: #dcfce7;
    stroke: #16a34a;
}

.graphs-page .graph-node.is-active circle {
    fill: #fef3c7;
    stroke: #f59e0b;
    stroke-width: 5;
}

.graphs-page .graph-node-label {
    fill: #082f63;
    font-size: 17px;
    font-weight: 900;
    text-anchor: middle;
}

.graphs-page .graph-stat-grid,
.graphs-page .graph-trace-variables {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
}

.graphs-page .graph-stat-grid > div,
.graphs-page .graph-trace-variables > div {
    min-width: 0;
    min-height: 82px;
    padding: 14px;
    border: 1px solid #cfdded;
    border-radius: 12px;
    background: #ffffff;
    box-sizing: border-box;
}

.graphs-page .graph-stat-grid span,
.graphs-page .graph-trace-variables span,
.graphs-page .graph-tracer-output span {
    display: block;
    margin-bottom: 8px;
    color: #60718a;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.graphs-page .graph-stat-grid strong,
.graphs-page .graph-trace-variables strong {
    color: #093a75;
    font-size: 16px;
    overflow-wrap: anywhere;
}

.graphs-page .graph-state-table {
    margin-top: 13px;
    overflow: auto;
    max-height: 245px;
    border: 1px solid #d3e0ef;
    border-radius: 11px;
    background: #ffffff;
}

.graphs-page .graph-value-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
    gap: 8px;
    padding: 10px;
}

.graphs-page .graph-value-grid > div {
    padding: 9px;
    border-radius: 9px;
    background: #eff6ff;
    text-align: center;
}

.graphs-page .graph-value-grid span,
.graphs-page .graph-value-grid strong { display: block; }
.graphs-page .graph-value-grid span { color: #64748b; font-size: 12px; font-weight: 800; }
.graphs-page .graph-value-grid strong { margin-top: 4px; color: #0b3b75; }

.graphs-page .graph-state-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: center;
}

.graphs-page .graph-state-table th,
.graphs-page .graph-state-table td {
    padding: 7px;
    border: 1px solid #d8e3ef;
}

.graphs-page .graph-state-table th { background: #eaf3ff; color: #113e72; }

.graphs-page .graph-control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-top: 1px solid #d5e1ee;
    background: #ffffff;
}

.graphs-page .graph-control-row button {
    min-width: 120px;
    min-height: 48px;
    padding: 10px 18px;
    border: 1px solid #b8cbe2;
    border-radius: 11px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
}

.graphs-page .graph-control-row button:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.graphs-page .graph-control-row button:nth-child(1),
.graphs-page .graph-control-row button:nth-child(5) { background: #667a96; }
.graphs-page .graph-control-row button:nth-child(2) { background: #2563eb; }
.graphs-page .graph-control-row button:nth-child(3) { background: #16a34a; }
.graphs-page .graph-control-row button:nth-child(4) { background: #f57c00; }

.graphs-page .graph-control-row > span {
    margin-left: auto;
    padding: 11px 16px;
    border-radius: 999px;
    background: #eaf3ff;
    color: #113e72;
    font-weight: 900;
}

.graphs-page #graphTraceResult > #graphTraceTitle {
    margin: 0;
    padding: 15px 18px;
    border-bottom: 1px solid #334155;
    background: #102a51;
    color: #f6d76b;
    font-size: 14px;
    letter-spacing: 0.08em;
}

.graphs-page .graph-tracer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.75fr);
    align-items: stretch;
}

.graphs-page .graph-tracer-code-panel {
    min-width: 0;
    padding: 16px;
    border-right: 1px solid #334155;
    background: #0f172a;
}

.graphs-page .graph-tracer-code-panel > h4 {
    margin: 0 0 11px;
    color: #ffffff;
    font-size: 15px;
}

.graphs-page #graphTraceCodeWindow {
    overflow: auto;
    height: 610px;
    min-height: 610px;
    max-height: 610px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #020617;
    color: #e2e8f0;
    scrollbar-color: #64748b #111c2f;
    scrollbar-width: thin;
    scroll-behavior: auto;
}

.graphs-page #graphTraceCodeWindow::-webkit-scrollbar { width: 10px; height: 10px; }
.graphs-page #graphTraceCodeWindow::-webkit-scrollbar-track { background: #111c2f; }
.graphs-page #graphTraceCodeWindow::-webkit-scrollbar-thumb { border: 2px solid #111c2f; border-radius: 999px; background: #64748b; }

.graphs-page #graphTraceCode {
    display: block;
    width: max-content;
    min-width: 100%;
    min-height: 100%;
    padding: 12px 8px;
    background: #020617;
    color: #e2e8f0;
    font: 13px/1.65 Consolas, Monaco, "Courier New", monospace;
    white-space: pre;
    box-sizing: border-box;
}

.graphs-page #graphTraceCode > span {
    display: block;
    min-height: 21px;
    padding: 0 10px;
    border-left: 4px solid transparent;
    color: inherit;
}

.graphs-page #graphTraceCode > span.is-active-line {
    border-left-color: #f6d76b;
    border-radius: 4px;
    background: #25466f;
    color: #ffffff;
}

.graphs-page .graph-tracer-side {
    display: flex;
    min-width: 0;
    max-height: 675px;
    padding: 16px;
    flex-direction: column;
    gap: 12px;
    overflow: auto;
    background: #f8fafc;
}

.graphs-page .graph-tracer-side .ads-explorer-message { margin: 0; }
.graphs-page .graph-trace-svg-wrap { min-height: 330px; }

.graphs-page .graph-tracer-output {
    padding: 14px;
    border: 1px solid #a7efc4;
    border-radius: 12px;
    background: #ecfdf5;
}

.graphs-page .graph-tracer-output strong {
    color: #06683c;
    font-size: 16px;
    overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
    .graphs-page .graph-controls,
    .graphs-page .graph-tracer-loader {
        grid-template-columns: minmax(280px, 2fr) 90px 90px minmax(190px, 1fr);
    }
    .graphs-page .graph-controls .primary-button,
    .graphs-page .graph-tracer-loader .primary-button { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 900px) {
    .graphs-page .graph-viz-layout,
    .graphs-page .graph-tracer-layout { grid-template-columns: 1fr; }
    .graphs-page .graph-tracer-code-panel { border-right: 0; border-bottom: 1px solid #334155; }
    .graphs-page .graph-tracer-side { max-height: none; }
}

@media (max-width: 720px) {
    .graphs-page .graph-controls,
    .graphs-page .graph-tracer-loader { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .graphs-page .graph-controls label:first-child,
    .graphs-page .graph-tracer-loader label:first-child,
    .graphs-page .graph-controls label:nth-child(4),
    .graphs-page .graph-tracer-loader label:nth-child(4) { grid-column: 1 / -1; }
    .graphs-page .graph-stat-grid,
    .graphs-page .graph-trace-variables { grid-template-columns: 1fr; }
    .graphs-page #graphTraceCodeWindow { height: 430px; min-height: 430px; max-height: 430px; }
}

@media (max-width: 520px) {
    .graphs-page .graph-controls,
    .graphs-page .graph-tracer-loader { grid-template-columns: 1fr; }
    .graphs-page .graph-controls label,
    .graphs-page .graph-tracer-loader label { grid-column: auto !important; }
    .graphs-page .graph-control-row button { min-width: 0; flex: 1 1 calc(50% - 8px); }
    .graphs-page .graph-control-row > span { width: 100%; margin-left: 0; text-align: center; }
}

.ads-page .main-content {
    width: min(100%, 1320px);
    max-width: 1320px;
    padding: 34px;
}

.ads-page .subject-hero {
    position: relative;
    overflow: hidden;
    padding: 42px 38px;
    border: 1px solid #244972;
    border-radius: 18px;
    background: linear-gradient(120deg, #0d203a 0%, #173c6b 100%);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
}

.ads-page .subject-hero::after {
    content: "";
    position: absolute;
    top: -68px;
    right: -42px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.15);
}

.ads-page .subject-hero .subject-label,
.ads-page .subject-hero .page-title,
.ads-page .subject-hero .page-description {
    position: relative;
    z-index: 1;
}

.ads-page .subject-hero .subject-label { color: #f6d76b; }
.ads-page .subject-hero .page-title { color: #ffffff; }
.ads-page .subject-hero .page-description {
    max-width: 850px;
    color: #dbeafe;
}

.ads-prerequisite-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    margin-top: 28px;
    border-left: 5px solid #d4af37;
}

.ads-prerequisite-card > div { max-width: 830px; }
.ads-prerequisite-card h2 { margin: 8px 0 10px; }
.ads-prerequisite-card p { margin: 0; }
.ads-prerequisite-card .secondary-button { flex-shrink: 0; }

.ads-course-map-section,
.ads-level-section { margin-top: 34px; }

.ads-course-map {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-top: 22px;
}

.ads-course-map-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 24px;
    border: 1px solid #d8e3ef;
    border-top: 4px solid #2563eb;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.07);
}

.ads-course-map-card.part-one { border-top-color: #2563eb; }
.ads-course-map-card.part-two { border-top-color: #7c3aed; }
.ads-course-map-card.part-three { border-top-color: #d4af37; }

.ads-course-map-number {
    margin-bottom: 8px;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.1px;
}

.ads-course-map-card h3 {
    margin: 0 0 10px;
    color: #0f172a;
    font-size: 20px;
}

.ads-course-map-card p {
    margin: 0 0 14px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.65;
}

.ads-course-map-card ul {
    margin: 0 0 18px;
    padding-left: 19px;
    color: #334155;
    font-size: 13px;
    line-height: 1.55;
}

.ads-course-map-card li { margin: 5px 0; }

.ads-course-map-card > span:last-child {
    align-self: flex-start;
    margin-top: auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}

.ads-index-page .topic-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
}

.ads-index-page .topic-card {
    min-height: 395px;
    padding: 23px;
    border-top: 4px solid #2563eb;
}

.ads-level-section[data-part="part-2"] .topic-card { border-top-color: #7c3aed; }
.ads-level-section[data-part="part-3"] .topic-card { border-top-color: #d4af37; }

.ads-index-page .topic-card.coming-soon:hover {
    transform: none;
    border-color: #d8e3ef;
    border-top-color: #2563eb;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.ads-level-section[data-part="part-2"] .topic-card.coming-soon:hover { border-top-color: #7c3aed; }
.ads-level-section[data-part="part-3"] .topic-card.coming-soon:hover { border-top-color: #d4af37; }
.ads-index-page .topic-card > p { margin-bottom: 14px; }

.ads-index-page .topic-subtopics-title {
    margin-bottom: 6px;
    color: #9a7416;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.85px;
    text-transform: uppercase;
}

.ads-index-page .topic-subtopics {
    margin: 0 0 18px;
    padding-left: 19px;
    color: #334155;
    font-size: 13px;
    line-height: 1.55;
}

.ads-index-page .topic-subtopics li { margin: 5px 0; }

.ads-index-page .topic-status {
    align-self: flex-start;
    margin-top: auto;
    padding: 7px 11px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
}

.ads-page .sidebar .sidebar-title { margin-top: 18px; }
.ads-page .sidebar .sidebar-title:first-child { margin-top: 0; }
.ads-page .sidebar .ads-topic-link.is-unavailable {
    pointer-events: none;
    color: #94a3b8;
}

.ads-page .sidebar .ads-topic-link.is-available {
    color: #1d4ed8;
    font-weight: 700;
}

.ads-index-page .topic-card.available-topic {
    border-top-color: #d4af37;
}

.ads-index-page .topic-title-link {
    color: inherit;
    text-decoration: none;
}

.ads-index-page .topic-title-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.ads-no-results {
    margin-top: 24px;
    padding: 18px;
    border: 1px solid #f3d68a;
    border-radius: 12px;
    background: #fffbeb;
    color: #854d0e;
    font-weight: 700;
    text-align: center;
}

.footer-note {
    display: block;
    max-width: 220px;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.6;
}

/* Mathematics-style CodeBhavya footer for ADS pages */
.ads-page .footer,
.ads-page .site-footer {
    width: 100%;
    margin-top: 0;
    padding: 40px 30px 0;
    box-sizing: border-box;
    background: #08131f;
    color: #ffffff;
}

.ads-page .footer-container {
    display: grid;
    grid-template-columns: 2fr 1fr 1.2fr 1fr;
    gap: 35px;
    width: 100%;
    max-width: 1150px;
    margin: 0 auto;
    padding-bottom: 30px;
}

.ads-page .footer-brand-section { text-align: left; }

.ads-page .footer-brand {
    margin-bottom: 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
    font-weight: 700;
}

.ads-page .footer-code { color: #b8d8f0 !important; }

.ads-page .footer-bhavya {
    background: linear-gradient(90deg, #d4af37, #f5d76e, #d4af37);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.ads-page .footer-tagline {
    margin: 0 0 12px;
    color: #cbd5e1;
    font-size: 15px;
}

.ads-page .footer-description {
    max-width: 300px;
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.7;
}

.ads-page .footer-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.ads-page .footer-column h3 {
    margin: 0 0 16px;
    color: #ffffff;
    font-size: 16px;
}

.ads-page .footer-column a {
    margin-bottom: 10px;
    color: #94a3b8;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.ads-page .footer-column a:hover { color: #b8d8f0; }

.ads-page .footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    max-width: 1150px;
    margin: 0 auto;
    padding: 14px 0 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ads-page .footer-bottom p {
    margin: 0;
    color: #94a3b8;
    font-size: 13px;
}

@media (max-width: 900px) {
    .ads-page .footer-container { grid-template-columns: 1fr 1fr; }
    .ads-page .footer-brand-section { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
    .ads-page .footer,
    .ads-page .site-footer { padding: 40px 20px 0; }
    .ads-page .footer-container { grid-template-columns: 1fr; gap: 28px; }
    .ads-page .footer-brand-section { grid-column: auto; }
    .ads-page .footer-bottom { flex-direction: column; text-align: center; }
}

@media (max-width: 1180px) {
    .ads-course-map,
    .ads-index-page .topic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 800px) {
    .ads-page .main-content { padding: 24px 18px; }
    .ads-prerequisite-card {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* =========================================
   LEVELS 14–15 — VERIFIED INTERACTIVE FIXES
   ========================================= */

.balanced-controls,
.balanced-tracer-loader {
    grid-template-columns: minmax(240px, 1.7fr) minmax(120px, 0.55fr) minmax(180px, 0.8fr) minmax(150px, 0.7fr) auto;
}

.balanced-algorithm-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.balanced-algorithm-grid .ads-algorithm-box {
    margin: 0;
    border-top: 4px solid #2563eb;
    background: linear-gradient(180deg, #f8fbff, #ffffff);
}

.balanced-algorithm-grid .ads-algorithm-box:nth-child(2) {
    border-top-color: #7c3aed;
    background: linear-gradient(180deg, #faf7ff, #ffffff);
}

.balanced-algorithm-grid .ads-algorithm-box:nth-child(3) {
    border-top-color: #d4a514;
    background: linear-gradient(180deg, #fffbeb, #ffffff);
}

.balanced-algorithm-grid h3 { margin-top: 0; color: #123f78; }
.balanced-algorithm-grid ol { margin-bottom: 0; padding-left: 23px; }
.balanced-algorithm-grid li { margin: 8px 0; line-height: 1.55; }

.digital-search-page .ads-lesson-section {
    padding: 28px 30px;
    border: 1px solid #d5e1ee;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 42, 81, 0.055);
}

.digital-search-page .ads-section-heading {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e2eaf3;
}

.digital-search-page .ads-section-heading h2 { margin: 8px 0 0; color: #123f78; }

.digital-search-page .ads-rule-grid > article,
.digital-search-page .ads-comparison-grid > article,
.digital-search-page .ads-interview-grid > article {
    min-width: 0;
    padding: 18px;
    border: 1px solid #d5e1ee;
    border-left: 5px solid #60a5fa;
    border-radius: 12px;
    background: #f8fbff;
}

.digital-search-page .ads-rule-grid > article:nth-child(even),
.digital-search-page .ads-comparison-grid > article:nth-child(even),
.digital-search-page .ads-interview-grid > article:nth-child(even) {
    border-left-color: #8b5cf6;
    background: #faf7ff;
}

.digital-search-page .ads-algorithm-box {
    padding: 20px 22px;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #2563eb;
    border-radius: 12px;
    background: #f8fbff;
}

.digital-search-page .ads-program-details {
    overflow: hidden;
    border: 1px solid #cbd9e8;
    border-radius: 12px;
    background: #ffffff;
}

.digital-search-page .ads-program-details summary {
    padding: 16px 18px;
    background: #eff6ff;
    color: #123f78;
}

.digital-search-page .ads-data-table { width: 100%; border-collapse: collapse; }
.digital-search-page .ads-data-table th { background: #173f73; color: #ffffff; }
.digital-search-page .ads-data-table th,
.digital-search-page .ads-data-table td { padding: 13px 14px; border: 1px solid #d8e3ef; text-align: left; }
.digital-search-page .ads-data-table tbody tr:nth-child(even) { background: #f8fafc; }
.digital-search-page [hidden] { display: none !important; }

@media (max-width: 1180px) {
    .balanced-controls,
    .balanced-tracer-loader { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .balanced-controls .primary-button,
    .balanced-tracer-loader .primary-button { width: 100%; }
}

@media (max-width: 900px) {
    .balanced-algorithm-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
    .balanced-controls,
    .balanced-tracer-loader { grid-template-columns: 1fr; }
    .digital-search-page .ads-lesson-section { padding: 20px 16px; }
}

/* =========================================
   LEVEL 19 — FILES AND FILE ORGANIZATION
   ========================================= */

.files-page .ads-lesson-section {
    padding: 28px 30px;
    border: 1px solid #d5e1ee;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 42, 81, 0.055);
}

.files-page .ads-section-heading {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e2eaf3;
}

.files-page .ads-section-heading h2,
.files-page .ads-interactive-header h2 {
    margin: 8px 0 0;
    color: #123f78;
}

.files-page .ads-interactive-header h2 {
    font-size: clamp(24px, 2.15vw, 33px);
}

.files-page .ads-interactive-header p { margin-bottom: 0; }

.files-page .ads-objective-list {
    display: grid;
    gap: 10px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.files-page .ads-objective-list li {
    position: relative;
    padding: 12px 15px 12px 43px;
    border: 1px solid #d8e3ef;
    border-radius: 11px;
    background: #f8fbff;
    line-height: 1.55;
}

.files-page .ads-objective-list li::before {
    content: "✓";
    position: absolute;
    top: 11px;
    left: 15px;
    color: #16a34a;
    font-weight: 900;
}

.files-page .ads-rule-grid > article,
.files-page .ads-comparison-grid > article,
.files-page .ads-decision-grid > article,
.files-page .ads-step-flow > article {
    min-width: 0;
    padding: 18px;
    border: 1px solid #d5e1ee;
    border-left: 5px solid #60a5fa;
    border-radius: 12px;
    background: #f8fbff;
}

.files-page .ads-rule-grid > article:nth-child(even),
.files-page .ads-comparison-grid > article:nth-child(even),
.files-page .ads-decision-grid > article:nth-child(even) {
    border-left-color: #8b5cf6;
    background: #faf7ff;
}

.files-page .ads-step-flow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.files-page .ads-step-flow > article > span {
    display: grid;
    width: 34px;
    height: 34px;
    margin-bottom: 11px;
    place-items: center;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-weight: 800;
}

.files-page .ads-rule-grid h3,
.files-page .ads-comparison-grid h3,
.files-page .ads-decision-grid h3,
.files-page .ads-step-flow h3 {
    margin: 0 0 8px;
    color: #173f73;
}

.files-page .ads-rule-grid p,
.files-page .ads-comparison-grid p,
.files-page .ads-decision-grid p,
.files-page .ads-step-flow p { margin-bottom: 0; }

.files-page .ads-decision-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.files-page .ads-algorithm-box {
    margin-top: 18px;
    padding: 20px 22px;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #2563eb;
    border-radius: 12px;
    background: #f8fbff;
}

.files-page .ads-algorithm-box h3 {
    margin: 0 0 12px;
    color: #123f78;
}

.files-page .ads-algorithm-box ol {
    margin-bottom: 0;
    padding-left: 23px;
}

.files-page .ads-algorithm-box li {
    margin: 8px 0;
    line-height: 1.55;
}

.files-page .ads-tip-box,
.files-page .ads-example-callout,
.files-page .ads-formula-box {
    margin-top: 18px;
    padding: 17px 19px;
    border: 1px solid #f6d365;
    border-left: 5px solid #d4af37;
    border-radius: 11px;
    background: #fffbeb;
    color: #854d0e;
    line-height: 1.65;
}

.files-page .ads-example-callout {
    border-color: #a7f3d0;
    border-left-color: #16a34a;
    background: #ecfdf5;
    color: #065f46;
}

.files-page .ads-formula-box {
    border-color: #c4b5fd;
    border-left-color: #7c3aed;
    background: #f5f3ff;
    color: #5b21b6;
}

.files-page .ads-program-details {
    overflow: hidden;
    margin-top: 18px;
    border: 1px solid #cbd9e8;
    border-radius: 12px;
    background: #ffffff;
}

.files-page .ads-program-details summary {
    padding: 16px 18px;
    background: #eff6ff;
    color: #123f78;
}

.file-controls,
.file-tracer-loader {
    display: grid;
    align-items: end;
    gap: 14px;
    margin: 22px 0 16px;
}

.file-controls {
    grid-template-columns:
        minmax(280px, 1.65fr)
        minmax(120px, 0.58fr)
        minmax(165px, 0.72fr)
        minmax(180px, 0.8fr)
        minmax(150px, 0.68fr)
        auto;
}

.file-tracer-loader {
    grid-template-columns:
        minmax(270px, 1.55fr)
        minmax(120px, 0.56fr)
        minmax(165px, 0.72fr)
        minmax(180px, 0.8fr)
        minmax(150px, 0.68fr)
        auto;
}

.file-controls label,
.file-tracer-loader label {
    display: grid;
    gap: 7px;
    min-width: 0;
    color: #173f73;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.file-controls input,
.file-controls select,
.file-tracer-loader input,
.file-tracer-loader select {
    width: 100%;
    min-width: 0;
    height: 52px;
    padding: 0 14px;
    border: 1px solid #cbd9e8;
    border-radius: 11px;
    outline: none;
    background: #ffffff;
    color: #102f59;
    font: inherit;
    font-size: 15px;
    font-weight: 650;
    text-transform: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.file-controls input:focus,
.file-controls select:focus,
.file-tracer-loader input:focus,
.file-tracer-loader select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.13);
}

.file-controls input:disabled,
.file-tracer-loader input:disabled {
    cursor: not-allowed;
    background: #edf2f7;
    color: #8190a7;
}

.file-controls .primary-button,
.file-tracer-loader .primary-button {
    min-height: 52px;
    padding: 0 20px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.file-controls .primary-button:hover,
.file-tracer-loader .primary-button:hover {
    transform: translateY(-1px);
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.file-visualizer-result,
.file-tracer-result { margin-top: 16px; }

.file-viz-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(270px, 0.68fr);
    gap: 16px;
    align-items: stretch;
}

.file-storage-panel,
.file-stat-panel,
.file-tracer-code-panel,
.file-tracer-side {
    min-width: 0;
    border: 1px solid #d4e1ef;
    border-radius: 14px;
    background: #f8fbff;
}

.file-storage-panel,
.file-stat-panel { padding: 18px; }

.file-storage-panel > h3,
.file-stat-panel > h3,
.file-tracer-code-panel > h4 {
    margin: 0 0 14px;
    color: #173f73;
}

.file-storage-view {
    min-height: 350px;
    max-height: 520px;
    padding: 15px;
    overflow: auto;
    border: 1px solid #cddcec;
    border-radius: 12px;
    background:
        linear-gradient(rgba(37, 99, 235, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.035) 1px, transparent 1px),
        #ffffff;
    background-size: 24px 24px;
}

.file-index-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-bottom: 14px;
    padding: 12px;
    border: 1px solid #c4b5fd;
    border-radius: 11px;
    background: #f5f3ff;
}

.file-index-title {
    margin-right: 4px;
    color: #5b21b6;
    font-size: 13px;
    text-transform: uppercase;
}

.file-index-entry {
    padding: 7px 10px;
    border: 1px solid #c4b5fd;
    border-radius: 999px;
    background: #ffffff;
    color: #6d28d9;
    font-size: 13px;
    font-weight: 800;
    transition: 0.2s ease;
}

.file-index-entry.is-active {
    border-color: #7c3aed;
    background: #7c3aed;
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.13);
}

.file-block-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
}

.file-block {
    overflow: hidden;
    min-width: 0;
    border: 2px solid #d4e1ef;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 42, 81, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.file-block.is-active {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13);
    transform: translateY(-2px);
}

.file-block-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: #173f73;
    color: #ffffff;
    font-size: 13px;
}

.file-block-header span { color: #bfdbfe; }

.file-record {
    display: grid;
    grid-template-columns: 68px minmax(70px, 1fr) 46px;
    align-items: center;
    gap: 8px;
    min-height: 45px;
    padding: 8px 10px;
    border-top: 1px solid #e2eaf3;
    color: #173f73;
    font-size: 14px;
}

.file-record.is-active {
    background: #dbeafe;
    color: #123f78;
}

.file-record-key {
    color: #1d4ed8;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.file-record-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-record-marks {
    justify-self: end;
    padding: 3px 7px;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0369a1;
    font-weight: 800;
}

.file-empty-block {
    padding: 28px 12px;
    color: #94a3b8;
    text-align: center;
    font-weight: 800;
}

.file-direct-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(245px, 1fr));
    gap: 10px;
}

.file-slot {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    align-items: stretch;
    min-height: 54px;
    overflow: hidden;
    border: 2px solid #d4e1ef;
    border-radius: 11px;
    background: #f8fafc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.file-slot.is-active {
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.file-slot.is-deleted {
    border-color: #fecaca;
    background: #fff7f7;
}

.file-slot-number {
    display: grid;
    place-items: center;
    background: #173f73;
    color: #ffffff;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-weight: 900;
}

.file-slot .file-record {
    border-top: 0;
    padding-left: 12px;
}

.file-slot-state {
    align-self: center;
    padding: 0 14px;
    color: #94a3b8;
    font-size: 13px;
    letter-spacing: 0.04em;
}

.file-slot.is-deleted .file-slot-state { color: #dc2626; }

.file-storage-panel .ads-explorer-message,
.file-tracer-side .ads-explorer-message {
    margin: 14px 0 0;
}

.file-storage-panel .ads-progress-track {
    height: 9px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #dce6f2;
}

.file-storage-panel .ads-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #8b5cf6);
    transition: width 0.25s ease;
}

.file-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.file-stat-grid > div,
.file-trace-variables > div {
    min-width: 0;
    padding: 12px;
    border: 1px solid #d5e1ee;
    border-radius: 11px;
    background: #ffffff;
}

.file-stat-grid span,
.file-trace-variables span,
.file-tracer-output span {
    display: block;
    margin-bottom: 6px;
    color: #64748b;
    font-size: 11px;
    font-weight: 850;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}

.file-stat-grid strong,
.file-trace-variables strong {
    display: block;
    overflow-wrap: anywhere;
    color: #173f73;
    font-size: 15px;
}

.file-control-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
    margin-top: 14px;
}

.file-control-row button {
    min-height: 42px;
    padding: 0 15px;
    border: 1px solid #b9cce1;
    border-radius: 9px;
    background: #ffffff;
    color: #173f73;
    font-weight: 800;
    cursor: pointer;
    transition: 0.2s ease;
}

.file-control-row button:hover:not(:disabled) {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
    transform: translateY(-1px);
}

.file-control-row button:nth-child(3) {
    border-color: #2563eb;
    background: #2563eb;
    color: #ffffff;
}

.file-control-row button:nth-child(3):hover:not(:disabled) {
    background: #1d4ed8;
    color: #ffffff;
}

.file-control-row button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.file-control-row > span {
    margin-left: auto;
    padding: 8px 11px;
    border-radius: 999px;
    background: #eaf2ff;
    color: #173f73;
    font-size: 13px;
    font-weight: 850;
}

.file-tracer-result {
    padding: 18px;
    border: 1px solid #cbd9e8;
    border-radius: 14px;
    background: #f8fbff;
}

.file-tracer-result > h3 {
    margin: 0 0 15px;
    padding-bottom: 13px;
    border-bottom: 1px solid #d5e1ee;
    color: #123f78;
    font-size: 18px;
    letter-spacing: 0.025em;
}

.file-tracer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(330px, 0.85fr);
    gap: 16px;
    align-items: stretch;
}

.file-tracer-code-panel { overflow: hidden; }

.file-tracer-code-panel > h4 {
    padding: 15px 17px 0;
}

.file-tracer-code-window {
    height: 545px;
    min-height: 545px;
    max-height: 545px;
    overflow: auto;
    border-top: 1px solid #d5e1ee;
    background: #07182f;
    color: #dbeafe;
    scroll-behavior: smooth;
}

.file-tracer-code {
    display: block;
    min-width: max-content;
    padding: 12px 0;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    line-height: 1.65;
    white-space: pre;
}

.file-tracer-code > span {
    display: block;
    min-height: 22px;
    padding: 0 16px;
    border-left: 4px solid transparent;
}

.file-tracer-code > span.is-active-line {
    border-left-color: #fbbf24;
    background: rgba(37, 99, 235, 0.42);
    color: #ffffff;
    box-shadow: inset 0 1px rgba(255, 255, 255, 0.05);
}

.file-tracer-side {
    display: flex;
    min-height: 0;
    padding: 15px;
    flex-direction: column;
    gap: 13px;
}

.file-tracer-side .ads-explorer-message { margin-top: 0; }

.file-trace-variables {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.compact-file-view {
    flex: 1 1 230px;
    min-height: 220px;
    max-height: 310px;
    padding: 10px;
}

.compact-file-view .file-direct-grid {
    grid-template-columns: 1fr;
}

.compact-file-view .file-block-grid {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.compact-file-view .file-record {
    grid-template-columns: 58px minmax(55px, 1fr) 42px;
    font-size: 12px;
}

.file-tracer-output {
    padding: 13px 14px;
    border: 1px solid #bbf7d0;
    border-radius: 11px;
    background: #ecfdf5;
}

.file-tracer-output strong {
    display: block;
    overflow-wrap: anywhere;
    color: #065f46;
}

.files-page [hidden] { display: none !important; }

@media (max-width: 1320px) {
    .file-controls,
    .file-tracer-loader {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .file-controls .primary-button,
    .file-tracer-loader .primary-button { width: 100%; }
}

@media (max-width: 1050px) {
    .file-viz-layout,
    .file-tracer-layout { grid-template-columns: 1fr; }

    .file-tracer-code-window {
        height: 430px;
        min-height: 430px;
        max-height: 430px;
    }

    .compact-file-view { max-height: 390px; }
}

@media (max-width: 800px) {
    .files-page .ads-lesson-section { padding: 20px 16px; }

    .files-page .ads-step-flow,
    .files-page .ads-decision-grid { grid-template-columns: 1fr; }

    .file-controls,
    .file-tracer-loader {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .file-direct-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .file-controls,
    .file-tracer-loader,
    .file-stat-grid,
    .file-trace-variables { grid-template-columns: 1fr; }

    .file-storage-panel,
    .file-stat-panel,
    .file-tracer-result,
    .file-tracer-side { padding: 12px; }

    .file-storage-view {
        min-height: 310px;
        padding: 10px;
    }

    .file-block-grid { grid-template-columns: 1fr; }

    .file-control-row button {
        flex: 1 1 calc(50% - 9px);
    }

    .file-control-row > span {
        width: 100%;
        margin-left: 0;
        text-align: center;
    }

    .file-tracer-code-window {
        height: 350px;
        min-height: 350px;
        max-height: 350px;
    }
}

/* ================================================================
   LEVEL 21 — PLACEMENT PROBLEMS
   ================================================================ */

.placement-page .placement-decision-grid,
.placement-page .revision-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.placement-page .placement-decision-grid article,
.placement-page .revision-grid article {
    padding: 18px;
    border: 1px solid #d2dfed;
    border-radius: 14px;
    background: linear-gradient(145deg, #ffffff, #f5f9ff);
}

.placement-page .placement-decision-grid span {
    display: block;
    margin-bottom: 7px;
    color: #64748b;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.placement-page .placement-decision-grid strong,
.placement-page .revision-grid strong {
    color: #0d4382;
    font-size: 18px;
}

.placement-page .placement-problem .algorithm-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.placement-page .placement-problem .algorithm-grid article {
    padding: 18px;
    border: 1px solid #d1deec;
    border-radius: 14px;
    background: #f8fbff;
}

.placement-page .placement-problem .algorithm-grid h3 {
    margin-top: 0;
    color: #0c3d77;
}

.placement-page .complexity-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 15px;
}

.placement-page .complexity-strip span {
    padding: 8px 12px;
    border-radius: 999px;
    background: #e6f0ff;
    color: #123f78;
    font-size: 13px;
    font-weight: 800;
}

.placement-page .placement-controls,
.placement-page .placement-tracer-loader {
    display: grid;
    grid-template-columns: minmax(320px, 2fr) minmax(150px, 0.7fr) minmax(240px, 1fr) auto;
    gap: 14px;
    align-items: end;
    margin: 22px 0 16px;
}

.placement-page .placement-controls label,
.placement-page .placement-tracer-loader label {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 8px;
    color: #173967;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.placement-page .placement-controls input,
.placement-page .placement-controls select,
.placement-page .placement-tracer-loader input,
.placement-page .placement-tracer-loader select {
    width: 100%;
    min-width: 0;
    height: 58px;
    padding: 0 15px;
    border: 1px solid #c9d9ec;
    border-radius: 12px;
    background: #ffffff;
    color: #0c2f63;
    font: 700 15px/1.2 inherit;
    box-sizing: border-box;
}

.placement-page .placement-controls input:focus,
.placement-page .placement-controls select:focus,
.placement-page .placement-tracer-loader input:focus,
.placement-page .placement-tracer-loader select:focus {
    border-color: #2563eb;
    outline: 3px solid rgba(37, 99, 235, 0.13);
}

.placement-page .placement-controls .primary-button,
.placement-page .placement-tracer-loader .primary-button {
    min-width: 190px;
    height: 58px;
    padding: 0 20px;
    border: 0;
    border-radius: 12px;
    background: #2563eb;
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 9px 20px rgba(37, 99, 235, 0.2);
}

.placement-page .placement-example-row {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 18px;
}

.placement-page .placement-example-row button {
    padding: 9px 14px;
    border: 1px solid #bcd5fb;
    border-radius: 999px;
    background: #ffffff;
    color: #1747b5;
    font-weight: 800;
    cursor: pointer;
}

.placement-page .placement-visualizer-result,
.placement-page .placement-tracer-result {
    margin-top: 16px;
    overflow: hidden;
    border: 1px solid #cbdced;
    border-radius: 15px;
    background: #ffffff;
}

.placement-page .placement-viz-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(310px, 0.75fr);
    gap: 16px;
    padding: 16px;
    background: #f8fbff;
}

.placement-page .placement-stage-panel,
.placement-page .placement-stat-panel {
    min-width: 0;
    padding: 14px;
    border: 1px solid #cbdced;
    border-radius: 14px;
    background: #ffffff;
}

.placement-page .placement-stage-panel > h3,
.placement-page .placement-stat-panel > h3 {
    margin: 0 0 13px;
    color: #0b3b75;
    font-size: 19px;
}

.placement-page .placement-stage {
    display: flex;
    min-height: 300px;
    max-height: 430px;
    padding: 22px;
    flex-wrap: wrap;
    gap: 12px;
    align-content: center;
    justify-content: center;
    overflow: auto;
    border: 1px solid #c8d9ed;
    border-radius: 13px;
    background-color: #fbfdff;
    background-image:
        linear-gradient(rgba(37, 99, 235, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(37, 99, 235, 0.045) 1px, transparent 1px);
    background-size: 28px 28px;
    box-sizing: border-box;
}

.placement-page .placement-item {
    display: flex;
    min-width: 92px;
    min-height: 76px;
    padding: 11px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px solid #b9cce4;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 5px 12px rgba(15, 23, 42, 0.07);
    box-sizing: border-box;
}

.placement-page .placement-item span {
    margin-bottom: 7px;
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
}

.placement-page .placement-item strong {
    color: #0a3d78;
    font-size: 17px;
    overflow-wrap: anywhere;
    text-align: center;
}

.placement-page .placement-item.is-active {
    border-color: #f59e0b;
    background: #fef3c7;
    transform: translateY(-4px);
}

.placement-page .placement-item.is-selected {
    border-color: #16a34a;
    background: #dcfce7;
}

.placement-page .placement-empty {
    color: #93a3ba;
    font-size: 20px;
    font-weight: 900;
}

.placement-page .placement-progress-track {
    height: 10px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: #dce7f3;
}

.placement-page .placement-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #16a34a);
    transition: width 0.2s;
}

.placement-page .placement-stat-grid,
.placement-page .placement-trace-variables {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
}

.placement-page .placement-stat-grid > div,
.placement-page .placement-trace-variables > div {
    min-width: 0;
    min-height: 84px;
    padding: 14px;
    border: 1px solid #cfdded;
    border-radius: 12px;
    background: #ffffff;
    box-sizing: border-box;
}

.placement-page .placement-stat-grid span,
.placement-page .placement-trace-variables span,
.placement-page .placement-tracer-output span,
.placement-page .placement-state-grid span {
    display: block;
    margin-bottom: 8px;
    color: #60718a;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.placement-page .placement-stat-grid strong,
.placement-page .placement-trace-variables strong {
    color: #093a75;
    font-size: 15px;
    overflow-wrap: anywhere;
}

.placement-page .placement-state-table {
    margin-top: 13px;
    overflow: auto;
    max-height: 230px;
    border: 1px solid #d3e0ef;
    border-radius: 11px;
    background: #ffffff;
}

.placement-page .placement-state-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
    padding: 10px;
}

.placement-page .placement-state-grid > div {
    padding: 9px;
    border-radius: 9px;
    background: #eff6ff;
    text-align: center;
}

.placement-page .placement-state-grid strong {
    color: #0b3b75;
    overflow-wrap: anywhere;
}

.placement-page .placement-control-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-top: 1px solid #d5e1ee;
    background: #ffffff;
}

.placement-page .placement-control-row button {
    min-width: 120px;
    min-height: 48px;
    padding: 10px 18px;
    border: 1px solid #b8cbe2;
    border-radius: 11px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 900;
    cursor: pointer;
}

.placement-page .placement-control-row button:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.placement-page .placement-control-row button:nth-child(1),
.placement-page .placement-control-row button:nth-child(5) { background: #667a96; }
.placement-page .placement-control-row button:nth-child(2) { background: #2563eb; }
.placement-page .placement-control-row button:nth-child(3) { background: #16a34a; }
.placement-page .placement-control-row button:nth-child(4) { background: #f57c00; }

.placement-page .placement-control-row > span {
    margin-left: auto;
    padding: 11px 16px;
    border-radius: 999px;
    background: #eaf3ff;
    color: #113e72;
    font-weight: 900;
}

.placement-page #placementTraceResult > #placementTraceTitle {
    margin: 0;
    padding: 15px 18px;
    border-bottom: 1px solid #334155;
    background: #102a51;
    color: #f6d76b;
    font-size: 14px;
    letter-spacing: 0.08em;
}

.placement-page .placement-tracer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.75fr);
    align-items: stretch;
}

.placement-page .placement-tracer-code-panel {
    min-width: 0;
    padding: 16px;
    border-right: 1px solid #334155;
    background: #0f172a;
}

.placement-page .placement-tracer-code-panel > h4 {
    margin: 0 0 11px;
    color: #ffffff;
    font-size: 15px;
}

.placement-page #placementTraceCodeWindow {
    overflow: auto;
    height: 610px;
    min-height: 610px;
    max-height: 610px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #020617;
    color: #e2e8f0;
    scrollbar-color: #64748b #111c2f;
    scrollbar-width: thin;
    scroll-behavior: auto;
}

.placement-page #placementTraceCodeWindow::-webkit-scrollbar { width: 10px; height: 10px; }
.placement-page #placementTraceCodeWindow::-webkit-scrollbar-track { background: #111c2f; }
.placement-page #placementTraceCodeWindow::-webkit-scrollbar-thumb { border: 2px solid #111c2f; border-radius: 999px; background: #64748b; }

.placement-page #placementTraceCode {
    display: block;
    width: max-content;
    min-width: 100%;
    min-height: 100%;
    padding: 12px 8px;
    background: #020617;
    color: #e2e8f0;
    font: 13px/1.65 Consolas, Monaco, "Courier New", monospace;
    white-space: pre;
    box-sizing: border-box;
}

.placement-page #placementTraceCode > span {
    display: block;
    min-height: 21px;
    padding: 0 10px;
    border-left: 4px solid transparent;
    color: inherit;
}

.placement-page #placementTraceCode > span.is-active-line {
    border-left-color: #f6d76b;
    border-radius: 4px;
    background: #25466f;
    color: #ffffff;
}

.placement-page .placement-tracer-side {
    display: flex;
    min-width: 0;
    max-height: 675px;
    padding: 16px;
    flex-direction: column;
    gap: 12px;
    overflow: auto;
    background: #f8fafc;
}

.placement-page .placement-trace-stage {
    min-height: 230px;
    max-height: 300px;
}

.placement-page .placement-tracer-output {
    padding: 14px;
    border: 1px solid #a7efc4;
    border-radius: 12px;
    background: #ecfdf5;
}

.placement-page .placement-tracer-output strong {
    color: #06683c;
    font-size: 16px;
    overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
    .placement-page .placement-controls,
    .placement-page .placement-tracer-loader { grid-template-columns: minmax(280px, 2fr) minmax(140px, 0.8fr) minmax(220px, 1fr); }
    .placement-page .placement-controls .primary-button,
    .placement-page .placement-tracer-loader .primary-button { grid-column: 1 / -1; width: 100%; }
}

@media (max-width: 950px) {
    .placement-page .placement-viz-layout,
    .placement-page .placement-tracer-layout { grid-template-columns: 1fr; }
    .placement-page .placement-tracer-code-panel { border-right: 0; border-bottom: 1px solid #334155; }
    .placement-page .placement-tracer-side { max-height: none; }
}

@media (max-width: 720px) {
    .placement-page .placement-problem .algorithm-grid { grid-template-columns: 1fr; }
    .placement-page .placement-controls,
    .placement-page .placement-tracer-loader { grid-template-columns: 1fr; }
    .placement-page .placement-stat-grid,
    .placement-page .placement-trace-variables { grid-template-columns: 1fr; }
    .placement-page #placementTraceCodeWindow { height: 430px; min-height: 430px; max-height: 430px; }
}

@media (max-width: 520px) {
    .placement-page .placement-control-row button { min-width: 0; flex: 1 1 calc(50% - 8px); }
    .placement-page .placement-control-row > span { width: 100%; margin-left: 0; text-align: center; }
    .placement-page .placement-stage { padding: 12px; }
}

/* =========================================
   LEVEL 15 — DIGITAL SEARCH TREES
   ========================================= */

.digital-controls,
.digital-tracer-loader {
    display: grid;
    grid-template-columns: minmax(250px, 1.35fr) minmax(180px, 0.7fr) minmax(210px, 0.8fr) auto;
    align-items: end;
    gap: 12px;
    margin: 18px 0 12px;
}

.digital-controls label,
.digital-tracer-loader label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

.digital-controls input,
.digital-controls select,
.digital-tracer-loader input,
.digital-tracer-loader select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    font: 700 14px/1.3 Consolas, Monaco, "Courier New", monospace;
    text-transform: none;
}

.digital-controls input:focus,
.digital-controls select:focus,
.digital-tracer-loader input:focus,
.digital-tracer-loader select:focus {
    border-color: #2563eb;
    outline: 3px solid rgba(37, 99, 235, 0.14);
}

.digital-controls .primary-button,
.digital-tracer-loader .primary-button {
    min-height: 46px;
    white-space: nowrap;
}

.digital-tree-panel {
    min-width: 0;
    padding: 16px;
    border: 1px solid #d9e4f0;
    border-radius: 13px;
    background: #f8fafc;
}

.digital-tree-panel h3 { margin: 0 0 12px; color: #173f73; }

.digital-svg-scroll {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #d9e4f0;
    border-radius: 12px;
    background: #ffffff;
}

.digital-tree-svg {
    display: block;
    width: 100%;
    min-width: 780px;
    min-height: 220px;
    max-height: 390px;
    background:
        radial-gradient(circle at top, rgba(219, 234, 254, 0.72), transparent 58%),
        #ffffff;
}

.digital-tree-edge {
    stroke: #94a3b8;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.digital-edge-label {
    fill: #1e3a5f;
    font-size: 12px;
    font-weight: 900;
    text-anchor: middle;
    paint-order: stroke;
    stroke: #ffffff;
    stroke-width: 5px;
    stroke-linejoin: round;
}

.digital-tree-node circle {
    fill: #2563eb;
    stroke: #93c5fd;
    stroke-width: 3;
}

.digital-tree-node.is-binary circle { fill: #0f766e; stroke: #99f6e4; }
.digital-tree-node.is-patricia circle { fill: #7c3aed; stroke: #ddd6fe; }
.digital-tree-node.is-suffix circle { fill: #c2410c; stroke: #fed7aa; }
.digital-tree-node.is-terminal circle { stroke-width: 4; }
.digital-tree-node .digital-terminal-ring { fill: none; stroke: rgba(255, 255, 255, 0.88); stroke-width: 2; }

.digital-tree-node.is-active circle:first-child {
    stroke: #facc15;
    stroke-width: 5;
    filter: drop-shadow(0 0 7px rgba(250, 204, 21, 0.72));
}

.digital-node-key {
    fill: #ffffff;
    font-size: 13px;
    font-weight: 900;
    text-anchor: middle;
    pointer-events: none;
}

.digital-tree-panel .ads-explorer-message,
.digital-tree-panel .ads-progress-track { margin-top: 12px; }

#digitalTraceResult { margin-top: 16px; }

#digitalTraceResult .ads-tracer-code {
    height: 350px;
    min-height: 350px;
    max-height: 350px;
    overflow: auto;
}

.digital-trace-scroll {
    border-color: #334155;
    background: #0f172a;
}

.digital-trace-svg {
    min-height: 190px;
    max-height: 285px;
    background:
        radial-gradient(circle at top, rgba(37, 99, 235, 0.17), transparent 60%),
        #0f172a;
}

.digital-trace-svg .digital-tree-edge { stroke: #64748b; }
.digital-trace-svg .digital-edge-label { fill: #bfdbfe; stroke: #0f172a; }

.digital-search-page .ads-interactive-header h2 {
    margin-bottom: 7px;
    font-size: clamp(24px, 2.15vw, 33px);
}

.digital-search-page .ads-interactive-header p { margin: 0; }

@media (max-width: 1120px) {
    .digital-controls,
    .digital-tracer-loader { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .digital-controls .primary-button,
    .digital-tracer-loader .primary-button { width: 100%; }
}

@media (max-width: 650px) {
    .digital-controls,
    .digital-tracer-loader { grid-template-columns: 1fr; }

    .digital-tree-panel { padding: 11px; }
    .digital-tree-svg { min-width: 660px; min-height: 190px; }

    #digitalTraceResult .ads-tracer-code {
        height: 310px;
        min-height: 310px;
        max-height: 310px;
    }
}

/* =========================================
   LEVEL 18 — VISUALIZER / TRACER FIX
   Keep this block at the end of ads.css.
   ========================================= */

.hashing-page .sorting-viz-layout {
    align-items: start;
}

.hashing-page .sorting-stat-panel {
    align-self: start;
}

.hashing-page .sorting-control-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 13px 14px;
    border: 1px solid #d7e2ee;
    border-radius: 11px;
    background: #f8fafc;
}

.hashing-page .sorting-control-row button {
    min-width: 104px;
    min-height: 42px;
    padding: 10px 15px;
    border: 0;
    border-radius: 9px;
    background: #2563eb;
    color: #ffffff;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 5px 12px rgba(37, 99, 235, 0.16);
}

.hashing-page .sorting-control-row button:hover:not(:disabled) {
    filter: brightness(0.94);
    transform: translateY(-1px);
}

.hashing-page .sorting-control-row button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
    box-shadow: none;
}

#hashPrevious,
#hashReset,
#hashTracePrevious,
#hashTraceReset {
    background: #64748b;
}

#hashNext,
#hashTraceNext {
    background: #2563eb;
}

#hashAuto,
#hashTraceAuto {
    background: #159447;
}

#hashPause,
#hashTracePause {
    background: #ea7800;
}

.hashing-page .sorting-control-row > span {
    margin-left: auto;
    color: #475569;
    font-size: 13px;
    font-weight: 900;
}

#hashTraceResult {
    overflow: hidden;
    margin-top: 17px;
    border: 1px solid #cbd9e8;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 42, 81, 0.08);
}

#hashTraceResult > h3 {
    margin: 0;
    padding: 15px 18px;
    border-bottom: 1px solid #334155;
    background: #102a51;
    color: #f6d76b;
    font-size: 14px;
    letter-spacing: 0.08em;
}

#hashTraceResult .ads-tracer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.7fr);
    align-items: stretch;
}

#hashTraceResult .ads-tracer-code-panel {
    min-width: 0;
    padding: 16px;
    border-right: 1px solid #334155;
    background: #0f172a;
}

#hashTraceResult .ads-tracer-code-panel h4 {
    margin: 0 0 11px;
    color: #ffffff;
    font-size: 15px;
}

#hashTraceResult .ads-tracer-code-window {
    overflow: auto;
    height: 350px;
    min-height: 350px;
    max-height: 350px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #020617;
    scrollbar-color: #64748b #111c2f;
    scrollbar-width: thin;
}

#hashTraceResult .ads-tracer-code-window::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

#hashTraceResult .ads-tracer-code-window::-webkit-scrollbar-track {
    background: #111c2f;
}

#hashTraceResult .ads-tracer-code-window::-webkit-scrollbar-thumb {
    border: 2px solid #111c2f;
    border-radius: 999px;
    background: #64748b;
}

#hashTraceResult code.ads-tracer-code {
    display: block;
    overflow: visible;
    width: max-content;
    min-width: 100%;
    height: auto;
    min-height: 100%;
    max-height: none;
    margin: 0;
    padding: 12px 8px;
    border: 0;
    border-radius: 0;
    background: #020617;
    color: #e2e8f0;
    font: 13px/1.65 Consolas, Monaco, "Courier New", monospace;
    white-space: pre;
    box-sizing: border-box;
}

#hashTraceResult code.ads-tracer-code > span {
    display: block;
    min-height: 21px;
    padding: 0 10px;
    border-left: 4px solid transparent;
    color: inherit;
}

#hashTraceResult code.ads-tracer-code > span.is-active-line {
    border-left-color: #f6d76b;
    border-radius: 4px;
    background: #25466f;
    color: #ffffff;
}

#hashTraceResult .ads-tracer-side {
    min-width: 0;
    padding: 16px;
    background: #f8fafc;
}

#hashTraceResult .ads-tracer-side > .ads-explorer-message {
    margin: 0 0 13px;
}

#hashTraceResult .ads-tracer-variables {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

#hashTraceResult .ads-tracer-variables > div {
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #d7e2ee;
    border-radius: 10px;
    background: #ffffff;
}

#hashTraceResult .ads-tracer-variables span {
    display: block;
    margin-bottom: 5px;
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

#hashTraceResult .ads-tracer-variables strong {
    display: block;
    color: #102a51;
    overflow-wrap: anywhere;
}

#hashTraceResult .ads-tracer-output {
    margin-top: 13px;
    padding: 13px 14px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #102a51;
}

#hashTraceResult .ads-tracer-output span {
    display: block;
    margin-bottom: 6px;
    color: #93c5fd;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

#hashTraceResult .ads-tracer-output strong {
    display: block;
    color: #ffffff;
    overflow-wrap: anywhere;
}

#hashTraceResult > .sorting-control-row {
    margin: 0;
    border: 0;
    border-top: 1px solid #d7e2ee;
    border-radius: 0;
}

@media (max-width: 1050px) {
    #hashTraceResult .ads-tracer-layout {
        grid-template-columns: 1fr;
    }

    #hashTraceResult .ads-tracer-code-panel {
        border-right: 0;
        border-bottom: 1px solid #334155;
    }
}

@media (max-width: 650px) {
    .hashing-page .sorting-control-row button {
        flex: 1 1 125px;
    }

    .hashing-page .sorting-control-row > span {
        flex: 1 0 100%;
        margin-left: 0;
        text-align: center;
    }

    #hashTraceResult .ads-tracer-code-window {
        height: 310px;
        min-height: 310px;
        max-height: 310px;
    }

    #hashTraceResult .ads-tracer-variables {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   LEVEL 18 — HASHING
   ========================================= */

.hashing-page .ads-lesson-section {
    padding: 28px 30px;
    border: 1px solid #d5e1ee;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 42, 81, 0.055);
}

.hashing-page .ads-section-heading {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e2eaf3;
}

.hashing-page .ads-section-heading h2 {
    margin: 8px 0 0;
    color: #123f78;
}

.hashing-page .ads-objective-list {
    display: grid;
    gap: 10px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.hashing-page .ads-objective-list li {
    position: relative;
    padding: 12px 15px 12px 43px;
    border: 1px solid #d8e3ef;
    border-radius: 11px;
    background: #f8fbff;
    line-height: 1.55;
}

.hashing-page .ads-objective-list li::before {
    content: "✓";
    position: absolute;
    top: 11px;
    left: 15px;
    color: #16a34a;
    font-weight: 900;
}

.hashing-page .ads-rule-grid > article,
.hashing-page .ads-comparison-grid > article,
.hashing-page .ads-decision-grid > article {
    min-width: 0;
}

.hashing-page .ads-rule-card.purple-panel {
    border-left-color: #8b5cf6;
    background: #faf7ff;
}

.hashing-page .ads-rule-card > strong {
    display: block;
    margin-bottom: 8px;
    color: #173f73;
}

.hashing-page .ads-rule-card p,
.hashing-page .ads-info-panel p {
    margin-bottom: 0;
}

.hashing-page .ads-decision-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.hashing-page .ads-algorithm-box {
    margin-top: 18px;
    padding: 20px 22px;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #2563eb;
    border-radius: 12px;
    background: #f8fbff;
}

.hashing-page .ads-algorithm-box h3 {
    margin: 0 0 12px;
    color: #123f78;
}

.hashing-page .ads-algorithm-box ol {
    margin-bottom: 0;
    padding-left: 23px;
}

.hashing-page .ads-algorithm-box li {
    margin: 8px 0;
    line-height: 1.55;
}

.hashing-page .ads-tip-box,
.hashing-page .ads-example-callout {
    margin-top: 18px;
    padding: 17px 19px;
    border: 1px solid #f6d365;
    border-left: 5px solid #d4af37;
    border-radius: 11px;
    background: #fffbeb;
    color: #854d0e;
    line-height: 1.65;
}

.hashing-page .ads-example-callout {
    border-color: #a7f3d0;
    border-left-color: #16a34a;
    background: #ecfdf5;
    color: #065f46;
}

.hashing-page .ads-program-details {
    overflow: hidden;
    border: 1px solid #cbd9e8;
    border-left: 5px solid #16a34a;
    border-radius: 12px;
    background: #ffffff;
}

.hashing-page .ads-program-details summary {
    padding: 16px 18px;
    background: #eff6ff;
    color: #123f78;
}

.hashing-page .ads-interactive-header h2 {
    margin-bottom: 7px;
    font-size: clamp(24px, 2.15vw, 33px);
}

.hashing-page .ads-interactive-header p { margin: 0; }

.hash-controls,
.hash-tracer-loader {
    display: grid;
    gap: 14px;
    align-items: end;
    margin-top: 20px;
}

.hash-controls {
    grid-template-columns:
        minmax(230px, 1.35fr)
        minmax(130px, 0.55fr)
        minmax(105px, 0.42fr)
        minmax(185px, 0.8fr)
        minmax(145px, 0.58fr)
        auto;
}

.hash-tracer-loader {
    grid-template-columns:
        minmax(230px, 1.25fr)
        minmax(125px, 0.55fr)
        minmax(100px, 0.4fr)
        minmax(185px, 0.76fr)
        minmax(140px, 0.58fr)
        auto;
}

.hash-controls label,
.hash-tracer-loader label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.35px;
    text-transform: uppercase;
}

.hash-controls input,
.hash-controls select,
.hash-tracer-loader input,
.hash-tracer-loader select {
    width: 100%;
    min-width: 0;
    padding: 12px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    font: 700 14px/1.2 Consolas, Monaco, "Courier New", monospace;
    text-transform: none;
}

.hash-controls input:focus,
.hash-controls select:focus,
.hash-tracer-loader input:focus,
.hash-tracer-loader select:focus {
    outline: 3px solid rgba(37, 99, 235, 0.15);
    border-color: #2563eb;
}

.hash-controls input:disabled,
.hash-tracer-loader input:disabled {
    background: #f1f5f9;
    color: #94a3b8;
}

.hash-table-panel {
    min-width: 0;
    padding: 18px;
    border: 1px solid #d8e3ef;
    border-radius: 14px;
    background: #f8fbff;
}

.hash-table-panel h3 {
    margin: 0 0 13px;
    color: #173f73;
}

.hash-table-view {
    display: grid;
    gap: 8px;
    overflow: auto;
    max-height: 530px;
    padding: 12px;
    border: 1px solid #cbd9e8;
    border-radius: 12px;
    background: #ffffff;
}

.hash-bucket {
    display: grid;
    grid-template-columns: 54px minmax(0, 1fr);
    min-width: 420px;
    border: 2px solid #d7e2ee;
    border-radius: 10px;
    background: #f8fafc;
    transition: border-color 0.18s ease, background 0.18s ease,
        box-shadow 0.18s ease;
}

.hash-bucket.is-active {
    border-color: #f59e0b;
    background: #fffbeb;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.hash-bucket-index {
    display: grid;
    min-height: 46px;
    place-items: center;
    border-right: 1px solid #cbd9e8;
    border-radius: 8px 0 0 8px;
    background: #173f73;
    color: #ffffff;
    font: 900 14px/1 Consolas, Monaco, monospace;
}

.hash-bucket-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 7px 11px;
}

.hash-chain-node,
.hash-open-slot {
    display: inline-grid;
    min-width: 54px;
    min-height: 32px;
    padding: 6px 10px;
    place-items: center;
    border: 2px solid #60a5fa;
    border-radius: 8px;
    background: #eff6ff;
    color: #173f73;
    font: 900 14px/1 Consolas, Monaco, monospace;
}

.hash-chain-arrow {
    color: #64748b;
    font-weight: 900;
}

.hash-empty-slot,
.hash-open-slot.is-empty {
    color: #94a3b8;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.6px;
}

.hash-open-slot.is-empty {
    border-style: dashed;
    border-color: #cbd5e1;
    background: #f8fafc;
}

.hash-open-slot.is-deleted {
    border-color: #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 11px;
}

.hash-chain-node.is-active-key,
.hash-open-slot.is-active-key {
    border-color: #f59e0b;
    background: #fef3c7;
    color: #92400e;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.16);
}

.hash-table-panel .ads-explorer-message,
.hash-table-panel .ads-progress-track { margin-top: 12px; }

.compact-hash-view {
    max-height: 300px;
    margin-top: 14px;
    padding: 8px;
}

.compact-hash-view .hash-bucket {
    grid-template-columns: 44px minmax(0, 1fr);
    min-width: 320px;
}

.compact-hash-view .hash-bucket-index,
.compact-hash-view .hash-bucket-content { min-height: 38px; }

.compact-hash-view .hash-chain-node,
.compact-hash-view .hash-open-slot {
    min-width: 46px;
    min-height: 27px;
    padding: 5px 8px;
    font-size: 12px;
}

#hashTraceResult { margin-top: 16px; }

#hashTraceResult .ads-tracer-code {
    height: 350px;
    min-height: 350px;
    max-height: 350px;
    overflow: auto;
}

.hashing-page [hidden] { display: none !important; }

@media (max-width: 1320px) {
    .hash-controls,
    .hash-tracer-loader {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .hash-controls .primary-button,
    .hash-tracer-loader .primary-button { width: 100%; }
}

@media (max-width: 900px) {
    .hash-controls,
    .hash-tracer-loader {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .hashing-page .ads-lesson-section { padding: 20px 16px; }
    .hashing-page .ads-decision-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
    .hash-controls,
    .hash-tracer-loader { grid-template-columns: 1fr; }

    .hash-bucket { min-width: 330px; }

    #hashTraceResult .ads-tracer-code {
        height: 310px;
        min-height: 310px;
        max-height: 310px;
    }
}

@media (max-width: 700px) {
    .ads-course-map,
    .ads-index-page .topic-grid { grid-template-columns: 1fr; }
    .ads-index-page .topic-card { min-height: auto; }
    .ads-page .subject-hero { padding: 28px 22px; }
}

/* =========================================
   ADS TOPIC PAGES
   ========================================= */

.ads-topic-page [hidden] {
    display: none !important;
}

.ads-topic-page .main-content {
    width: min(100%, 1320px);
    max-width: 1320px;
}

.ads-topic-hero {
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    padding: 42px 38px;
    border: 1px solid #244972;
    border-radius: 18px;
    background: linear-gradient(120deg, #0d203a 0%, #173c6b 100%);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
}

.ads-topic-hero::after {
    content: "";
    position: absolute;
    top: -70px;
    right: -40px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.15);
}

.ads-topic-hero .subject-label,
.ads-topic-hero .page-title,
.ads-topic-hero .page-description {
    position: relative;
    z-index: 1;
}

.ads-topic-hero .subject-label { color: #f6d76b; }
.ads-topic-hero .page-title { color: #ffffff; }
.ads-topic-hero .page-description {
    max-width: 860px;
    margin-bottom: 0;
    color: #dbeafe;
}

.ads-page-jump-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 24px;
}

.ads-page-jump-nav a {
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    background: #ffffff;
    color: #1e40af;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.ads-page-jump-nav a:hover {
    border-color: #93c5fd;
    background: #eff6ff;
}

.ads-lesson-section {
    margin-bottom: 26px;
    padding: 30px;
}

.ads-section-heading {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e2e8f0;
}

.ads-section-heading h2 {
    margin: 6px 0 0;
    color: #123f78;
    font-size: clamp(24px, 2.2vw, 32px);
}

.ads-spaced-list,
.ads-interview-list,
.ads-revision-list {
    margin: 15px 0 0;
    padding-left: 25px;
}

.ads-spaced-list li,
.ads-interview-list li,
.ads-revision-list li {
    margin: 11px 0;
    padding-left: 4px;
    line-height: 1.65;
}

.ads-definition-box,
.ads-note-box,
.ads-warning-box,
.ads-formula-box,
.ads-order-box,
.ads-practice-note,
.ads-explorer-prompt {
    margin-top: 18px;
    padding: 18px 20px;
    border-radius: 12px;
    line-height: 1.65;
}

.ads-definition-box {
    border: 1px solid #bfdbfe;
    border-left: 5px solid #2563eb;
    background: #eff6ff;
    color: #1e3a5f;
}

.ads-note-box {
    border: 1px solid #c4b5fd;
    border-left: 5px solid #7c3aed;
    background: #f5f3ff;
    color: #4c1d95;
}

.ads-warning-box,
.ads-practice-note {
    border: 1px solid #f7d66d;
    border-left: 5px solid #d4af37;
    background: #fffbeb;
    color: #854d0e;
}

.ads-formula-box,
.ads-order-box {
    border: 1px solid #a7f3d0;
    border-left: 5px solid #16a34a;
    background: #ecfdf5;
    color: #065f46;
    font-size: 17px;
    text-align: center;
}

.ads-comparison-grid,
.ads-rule-grid,
.ads-notation-grid,
.ads-io-grid,
.ads-complexity-grid,
.ads-interview-question-grid,
.ads-mistake-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.ads-info-panel,
.ads-rule-card,
.ads-notation-card,
.ads-complexity-grid article,
.ads-interview-question-grid article {
    padding: 20px;
    border: 1px solid #d8e3ef;
    border-left: 5px solid #60a5fa;
    border-radius: 14px;
    background: #f8fbff;
}

.ads-info-panel h3,
.ads-rule-card h3,
.ads-notation-card h3 {
    margin: 0 0 10px;
    color: #173f73;
}

.ads-info-panel ul { margin-bottom: 0; padding-left: 20px; }
.ads-info-panel li { margin: 7px 0; }
.ads-info-panel.purple-panel { border-left-color: #8b5cf6; background: #faf7ff; }

.ads-table-wrap {
    overflow-x: auto;
    margin-top: 20px;
    border: 1px solid #d8e3ef;
    border-radius: 14px;
}

.ads-data-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

.ads-data-table th,
.ads-data-table td {
    padding: 15px 16px;
    border-right: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
}

.ads-data-table th {
    background: #1c477c;
    color: #ffffff;
    font-size: 14px;
}

.ads-data-table tbody tr:nth-child(even) { background: #f8fafc; }
.ads-data-table tr:last-child td { border-bottom: 0; }
.ads-data-table th:last-child,
.ads-data-table td:last-child { border-right: 0; }

.ads-example-box {
    margin-top: 18px;
    padding: 22px;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #60a5fa;
    border-radius: 14px;
    background: #f8fbff;
}

.ads-example-box.alt-example {
    border-color: #ddd6fe;
    border-left-color: #8b5cf6;
    background: #faf7ff;
}

.ads-example-box h3 { margin: 0 0 12px; color: #123f78; }
.ads-label-accent { color: #b45309; }
.ads-complexity-result { color: #047857; font-weight: 800; }

.ads-rule-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ads-rule-card.green-rule { border-left-color: #16a34a; background: #f0fdf4; }
.ads-rule-card.gold-rule { border-left-color: #d4af37; background: #fffbeb; }
.ads-rule-card.red-rule { border-left-color: #dc2626; background: #fef2f2; }

.ads-notation-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ads-notation-card > span {
    display: inline-block;
    margin-bottom: 12px;
    padding: 7px 11px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-weight: 900;
}
.ads-notation-card.omega { border-left-color: #8b5cf6; background: #faf7ff; }
.ads-notation-card.theta { border-left-color: #16a34a; background: #f0fdf4; }

.ads-badge {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
}
.ads-badge.excellent { background: #dcfce7; color: #15803d; }
.ads-badge.good { background: #dbeafe; color: #1d4ed8; }
.ads-badge.caution { background: #fef3c7; color: #a16207; }
.ads-badge.poor { background: #fee2e2; color: #b91c1c; }

.ads-rule-list {
    display: grid;
    gap: 13px;
    margin-top: 18px;
}

.ads-rule-list article {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 17px 19px;
    border: 1px solid #d8e3ef;
    border-radius: 12px;
    background: #f8fafc;
}

.ads-rule-list article > span {
    display: grid;
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-weight: 900;
}

.ads-rule-list h3 { margin: 0 0 5px; color: #173f73; }
.ads-rule-list p { margin: 0; }

.ads-explorer-controls {
    display: grid;
    grid-template-columns: 0.7fr 1.3fr auto;
    gap: 14px;
    align-items: end;
    margin-top: 20px;
}

.ads-explorer-controls label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-weight: 800;
}

.ads-explorer-controls input,
.ads-explorer-controls select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
}

.ads-example-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 14px;
}

.ads-example-chips button {
    padding: 8px 11px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #f8fbff;
    color: #1e40af;
    font-weight: 700;
    cursor: pointer;
}

.ads-explorer-prompt { border: 1px solid #bfdbfe; background: #eff6ff; color: #1e3a8a; }
.ads-explorer-result { margin-top: 18px; }
.ads-explorer-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.ads-explorer-summary > div {
    padding: 16px;
    border: 1px solid #d8e3ef;
    border-radius: 12px;
    background: #f8fafc;
    text-align: center;
}
.ads-explorer-summary span { display: block; margin-bottom: 7px; color: #64748b; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.ads-explorer-summary strong { color: #123f78; font-size: 18px; }
.ads-explorer-explanation { padding: 15px 17px; border-left: 5px solid #d4af37; background: #fffbeb; color: #854d0e; }

.ads-growth-bars { display: grid; gap: 10px; margin-top: 16px; }
.ads-growth-row {
    display: grid;
    grid-template-columns: 90px minmax(120px, 1fr) 130px;
    gap: 12px;
    align-items: center;
    padding: 9px;
    border-radius: 9px;
}
.ads-growth-row.selected-growth-row { background: #eff6ff; }
.ads-growth-label { color: #173f73; font-weight: 900; }
.ads-growth-track { overflow: hidden; height: 16px; border-radius: 999px; background: #e2e8f0; }
.ads-growth-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2563eb, #8b5cf6); }
.ads-growth-row strong { color: #334155; font-size: 13px; text-align: right; }

.ads-io-grid > div {
    padding: 18px;
    border: 1px solid #d8e3ef;
    border-radius: 13px;
    background: #f8fafc;
}
.ads-io-grid h3 { margin-top: 0; color: #173f73; }
.ads-complexity-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ads-complexity-grid article span { display: block; color: #64748b; font-size: 12px; font-weight: 800; text-transform: uppercase; }
.ads-complexity-grid article strong { display: block; margin: 8px 0; color: #047857; }
.ads-complexity-grid article p { margin: 0; }

.ads-interview-question-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ads-interview-question-grid article { display: flex; align-items: center; gap: 12px; }
.ads-interview-question-grid article > span { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: #173f73; color: #ffffff; font-weight: 900; }
.ads-interview-question-grid p { margin: 0; font-weight: 700; }

.ads-practice-note { margin-bottom: 20px; }
.ads-practice-list { display: grid; gap: 16px; }
.ads-practice-problem {
    padding: 22px;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #60a5fa;
    border-radius: 14px;
    background: #f8fbff;
}
.ads-practice-problem.alt-practice { border-color: #ddd6fe; border-left-color: #8b5cf6; background: #faf7ff; }
.ads-practice-problem h3 { margin: 0; color: #123f78; font-size: 17px; }
.ads-practice-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 15px; }
.ads-practice-actions button {
    padding: 10px 15px;
    border: 0;
    border-radius: 9px;
    background: #64748b;
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}
.ads-practice-actions button:last-child { background: #2563eb; }
.ads-practice-actions button:hover { filter: brightness(0.94); }
.ads-hint-box,
.ads-solution-box { margin-top: 15px; padding: 16px 18px; border-radius: 10px; line-height: 1.65; }
.ads-hint-box { border: 1px solid #f6d365; border-left: 5px solid #d4af37; background: #fffbeb; color: #854d0e; }
.ads-solution-box { border: 1px solid #86efac; border-left: 5px solid #16a34a; background: #f0fdf4; color: #166534; }

.ads-topic-navigation {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin: 30px 0 12px;
}
.ads-topic-navigation a,
.ads-topic-navigation span {
    padding: 13px 17px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-weight: 800;
    text-decoration: none;
}
.ads-topic-navigation .previous-topic { background: #e2e8f0; color: #334155; }
.ads-topic-navigation .next-topic { background: #dbeafe; color: #1d4ed8; }
.ads-topic-navigation .disabled-topic { background: #f1f5f9; color: #94a3b8; }

@media (max-width: 1050px) {
    .ads-rule-grid,
    .ads-notation-grid,
    .ads-complexity-grid { grid-template-columns: 1fr; }
    .ads-explorer-controls { grid-template-columns: 1fr 1fr; }
    .ads-explorer-controls .primary-button { width: fit-content; }
}

@media (max-width: 700px) {
    .ads-topic-hero { padding: 28px 22px; }
    .ads-lesson-section { padding: 22px 18px; }
    .ads-comparison-grid,
    .ads-io-grid,
    .ads-interview-question-grid,
    .ads-explorer-summary { grid-template-columns: 1fr; }
    .ads-explorer-controls { grid-template-columns: 1fr; }
    .ads-growth-row { grid-template-columns: 65px 1fr; }
    .ads-growth-row strong { grid-column: 2; text-align: left; }
    .ads-topic-navigation { flex-direction: column; }
}

/* =========================================
   LEVEL 9 — DISJOINT SETS / UNION-FIND
   ========================================= */

.ads-set-example {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
    padding: 22px;
    border: 1px solid #c7d2fe;
    border-radius: 14px;
    background: linear-gradient(135deg, #eff6ff, #f5f3ff);
}

.ads-set-example span {
    padding: 10px 15px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #ffffff;
    color: #173f73;
    font-weight: 900;
}

.ads-application-grid,
.ads-operation-grid,
.ads-optimization-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.ads-application-grid article,
.ads-operation-grid article,
.ads-optimization-grid article,
.ads-mistake-grid article {
    padding: 20px;
    border: 1px solid #d8e3ef;
    border-left: 5px solid #60a5fa;
    border-radius: 14px;
    background: #f8fbff;
}

.ads-application-grid article:nth-child(even),
.ads-mistake-grid article:nth-child(even) {
    border-left-color: #8b5cf6;
    background: #faf7ff;
}

.ads-application-grid article > span {
    display: block;
    margin-bottom: 8px;
    font-size: 28px;
}

.ads-application-grid h3,
.ads-operation-grid h3,
.ads-optimization-grid h3,
.ads-mistake-grid h3 {
    margin: 0 0 9px;
    color: #173f73;
}

.ads-application-grid p,
.ads-operation-grid p,
.ads-optimization-grid p,
.ads-mistake-grid p { margin-bottom: 0; }

.ads-operation-grid article {
    position: relative;
    padding-top: 58px;
}

.ads-operation-grid article > span {
    position: absolute;
    top: 16px;
    left: 18px;
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-weight: 900;
}

.ads-operation-grid .find-operation {
    border-left-color: #8b5cf6;
    background: #faf7ff;
}

.ads-operation-grid .find-operation > span { background: #7c3aed; }
.ads-operation-grid .union-operation {
    border-left-color: #16a34a;
    background: #f0fdf4;
}
.ads-operation-grid .union-operation > span { background: #16a34a; }

.ads-operation-grid code {
    display: inline-block;
    margin-top: 12px;
    padding: 7px 10px;
    border-radius: 7px;
    background: #0f172a;
    color: #e2e8f0;
}

.ads-forest-demo {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 22px;
    margin-top: 22px;
    padding: 24px;
    border: 1px solid #d8e3ef;
    border-radius: 14px;
    background: #f8fafc;
}

.ads-demo-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border: 1px solid #dbeafe;
    border-radius: 12px;
    background: #ffffff;
}

.ads-demo-tree strong { color: #173f73; }
.tree-branch { display: flex; justify-content: center; gap: 46px; }
.tree-branch.child-branch { margin-left: 75px; }

.dsu-node {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 3px solid #60a5fa;
    border-radius: 50%;
    background: #eff6ff;
    color: #173f73;
    font-weight: 900;
}

.dsu-node.root-node {
    border-color: #d4af37;
    background: #fffbeb;
    color: #854d0e;
}

.ads-step-flow {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.ads-step-flow article {
    padding: 17px;
    border: 1px solid #d8e3ef;
    border-radius: 12px;
    background: #f8fafc;
}

.ads-step-flow span {
    display: inline-block;
    margin-bottom: 9px;
    color: #2563eb;
    font-size: 12px;
    font-weight: 900;
}

.ads-step-flow p { margin: 0; }

.ads-worked-example {
    margin-top: 20px;
    padding: 18px 20px;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #2563eb;
    border-radius: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #f8fbff 100%);
    color: #1e3a5f;
}

.ads-worked-example > strong {
    display: block;
    margin-bottom: 7px;
    color: #1d4ed8;
    font-size: 15px;
}

.ads-worked-example p { margin: 0; }

.ads-algorithm-block {
    margin-top: 20px;
    padding: 20px 22px;
    border: 1px solid #ddd6fe;
    border-left: 5px solid #8b5cf6;
    border-radius: 13px;
    background: #faf7ff;
}

.ads-algorithm-block h3 {
    margin: 0 0 14px;
    color: #4c1d95;
}

.ads-algorithm-list {
    margin: 0;
    padding-left: 26px;
    color: #1e293b;
    line-height: 1.7;
}

.ads-algorithm-list li { margin: 8px 0; padding-left: 5px; }
.ads-algorithm-list li::marker { color: #7c3aed; font-weight: 900; }

.ads-program-details {
    overflow: hidden;
    margin-top: 22px;
    border: 1px solid #cbd5e1;
    border-left: 5px solid #16a34a;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.ads-program-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 17px 20px;
    background: #f0fdf4;
    color: #065f46;
    font-weight: 900;
    cursor: pointer;
    list-style: none;
}

.ads-program-details summary::-webkit-details-marker { display: none; }
.ads-program-details summary small {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 999px;
    background: #16a34a;
    color: #ffffff;
    font-size: 11px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.ads-program-details[open] summary { border-bottom: 1px solid #bbf7d0; }
.ads-program-details[open] summary small::before { content: "Close "; }
.ads-program-details[open] summary small { font-size: 0; }
.ads-program-details[open] summary small::before { font-size: 11px; }

.ads-program-body { padding: 20px; }
.ads-program-body > p { margin-top: 0; color: #475569; }

.ads-program-body > pre {
    overflow: auto;
    max-height: 520px;
    margin: 16px 0 0;
    padding: 20px;
    border: 1px solid #263650;
    border-radius: 12px;
    background: #0f172a;
    color: #f8fafc;
    font: 15px/1.65 Consolas, Monaco, "Courier New", monospace;
    tab-size: 4;
}

.ads-program-body > pre code { color: inherit; font: inherit; }
.ads-program-body .ads-io-grid pre {
    overflow-x: auto;
    margin-bottom: 0;
    padding: 14px;
    border-radius: 9px;
    background: #0f172a;
    color: #f8fafc;
}

.ads-program-link-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 22px;
    padding: 18px 20px;
    border: 1px solid #bbf7d0;
    border-left: 5px solid #16a34a;
    border-radius: 13px;
    background: #f0fdf4;
}

.ads-program-link-panel strong { color: #065f46; }
.ads-program-link-panel p { margin: 5px 0 0; color: #475569; }
.ads-program-link-panel a {
    flex: 0 0 auto;
    padding: 10px 14px;
    border-radius: 9px;
    background: #2563eb;
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
}

.ads-program-link-panel a:hover { background: #1d4ed8; }

.ads-optimization-grid .rank-card { border-left-color: #2563eb; }
.ads-optimization-grid .size-card { border-left-color: #8b5cf6; background: #faf7ff; }
.ads-optimization-grid .compression-card { border-left-color: #16a34a; background: #f0fdf4; }

.ads-optimization-grid pre {
    margin: 15px 0 0;
    font-size: 13px;
}

.ads-mistake-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.disjoint-sets-page .ads-complexity-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.dsu-init-controls {
    display: grid;
    grid-template-columns: minmax(200px, 320px) auto;
    align-items: end;
    gap: 14px;
    margin-top: 20px;
}

.dsu-init-controls label,
.dsu-action-controls label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-weight: 800;
}

.dsu-init-controls input,
.dsu-action-controls select {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
}

.dsu-explorer-workspace { margin-top: 20px; }

.dsu-action-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(100px, 0.5fr)) repeat(4, auto);
    align-items: end;
    gap: 10px;
    padding: 18px;
    border: 1px solid #d8e3ef;
    border-radius: 14px;
    background: #f8fafc;
}

.dsu-action-controls button {
    min-height: 46px;
    white-space: nowrap;
}

.dsu-action-controls .reset-button {
    padding: 12px 15px;
    border: 0;
    border-radius: 9px;
    background: #64748b;
    color: #ffffff;
    font-weight: 800;
    cursor: pointer;
}

.dsu-action-message {
    margin-top: 14px;
    padding: 15px 17px;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #2563eb;
    border-radius: 10px;
    background: #eff6ff;
    color: #1e3a8a;
    font-weight: 700;
}

.dsu-action-message.success-message { border-color: #86efac; border-left-color: #16a34a; background: #f0fdf4; color: #166534; }
.dsu-action-message.warning-message { border-color: #fecaca; border-left-color: #dc2626; background: #fef2f2; color: #991b1b; }
.dsu-action-message.find-message { border-color: #c4b5fd; border-left-color: #7c3aed; background: #f5f3ff; color: #5b21b6; }
.dsu-action-message.neutral-message { border-color: #f7d66d; border-left-color: #d4af37; background: #fffbeb; color: #854d0e; }

.dsu-state-grid {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 16px;
    margin-top: 18px;
}

.dsu-state-grid > div,
.dsu-forest-panel,
.dsu-history-panel {
    padding: 18px;
    border: 1px solid #d8e3ef;
    border-radius: 14px;
    background: #ffffff;
}

.dsu-state-grid h3,
.dsu-forest-panel h3,
.dsu-history-panel h3 {
    margin: 0 0 14px;
    color: #173f73;
}

.dsu-set-groups,
.dsu-array-view {
    display: grid;
    gap: 9px;
}

.dsu-set-card,
.dsu-array-cell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 13px;
    border: 1px solid #dbeafe;
    border-radius: 9px;
    background: #f8fbff;
}

.dsu-set-card span,
.dsu-array-cell span { color: #64748b; font-size: 12px; font-weight: 800; }
.dsu-set-card strong,
.dsu-array-cell strong { color: #173f73; }
.dsu-array-cell.root-cell { border-color: #f3d68a; background: #fffbeb; }

.dsu-forest-panel,
.dsu-history-panel { margin-top: 16px; }

.dsu-forest-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.dsu-visual-tree {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 128px;
    padding: 16px;
    border: 1px solid #c7d2fe;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbff, #f5f3ff);
}

.dsu-visual-root {
    display: grid;
    width: 45px;
    height: 45px;
    place-items: center;
    border: 3px solid #d4af37;
    border-radius: 50%;
    background: #fffbeb;
    color: #854d0e;
    font-weight: 900;
}

.dsu-visual-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
}

.dsu-visual-links span {
    padding: 6px 9px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #ffffff;
    color: #1e40af;
    font-size: 12px;
    font-weight: 800;
}

.dsu-visual-links .singleton-label { color: #64748b; }
.dsu-history-panel ol { margin: 0; padding-left: 24px; }
.dsu-history-panel li { margin: 9px 0; padding-left: 4px; line-height: 1.55; }

@media (max-width: 1150px) {
    .ads-application-grid,
    .ads-operation-grid,
    .ads-optimization-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dsu-action-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 850px) {
    .ads-step-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dsu-state-grid,
    .ads-forest-demo { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .ads-application-grid,
    .ads-operation-grid,
    .ads-optimization-grid,
    .ads-mistake-grid,
    .ads-step-flow,
    .dsu-init-controls,
    .dsu-action-controls { grid-template-columns: 1fr; }
    .dsu-init-controls .primary-button,
    .dsu-action-controls button { width: 100%; }
    .dsu-set-card,
    .dsu-array-cell { align-items: flex-start; flex-direction: column; }
}

/* =========================================
   DSA-STYLE PREMIUM VISUALIZER + TRACING
   ========================================= */

.ads-premium-viz {
    overflow: hidden;
    margin-bottom: 26px;
    border: 1px solid #cbd5e1;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.ads-premium-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 17px 20px;
    border-bottom: 1px solid #dbe4ef;
    background: #ffffff;
}

.ads-premium-label {
    color: #2563eb;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.14em;
}

.ads-premium-header h2 {
    margin: 6px 0 0;
    color: #123f78;
    font-size: clamp(20px, 1.7vw, 24px);
}

.ads-premium-brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0;
    color: inherit;
    font-size: 22px;
    font-weight: 900;
    text-decoration: none;
}

.ads-premium-brand img {
    width: 40px;
    height: 40px;
    margin-right: 6px;
    padding: 4px;
    border: 1px solid #d8e3ef;
    border-radius: 11px;
    background: #ffffff;
    object-fit: contain;
    box-shadow: 0 7px 16px rgba(15, 23, 42, 0.08);
}

.ads-premium-brand .brand-code { color: #2563eb; }
.ads-premium-brand .brand-bhavya { color: #f59e0b; }

/* Compact visualizer heading used by the combined Level 13 visualizer. */
.ads-interactive-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.ads-interactive-header > div:first-child {
    min-width: 0;
}

.ads-visualizer-brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0;
    margin-left: auto;
    color: inherit;
    font-size: 22px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
}

.ads-visualizer-brand img {
    display: block;
    width: 40px;
    height: 40px;
    max-width: 40px;
    margin: 0 6px 0 0;
    padding: 4px;
    border: 1px solid #d8e3ef;
    border-radius: 11px;
    background: #ffffff;
    object-fit: contain;
    box-shadow: 0 7px 16px rgba(15, 23, 42, 0.08);
}

.ads-visualizer-brand span {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.ads-visualizer-brand b,
.ads-visualizer-brand strong {
    margin: 0;
    font: inherit;
}

.ads-visualizer-brand b { color: #2563eb; }
.ads-visualizer-brand strong { color: #f59e0b; }

.ads-premium-body {
    padding: 28px;
    border-left: 5px solid #2563eb;
    background: linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
}

.ads-tracer-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    padding: 13px 18px;
    border: 0;
    border-radius: 10px;
    background: #2563eb;
    color: #ffffff;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.ads-tracer-toggle:hover { background: #1d4ed8; }

.ads-tracer {
    overflow: hidden;
    margin: 16px 0 0;
    border: 1px solid #334155;
    border-radius: 14px;
    background: #0f172a;
    color: #ffffff;
}

.ads-tracer-title {
    padding: 14px 17px;
    border-bottom: 1px solid #334155;
    color: #f6d76b;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.15em;
}

.ads-tracer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ads-tracer-panel {
    min-width: 0;
    padding: 14px;
    border-right: 1px solid #334155;
}

.ads-tracer-panel:last-child { border-right: 0; }
.ads-tracer-panel h3 { margin: 0 0 12px; color: #ffffff; font-size: 16px; }
.ads-tracer-live-panel > h3:not(:first-child) { margin-top: 12px; }

.ads-tracer-code,
.ads-trace-output {
    overflow: auto;
    margin: 0;
    border: 1px solid #3b4c65;
    border-radius: 10px;
    background: #020617;
    color: #f8fafc;
    font: 13px/1.6 Consolas, Monaco, "Courier New", monospace;
    white-space: pre;
}

.ads-tracer-code {
    position: relative;
    height: 270px;
    min-height: 0;
    max-height: 270px;
    padding: 12px 8px;
    overflow-y: auto;
    scrollbar-color: #64748b #111c2f;
    scrollbar-width: thin;
}

.ads-tracer-code::-webkit-scrollbar { width: 10px; height: 10px; }
.ads-tracer-code::-webkit-scrollbar-track { background: #111c2f; }
.ads-tracer-code::-webkit-scrollbar-thumb { border: 2px solid #111c2f; border-radius: 999px; background: #64748b; }
.ads-tracer-code::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

.ads-tracer-code code {
    display: flex;
    min-width: max-content;
    flex-direction: column;
}
.ads-tracer-code span { display: block; padding: 0 9px; border-left: 4px solid transparent; }
.ads-tracer-code span.is-active-line {
    border-left-color: #f6d76b;
    border-radius: 4px;
    background: #25466f;
    color: #ffffff;
}

.ads-tracer-explain {
    min-height: 58px;
    padding: 12px 13px;
    border-left: 5px solid #38bdf8;
    border-radius: 8px;
    background: #172033;
    color: #e2e8f0;
    line-height: 1.55;
}

.ads-trace-vars {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.ads-trace-vars > div {
    min-width: 0;
    padding: 10px;
    border: 1px solid #334155;
    border-radius: 9px;
    background: #111c2f;
}

.ads-trace-vars span,
.ads-trace-array > span {
    display: block;
    margin-bottom: 5px;
    color: #93c5fd;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ads-trace-vars strong { overflow-wrap: anywhere; color: #ffffff; }
.ads-trace-output { min-height: 70px; padding: 11px; }

.ads-trace-array {
    margin-top: 8px;
    padding: 10px;
    border: 1px solid #334155;
    border-radius: 9px;
    background: #111c2f;
}

.ads-trace-array code {
    display: block;
    overflow-x: auto;
    color: #f8fafc;
    font: 13px/1.55 Consolas, Monaco, "Courier New", monospace;
    white-space: nowrap;
}

.ads-tracer-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    border-top: 1px solid #334155;
}

.ads-tracer-controls button {
    padding: 9px 13px;
    border: 0;
    border-radius: 9px;
    color: #ffffff;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
}

.ads-tracer-controls button:disabled { cursor: not-allowed; opacity: 0.46; }
.ads-tracer-controls .trace-previous,
.ads-tracer-controls .trace-reset { background: #64748b; }
.ads-tracer-controls .trace-next { background: #2563eb; }
.ads-tracer-controls .trace-auto { background: #159447; }
.ads-tracer-controls .trace-pause { background: #ea7800; }

.ads-tracer-status {
    margin: 0;
    padding: 0 16px 13px;
    color: #b8c5d8;
    font-size: 13px;
    font-weight: 800;
}

@media (max-width: 900px) {
    .ads-premium-header { align-items: flex-start; flex-direction: column; }
    .ads-interactive-header { align-items: flex-start; flex-direction: column; }
    .ads-visualizer-brand { margin-left: 0; }
    .ads-tracer-grid { grid-template-columns: 1fr; }
    .ads-tracer-panel { border-right: 0; border-bottom: 1px solid #334155; }
    .ads-tracer-panel:last-child { border-bottom: 0; }
    .ads-tracer-code { height: 245px; max-height: 245px; }
    .ads-trace-vars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .ads-premium-header { padding: 16px; }
    .ads-premium-body { padding: 20px 17px; }
    .ads-premium-brand { font-size: 20px; }
    .ads-premium-brand img { width: 40px; height: 40px; }
    .ads-visualizer-brand { font-size: 20px; }
    .ads-visualizer-brand img { width: 38px; height: 38px; max-width: 38px; }
    .ads-trace-vars { grid-template-columns: 1fr; }
    .ads-tracer-controls button { flex: 1 1 135px; }
}

/* =========================================
   LEVEL 11 — STRING PATTERN MATCHING
   ========================================= */

.string-search-controls {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) minmax(160px, 1fr) minmax(160px, 0.8fr) auto;
    gap: 12px;
    align-items: end;
    margin: 18px 0 12px;
}

.string-search-controls label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.string-search-controls input,
.string-search-controls select {
    min-width: 0;
    height: 46px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    font: 16px/1.2 Consolas, Monaco, "Courier New", monospace;
    text-transform: none;
}

.string-search-controls .primary-button { min-height: 46px; white-space: nowrap; }
.string-visualizer-result { margin-top: 17px; }

.string-viz-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(270px, 0.75fr);
    gap: 14px;
}

.string-sequence-panel,
.string-stat-panel {
    min-width: 0;
    padding: 16px;
    border: 1px solid #d9e4f0;
    border-radius: 13px;
    background: #f8fafc;
}

.string-sequence-panel h3,
.string-stat-panel h3 { margin: 0 0 13px; color: #123f78; }

.string-row-label {
    margin: 10px 0 5px;
    color: #64748b;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
}

.string-sequence-row {
    display: grid;
    grid-auto-columns: 42px;
    grid-auto-flow: column;
    justify-content: start;
    gap: 5px;
    min-height: 47px;
    overflow-x: auto;
    padding: 2px 2px 7px;
}

.string-cell {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 2px solid #cbd5e1;
    border-radius: 9px;
    background: #ffffff;
    color: #102a51;
    font: 900 17px/1 Consolas, Monaco, "Courier New", monospace;
    transition: 0.18s ease;
}

.string-cell.is-placeholder { border-color: transparent; background: transparent; }
.string-cell.is-current { border-color: #2563eb; background: #dbeafe; color: #1d4ed8; transform: translateY(-2px); }
.string-cell.is-mismatch { border-color: #ef4444; background: #fee2e2; color: #b91c1c; }
.string-cell.is-found { border-color: #22c55e; background: #dcfce7; color: #08783f; }

.ads-explorer-message {
    min-height: 56px;
    margin-top: 14px;
    padding: 13px 15px;
    border-left: 5px solid #2563eb;
    border-radius: 9px;
    background: #eaf3ff;
    color: #17345f;
    font-weight: 800;
    line-height: 1.55;
}

.ads-progress-track {
    overflow: hidden;
    height: 8px;
    margin-top: 12px;
    border-radius: 999px;
    background: #dbe4ef;
}

.ads-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #7c3aed, #e3b221);
    transition: width 0.2s ease;
}

.string-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.string-stat-grid > div,
.string-match-box {
    padding: 11px;
    border: 1px solid #d7e2ee;
    border-radius: 10px;
    background: #ffffff;
}

.string-stat-grid span,
.string-match-box span {
    display: block;
    margin-bottom: 5px;
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.string-stat-grid strong,
.string-match-box strong { color: #102a51; overflow-wrap: anywhere; }
.string-match-box { margin-top: 9px; }
.string-visual-controls { margin-top: 14px; border: 1px solid #d9e4f0; border-bottom: 0; border-radius: 11px 11px 0 0; }
.string-visualizer-result .ads-tracer-status { padding-top: 11px; border: 1px solid #d9e4f0; border-top: 0; border-radius: 0 0 11px 11px; background: #f8fafc; }

@media (max-width: 1050px) {
    .string-search-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .string-search-controls .primary-button { width: 100%; }
}

@media (max-width: 820px) {
    .string-viz-layout { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .string-search-controls { grid-template-columns: 1fr; }
    .string-sequence-row { grid-auto-columns: 36px; }
    .string-cell { width: 36px; height: 36px; font-size: 15px; }
    .string-stat-grid { grid-template-columns: 1fr; }
}

/* =========================================
   LEVEL 12 — ADVANCED SORTING
   ========================================= */

.sorting-controls,
.program-tracer-loader {
    display: grid;
    grid-template-columns: minmax(280px, 1.6fr) minmax(190px, 0.8fr) auto;
    gap: 12px;
    align-items: end;
    margin: 18px 0 12px;
}

.sorting-controls label,
.program-tracer-loader label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 900;
    text-transform: uppercase;
}

.sorting-controls input,
.sorting-controls select,
.program-tracer-loader input,
.program-tracer-loader select {
    min-width: 0;
    height: 46px;
    padding: 0 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    font: 16px/1.2 Consolas, Monaco, "Courier New", monospace;
    text-transform: none;
}

.sorting-controls .primary-button,
.program-tracer-loader .primary-button { min-height: 46px; white-space: nowrap; }

.advanced-searching-page .sorting-controls,
.advanced-searching-page .program-tracer-loader {
    grid-template-columns: minmax(250px, 1.45fr) minmax(105px, 0.42fr) minmax(185px, 0.72fr) auto;
}
.sorting-visualizer-result { margin-top: 17px; }

.program-tracer-help {
    margin: -2px 0 12px;
    color: #64748b;
    font-size: 13px;
}

#programTraceResult { margin-top: 17px; }
.program-tracer-code span { position: relative; padding-left: 12px; }

.program-trace-array {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    min-height: 53px;
    padding: 10px;
    border: 1px solid #334155;
    border-radius: 9px;
    background: #111c2f;
}

.program-trace-array span {
    display: grid;
    min-width: 42px;
    min-height: 38px;
    place-items: center;
    padding: 7px 9px;
    border: 2px solid #475569;
    border-radius: 8px;
    background: #0f172a;
    color: #f8fafc;
    font: 900 13px/1 Consolas, Monaco, "Courier New", monospace;
    transition: 0.18s ease;
}

.program-trace-array span.is-active-value {
    border-color: #f6d76b;
    background: #25466f;
    color: #ffffff;
    transform: translateY(-2px);
}

.program-trace-array span.is-pivot-value {
    border-color: #c4b5fd;
    background: #5b21b6;
}

.sorting-viz-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(260px, 0.7fr);
    gap: 14px;
}

.sorting-bars-panel,
.sorting-stat-panel {
    min-width: 0;
    padding: 16px;
    border: 1px solid #d9e4f0;
    border-radius: 13px;
    background: #f8fafc;
}

.sorting-bars-panel h3,
.sorting-stat-panel h3 { margin: 0 0 13px; color: #123f78; }

.sorting-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 7px;
    min-height: 235px;
    overflow-x: auto;
    padding: 16px 8px 8px;
    border: 1px solid #dce6f1;
    border-radius: 11px;
    background: linear-gradient(180deg, #ffffff, #eef5fd);
}

.sorting-bar-wrap {
    display: grid;
    flex: 0 0 48px;
    justify-items: center;
    gap: 5px;
}

.sorting-bar {
    display: block;
    width: 37px;
    min-height: 34px;
    border: 2px solid #7db7f3;
    border-radius: 8px 8px 4px 4px;
    background: linear-gradient(180deg, #60a5fa, #2563eb);
    box-shadow: 0 6px 12px rgba(37, 99, 235, 0.16);
    transition: height 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.sorting-bar.is-active { border-color: #e3aa16; background: linear-gradient(180deg, #fde68a, #e3a414); transform: translateY(-4px); }
.sorting-bar.is-pivot { border-color: #7c3aed; background: linear-gradient(180deg, #c4b5fd, #7c3aed); }
.sorting-bar.is-sorted { border-color: #16a34a; background: linear-gradient(180deg, #86efac, #16a34a); }
.sorting-bar-wrap strong { color: #102a51; font-size: 13px; }
.sorting-bar-wrap small { color: #64748b; font-size: 10px; }

.sorting-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
}

.sorting-stat-grid > div {
    min-width: 0;
    padding: 12px;
    border: 1px solid #d7e2ee;
    border-radius: 10px;
    background: #ffffff;
}

.sorting-stat-grid span {
    display: block;
    margin-bottom: 5px;
    color: #64748b;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.sorting-stat-grid strong { color: #102a51; overflow-wrap: anywhere; }
.sorting-visual-controls { margin-top: 14px; border: 1px solid #d9e4f0; border-bottom: 0; border-radius: 11px 11px 0 0; }
.sorting-visualizer-result .ads-tracer-status { padding-top: 11px; border: 1px solid #d9e4f0; border-top: 0; border-radius: 0 0 11px 11px; background: #f8fafc; }

@media (max-width: 950px) {
    .sorting-controls,
    .program-tracer-loader { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sorting-controls .primary-button,
    .program-tracer-loader .primary-button { width: 100%; }
    .sorting-viz-layout { grid-template-columns: 1fr; }
}

@media (max-width: 1120px) {
    .advanced-searching-page .sorting-controls,
    .advanced-searching-page .program-tracer-loader {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .sorting-controls,
    .program-tracer-loader { grid-template-columns: 1fr; }
    .sorting-bars { justify-content: flex-start; min-height: 210px; }
    .sorting-bar-wrap { flex-basis: 42px; }
    .sorting-bar { width: 32px; }
    .sorting-stat-grid { grid-template-columns: 1fr; }
    .program-trace-array span { min-width: 38px; min-height: 36px; }
}

/* =========================================
   LEVEL 10 — SPARSE MATRICES
   ========================================= */

.sparse-matrix-demo {
    display: grid;
    grid-template-columns: repeat(var(--matrix-columns, 5), minmax(44px, 64px));
    justify-content: center;
    gap: 8px;
    margin: 22px auto;
}

.sparse-matrix-demo > span,
.sparse-matrix-cell {
    display: grid;
    min-height: 48px;
    place-items: center;
    border: 1px solid #d8e3ef;
    border-radius: 9px;
    background: #f8fafc;
    color: #64748b;
    font-weight: 800;
}

.sparse-matrix-demo .non-zero-cell,
.sparse-matrix-cell.non-zero-cell {
    border-color: #60a5fa;
    background: #dbeafe;
    color: #1d4ed8;
    box-shadow: 0 5px 12px rgba(37, 99, 235, 0.12);
}

.sparse-example-table .sparse-header-row td {
    background: #fffbeb;
    color: #854d0e;
    font-weight: 900;
}

.sparse-array-stack {
    display: grid;
    gap: 12px;
    margin-top: 20px;
}

.sparse-array-stack > div {
    display: grid;
    grid-template-columns: 140px minmax(220px, 1fr) 1.2fr;
    align-items: center;
    gap: 14px;
    padding: 15px 17px;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #2563eb;
    border-radius: 11px;
    background: #f8fbff;
}

.sparse-array-stack.purple-stack > div { border-color: #ddd6fe; border-left-color: #8b5cf6; background: #faf7ff; }
.sparse-array-stack span { color: #173f73; font-weight: 900; }
.sparse-array-stack code { overflow-x: auto; color: #1d4ed8; font-weight: 800; white-space: nowrap; }
.sparse-array-stack p { margin: 0; color: #64748b; }

.sparse-operation-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.sparse-input-grid {
    display: grid;
    grid-template-columns: 160px 160px minmax(300px, 1fr) auto;
    align-items: end;
    gap: 14px;
    margin-top: 20px;
}

.sparse-input-grid label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-weight: 800;
}

.sparse-input-grid input,
.sparse-input-grid textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    font: inherit;
}

.sparse-input-grid textarea {
    min-height: 118px;
    resize: vertical;
    font-family: Consolas, Monaco, "Courier New", monospace;
    line-height: 1.55;
}

.sparse-visualizer-result { margin-top: 20px; }
.sparse-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sparse-summary strong { font-size: 16px; }

.sparse-result-grid,
.sparse-format-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.sparse-result-grid > section,
.sparse-format-grid > section {
    min-width: 0;
    padding: 18px;
    border: 1px solid #d8e3ef;
    border-radius: 13px;
    background: #ffffff;
}

.sparse-result-grid h3,
.sparse-format-grid h3 { margin: 0 0 14px; color: #173f73; }
.compact-matrix { margin: 8px 0; grid-template-columns: repeat(var(--matrix-columns, 5), minmax(38px, 1fr)); }
.compact-data-table th,
.compact-data-table td { padding: 9px 10px; }

.sparse-output-array {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    margin-top: 9px;
    padding: 11px 12px;
    border-radius: 9px;
    background: #f1f5f9;
}

.sparse-output-array span { color: #475569; font-size: 12px; font-weight: 900; text-transform: uppercase; }
.sparse-output-array code { overflow-x: auto; color: #1d4ed8; font-weight: 800; white-space: nowrap; }

@media (max-width: 1100px) {
    .sparse-input-grid { grid-template-columns: 1fr 1fr; }
    .sparse-matrix-input-label { grid-column: 1 / -1; }
    .sparse-input-grid .primary-button { width: fit-content; }
    .sparse-operation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 750px) {
    .sparse-array-stack > div { grid-template-columns: 1fr; }
    .sparse-result-grid,
    .sparse-format-grid,
    .sparse-summary,
    .sparse-operation-grid { grid-template-columns: 1fr; }
    .sparse-matrix-demo { grid-template-columns: repeat(var(--matrix-columns, 5), minmax(34px, 1fr)); }

    .ads-program-link-panel { align-items: stretch; flex-direction: column; }
    .ads-program-link-panel a { align-self: flex-start; }
}

@media (max-width: 520px) {
    .sparse-input-grid { grid-template-columns: 1fr; }
    .sparse-matrix-input-label { grid-column: auto; }
    .sparse-input-grid .primary-button { width: 100%; }
    .sparse-output-array { grid-template-columns: 1fr; }
    .sparse-matrix-demo { gap: 5px; }
    .sparse-matrix-demo > span,
    .sparse-matrix-cell { min-height: 38px; font-size: 13px; }

    .ads-program-details summary { align-items: flex-start; flex-direction: column; gap: 10px; }
    .ads-program-body { padding: 14px; }
    .ads-program-body > pre { max-height: 430px; padding: 15px; font-size: 13px; }
}

/* =========================================
   LEVEL 14 — BALANCED BINARY SEARCH TREES
   ========================================= */

.balanced-controls,
.balanced-tracer-loader {
    display: grid;
    grid-template-columns: minmax(280px, 1.6fr) minmax(210px, 0.8fr) auto;
    align-items: end;
    gap: 12px;
    margin: 18px 0 12px;
}

.balanced-controls label,
.balanced-tracer-loader label {
    display: grid;
    gap: 7px;
    color: #334155;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.balanced-controls input,
.balanced-controls select,
.balanced-tracer-loader input,
.balanced-tracer-loader select {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #0f172a;
    font: 700 15px/1.3 Consolas, Monaco, "Courier New", monospace;
    text-transform: none;
}

.balanced-controls input:focus,
.balanced-controls select:focus,
.balanced-tracer-loader input:focus,
.balanced-tracer-loader select:focus {
    border-color: #2563eb;
    outline: 3px solid rgba(37, 99, 235, 0.14);
}

.balanced-controls .primary-button,
.balanced-tracer-loader .primary-button {
    min-height: 46px;
    white-space: nowrap;
}

.balanced-tree-panel {
    min-width: 0;
    padding: 16px;
    border: 1px solid #d9e4f0;
    border-radius: 13px;
    background: #f8fafc;
}

.balanced-tree-panel h3 { margin: 0 0 12px; color: #173f73; }

.balanced-tree-svg {
    display: block;
    width: 100%;
    min-height: 220px;
    max-height: 390px;
    border: 1px solid #d9e4f0;
    border-radius: 12px;
    background:
        radial-gradient(circle at top, rgba(219, 234, 254, 0.7), transparent 55%),
        #ffffff;
}

.balanced-tree-edge {
    stroke: #94a3b8;
    stroke-width: 2.2;
    stroke-linecap: round;
}

.balanced-tree-node circle {
    fill: #2563eb;
    stroke: #93c5fd;
    stroke-width: 3;
    transition: fill 0.2s ease, stroke 0.2s ease, stroke-width 0.2s ease;
}

.balanced-tree-node.is-avl circle { fill: #2563eb; }
.balanced-tree-node.is-splay circle { fill: #7c3aed; stroke: #c4b5fd; }
.balanced-tree-node.is-red circle { fill: #dc2626; stroke: #fecaca; }
.balanced-tree-node.is-black circle { fill: #0f172a; stroke: #64748b; }

.balanced-tree-node.is-active circle {
    stroke: #facc15;
    stroke-width: 5;
    filter: drop-shadow(0 0 7px rgba(250, 204, 21, 0.75));
}

.balanced-tree-key {
    fill: #ffffff;
    font-size: 15px;
    font-weight: 900;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

.balanced-tree-meta {
    fill: #475569;
    font-size: 11px;
    font-weight: 800;
    text-anchor: middle;
    pointer-events: none;
}

.balanced-tree-empty {
    fill: #64748b;
    font-size: 15px;
    font-weight: 800;
    text-anchor: middle;
}

.balanced-tree-panel .ads-explorer-message { margin-top: 12px; }
.balanced-tree-panel .ads-progress-track { margin-top: 12px; }

#balancedTraceResult { margin-top: 16px; }

#balancedTraceResult .ads-tracer-code {
    height: 350px;
    min-height: 350px;
    max-height: 350px;
    overflow: auto;
}

.balanced-trace-svg {
    min-height: 190px;
    max-height: 280px;
    border-color: #334155;
    background:
        radial-gradient(circle at top, rgba(37, 99, 235, 0.16), transparent 58%),
        #0f172a;
}

.balanced-trace-svg .balanced-tree-edge { stroke: #64748b; }
.balanced-trace-svg .balanced-tree-meta { fill: #bfdbfe; }
.balanced-trace-svg .balanced-tree-empty { fill: #94a3b8; }

.balanced-bst-page .ads-interactive-header h2 {
    margin-bottom: 7px;
    font-size: clamp(24px, 2.15vw, 33px);
}

.balanced-bst-page .ads-interactive-header p { margin: 0; }

@media (max-width: 950px) {
    .balanced-controls,
    .balanced-tracer-loader { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .balanced-controls .primary-button,
    .balanced-tracer-loader .primary-button { width: 100%; }
}

@media (max-width: 600px) {
    .balanced-controls,
    .balanced-tracer-loader { grid-template-columns: 1fr; }

    .balanced-tree-panel { padding: 11px; }
    .balanced-tree-svg { min-height: 190px; }

    #balancedTraceResult .ads-tracer-code {
        height: 310px;
        min-height: 310px;
        max-height: 310px;
    }
}

/* Final cascade overrides for the expanded Level 14 controls. */
.balanced-controls,
.balanced-tracer-loader {
    grid-template-columns: minmax(240px, 1.7fr) minmax(120px, 0.55fr) minmax(180px, 0.8fr) minmax(150px, 0.7fr) auto;
}

@media (max-width: 1180px) {
    .balanced-controls,
    .balanced-tracer-loader { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 650px) {
    .balanced-controls,
    .balanced-tracer-loader { grid-template-columns: 1fr; }
}

/* =========================================
   LEVELS 16–17 — MULTIWAY TREES AND HEAPS
   ========================================= */

.multiway-search-page .ads-lesson-section,
.heaps-page .ads-lesson-section {
    padding: 28px 30px;
    border: 1px solid #d5e1ee;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 8px 22px rgba(15, 42, 81, 0.055);
}

.multiway-search-page .ads-section-heading,
.heaps-page .ads-section-heading {
    margin-bottom: 20px;
    padding-bottom: 14px;
    border-bottom: 2px solid #e2eaf3;
}

.multiway-search-page .ads-section-heading h2,
.heaps-page .ads-section-heading h2 {
    margin: 8px 0 0;
    color: #123f78;
}

.multiway-search-page .ads-objective-list,
.heaps-page .ads-objective-list {
    display: grid;
    gap: 10px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.multiway-search-page .ads-objective-list li,
.heaps-page .ads-objective-list li {
    position: relative;
    padding: 12px 15px 12px 43px;
    border: 1px solid #d8e3ef;
    border-radius: 11px;
    background: #f8fbff;
    line-height: 1.55;
}

.multiway-search-page .ads-objective-list li::before,
.heaps-page .ads-objective-list li::before {
    content: "✓";
    position: absolute;
    top: 11px;
    left: 15px;
    color: #16a34a;
    font-weight: 900;
}

.multiway-search-page .ads-rule-grid > article,
.multiway-search-page .ads-comparison-grid > article,
.multiway-search-page .ads-decision-grid > article,
.heaps-page .ads-rule-grid > article,
.heaps-page .ads-comparison-grid > article,
.heaps-page .ads-decision-grid > article {
    min-width: 0;
    padding: 18px;
    border: 1px solid #d5e1ee;
    border-left: 5px solid #60a5fa;
    border-radius: 12px;
    background: #f8fbff;
}

.multiway-search-page .ads-rule-grid > article:nth-child(even),
.multiway-search-page .ads-comparison-grid > article:nth-child(even),
.multiway-search-page .ads-decision-grid > article:nth-child(even),
.heaps-page .ads-rule-grid > article:nth-child(even),
.heaps-page .ads-comparison-grid > article:nth-child(even),
.heaps-page .ads-decision-grid > article:nth-child(even) {
    border-left-color: #8b5cf6;
    background: #faf7ff;
}

.multiway-search-page .ads-rule-grid h3,
.multiway-search-page .ads-comparison-grid h3,
.multiway-search-page .ads-decision-grid h3,
.heaps-page .ads-rule-grid h3,
.heaps-page .ads-comparison-grid h3,
.heaps-page .ads-decision-grid h3 {
    margin: 0 0 8px;
    color: #173f73;
}

.multiway-search-page .ads-rule-grid p,
.multiway-search-page .ads-comparison-grid p,
.multiway-search-page .ads-decision-grid p,
.heaps-page .ads-rule-grid p,
.heaps-page .ads-comparison-grid p,
.heaps-page .ads-decision-grid p {
    margin-bottom: 0;
}

.multiway-search-page .ads-decision-grid,
.heaps-page .ads-decision-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.multiway-search-page .ads-algorithm-box,
.heaps-page .ads-algorithm-box {
    margin-top: 18px;
    padding: 20px 22px;
    border: 1px solid #bfdbfe;
    border-left: 5px solid #2563eb;
    border-radius: 12px;
    background: #f8fbff;
}

.multiway-search-page .ads-algorithm-box h3,
.heaps-page .ads-algorithm-box h3 {
    margin: 0 0 12px;
    color: #123f78;
}

.multiway-search-page .ads-algorithm-box ol,
.heaps-page .ads-algorithm-box ol {
    margin-bottom: 0;
    padding-left: 23px;
}

.multiway-search-page .ads-algorithm-box li,
.heaps-page .ads-algorithm-box li {
    margin: 8px 0;
    line-height: 1.55;
}

.multiway-search-page .ads-tip-box,
.multiway-search-page .ads-example-callout,
.heaps-page .ads-tip-box,
.heaps-page .ads-example-callout {
    margin-top: 18px;
    padding: 17px 19px;
    border: 1px solid #f6d365;
    border-left: 5px solid #d4af37;
    border-radius: 11px;
    background: #fffbeb;
    color: #854d0e;
    line-height: 1.65;
}

.multiway-search-page .ads-example-callout,
.heaps-page .ads-example-callout {
    border-color: #a7f3d0;
    border-left-color: #16a34a;
    background: #ecfdf5;
    color: #065f46;
}

.multiway-search-page .ads-program-details,
.heaps-page .ads-program-details {
    overflow: hidden;
    border: 1px solid #cbd9e8;
    border-radius: 12px;
    background: #ffffff;
}

.multiway-search-page .ads-program-details summary,
.heaps-page .ads-program-details summary {
    padding: 16px 18px;
    background: #eff6ff;
    color: #123f78;
}

.multiway-search-page .ads-interactive-header h2,
.heaps-page .ads-interactive-header h2 {
    margin-bottom: 7px;
    font-size: clamp(24px, 2.15vw, 33px);
}

.multiway-search-page .ads-interactive-header p,
.heaps-page .ads-interactive-header p { margin: 0; }

.multiway-search-page .digital-controls,
.heaps-page .digital-controls {
    grid-template-columns: minmax(230px, 1.35fr) minmax(150px, 0.65fr) minmax(190px, 0.8fr) minmax(145px, 0.6fr) auto;
}

.multiway-search-page .digital-tracer-loader,
.heaps-page .digital-tracer-loader {
    grid-template-columns: minmax(240px, 1.35fr) minmax(160px, 0.7fr) minmax(200px, 0.8fr) auto;
}

#multiwayTraceResult,
#heapTraceResult { margin-top: 16px; }

#multiwayTraceResult .ads-tracer-code,
#heapTraceResult .ads-tracer-code {
    height: 350px;
    min-height: 350px;
    max-height: 350px;
    overflow: auto;
}

.multiway-search-page [hidden],
.heaps-page [hidden] { display: none !important; }

@media (max-width: 1240px) {
    .multiway-search-page .digital-controls,
    .multiway-search-page .digital-tracer-loader,
    .heaps-page .digital-controls,
    .heaps-page .digital-tracer-loader {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .multiway-search-page .digital-controls .primary-button,
    .multiway-search-page .digital-tracer-loader .primary-button,
    .heaps-page .digital-controls .primary-button,
    .heaps-page .digital-tracer-loader .primary-button {
        width: 100%;
    }
}

@media (max-width: 760px) {
    .multiway-search-page .ads-lesson-section,
    .heaps-page .ads-lesson-section { padding: 20px 16px; }

    .multiway-search-page .ads-decision-grid,
    .heaps-page .ads-decision-grid { grid-template-columns: 1fr; }
}

@media (max-width: 650px) {
    .multiway-search-page .digital-controls,
    .multiway-search-page .digital-tracer-loader,
    .heaps-page .digital-controls,
    .heaps-page .digital-tracer-loader {
        grid-template-columns: 1fr;
    }

    #multiwayTraceResult .ads-tracer-code,
    #heapTraceResult .ads-tracer-code {
        height: 310px;
        min-height: 310px;
        max-height: 310px;
    }
}

/* =========================================
   LEVEL 19 — FINAL VISUALIZER / TRACER OVERRIDE
   This block must remain at the end of ads.css.
   ========================================= */

.files-page #fileResult .file-control-row,
.files-page #fileTraceResult .file-control-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
    padding: 13px 14px;
    border: 1px solid #d7e2ee;
    border-radius: 11px;
    background: #f8fafc;
}

.files-page #fileResult .file-control-row button,
.files-page #fileTraceResult .file-control-row button {
    min-width: 104px;
    min-height: 42px;
    padding: 10px 15px;
    border: 0;
    border-radius: 9px;
    color: #ffffff;
    font: inherit;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 5px 12px rgba(37, 99, 235, 0.16);
    transition: filter 0.2s ease, transform 0.2s ease;
}

.files-page #filePrevious,
.files-page #fileReset,
.files-page #fileTracePrevious,
.files-page #fileTraceReset {
    background: #64748b !important;
    color: #ffffff !important;
}

.files-page #fileNext,
.files-page #fileTraceNext {
    background: #2563eb !important;
    color: #ffffff !important;
}

.files-page #fileAuto,
.files-page #fileTraceAuto {
    background: #159447 !important;
    color: #ffffff !important;
}

.files-page #filePause,
.files-page #fileTracePause {
    background: #ea7800 !important;
    color: #ffffff !important;
}

.files-page #fileResult .file-control-row button:hover:not(:disabled),
.files-page #fileTraceResult .file-control-row button:hover:not(:disabled) {
    filter: brightness(0.94);
    transform: translateY(-1px);
}

.files-page #fileResult .file-control-row button:disabled,
.files-page #fileTraceResult .file-control-row button:disabled {
    cursor: not-allowed;
    opacity: 0.42;
    box-shadow: none;
}

.files-page #fileResult .file-control-row > span,
.files-page #fileTraceResult .file-control-row > span {
    margin-left: auto;
    color: #475569;
    font-size: 13px;
    font-weight: 900;
}

.files-page #fileTraceResult {
    overflow: hidden;
    padding: 0;
    border: 1px solid #cbd9e8;
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(15, 42, 81, 0.08);
}

.files-page #fileTraceResult > #fileTraceTitle {
    margin: 0;
    padding: 15px 18px;
    border-bottom: 1px solid #334155;
    background: #102a51;
    color: #f6d76b;
    font-size: 14px;
    letter-spacing: 0.08em;
}

.files-page #fileTraceResult .file-tracer-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(330px, 0.7fr);
    align-items: stretch;
    gap: 0;
}

.files-page #fileTraceResult .file-tracer-code-panel {
    min-width: 0;
    padding: 16px;
    border: 0;
    border-right: 1px solid #334155;
    border-radius: 0;
    background: #0f172a !important;
}

.files-page #fileTraceResult .file-tracer-code-panel > h4 {
    margin: 0 0 11px;
    padding: 0;
    color: #ffffff;
    font-size: 15px;
}

.files-page #fileTraceCodeWindow {
    overflow: auto;
    height: 545px;
    min-height: 545px;
    max-height: 545px;
    border: 1px solid #334155;
    border-radius: 10px;
    background: #020617 !important;
    color: #e2e8f0 !important;
    scrollbar-color: #64748b #111c2f;
    scrollbar-width: thin;
}

.files-page #fileTraceCodeWindow::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.files-page #fileTraceCodeWindow::-webkit-scrollbar-track {
    background: #111c2f;
}

.files-page #fileTraceCodeWindow::-webkit-scrollbar-thumb {
    border: 2px solid #111c2f;
    border-radius: 999px;
    background: #64748b;
}

.files-page #fileTraceCode {
    display: block;
    overflow: visible;
    width: max-content;
    min-width: 100%;
    height: auto;
    min-height: 100%;
    max-height: none;
    margin: 0;
    padding: 12px 8px;
    border: 0;
    border-radius: 0;
    background: #020617 !important;
    color: #e2e8f0 !important;
    font: 13px/1.65 Consolas, Monaco, "Courier New", monospace;
    white-space: pre;
    box-sizing: border-box;
}

.files-page #fileTraceCode > span {
    display: block;
    min-height: 21px;
    padding: 0 10px;
    border-left: 4px solid transparent;
    background: transparent;
    color: inherit !important;
}

.files-page #fileTraceCode > span.is-active-line {
    border-left-color: #f6d76b;
    border-radius: 4px;
    background: #25466f !important;
    color: #ffffff !important;
}

.files-page #fileTraceResult .file-tracer-side {
    min-width: 0;
    padding: 16px;
    border: 0;
    border-radius: 0;
    background: #f8fafc;
}

.files-page #fileTraceResult > .file-control-row {
    margin: 0;
    padding: 13px 14px;
    border: 0;
    border-top: 1px solid #d7e2ee;
    border-radius: 0;
}

@media (max-width: 1050px) {
    .files-page #fileTraceResult .file-tracer-layout {
        grid-template-columns: 1fr;
    }

    .files-page #fileTraceResult .file-tracer-code-panel {
        border-right: 0;
        border-bottom: 1px solid #334155;
    }

    .files-page #fileTraceCodeWindow {
        height: 430px;
        min-height: 430px;
        max-height: 430px;
    }
}

@media (max-width: 560px) {
    .files-page #fileResult .file-control-row button,
    .files-page #fileTraceResult .file-control-row button {
        min-width: 0;
        flex: 1 1 calc(50% - 10px);
    }

    .files-page #fileResult .file-control-row > span,
    .files-page #fileTraceResult .file-control-row > span {
        width: 100%;
        margin-left: 0;
        text-align: center;
    }

    .files-page #fileTraceCodeWindow {
        height: 350px;
        min-height: 350px;
        max-height: 350px;
    }
}
