/* PROFKAI BLOCK START: CLASSROOM DESIGN TOKENS */
.profkai-classroom {
    --pk-background: #edf2f7;
    --pk-panel: #ffffff;
    --pk-panel-soft: #f6f9fc;
    --pk-text: #172839;
    --pk-muted: #65778a;
    --pk-border: #d8e2ec;
    --pk-primary: #2468c9;
    --pk-primary-soft: #e8f1ff;
    --pk-success: #21835b;
    --pk-warning: #b45f16;
    --pk-danger: #b43c3c;
    --pk-shadow: 0 10px 28px rgba(26, 49, 72, 0.08);
    color: var(--pk-text);
    background: var(--pk-background);
    border-radius: 20px;
    padding: 14px;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}

.profkai-classroom,
.profkai-classroom * {
    box-sizing: border-box;
}

.profkai-classroom [hidden] {
    display: none !important;
}

.profkai-classroom button,
.profkai-classroom input {
    font: inherit;
}
/* PROFKAI BLOCK END: CLASSROOM DESIGN TOKENS */

/* PROFKAI BLOCK START: FOUR AREA CLASSROOM LAYOUT */
.profkai-topbar,
.profkai-controls,
.profkai-panel {
    background: var(--pk-panel);
    border: 1px solid var(--pk-border);
    box-shadow: var(--pk-shadow);
}

.profkai-topbar {
    min-height: 66px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-radius: 14px;
    padding: 10px 15px;
    margin-bottom: 10px;
}

.profkai-brand {
    font-size: 23px;
    font-weight: 700;
}

.profkai-lesson-name,
.profkai-progress {
    color: var(--pk-muted);
    font-size: 13px;
}

.profkai-progress {
    color: var(--pk-primary);
    font-weight: 600;
    white-space: nowrap;
}

.profkai-topbar-tools,
.profkai-subject-search,
.profkai-board-title-tools {
    display: flex;
    align-items: center;
    gap: 8px;
}

.profkai-topbar-tools {
    justify-content: flex-end;
    flex: 1;
}

.profkai-subject-search {
    position: relative;
    width: min(390px, 55vw);
}

.profkai-subject-search input {
    width: 100%;
    min-height: 36px;
    border: 1px solid var(--pk-border);
    border-radius: 9px;
    padding: 7px 10px;
    color: var(--pk-text);
    background: var(--pk-panel-soft);
    font-size: 13px;
}

.profkai-language-select {
    min-height: 36px;
    max-width: 135px;
    border: 1px solid var(--pk-border);
    border-radius: 9px;
    padding: 6px 8px;
    color: var(--pk-text);
    background: var(--pk-panel-soft);
    font-size: 12px;
}

.profkai-search-button {
    min-height: 36px !important;
    padding: 6px 10px !important;
    font-size: 12px !important;
}

.profkai-search-message {
    position: absolute;
    z-index: 4;
    top: calc(100% + 6px);
    right: 0;
    width: min(360px, 80vw);
    border: 1px solid var(--pk-border);
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--pk-text);
    background: var(--pk-panel);
    box-shadow: var(--pk-shadow);
    font-size: 12px;
}

.profkai-grid {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(250px, 29%) minmax(0, 1fr);
    grid-template-rows: 430px minmax(340px, auto);
    grid-template-areas:
        "kai board"
        "conversation support";
    gap: 10px;
}

.profkai-panel {
    border-radius: 14px;
    overflow: hidden;
    min-width: 0;
}

.profkai-kai-panel { grid-area: kai; }
.profkai-conversation-panel { grid-area: conversation; }
.profkai-board-panel { grid-area: board; }
.profkai-support-panel { grid-area: support; }

.profkai-panel-header {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--pk-border);
    color: var(--pk-muted);
    font-size: 12px;
}

.profkai-panel-header h2 {
    margin: 0;
    color: var(--pk-text);
    font-size: 14px;
    font-weight: 650;
}

.profkai-board-title-tools {
    flex-wrap: wrap;
}

.profkai-board-tool {
    min-height: 32px !important;
    border-color: var(--pk-primary) !important;
    border-radius: 7px !important;
    padding: 5px 9px !important;
    color: #ffffff !important;
    background: var(--pk-primary) !important;
    font-size: 12px !important;
    font-weight: 600;
}

.profkai-board-tool:hover {
    border-color: #174e9c !important;
    background: #174e9c !important;
}

.profkai-math-demo-select {
    min-height: 32px;
    max-width: 150px;
    border: 1px solid var(--pk-primary);
    border-radius: 7px;
    padding: 4px 7px;
    color: var(--pk-primary);
    background: #ffffff;
    font-size: 11px;
    font-weight: 600;
}
/* PROFKAI BLOCK END: FOUR AREA CLASSROOM LAYOUT */

/* PROFKAI BLOCK START: PROFESSOR KAI PLACEHOLDER */
.profkai-kai-panel {
    display: flex;
    flex-direction: column;
}

.profkai-kai-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: stretch;
    gap: 8px;
    padding: 12px;
    background: linear-gradient(145deg, var(--pk-panel), var(--pk-panel-soft));
}

.profkai-kai-embodiment {
    flex: 7 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}

.profkai-avatar-placeholder {
    width: 142px;
    height: 174px;
    display: grid;
    place-items: center;
    border: 1px solid var(--pk-border);
    border-radius: 72px 72px 28px 28px;
    color: var(--pk-primary);
    background: var(--pk-primary-soft);
    font-size: 50px;
    font-weight: 700;
}

.profkai-avatar-note {
    max-width: 220px;
    margin: 0;
    color: var(--pk-muted);
    font-size: 12px;
    text-align: center;
}

.profkai-camera-preview {
    width: 100%;
    height: 100%;
    min-height: 64px;
    border-radius: 8px;
    background: #111820;
    object-fit: cover;
    transform: scaleX(-1);
}

.profkai-student-camera {
    position: relative;
    flex: 3 1 0;
    min-height: 92px;
    width: 100%;
    overflow: hidden;
    border: 1px solid var(--pk-border);
    border-radius: 10px;
    background: #e8edf3;
}

.profkai-student-camera-label {
    position: absolute;
    z-index: 2;
    top: 6px;
    left: 7px;
    border-radius: 5px;
    padding: 2px 6px;
    color: #fff;
    background: rgba(23, 40, 57, 0.75);
    font-size: 10px;
}

.profkai-camera-off-placeholder {
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--pk-muted);
    font-size: 12px;
}

.profkai-camera-privacy {
    position: absolute;
    right: 7px;
    bottom: 5px;
    margin: 0;
    border-radius: 4px;
    padding: 2px 5px;
    color: #fff;
    background: rgba(23, 40, 57, 0.75);
    font-size: 9px;
}

.profkai-live-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--pk-success);
}

.profkai-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}
/* PROFKAI BLOCK END: PROFESSOR KAI PLACEHOLDER */

/* PROFKAI BLOCK START: CONVERSATION */
.profkai-conversation-panel {
    display: flex;
    flex-direction: column;
}

.profkai-conversation-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
}

.profkai-message,
.profkai-confirmation {
    padding: 10px 11px;
    border-radius: 10px;
    font-size: 15px;
}

.profkai-message-kai {
    background: var(--pk-primary-soft);
}

.profkai-confirmation {
    border: 1px solid var(--pk-border);
    background: var(--pk-panel-soft);
}

.profkai-confirmation p {
    margin: 0 0 9px;
}

.profkai-inline-actions,
.profkai-answer-row,
.profkai-control-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.profkai-answer-row { flex-direction: column; align-items: stretch; }
.profkai-answer-row [data-pk-send] { align-self: flex-end; }

.profkai-answer-label {
    margin-top: auto;
    color: var(--pk-muted);
    font-size: 12px;
}

.profkai-answer-input {
    width: 100%;
    resize: vertical;
    min-width: 120px;
    min-height: 115px;
    max-height: 220px;
    border: 1px solid var(--pk-border);
    border-radius: 9px;
    padding: 9px 10px;
    color: var(--pk-text);
    background: var(--pk-panel-soft);
    font-size: 15px;
}

.profkai-classroom textarea.profkai-answer-input::placeholder { font-size: 14px; }

.profkai-classroom.is-quadratic .profkai-original-equation,
.profkai-classroom.is-quadratic .profkai-result-two {
    width: fit-content;
    max-width: 96%;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.profkai-classroom.is-quadratic .profkai-equation-line { font-size: clamp(20px, 2.8vw, 32px); }
.profkai-classroom.is-quadratic .profkai-operation-line { font-size: clamp(17px, 2vw, 23px); }

.profkai-classroom.is-quadratic .profkai-balance-beam {
    border: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 12px;
}
.profkai-classroom.is-quadratic .profkai-balance-center { display: none; }
.profkai-classroom.is-quadratic .profkai-balance-pan {
    border: 2px solid var(--pk-primary);
    font-weight: 700;
    color: var(--pk-primary);
    padding: 10px;
}

.profkai-worked-example { width: min(690px, 100%); margin: 0 auto; text-align: center; }
.profkai-worked-example h3 { font-size: 17px; margin: 4px 0 18px; }
.profkai-worked-steps { display: grid; gap: 10px; }
.profkai-worked-steps p { margin: 0; padding: 7px; border-radius: 8px; background: #e8f1ff; font-family: Cambria, Georgia, serif; font-size: clamp(19px, 2.3vw, 27px); }
.profkai-worked-steps p:last-child { font-size: clamp(15px, 1.7vw, 20px); }
.profkai-worked-example [data-pk-example-caption] { color: var(--pk-primary); font-size: 15px; font-weight: 650; }

.profkai-answer-input:focus,
.profkai-button:focus,
.profkai-choice:focus,
.profkai-text-action:focus {
    outline: 3px solid rgba(36, 104, 201, 0.25);
    outline-offset: 2px;
}

.profkai-text-action {
    align-self: flex-start;
    border: 0;
    padding: 2px 0;
    color: var(--pk-primary);
    background: transparent;
    text-decoration: underline;
}
/* PROFKAI BLOCK END: CONVERSATION */

/* PROFKAI BLOCK START: TEACHING BOARD */
.profkai-board-panel {
    display: flex;
    flex-direction: column;
}

.profkai-board {
    flex: 1;
    position: relative;
    padding: 24px 28px;
    background-color: var(--pk-panel);
    background-image:
        linear-gradient(var(--pk-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--pk-border) 1px, transparent 1px);
    background-size: 30px 30px;
}

.profkai-math-showcase {
    position: absolute;
    z-index: 5;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 22px;
    padding: 28px;
    background-color: rgba(255, 255, 255, 0.97);
    background-image:
        linear-gradient(var(--pk-border) 1px, transparent 1px),
        linear-gradient(90deg, var(--pk-border) 1px, transparent 1px);
    background-size: 30px 30px;
    text-align: center;
}

.profkai-math-showcase-label {
    color: var(--pk-primary);
    font-size: 14px;
    font-weight: 700;
}

.profkai-rendered-math {
    max-width: 100%;
    overflow-x: auto;
    padding: 12px;
    color: var(--pk-text);
    font-size: clamp(24px, 4vw, 46px);
}

.profkai-math-showcase p {
    max-width: 620px;
    margin: 0;
    color: var(--pk-muted);
    font-size: 14px;
}

.profkai-board-prompt,
.profkai-board-explanation {
    margin: 0;
    color: var(--pk-muted);
    font-size: 13px;
}

.profkai-equation-line {
    width: min(620px, 94%);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
    align-items: center;
    justify-items: center;
    gap: 6px;
    margin: 25px auto 0;
    font-family: Cambria, Georgia, serif;
    font-size: clamp(23px, 3.1vw, 34px);
    text-align: center;
}

.profkai-equation-line > span {
    white-space: nowrap;
}

.profkai-original-equation {
    margin-top: 38px;
}

.profkai-equation-line mark {
    border-radius: 5px;
    padding: 1px 5px;
    color: var(--pk-primary);
    background: var(--pk-primary-soft);
}

.profkai-operation-line {
    margin-top: 8px;
    color: var(--pk-primary);
    font-size: clamp(19px, 3vw, 28px);
}

.profkai-operation-space {
    width: 1px;
}

.profkai-work-line {
    font-size: clamp(19px, 2.65vw, 28px);
}

.profkai-result-line {
    color: var(--pk-success);
}

.profkai-board-explanation {
    margin-top: 30px;
    text-align: center;
}

.profkai-cancel-term.is-cancelled {
    color: var(--pk-muted);
    text-decoration: line-through;
    text-decoration-thickness: 2px;
}

.profkai-equation-line.is-entering {
    animation: profkai-enter 450ms ease-out both;
}

.profkai-equation-line.is-settling {
    animation: profkai-settle 480ms ease-out both;
}

@keyframes profkai-enter {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes profkai-settle {
    0% { opacity: 0; transform: scale(0.97); }
    100% { opacity: 1; transform: scale(1); }
}
/* PROFKAI BLOCK END: TEACHING BOARD */

/* PROFKAI BLOCK START: SUPPORTING VISUAL */
.profkai-support-body {
    min-height: 0;
    padding: 12px;
}

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

.profkai-choice {
    min-height: 46px;
    border: 1px solid var(--pk-border);
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--pk-text);
    background: var(--pk-panel-soft);
    text-align: left;
    font-size: 15px;
}

.profkai-choice-single {
    grid-column: 1 / -1;
    max-width: 280px;
    justify-self: center;
    color: #fff;
    background: var(--pk-primary);
    text-align: center;
    font-weight: 650;
}

.profkai-choice:hover {
    border-color: var(--pk-primary);
}

.profkai-choice.is-correct {
    border-color: var(--pk-success);
    background: #e8f7f0;
}

.profkai-choice.is-incorrect {
    border-color: var(--pk-warning);
    background: #fff4e8;
}

.profkai-choice-feedback {
    margin-top: 10px;
    border-left: 4px solid var(--pk-primary);
    border-radius: 6px;
    padding: 9px 11px;
    color: var(--pk-text);
    background: var(--pk-primary-soft);
    font-size: 13px;
}

.profkai-choice-feedback.is-correction,
.profkai-choice-feedback.is-warning {
    border-left-color: var(--pk-warning);
    background: #fff4e8;
}

.profkai-choice-feedback.is-correct {
    border-left-color: var(--pk-success);
    background: #e8f7f0;
}

.profkai-balance {
    padding: 14px;
    text-align: center;
}

.profkai-balance-beam {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 42px 1fr;
    align-items: end;
    max-width: 620px;
    margin: 10px auto 18px;
    border-bottom: 5px solid var(--pk-primary);
}

.profkai-balance-pan {
    min-height: 54px;
    display: grid;
    place-items: center;
    margin: 0 8px 9px;
    border: 1px solid var(--pk-border);
    border-radius: 10px;
    background: var(--pk-primary-soft);
    font-family: Cambria, Georgia, serif;
    font-size: 19px;
}

.profkai-balance-center {
    width: 0;
    height: 0;
    justify-self: center;
    border-left: 19px solid transparent;
    border-right: 19px solid transparent;
    border-bottom: 48px solid var(--pk-primary);
}

.profkai-verification {
    border: 1px solid var(--pk-border);
    border-radius: 12px;
    padding: 14px;
    background: var(--pk-panel-soft);
}

.profkai-verification h3 {
    margin: 0 0 12px;
    font-size: 15px;
}

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

.profkai-verification-grid > div {
    display: grid;
    gap: 4px;
    border: 1px solid var(--pk-border);
    border-radius: 10px;
    padding: 12px;
    background: var(--pk-panel);
}

.profkai-verification-grid span,
.profkai-verification p {
    color: var(--pk-muted);
    font-size: 12px;
}

.profkai-verification-grid strong {
    font-family: Cambria, Georgia, serif;
    font-size: 19px;
}

.profkai-verification p {
    margin: 12px 0 0;
}

.profkai-mastery {
    display: grid;
    gap: 4px;
    margin-top: 10px;
    border-left: 4px solid var(--pk-success);
    border-radius: 8px;
    padding: 11px 13px;
    background: #e8f7f0;
}

.profkai-mastery span {
    color: var(--pk-muted);
    font-size: 12px;
}

.profkai-mastery [data-pk-score-message] {
    color: var(--pk-primary);
    font-size: clamp(17px, 1.8vw, 21px);
    font-weight: 700;
    line-height: 1.35;
}

.profkai-completion-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.profkai-session-record {
    margin-top: 12px;
    border: 1px solid var(--pk-border);
    border-radius: 10px;
    padding: 11px 12px;
    background: var(--pk-panel-soft);
    font-size: 12px;
}

.profkai-session-record > strong {
    display: block;
    margin-bottom: 6px;
}

.profkai-session-record [data-pk-session-entries] {
    display: grid;
    gap: 4px;
    margin-bottom: 7px;
}

.profkai-session-record small {
    color: var(--pk-muted);
}

.profkai-final-answer {
    font-weight: 700;
}
/* PROFKAI BLOCK END: SUPPORTING VISUAL */

/* PROFKAI BLOCK START: CONTROLS */
.profkai-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    min-height: 60px;
    margin-top: 10px;
    border-radius: 14px;
    padding: 9px 12px;
}

.profkai-button {
    min-height: 38px;
    border: 1px solid var(--pk-border);
    border-radius: 9px;
    padding: 8px 11px;
    color: var(--pk-text);
    background: var(--pk-panel);
    font-size: 14px;
}

.profkai-button:hover {
    border-color: var(--pk-primary);
}

.profkai-button-primary {
    border-color: var(--pk-primary);
    color: #ffffff;
    background: var(--pk-primary);
}

.profkai-button:disabled,
.profkai-choice:disabled {
    opacity: 0.55;
}

.profkai-control-note {
    color: var(--pk-muted);
    font-size: 12px;
}
/* PROFKAI BLOCK END: CONTROLS */

/* PROFKAI BLOCK START: RESPONSIVE CLASSROOM */
@media (max-width: 820px) {
    .profkai-grid {
        grid-template-columns: minmax(210px, 34%) minmax(0, 1fr);
    }

    .profkai-equation-line {
        font-size: clamp(21px, 3.5vw, 28px);
    }

    .profkai-controls {
        align-items: flex-start;
    }
}

@media (max-width: 650px) {
    .profkai-classroom {
        padding: 8px;
        border-radius: 12px;
    }

    .profkai-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 390px auto;
        grid-template-areas:
            "kai"
            "conversation"
            "board"
            "support";
    }

    .profkai-kai-stage {
        min-height: 220px;
    }

    .profkai-conversation-body {
        min-height: 230px;
    }

    .profkai-board {
        min-height: 360px;
        padding: 20px 10px;
    }

    .profkai-choices {
        grid-template-columns: 1fr;
    }

    .profkai-verification-grid {
        grid-template-columns: 1fr;
    }

    .profkai-topbar,
    .profkai-controls {
        align-items: flex-start;
        flex-direction: column;
    }

    .profkai-topbar-tools {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .profkai-language-select {
        max-width: none;
        width: 100%;
    }

    .profkai-subject-search {
        width: 100%;
    }

    .profkai-panel-header:has(.profkai-board-title-tools) {
        align-items: flex-start;
        flex-direction: column;
    }
}

.profkai-classroom.is-reduced-motion *,
.profkai-classroom.is-reduced-motion *::before,
.profkai-classroom.is-reduced-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
}

@media (prefers-reduced-motion: reduce) {
    .profkai-classroom *,
    .profkai-classroom *::before,
    .profkai-classroom *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}
/* PROFKAI BLOCK END: RESPONSIVE CLASSROOM */
