/* =========================================================================
   Smart Notes v2 — engine controls, compression ladder, data-driven blocks
   and the concept mind map.
   Loaded after ai-smart-notes.css so it can layer on top of the base sheet.
   ========================================================================= */

/* A rule that is text rather than maths — rendered verbatim, never via KaTeX. */
.aisn-formula-card.is-text {
    font-family: inherit;
    font-size: 0.86rem;
    line-height: 1.55;
    font-style: normal;
    letter-spacing: 0;
}

.aisn-field-hint {
    margin: 6px 0 0;
    font-size: 0.74rem;
    line-height: 1.45;
    color: rgba(232, 234, 237, 0.55);
}

.aisn-toggle-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 10px 0 4px;
    padding: 9px 11px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.82rem;
    color: #d6dae0;
    cursor: pointer;
}

.aisn-toggle-row input {
    accent-color: #00e5ff;
    cursor: pointer;
}

/* ---------------------------------------------------- compression ladder */

.aisn-ladder {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin: 14px 0 4px;
    padding: 7px 9px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.aisn-ladder-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(232, 234, 237, 0.5);
    margin-right: 4px;
}

.aisn-ladder-btn {
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: #c9cdd4;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 13px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.18s ease;
}

.aisn-ladder-btn:hover {
    background: rgba(0, 229, 255, 0.1);
    color: #eaf7ff;
}

.aisn-ladder-btn.is-active {
    background: linear-gradient(135deg, #00e5ff, #4d8dff);
    border-color: transparent;
    color: #04121c;
    box-shadow: 0 4px 14px rgba(0, 229, 255, 0.32);
}

.aisn-hidden-note {
    margin: 12px 0;
    padding: 9px 12px;
    border-radius: 10px;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.78rem;
    color: rgba(232, 234, 237, 0.62);
}

/* ------------------------------------------------- coverage + changelog */

.aisn-coverage,
.aisn-changelog {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 10px 0;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 0.76rem;
    color: rgba(232, 234, 237, 0.68);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.aisn-coverage b {
    color: #8ce9c0;
}

.aisn-cov-engine {
    font-weight: 700;
    color: #00e5ff;
}

.aisn-changelog {
    border-left: 3px solid #a78bfa;
}

.aisn-chg-added {
    color: #8ce9c0;
    font-weight: 600;
}

.aisn-chg-removed {
    color: #9fb0c4;
    font-weight: 600;
}

.aisn-chg-list {
    flex-basis: 100%;
    color: rgba(232, 234, 237, 0.5);
    font-size: 0.73rem;
}

/* ------------------------------------------------------- concept badges */

.aisn-concept-badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 8px 0 4px;
}

.aisn-pyq-badge,
.aisn-rev-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}

.aisn-pyq-badge.is-high {
    background: rgba(255, 87, 51, 0.16);
    border-color: rgba(255, 87, 51, 0.42);
    color: #ffb199;
}

.aisn-pyq-badge.is-medium {
    background: rgba(255, 193, 7, 0.14);
    border-color: rgba(255, 193, 7, 0.36);
    color: #ffd97a;
}

.aisn-pyq-badge.is-low {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
    color: #c3c9d1;
}

.aisn-rev-chip.is-weak {
    background: rgba(244, 67, 54, 0.15);
    border-color: rgba(244, 67, 54, 0.4);
    color: #ff9d95;
}

.aisn-rev-chip.is-medium {
    background: rgba(255, 193, 7, 0.13);
    border-color: rgba(255, 193, 7, 0.34);
    color: #ffd97a;
}

.aisn-rev-chip.is-strong {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.38);
    color: #8ce9c0;
}

/* ------------------------------------------- prerequisites and sub-rules */

.aisn-prereq {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin: 8px 0;
    padding: 7px 11px;
    border-radius: 9px;
    background: rgba(167, 139, 250, 0.09);
    border-left: 3px solid #a78bfa;
    font-size: 0.77rem;
    color: #d8cff5;
}

.aisn-prereq-item {
    font-weight: 700;
    color: #c4b5fd;
}

.aisn-prereq .fa-angle-right {
    opacity: 0.5;
    font-size: 0.7rem;
}

.aisn-subrules {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
}

.aisn-subrule {
    padding: 3px 10px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.74rem;
    color: #cbd2da;
}

/* ------------------------------------------------- error-type diagnosis */

.aisn-errtypes {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
    margin: 10px 0;
}

.aisn-errtype {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.74rem;
    font-weight: 700;
}

.aisn-errtype.is-calculation {
    background: rgba(255, 193, 7, 0.14);
    color: #ffd97a;
}

.aisn-errtype.is-trap {
    background: rgba(244, 67, 54, 0.15);
    color: #ff9d95;
}

.aisn-errtype.is-concept {
    background: rgba(79, 141, 255, 0.16);
    color: #a8c7ff;
}

.aisn-errtype.is-speed {
    background: rgba(0, 229, 255, 0.13);
    color: #8ce6f5;
}

.aisn-errtype-advice {
    flex-basis: 100%;
    font-size: 0.76rem;
    line-height: 1.5;
    color: rgba(232, 234, 237, 0.62);
    font-style: italic;
}

/* --------------------------------------------------- distractor autopsy */

.aisn-block-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #00e5ff;
    margin-bottom: 9px;
}

.aisn-autopsy {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(140deg, rgba(244, 67, 54, 0.08), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(244, 67, 54, 0.22);
}

.aisn-autopsy-row {
    position: relative;
    padding: 10px 12px;
    margin-bottom: 9px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.22);
    border-left: 3px solid rgba(244, 67, 54, 0.55);
}

.aisn-autopsy-row.is-calculation {
    border-left-color: rgba(255, 193, 7, 0.65);
}

.aisn-autopsy-row.is-concept {
    border-left-color: rgba(79, 141, 255, 0.65);
}

.aisn-autopsy-row:last-child {
    margin-bottom: 0;
}

.aisn-autopsy-picks {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-wrap: wrap;
}

.aisn-autopsy-picks .fa-arrow-right-long {
    align-self: center;
    color: rgba(255, 255, 255, 0.35);
}

.aisn-pick {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 180px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
}

.aisn-pick b {
    font-size: 0.85rem;
}

.aisn-pick em {
    font-size: 0.68rem;
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.72;
}

.aisn-pick.is-wrong {
    background: rgba(244, 67, 54, 0.14);
    color: #ffb3ac;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.aisn-pick.is-right {
    background: rgba(76, 175, 80, 0.14);
    color: #9be9bd;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.aisn-autopsy-why {
    margin: 9px 0 0;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #e2e6ea;
}

.aisn-autopsy-crowd {
    margin: 6px 0 0;
    font-size: 0.75rem;
    color: #ffd97a;
}

.aisn-autopsy-ref {
    position: absolute;
    top: 8px;
    right: 10px;
    font-size: 0.68rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.32);
}

/* ------------------------------------------------------ confusion pairs */

.aisn-confusion {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.09);
}

.aisn-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.aisn-confusion-table {
    width: 100%;
    min-width: 420px;
    border-collapse: collapse;
    font-size: 0.79rem;
}

.aisn-confusion-table th {
    text-align: left;
    padding: 7px 10px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(232, 234, 237, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.aisn-confusion-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: top;
}

.aisn-confusion-table td.is-right {
    color: #9be9bd;
    font-weight: 700;
}

.aisn-confusion-table td.is-wrong {
    color: #ffb3ac;
    font-weight: 700;
}

.aisn-confusion-table td.is-ctx {
    color: rgba(232, 234, 237, 0.55);
    font-size: 0.74rem;
}

/* ---------------------------------------------------- practice variants */

.aisn-variants {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(0, 229, 255, 0.05);
    border: 1px solid rgba(0, 229, 255, 0.18);
}

.aisn-variant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 10px;
}

.aisn-variant {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.24);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.aisn-variant-head {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #00e5ff;
    margin-bottom: 6px;
}

.aisn-variant-given {
    margin: 0 0 5px;
    font-size: 0.81rem;
    color: #e2e6ea;
    line-height: 1.5;
}

.aisn-variant-ask {
    margin: 0;
    font-size: 0.78rem;
    color: rgba(232, 234, 237, 0.6);
    font-style: italic;
}

.aisn-variant-sol {
    margin-top: 8px;
}

.aisn-variant-sol summary {
    cursor: pointer;
    font-size: 0.74rem;
    font-weight: 700;
    color: #8ce6f5;
    list-style: none;
}

.aisn-variant-sol summary::-webkit-details-marker {
    display: none;
}

.aisn-variant-sol summary::before {
    content: '\25B8\00a0';
}

.aisn-variant-sol[open] summary::before {
    content: '\25BE\00a0';
}

.aisn-variant-sol p {
    margin: 6px 0 0;
    font-size: 0.79rem;
    line-height: 1.55;
    color: #d6dae0;
}

.aisn-variant-formula {
    margin-top: 7px;
    padding: 6px 9px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.aisn-variant-answer {
    color: #9be9bd !important;
}

/* ----------------------------------------------------- Hindi pivot block */

.aisn-hindi {
    margin: 10px 0 0;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255, 193, 7, 0.07);
    border: 1px solid rgba(255, 193, 7, 0.18);
}

.aisn-hindi summary {
    cursor: pointer;
    font-size: 0.77rem;
    font-weight: 700;
    color: #ffd97a;
    list-style: none;
}

.aisn-hindi summary::-webkit-details-marker {
    display: none;
}

.aisn-hindi p {
    margin: 8px 0 0;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #e2e6ea;
}

/* --------------------------------------------------------- concept flash */

.aisn-concept.is-flash {
    animation: aisnFlash 1.5s ease;
}

@keyframes aisnFlash {
    0%, 100% { box-shadow: none; }
    25% { box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.55); }
    60% { box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.25); }
}

/* ============================== CONCEPT MIND MAP ========================= */

.aisn-mindmap {
    margin: 18px 0 22px;
    padding: 16px 14px 12px;
    border-radius: 16px;
    background:
        radial-gradient(circle at 50% 42%, rgba(0, 229, 255, 0.09), transparent 62%),
        linear-gradient(160deg, rgba(28, 34, 48, 0.75), rgba(14, 17, 24, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.aisn-mm-head h3 {
    margin: 0 0 3px;
    font-size: 1rem;
    font-weight: 800;
    color: #eaf7ff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.aisn-mm-head h3 i {
    color: #00e5ff;
}

.aisn-mm-head p {
    margin: 0 0 6px;
    font-size: 0.75rem;
    color: rgba(232, 234, 237, 0.5);
}

.aisn-mm-canvas {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.aisn-mm-svg {
    display: block;
    min-width: 560px;
    height: auto;
}

/* Links draw themselves in, staggered by node order. */
.aisn-mm-link {
    fill: none;
    stroke: rgba(255, 255, 255, 0.22);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-dasharray: 620;
    stroke-dashoffset: 620;
    animation: aisnMmDraw 0.85s ease forwards;
    animation-delay: calc(var(--i) * 55ms);
}

.aisn-mm-link.is-weak { stroke: rgba(244, 67, 54, 0.45); }
.aisn-mm-link.is-medium { stroke: rgba(255, 193, 7, 0.4); }
.aisn-mm-link.is-strong { stroke: rgba(76, 175, 80, 0.4); }

@keyframes aisnMmDraw {
    to { stroke-dashoffset: 0; }
}

.aisn-mm-center-core {
    fill: url(#aisnMmCoreGrad);
    stroke: rgba(0, 229, 255, 0.5);
    stroke-width: 1.6;
}

.aisn-mm-grad-a { stop-color: #1b3448; }
.aisn-mm-grad-b { stop-color: #0d1420; }

.aisn-mm-center-label {
    fill: #eaf7ff;
    font-size: 14px;
    font-weight: 800;
}

.aisn-mm-center-sub {
    fill: rgba(234, 247, 255, 0.5);
    font-size: 10.5px;
    font-weight: 600;
}

/* Nodes pop in just after their link finishes drawing. */
.aisn-mm-node {
    cursor: pointer;
    opacity: 0;
    animation: aisnMmPop 0.4s ease forwards;
    animation-delay: calc(var(--i) * 55ms + 260ms);
}

@keyframes aisnMmPop {
    from { opacity: 0; }
    to { opacity: 1; }
}

.aisn-mm-halo {
    fill: transparent;
    transition: fill 0.2s ease;
}

.aisn-mm-node:hover .aisn-mm-halo,
.aisn-mm-node:focus .aisn-mm-halo {
    fill: rgba(0, 229, 255, 0.16);
}

.aisn-mm-node:focus {
    outline: none;
}

.aisn-mm-dot {
    stroke-width: 2;
}

.aisn-mm-node.is-weak .aisn-mm-dot {
    fill: rgba(244, 67, 54, 0.3);
    stroke: #ff7a6e;
}

.aisn-mm-node.is-medium .aisn-mm-dot {
    fill: rgba(255, 193, 7, 0.26);
    stroke: #ffc93c;
}

.aisn-mm-node.is-strong .aisn-mm-dot {
    fill: rgba(76, 175, 80, 0.26);
    stroke: #6fdc9b;
}

.aisn-mm-count {
    fill: #ffffff;
    font-size: 12px;
    font-weight: 800;
    pointer-events: none;
}

.aisn-mm-badge {
    font-size: 13px;
    pointer-events: none;
}

.aisn-mm-label {
    fill: #dbe2ea;
    font-size: 12.5px;
    font-weight: 600;
    pointer-events: none;
}

.aisn-mm-sub {
    fill: rgba(219, 226, 234, 0.45);
    font-size: 10px;
    font-weight: 500;
}

.aisn-mm-legend {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    font-size: 0.72rem;
    color: rgba(232, 234, 237, 0.55);
}

.aisn-mm-key {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 3px;
    vertical-align: middle;
}

.aisn-mm-key.is-weak { background: #ff7a6e; }
.aisn-mm-key.is-medium { background: #ffc93c; }
.aisn-mm-key.is-strong { background: #6fdc9b; }

.aisn-mm-note {
    font-style: italic;
    color: rgba(232, 234, 237, 0.4);
}

.aisn-mm-hint {
    margin-left: auto;
    font-style: italic;
    color: rgba(0, 229, 255, 0.6);
}

@media (max-width: 720px) {
    .aisn-mm-hint { margin-left: 0; }
    .aisn-variant-grid { grid-template-columns: 1fr; }
    .aisn-autopsy-picks { flex-direction: column; }
    .aisn-autopsy-picks .fa-arrow-right-long { transform: rotate(90deg); align-self: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    .aisn-mm-link,
    .aisn-mm-node,
    .aisn-mm-center-ring,
    .aisn-concept.is-flash {
        animation: none !important;
        opacity: 1 !important;
        stroke-dashoffset: 0 !important;
    }
}

/* -------------------------------------------------------- print overrides */

@media print {
    .aisn-ladder,
    .aisn-mm-hint,
    .aisn-hidden-note {
        display: none !important;
    }

    .aisn-mindmap {
        background: #ffffff !important;
        border: 1px solid #cccccc !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .aisn-mm-head h3,
    .aisn-mm-head p,
    .aisn-mm-legend {
        color: #111111 !important;
    }

    .aisn-mm-link {
        stroke: #666666 !important;
        stroke-dashoffset: 0 !important;
        animation: none !important;
    }

    .aisn-mm-center-core { fill: #f0f4f8 !important; stroke: #333333 !important; }
    .aisn-mm-center-glow { fill: none !important; }
    .aisn-mm-center-ring { stroke: #999999 !important; animation: none !important; }

    .aisn-mm-center-label,
    .aisn-mm-center-sub,
    .aisn-mm-count,
    .aisn-mm-label,
    .aisn-mm-sub { fill: #111111 !important; }

    .aisn-mm-dot { fill: #ffffff !important; stroke: #333333 !important; }
    .aisn-mm-node { opacity: 1 !important; animation: none !important; }

    .aisn-autopsy,
    .aisn-confusion,
    .aisn-variants,
    .aisn-hindi,
    .aisn-prereq {
        background: #fafafa !important;
        border: 1px solid #dddddd !important;
        color: #111111 !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .aisn-block-title { color: #1d5f8f !important; }

    .aisn-autopsy-why,
    .aisn-variant-given,
    .aisn-variant-sol p,
    .aisn-hindi p { color: #111111 !important; }

    .aisn-pick.is-wrong { background: #fdeaea !important; color: #b71c1c !important; }
    .aisn-pick.is-right { background: #eef7ee !important; color: #1b5e20 !important; }

    .aisn-confusion-table th,
    .aisn-confusion-table td { color: #111111 !important; }
    .aisn-confusion-table td.is-right { color: #1b5e20 !important; }
    .aisn-confusion-table td.is-wrong { color: #b71c1c !important; }

    .aisn-variant-sol summary { color: #1d5f8f !important; }

    /* Expand collapsed sections so nothing is lost on paper. */
    .aisn-variant-sol > *,
    .aisn-hindi > * { display: block !important; }
}
