.aisn-open {
    overflow: hidden;
}

#ai-smart-notes-root {
    display: none;
}

#ai-smart-notes-root.open {
    display: block;
}

.aisn-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 10, 16, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 120000;
}

.aisn-modal {
    position: fixed;
    inset: 24px;
    z-index: 120001;
    background: #181d28;
    background: linear-gradient(160deg, rgba(28, 34, 48, 0.97), rgba(14, 17, 24, 0.98));
    color: #e8eaed;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 20px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(28px) saturate(160%);
    -webkit-backdrop-filter: blur(28px) saturate(160%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: inset 0.25s ease, border-radius 0.25s ease;
}

.aisn-modal.is-fullscreen {
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    z-index: 120002 !important;
    background: #0b0f17 !important;
}

.aisn-modal.is-fullscreen .aisn-modal-grid {
    display: block !important;
    width: 100% !important;
    height: calc(100vh - 65px) !important;
    height: calc(100dvh - 65px) !important;
    overflow: hidden !important;
}

.aisn-modal.is-fullscreen .aisn-panel {
    display: none !important;
}

.aisn-modal.is-fullscreen .aisn-preview {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 1050px !important;
    margin: 0 auto !important;
    padding: 24px 30px !important;
    overflow-y: auto !important;
}

.aisn-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
}

.aisn-modal-head p {
    margin: 0 0 3px 0;
    color: #8ab4f8;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.aisn-modal-head h2 {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.2;
}

.aisn-icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: #e8eaed;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: 0.2s ease;
}

.aisn-icon-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.aisn-modal-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(320px, 390px) 1fr;
}

.aisn-panel {
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px;
    overflow: auto;
    background: rgba(255, 255, 255, 0.03);
}

.aisn-field {
    margin-bottom: 16px;
}

.aisn-field label {
    display: block;
    margin-bottom: 8px;
    color: #aab2c0;
    font-size: 0.8rem;
    font-weight: 700;
}

.aisn-field select {
    width: 100%;
    background: #181d28;
    color: #e8eaed;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    padding: 10px 12px;
    outline: none;
    cursor: pointer;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.aisn-field select option {
    background-color: #141822;
    color: #ffffff;
    padding: 10px;
}

.aisn-modal.is-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
}

.aisn-walle-loader {
    min-height: 280px;
    background: rgba(13, 17, 23, 0.95);
    border: 1px dashed rgba(0, 229, 255, 0.35);
    border-radius: 16px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 16px;
    box-shadow: 0 8px 32px rgba(0, 229, 255, 0.08);
}

.aisn-walle-avatar {
    animation: eveFloat 2.4s ease-in-out infinite;
    filter: drop-shadow(0 0 16px rgba(0, 229, 255, 0.6));
}

.aisn-walle-info h4 {
    margin: 0 0 6px 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: #00e5ff;
    letter-spacing: 0.02em;
}

.aisn-walle-info p {
    margin: 0;
    font-size: 0.88rem;
    color: #8ab4f8;
}

.aisn-walle-progress-track {
    width: 220px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.aisn-walle-progress-bar {
    width: 45%;
    height: 100%;
    background: linear-gradient(90deg, #00e5ff, #8ab4f8);
    border-radius: 6px;
    animation: aisnWallePulse 1.5s ease-in-out infinite alternate;
}

@keyframes aisnWallePulse {
    0% { width: 15%; transform: translateX(0); }
    100% { width: 85%; transform: translateX(30%); }
}

.aisn-custom-panel {
    background: rgba(138, 180, 248, 0.05);
    border: 1px dashed rgba(138, 180, 248, 0.3);
    border-radius: 12px;
    padding: 12px;
    margin: 10px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aisn-custom-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #8ab4f8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.aisn-custom-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.aisn-custom-field label {
    font-size: 0.76rem;
    font-weight: 700;
    color: #a0aec0;
}

.aisn-custom-field select,
.aisn-custom-field textarea {
    background: #141822;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    padding: 7px 10px;
    color: #e2e8f0;
    font-size: 0.82rem;
    outline: none;
}

.aisn-custom-field textarea {
    min-height: 54px;
    resize: vertical;
    font-family: inherit;
}

.aisn-custom-checks {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.aisn-custom-checks label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: #d2d6dc;
    cursor: pointer;
}

.aisn-custom-checks input[type="checkbox"] {
    accent-color: #8ab4f8;
    cursor: pointer;
}

.aisn-segments {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.aisn-segments button,
.aisn-select-row button,
.aisn-actions button {
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: #dce3ee;
    border-radius: 10px;
    padding: 9px 10px;
    cursor: pointer;
    font-weight: 700;
    transition: 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.aisn-segments button:hover,
.aisn-select-row button:hover,
.aisn-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.aisn-segments button.active {
    background: rgba(138, 180, 248, 0.85);
    color: #101318;
    border-color: #8ab4f8;
}

.aisn-select-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.aisn-select-row button {
    flex: 1;
}

.aisn-count {
    color: #9aa0a6;
    font-size: 0.82rem;
    margin-bottom: 10px;
}

.aisn-question-list {
    max-height: 46vh;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.aisn-question-row {
    display: grid;
    grid-template-columns: 20px 42px 1fr;
    gap: 8px;
    align-items: start;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: 0.2s ease;
}

.aisn-question-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

.aisn-q-index {
    color: #8ab4f8;
    font-weight: 800;
    font-size: 0.78rem;
}

.aisn-q-text {
    color: #dce3ee;
    font-size: 0.84rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.aisn-no-questions {
    color: #9aa0a6;
    text-align: center;
    padding: 24px 12px;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.aisn-generate {
    width: 100%;
    margin-top: 14px;
    border: none;
    border-radius: 14px;
    padding: 13px 16px;
    cursor: pointer;
    color: #111318;
    background: linear-gradient(135deg, #fdd663, #8ab4f8);
    font-weight: 800;
}

.aisn-preview {
    position: relative;
    overflow: auto;
    padding: 18px;
    background: rgba(0, 0, 0, 0.16);
}

.aisn-preview-empty {
    min-height: 260px;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #9aa0a6;
    padding: 24px;
}

.aisn-preview-empty h3 {
    color: #e8eaed;
    margin: 0 0 8px 0;
}

.aisn-status {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(138, 180, 248, 0.12);
    border: 1px solid rgba(138, 180, 248, 0.28);
    color: #c9dcff;
    font-size: 0.88rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.aisn-status.success {
    background: rgba(76, 175, 80, 0.12);
    border-color: rgba(76, 175, 80, 0.3);
    color: #b7efc0;
}

.aisn-status.warn {
    background: rgba(255, 202, 40, 0.12);
    border-color: rgba(255, 202, 40, 0.32);
    color: #ffe082;
}

.aisn-status.error {
    background: rgba(244, 67, 54, 0.12);
    border-color: rgba(244, 67, 54, 0.35);
    color: #ffb4ab;
}

.aisn-actions {
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.ai-smart-notes-sheet {
    max-width: 900px;
    margin: 0 auto;
    background: #fbfaf4;
    color: #171717;
    border-radius: 8px;
    padding: 28px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    font-family: "Kalam", "Comic Sans MS", cursive;
}

.aisn-sheet-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 2px solid #d8d1bd;
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.aisn-kicker {
    margin: 0 0 4px 0;
    color: #1d5f8f;
    font-family: "Outfit", Arial, sans-serif;
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.aisn-sheet-header h2 {
    margin: 0;
    color: #111111;
    font-size: 1.55rem;
    line-height: 1.2;
}

.aisn-sheet-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-end;
    color: #333333;
    font-family: "Outfit", Arial, sans-serif;
    font-size: 0.82rem;
}

.aisn-stats {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    font-family: "Outfit", Arial, sans-serif;
}

.aisn-stats span,
.aisn-qrefs,
.aisn-focus-list span {
    border: 1px solid #d8d1bd;
    background: #ffffff;
    color: #1c2833;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.78rem;
    font-weight: 700;
}

.aisn-concepts {
    display: grid;
    gap: 10px;
}

.aisn-concept {
    page-break-inside: avoid;
    break-inside: avoid;
    border: 1px solid #d8d1bd;
    border-left: 4px solid #1d5f8f;
    border-radius: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.76);
}

.aisn-concept.is-high {
    border-left-color: #b3261e;
}

.aisn-concept.is-low {
    border-left-color: #667085;
}

.aisn-concept-top {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.aisn-concept-no {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #111111;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: "Outfit", Arial, sans-serif;
    font-size: 0.8rem;
    font-weight: 800;
}

.aisn-concept h3,
.aisn-focus h3 {
    margin: 0;
    color: #111111;
    font-size: 1.06rem;
}

.aisn-formula {
    margin: 8px 0;
    padding: 8px 10px;
    border-radius: 6px;
    background: #f2efe2;
    color: #111111;
    font-family: "Outfit", Arial, sans-serif;
    overflow-x: auto;
}

.aisn-formulas-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 14px 0;
}

.aisn-geometry-card {
    background: #111622;
    border: 1px solid rgba(138, 180, 248, 0.25);
    border-radius: 10px;
    padding: 12px 14px;
    margin: 12px 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

.aisn-geo-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: #8ab4f8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.aisn-geo-svg {
    max-height: 200px;
    display: block;
    margin: 0 auto;
}

.aisn-formula-card {
    background: #f5f2e8;
    border: 1px solid #dfd8c8;
    border-left: 4px solid #1d5f8f;
    border-radius: 8px;
    padding: 10px 14px;
    color: #111111;
    font-family: "Outfit", Arial, sans-serif;
    font-size: 1.02rem;
    line-height: 1.5;
    overflow-x: auto;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.aisn-example-box {
    margin-top: 12px;
    background: #fbf7ee;
    border: 1px dashed #d0c8b6;
    border-radius: 8px;
    padding: 12px 14px;
    color: #1f2933;
}

.aisn-example-title {
    font-weight: 800;
    color: #1d5f8f;
    font-size: 0.88rem;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.aisn-example-content {
    font-size: 0.92rem;
    line-height: 1.55;
    color: #24292f;
}

.aisn-lines {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.aisn-lines p {
    margin: 3px 0;
    line-height: 1.5;
    color: #1f2933;
    font-size: 0.91rem;
}

.aisn-line-shortcut {
    background: rgba(3, 218, 198, 0.08);
    border-left: 3px solid #00bfa5;
    padding: 6px 10px;
    border-radius: 0 6px 6px 0;
}

.aisn-line-trap {
    background: rgba(239, 83, 80, 0.08);
    border-left: 3px solid #e53935;
    padding: 6px 10px;
    border-radius: 0 6px 6px 0;
}

.aisn-lines strong {
    color: #111111;
}

.aisn-focus {
    page-break-inside: avoid;
    break-inside: avoid;
    margin-top: 16px;
    border-top: 2px solid #d8d1bd;
    padding-top: 12px;
}

.aisn-focus-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.aisn-empty {
    color: #444444;
    padding: 20px;
    text-align: center;
}

.ai-notes-btn {
    background: rgba(138, 180, 248, 0.16);
    /* A 16%-alpha blue fill sits on whatever is behind it, so a hard-coded
       near-white label vanished completely in the light theme — the pill was
       there but read as an empty shape. The token flips with the theme. */
    color: var(--text-main, #eaf1ff);
    border: 1px solid rgba(138, 180, 248, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(3, 218, 198, 0.16);
    transition: 0.2s ease;
}

.ai-notes-btn:hover {
    background: rgba(138, 180, 248, 0.26);
    border-color: rgba(138, 180, 248, 0.6);
    transform: translateY(-2px);
}

.btn-action-ai-notes {
    flex: 1;
    min-width: 190px;
    background: linear-gradient(135deg, #8ab4f8 0%, #03dac6 100%);
    color: #071014;
    font-weight: 800;
    font-size: 0.98rem;
    padding: 14px 20px;
    border: none;
    border-radius: 28px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(3, 218, 198, 0.24);
    transition: 0.22s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-action-ai-notes:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(3, 218, 198, 0.38);
}

@media (max-width: 820px) {
    .aisn-modal {
        inset: 8px;
        border-radius: 14px;
    }

    .aisn-modal-grid {
        grid-template-columns: 1fr;
    }

    .aisn-panel {
        border-right: 0;
        border-bottom: 1px solid #2a303a;
        max-height: 46vh;
    }

    .aisn-question-list {
        max-height: 24vh;
    }

    .ai-smart-notes-sheet {
        padding: 18px;
    }

    .aisn-sheet-header {
        flex-direction: column;
    }

    .aisn-sheet-meta {
        align-items: flex-start;
    }
}

@media print {
    @page {
        margin: 10mm;
        size: A4 portrait;
    }

    body > *:not(#aisn-print-mount) {
        display: none !important;
    }

}
