@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --ai-primary: #6C5CE7;
    --ai-primary-light: #A29BFE;
    --ai-secondary: #00CEC9;
    --ai-accent: #FDCB6E;
    --ai-coral: #FF7675;
    --ai-bg: #FFF9F0;
    --ai-card: #FFFFFF;
    --ai-text: #2D3436;
    --ai-muted: #636E72;
    --ai-border: #FFEAA7;
    --ai-radius: 16px;
    --ai-shadow: 0 4px 20px rgba(108, 92, 231, 0.12);
}

[data-theme="dark"] {
    --ai-bg: #1a1a2e;
    --ai-card: #16213e;
    --ai-text: #edf2f4;
    --ai-muted: #a0aec0;
    --ai-border: #2d3748;
    --ai-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.ai-study-dashboard {
    max-width: 1240px;
    margin: 24px auto;
    color: var(--ai-text);
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    box-sizing: border-box;
}

.ai-study-dashboard *,
.ai-study-auth-shell * {
    box-sizing: border-box;
}

.ai-study-shell {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    min-height: 760px;
    border: 2px solid var(--ai-border);
    background: var(--ai-bg);
    border-radius: var(--ai-radius);
    overflow: hidden;
    box-shadow: var(--ai-shadow);
}

.ai-study-tabs {
    padding: 14px;
    border-right: 2px solid var(--ai-border);
    background: var(--ai-card);
}

.ai-study-student-profile {
    display: grid;
    gap: 6px;
    margin-bottom: 14px;
    padding: 14px;
    border: 2px solid var(--ai-primary-light);
    border-radius: var(--ai-radius);
    background: linear-gradient(135deg, #f8f5ff 0%, #fff9f0 100%);
}

.ai-study-student-profile strong {
    color: var(--ai-primary);
    font-size: 16px;
}

.ai-study-student-profile span {
    color: var(--ai-muted);
    font-size: 13px;
}

.ai-study-logout-button {
    width: 100%;
    min-height: 34px;
    border: 1px solid #c8d6e2;
    border-radius: 8px;
    background: #ffffff;
    color: #183247;
    cursor: pointer;
    font-weight: 700;
}

.ai-study-tab {
    width: 100%;
    margin: 0 0 6px;
    padding: 10px 12px;
    border: 2px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--ai-text);
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.25;
    transition: all 0.2s ease;
}

.ai-study-tab.is-active,
.ai-study-tab:hover {
    border-color: var(--ai-primary-light);
    background: linear-gradient(135deg, #f0edff 0%, #e8fff9 100%);
    color: var(--ai-primary);
    transform: translateX(3px);
}

.ai-study-auth-shell {
    max-width: 1040px;
    margin: 28px auto;
    padding: 22px;
    border: 1px solid #dce4ec;
    background: #f6f8fb;
    color: #182033;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ai-study-auth-hero {
    margin-bottom: 18px;
    padding: 24px;
    border: 1px solid #cddce9;
    border-radius: 8px;
    background: #ffffff;
}

.ai-study-auth-hero span {
    display: block;
    margin-bottom: 8px;
    color: #0f6ba8;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.ai-study-auth-hero h2 {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.15;
}

.ai-study-auth-hero p {
    margin: 0;
    color: #526070;
    line-height: 1.5;
}

.ai-study-auth-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.ai-study-auth-card {
    display: grid;
    gap: 13px;
    padding: 20px;
    border: 1px solid #dce4ec;
    border-radius: 8px;
    background: #ffffff;
}

.ai-study-auth-card h3 {
    margin: 0;
    font-size: 21px;
}

.ai-study-auth-card label {
    display: grid;
    gap: 7px;
    color: #344054;
    font-weight: 700;
}

.ai-study-auth-card input[type="text"],
.ai-study-auth-card input[type="email"],
.ai-study-auth-card input[type="tel"],
.ai-study-auth-card input[type="password"] {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid #c8d6e2;
    border-radius: 8px;
}

.ai-study-auth-check {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 8px !important;
}

.ai-study-auth-notice {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-left: 4px solid #0b67a3;
    background: #eef7ff;
    color: #18435e;
    font-weight: 700;
}

.ai-study-auth-note {
    padding: 10px 12px;
    border: 1px solid #bdd7e9;
    border-radius: 8px;
    background: #f2f9ff;
    color: #18435e;
    line-height: 1.45;
}

.ai-study-main {
    min-width: 0;
    padding: 22px;
}

.ai-study-panel {
    display: none;
}

.ai-study-panel.is-active {
    display: block;
}

.ai-study-hero,
.ai-study-scan-hero {
    margin-bottom: 18px;
    padding: 26px;
    border: 1px solid #cddce9;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffffff 0%, #ecf7ff 100%);
}

.ai-study-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 18px;
    align-items: center;
}

.ai-study-kicker {
    display: block;
    margin-bottom: 8px;
    color: #0f6ba8;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

.ai-study-hero h2,
.ai-study-scan-hero h2 {
    margin: 0 0 10px;
    font-size: 32px;
    line-height: 1.15;
}

.ai-study-hero p,
.ai-study-scan-hero p,
.ai-study-muted {
    margin: 0 0 16px;
    color: #526070;
    line-height: 1.55;
}

.ai-study-hero__media {
    display: grid;
    place-items: center;
    min-height: 150px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid #d6e3ee;
}

.ai-study-camera-mark {
    font-size: 72px;
}

.ai-study-primary-button,
.ai-study-secondary-button,
.ai-study-upload-button,
.ai-study-link-button {
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

.ai-study-primary-button {
    border: 1px solid #0b67a3;
    background: #0b67a3;
    color: #ffffff;
}

.ai-study-secondary-button,
.ai-study-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #c8d6e2;
    background: #ffffff;
    color: #183247;
}

.ai-study-link-button {
    border: 0;
    background: transparent;
    color: #0b67a3;
}

.ai-study-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.ai-study-buddy-card {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid #d7d1ef;
    border-radius: 8px;
    background: #fbf9ff;
}

.ai-study-buddy-avatar {
    display: grid;
    place-items: center;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    border: 3px solid #8c7ad8;
    background: #ffffff;
    color: #51429a;
    font-size: 26px;
    font-weight: 900;
}

.ai-study-buddy-card h3 {
    margin: 0 0 6px;
    font-size: 22px;
}

.ai-study-buddy-card p {
    margin: 0 0 12px;
    color: #526070;
}

.ai-study-buddy-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ai-study-buddy-message {
    padding: 10px 12px;
    border-radius: 8px;
    background: #ffffff;
    color: #344054;
    font-weight: 700;
}

.ai-study-streak-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.ai-study-streak-badge {
    padding: 16px;
    border: 1px solid #dce4ec;
    border-radius: 8px;
    background: #ffffff;
}

.ai-study-streak-badge.is-unlocked {
    border-color: #b8d8c0;
    background: #f4fbf5;
}

.ai-study-streak-badge strong,
.ai-study-streak-badge span {
    display: block;
}

.ai-study-streak-badge span {
    margin-top: 6px;
    color: #667085;
}

.ai-study-stat-card,
.ai-study-section,
.ai-study-result-box,
.ai-study-subscription-box {
    padding: 18px;
    border: 1px solid #dce4ec;
    border-radius: 8px;
    background: #ffffff;
}

.ai-study-stat-card span,
.ai-study-stat-card small,
.ai-study-subscription-box span {
    display: block;
    color: #667085;
}

.ai-study-stat-card strong {
    display: block;
    margin: 8px 0 4px;
    font-size: 25px;
}

.ai-study-stat-card--action {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
}

.ai-study-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.ai-study-section__header h2,
.ai-study-section__header h3 {
    margin: 0;
}

.ai-study-dashboard__blocked {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-left: 4px solid #c93535;
    background: #fff2f2;
    color: #8a1f1f;
}

.ai-study-camera-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 14px;
    margin-bottom: 14px;
}

.ai-study-camera-box {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 360px;
    overflow: hidden;
    border: 1px solid #cddce9;
    border-radius: 8px;
    background: #111827;
}

.ai-study-camera-video,
.ai-study-image-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ai-study-camera-empty {
    display: grid;
    gap: 6px;
    place-items: center;
    color: #ffffff;
    text-align: center;
}

.ai-study-camera-actions {
    display: grid;
    gap: 10px;
    align-content: start;
}

.ai-study-compact-label {
    display: grid;
    gap: 6px;
    color: #344054;
    font-size: 13px;
    font-weight: 700;
}

.ai-study-compact-label select {
    min-height: 40px;
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #c8d6e2;
    border-radius: 8px;
    background: #ffffff;
    color: #182033;
}

.ai-study-smart-ocr-box {
    display: grid;
    grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
    gap: 14px;
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid #bdd7e9;
    border-radius: 8px;
    background: #f2f9ff;
}

.ai-study-smart-ocr-box strong {
    display: block;
    margin-bottom: 6px;
    color: #0b4778;
}

.ai-study-smart-ocr-box p {
    margin: 0;
    color: #526070;
    line-height: 1.45;
}

.ai-study-revision-box,
.ai-study-weakness-box {
    display: grid;
    gap: 12px;
    margin-top: 2px;
    margin-bottom: 14px;
    padding: 16px;
    border: 1px solid #cfe0d3;
    border-radius: 8px;
    background: #f5fbf6;
}

.ai-study-revision-box {
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: center;
}

.ai-study-revision-box strong,
.ai-study-weakness-box strong {
    display: block;
    margin-bottom: 6px;
    color: #235b35;
}

.ai-study-revision-box p,
.ai-study-weakness-box p,
.ai-study-output-block p {
    margin: 0;
    color: #526070;
    line-height: 1.45;
}

.ai-study-output-block h4 {
    margin: 0 0 10px;
}

.ai-study-output-block ol,
.ai-study-output-block ul {
    margin-top: 8px;
    margin-bottom: 8px;
    padding-left: 22px;
}

.ai-study-premium-box {
    display: grid;
    gap: 10px;
    padding: 16px;
    border: 1px solid #d8c58c;
    border-radius: 8px;
    background: #fffaf0;
}

.ai-study-premium-badge {
    width: fit-content;
    padding: 5px 9px;
    border-radius: 8px;
    background: #7a5600;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
}

.ai-study-premium-box strong {
    color: #5a3d00;
    font-size: 18px;
}

.ai-study-premium-box p {
    margin: 0;
    color: #5f5a4d;
    line-height: 1.45;
}

.ai-study-premium-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-study-chat-row {
    margin: 8px 0;
    padding: 10px 12px;
    border-radius: 8px;
    line-height: 1.45;
}

.ai-study-chat-user {
    background: #eef7ff;
    color: #18435e;
}

.ai-study-chat-ai {
    background: #f4fbf5;
    color: #235b35;
}

.ai-study-feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.ai-study-feature-list span {
    padding: 8px 10px;
    border: 1px solid #d6e3ee;
    border-radius: 8px;
    background: #ffffff;
    color: #344054;
    font-size: 13px;
}

.ai-study-answer-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.ai-study-result-box h3 {
    margin: 0 0 10px;
}

.ai-study-result-box textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #c8d6e2;
    border-radius: 8px;
    resize: vertical;
}

.ai-study-answer-output {
    min-height: 150px;
    padding: 12px;
    border: 1px solid #c8d6e2;
    border-radius: 8px;
    background: #f8fafc;
    color: #344054;
}

.ai-study-save-note {
    margin: 12px 0 0;
    padding-top: 10px;
    border-top: 1px solid #dce4ec;
    color: #0b67a3;
    font-weight: 700;
}

.ai-study-history-list {
    display: grid;
    gap: 10px;
}

.ai-study-history-item {
    padding: 14px;
    border: 1px solid #dce4ec;
    border-radius: 8px;
    background: #ffffff;
}

.ai-study-history-item span {
    color: #0b67a3;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.ai-study-history-item h4 {
    margin: 6px 0;
}

.ai-study-history-item p,
.ai-study-empty-state {
    margin: 0;
    color: #667085;
}

.ai-study-subscription-box {
    display: grid;
    gap: 8px;
}

.ai-study-subscription-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.ai-study-subscription-box p {
    margin: 0;
    color: #526070;
}

.ai-study-tool-panel {
    display: grid;
    gap: 16px;
}

.ai-study-tool-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr);
    gap: 14px;
}

.ai-study-tool-inputs,
.ai-study-tool-output {
    display: grid;
    align-content: start;
    gap: 12px;
}

.ai-study-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ai-study-chip-row span {
    padding: 8px 10px;
    border: 1px solid #bdd7e9;
    border-radius: 8px;
    background: #eef7ff;
    color: #18435e;
    font-size: 13px;
    font-weight: 700;
}

.ai-study-field-label {
    display: grid;
    gap: 8px;
    color: #344054;
    font-weight: 700;
}

.ai-study-file-input,
.ai-study-field-label textarea,
.ai-study-tool-actions select {
    width: 100%;
    border: 1px solid #c8d6e2;
    border-radius: 8px;
    background: #ffffff;
    color: #182033;
}

.ai-study-file-input,
.ai-study-tool-actions select {
    min-height: 42px;
    padding: 8px 10px;
}

.ai-study-field-label textarea {
    min-height: 170px;
    padding: 12px;
    resize: vertical;
    font-weight: 400;
}

.ai-study-file-name {
    margin: -4px 0 2px;
    color: #667085;
    font-size: 13px;
}

.ai-study-tool-actions {
    display: grid;
    grid-template-columns: minmax(0, 150px) minmax(0, 150px) max-content max-content;
    gap: 10px;
    align-items: center;
}

.ai-study-premium-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.ai-study-premium-fields input,
.ai-study-premium-fields select {
    width: 100%;
    min-height: 42px;
    border: 1px solid #c9d4df;
    border-radius: 8px;
    padding: 10px 12px;
}

.ai-study-premium-previews {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin: 10px 0 12px;
}

.ai-study-premium-previews img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #dce4ec;
}

.ai-study-warning-inline {
    background: #fff8e6;
    border: 1px solid #ffe1a3;
    color: #8a5a00;
    border-radius: 8px;
    padding: 10px 12px;
    font-weight: 700;
}

.ai-study-master-card-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 14px 0 18px;
}

.ai-study-master-card {
    background: #fff;
    border: 1px solid #dce4ec;
    border-radius: 8px;
    padding: 14px;
    min-height: 118px;
}

.ai-study-master-card.is-highlighted {
    border-color: #2e90fa;
    background: #eff8ff;
}

.ai-study-master-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.ai-study-master-card p {
    margin: 0;
    color: #667085;
    font-size: 13px;
}

.ai-study-table-builder {
    background: #fff;
    border: 1px solid #dce4ec;
    border-radius: 8px;
    padding: 18px;
}

.ai-study-table-controls {
    display: grid;
    grid-template-columns: minmax(0, 160px) minmax(0, 180px) repeat(3, max-content);
    gap: 10px;
    align-items: end;
    margin-bottom: 14px;
}

.ai-study-table-controls--wide {
    grid-template-columns: minmax(0, 220px) repeat(5, minmax(0, 120px)) max-content max-content;
}

.ai-study-table-controls--english {
    grid-template-columns: repeat(4, minmax(0, 1fr)) max-content;
}

.ai-study-calculation-result ol,
.ai-study-formula-result ol {
    margin-top: 12px;
}

.ai-study-graph-placeholder {
    min-height: 220px;
    border: 1px dashed #98a2b3;
    border-radius: 8px;
    background: linear-gradient(90deg, rgba(152,162,179,.18) 1px, transparent 1px), linear-gradient(rgba(152,162,179,.18) 1px, transparent 1px);
    background-size: 28px 28px;
    padding: 16px;
    display: grid;
    align-content: center;
    text-align: center;
}

.ai-study-vocab-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ai-study-vocab-card {
    border: 1px solid #e4eaf1;
    border-radius: 8px;
    background: #f7f9fc;
    padding: 14px;
}

.ai-study-vocab-card h5 {
    margin: 0 0 10px;
    font-size: 18px;
}

.ai-study-vocab-card p {
    margin: 6px 0;
}

.ai-study-english-tool-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.ai-study-english-tool-card {
    border: 1px solid #e4eaf1;
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.ai-study-english-tool-card h4 {
    margin: 0 0 8px;
}

.ai-study-english-tool-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 10px 0;
}

.ai-study-english-tool-card textarea,
.ai-study-english-tool-card select {
    width: 100%;
    border: 1px solid #c9d4df;
    border-radius: 8px;
    padding: 10px 12px;
}

.ai-study-table-lines {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.ai-study-table-lines div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #e4eaf1;
    border-radius: 8px;
    padding: 10px 12px;
    background: #f7f9fc;
}

.ai-study-tool-output h3 {
    margin: 0;
}

.ai-study-feature-list--wide {
    margin-top: 2px;
}

.ai-study-advanced {
    max-width: 1120px;
    margin: 24px auto;
    padding: 0 16px;
    color: #172033;
}

.ai-study-advanced-header {
    margin-bottom: 16px;
}

.ai-study-advanced-header h2 {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.15;
}

.ai-study-advanced-header p {
    margin: 0;
    color: #667085;
}

.ai-study-advanced-card,
.ai-study-question-card {
    background: #fff;
    border: 1px solid #dce4ec;
    border-radius: 8px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 8px 24px rgba(22, 34, 51, .06);
}

.ai-study-advanced-grid {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.ai-study-advanced-grid--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ai-study-advanced-grid--four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ai-study-field {
    display: grid;
    gap: 6px;
    font-weight: 700;
}

.ai-study-field input,
.ai-study-field select,
.ai-study-field textarea,
.ai-study-filter-bar input,
.ai-study-filter-bar select,
.ai-study-inline-form input,
.ai-study-inline-form select {
    width: 100%;
    min-height: 42px;
    border: 1px solid #c9d4df;
    border-radius: 8px;
    padding: 10px 12px;
    background: #fff;
    color: #172033;
}

.ai-study-field textarea {
    resize: vertical;
}

.ai-study-filter-bar,
.ai-study-inline-form,
.ai-study-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
    margin-bottom: 14px;
}

.ai-study-filter-bar label {
    display: grid;
    gap: 6px;
    flex: 1 1 170px;
    font-weight: 700;
}

.ai-study-inline-form > * {
    flex: 1 1 160px;
}

.ai-study-advanced-list {
    display: grid;
    gap: 14px;
}

.ai-study-advanced-list--grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ai-study-meta-row,
.ai-study-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.ai-study-meta-row span,
.ai-study-chip-row span {
    background: #eef6f1;
    color: #1f6f4a;
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 700;
}

.ai-study-answer-box {
    background: #f7f9fc;
    border: 1px solid #e4eaf1;
    border-radius: 8px;
    padding: 12px;
}

.ai-study-warning,
.ai-study-success {
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-weight: 700;
}

.ai-study-warning {
    background: #fff8e6;
    color: #8a5a00;
    border: 1px solid #ffe1a3;
}

.ai-study-success {
    background: #ecfdf3;
    color: #05603a;
    border: 1px solid #abefc6;
}

.ai-study-timer {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    min-height: 44px;
    background: #172033;
    color: #fff;
    border-radius: 8px;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 12px;
}

.ai-study-timer.is-finished {
    background: #b42318;
}

.ai-study-question-card {
    display: grid;
    gap: 10px;
}

.ai-study-question-card legend {
    font-weight: 800;
    margin-bottom: 8px;
}

.ai-study-question-card label {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.ai-study-history-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #edf1f6;
    padding: 10px 0;
}

.ai-study-result-details {
    margin: 8px 0 12px;
}

.ai-study-progress-line {
    height: 10px;
    background: #edf1f6;
    border-radius: 999px;
    overflow: hidden;
}

.ai-study-progress-line span {
    display: block;
    height: 100%;
    background: #2e90fa;
}

.ai-study-report-card .ai-study-advanced-grid > div {
    display: grid;
    gap: 6px;
    background: #f7f9fc;
    border: 1px solid #e4eaf1;
    border-radius: 8px;
    padding: 12px;
}

.ai-study-flashcard-stack {
    display: grid;
    gap: 12px;
}

.ai-study-flashcard {
    background: #fff;
    border: 1px solid #dce4ec;
    border-radius: 8px;
    padding: 18px;
}

.ai-study-flashcard span {
    color: #667085;
    font-weight: 700;
}

.ai-study-flashcard h3 {
    margin: 8px 0 12px;
}

@media (max-width: 900px) {
    .ai-study-shell,
    .ai-study-hero,
    .ai-study-auth-grid,
    .ai-study-camera-grid,
    .ai-study-answer-layout,
    .ai-study-tool-grid,
    .ai-study-subscription-grid,
    .ai-study-smart-ocr-box,
    .ai-study-revision-box,
    .ai-study-buddy-card,
    .ai-study-streak-grid,
    .ai-study-advanced-grid--two,
    .ai-study-advanced-grid--four,
    .ai-study-advanced-list--grid {
        grid-template-columns: 1fr;
    }

    .ai-study-tabs {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid #dce4ec;
    }

    .ai-study-tab {
        flex: 0 0 auto;
        width: auto;
        white-space: nowrap;
    }

    .ai-study-stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .ai-study-dashboard,
    .ai-study-auth-shell {
        width: 100%;
        margin: 0;
        padding: 10px;
        border-left: 0;
        border-right: 0;
    }

    .ai-study-shell {
        min-height: auto;
        border-left: 0;
        border-right: 0;
    }

    .ai-study-main {
        padding: 10px;
    }

    .ai-study-tabs {
        padding: 10px;
    }

    .ai-study-tab {
        font-size: 13px;
        padding: 9px 10px;
    }

    .ai-study-auth-hero,
    .ai-study-auth-card,
    .ai-study-section,
    .ai-study-stat-card,
    .ai-study-result-box,
    .ai-study-subscription-box {
        padding: 14px;
    }

    .ai-study-hero h2,
    .ai-study-scan-hero h2,
    .ai-study-auth-hero h2 {
        font-size: 23px;
    }

    .ai-study-stat-grid {
        grid-template-columns: 1fr;
    }

    .ai-study-camera-box {
        min-height: 260px;
    }

    .ai-study-tool-actions {
        grid-template-columns: 1fr;
    }

    .ai-study-premium-fields,
    .ai-study-premium-previews,
    .ai-study-master-card-grid,
    .ai-study-table-controls,
    .ai-study-table-lines,
    .ai-study-table-controls--english,
    .ai-study-vocab-grid,
    .ai-study-english-tool-grid,
    .ai-study-english-tool-controls {
        grid-template-columns: 1fr;
    }

    .ai-study-advanced {
        padding: 0 10px;
        margin: 10px auto;
    }

    .ai-study-advanced-header h2 {
        font-size: 24px;
    }

    .ai-study-filter-bar,
    .ai-study-inline-form,
    .ai-study-card-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .ai-study-history-row {
        display: grid;
    }

    .ai-study-primary-button,
    .ai-study-secondary-button,
    .ai-study-upload-button,
    .ai-study-link-button {
        width: 100%;
        justify-content: center;
        white-space: normal;
    }
}

/* Kids-friendly colorful dashboard theme */
.ai-study-dashboard {
    background: #fff8fd;
    border-radius: 18px;
}

.ai-study-shell {
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, #fff7e8 0%, #eef8ff 45%, #fff0fb 100%);
    box-shadow: 0 18px 45px rgba(66, 88, 130, .18);
}

.ai-study-tabs {
    border-right: 0;
    background:
        radial-gradient(circle at 18% 8%, rgba(255, 215, 105, .95) 0 34px, transparent 35px),
        radial-gradient(circle at 88% 20%, rgba(126, 224, 255, .9) 0 28px, transparent 29px),
        radial-gradient(circle at 22% 88%, rgba(255, 146, 198, .75) 0 34px, transparent 35px),
        linear-gradient(180deg, #6c5ce7 0%, #00b8d9 52%, #35d07f 100%);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, .35);
}

.ai-study-student-profile {
    border: 2px solid rgba(255, 255, 255, .75);
    border-radius: 16px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 10px 22px rgba(27, 43, 92, .18);
}

.ai-study-student-profile strong {
    color: #4a2fb5;
    font-size: 17px;
}

.ai-study-student-profile span {
    color: #007c89;
    font-weight: 800;
}

.ai-study-logout-button {
    border: 0;
    background: linear-gradient(135deg, #ff6b6b, #ff9f43);
    color: #fff;
    box-shadow: 0 6px 14px rgba(255, 107, 107, .3);
}

.ai-study-tab {
    position: relative;
    overflow: hidden;
    margin-bottom: 8px;
    border: 2px solid rgba(255, 255, 255, .38);
    border-radius: 14px;
    background: rgba(255, 255, 255, .20);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(32, 50, 110, .14);
    transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}

.ai-study-tab:nth-of-type(4n + 1) {
    background: rgba(255, 122, 162, .42);
}

.ai-study-tab:nth-of-type(4n + 2) {
    background: rgba(255, 209, 102, .42);
}

.ai-study-tab:nth-of-type(4n + 3) {
    background: rgba(78, 205, 196, .42);
}

.ai-study-tab:nth-of-type(4n + 4) {
    background: rgba(126, 87, 194, .42);
}

.ai-study-tab:hover,
.ai-study-tab.is-active {
    transform: translateX(4px);
    border-color: #fff;
    background: #fff;
    color: #4a2fb5;
    box-shadow: 0 12px 24px rgba(27, 43, 92, .25);
}

.ai-study-main {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, .62), rgba(255, 255, 255, .86)),
        radial-gradient(circle at 100% 0%, rgba(255, 214, 102, .35), transparent 260px),
        radial-gradient(circle at 0% 100%, rgba(78, 205, 196, .32), transparent 280px);
}

.ai-study-hero,
.ai-study-scan-hero,
.ai-study-auth-hero {
    border: 0;
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(255, 250, 231, .92)),
        linear-gradient(135deg, #ff9ff3, #feca57 35%, #48dbfb 70%, #1dd1a1);
    box-shadow: 0 14px 35px rgba(67, 83, 125, .16);
}

.ai-study-kicker {
    color: #d63384;
    letter-spacing: 0;
}

.ai-study-primary-button {
    border: 0;
    background: linear-gradient(135deg, #ff6b6b 0%, #feca57 52%, #1dd1a1 100%);
    color: #fff;
    box-shadow: 0 8px 18px rgba(255, 107, 107, .25);
}

.ai-study-secondary-button,
.ai-study-upload-button,
.ai-study-link-button {
    border: 2px solid #c7f0ff;
    background: #ffffff;
    color: #4a2fb5;
    box-shadow: 0 6px 14px rgba(72, 219, 251, .18);
}

.ai-study-stat-card,
.ai-study-section,
.ai-study-result-box,
.ai-study-subscription-box,
.ai-study-table-builder,
.ai-study-advanced-card,
.ai-study-question-card,
.ai-study-english-tool-card,
.ai-study-vocab-card {
    border: 0;
    border-radius: 16px;
    background: rgba(255, 255, 255, .95);
    box-shadow: 0 10px 26px rgba(66, 88, 130, .12);
}

.ai-study-stat-card:nth-child(4n + 1),
.ai-study-master-card:nth-child(4n + 1) {
    background: linear-gradient(135deg, #fff, #fff1f8);
}

.ai-study-stat-card:nth-child(4n + 2),
.ai-study-master-card:nth-child(4n + 2) {
    background: linear-gradient(135deg, #fff, #fff8df);
}

.ai-study-stat-card:nth-child(4n + 3),
.ai-study-master-card:nth-child(4n + 3) {
    background: linear-gradient(135deg, #fff, #e9fbff);
}

.ai-study-stat-card:nth-child(4n + 4),
.ai-study-master-card:nth-child(4n + 4) {
    background: linear-gradient(135deg, #fff, #ebfff4);
}

.ai-study-master-card {
    border: 0;
    border-radius: 16px;
    box-shadow: 0 10px 22px rgba(66, 88, 130, .12);
}

.ai-study-master-card.is-highlighted {
    border: 2px solid #48dbfb;
    background: linear-gradient(135deg, #e9fbff, #fff8df);
}

.ai-study-buddy-card {
    border: 0;
    border-radius: 18px;
    background: linear-gradient(135deg, #fef3ff 0%, #e8f9ff 48%, #ecfff4 100%);
    box-shadow: 0 14px 34px rgba(108, 92, 231, .18);
}

.ai-study-buddy-avatar,
.ai-study-camera-mark {
    background: linear-gradient(135deg, #6c5ce7, #ff6bcb);
    color: #fff;
}

.ai-study-field-label input,
.ai-study-field-label select,
.ai-study-field-label textarea,
.ai-study-auth-card input[type="text"],
.ai-study-auth-card input[type="email"],
.ai-study-auth-card input[type="tel"],
.ai-study-auth-card input[type="password"] {
    border: 2px solid #dff3ff;
    border-radius: 12px;
    background: #fff;
}

.ai-study-answer-box,
.ai-study-table-lines div {
    border: 0;
    border-radius: 14px;
    background: #f3fbff;
}

@media (max-width: 900px) {
    .ai-study-tabs {
        background: linear-gradient(90deg, #6c5ce7, #00b8d9, #35d07f);
    }

    .ai-study-tab:hover,
    .ai-study-tab.is-active {
        transform: translateY(-2px);
    }
}

/* =========================================================
   AI Study Assistant Pro - Premium Colorful UI + Theme Pack
   Added: light/dark toggle, glassmorphism, neon dark theme,
   animated cards, progress rings feel, gamification polish.
   ========================================================= */
:root {
    --ai-ui-bg: #eef4ff;
    --ai-ui-bg-2: #fff7ed;
    --ai-ui-card: rgba(255, 255, 255, .86);
    --ai-ui-card-solid: #ffffff;
    --ai-ui-text: #14213d;
    --ai-ui-muted: #5f6f89;
    --ai-ui-border: rgba(99, 102, 241, .18);
    --ai-ui-shadow: 0 22px 60px rgba(45, 55, 99, .16);
    --ai-ui-shadow-soft: 0 12px 30px rgba(45, 55, 99, .10);
    --ai-ui-gradient: linear-gradient(135deg, #ff5c8a 0%, #ffb703 30%, #22c55e 62%, #3b82f6 100%);
    --ai-ui-gradient-2: linear-gradient(135deg, #7c3aed 0%, #ec4899 45%, #f59e0b 100%);
    --ai-ui-gradient-3: linear-gradient(135deg, #06b6d4 0%, #6366f1 52%, #a855f7 100%);
}

html[data-theme="dark"] {
    --ai-ui-bg: #08111f;
    --ai-ui-bg-2: #111827;
    --ai-ui-card: rgba(15, 23, 42, .76);
    --ai-ui-card-solid: #111827;
    --ai-ui-text: #f8fafc;
    --ai-ui-muted: #cbd5e1;
    --ai-ui-border: rgba(148, 163, 184, .22);
    --ai-ui-shadow: 0 24px 70px rgba(0, 0, 0, .42);
    --ai-ui-shadow-soft: 0 12px 36px rgba(0, 0, 0, .32);
}

.ai-study-dashboard,
.ai-study-auth-shell {
    color: var(--ai-ui-text) !important;
}

.ai-study-dashboard {
    position: relative;
    isolation: isolate;
}

.ai-study-dashboard::before {
    content: "";
    position: absolute;
    inset: -22px;
    z-index: -1;
    border-radius: 34px;
    background:
        radial-gradient(circle at 10% 8%, rgba(236, 72, 153, .28), transparent 310px),
        radial-gradient(circle at 90% 12%, rgba(59, 130, 246, .24), transparent 300px),
        radial-gradient(circle at 50% 100%, rgba(34, 197, 94, .18), transparent 340px),
        linear-gradient(135deg, var(--ai-ui-bg), var(--ai-ui-bg-2));
}

.ai-study-shell {
    overflow: hidden;
    border: 1px solid var(--ai-ui-border) !important;
    border-radius: 30px !important;
    background: rgba(255, 255, 255, .44) !important;
    box-shadow: var(--ai-ui-shadow) !important;
    backdrop-filter: blur(18px);
}

html[data-theme="dark"] .ai-study-shell {
    background: rgba(2, 6, 23, .62) !important;
}

.ai-study-tabs {
    border-right: 1px solid var(--ai-ui-border) !important;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, .36), transparent 180px),
        var(--ai-ui-gradient-3) !important;
}

html[data-theme="dark"] .ai-study-tabs {
    background:
        radial-gradient(circle at top left, rgba(236, 72, 153, .22), transparent 190px),
        linear-gradient(180deg, #111827, #1e1b4b 56%, #0f172a) !important;
}

.ai-study-main {
    background:
        radial-gradient(circle at 15% 5%, rgba(255, 92, 138, .18), transparent 260px),
        radial-gradient(circle at 95% 8%, rgba(34, 197, 94, .16), transparent 260px),
        linear-gradient(135deg, var(--ai-ui-bg), var(--ai-ui-bg-2)) !important;
    color: var(--ai-ui-text) !important;
}

html[data-theme="dark"] .ai-study-main {
    background:
        radial-gradient(circle at 15% 5%, rgba(236, 72, 153, .14), transparent 280px),
        radial-gradient(circle at 95% 8%, rgba(14, 165, 233, .15), transparent 280px),
        linear-gradient(135deg, #020617, #111827) !important;
}

.ai-study-student-profile,
.ai-study-stat-card,
.ai-study-section,
.ai-study-result-box,
.ai-study-subscription-box,
.ai-study-table-builder,
.ai-study-advanced-card,
.ai-study-question-card,
.ai-study-english-tool-card,
.ai-study-vocab-card,
.ai-study-master-card,
.ai-study-auth-card {
    border: 1px solid var(--ai-ui-border) !important;
    background: var(--ai-ui-card) !important;
    color: var(--ai-ui-text) !important;
    box-shadow: var(--ai-ui-shadow-soft) !important;
    backdrop-filter: blur(16px);
}

.ai-study-stat-card,
.ai-study-section,
.ai-study-result-box,
.ai-study-subscription-box,
.ai-study-advanced-card,
.ai-study-question-card,
.ai-study-master-card,
.ai-study-auth-card {
    border-radius: 22px !important;
}

.ai-study-stat-card,
.ai-study-master-card,
.ai-study-advanced-card,
.ai-study-question-card,
.ai-study-english-tool-card,
.ai-study-vocab-card,
.ai-study-streak-badge {
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.ai-study-stat-card:hover,
.ai-study-master-card:hover,
.ai-study-advanced-card:hover,
.ai-study-question-card:hover,
.ai-study-english-tool-card:hover,
.ai-study-vocab-card:hover,
.ai-study-streak-badge:hover {
    transform: translateY(-5px) scale(1.01);
    box-shadow: 0 26px 58px rgba(72, 79, 130, .22) !important;
}

.ai-study-hero,
.ai-study-scan-hero,
.ai-study-auth-hero {
    position: relative;
    overflow: hidden;
    border: 0 !important;
    border-radius: 28px !important;
    background: var(--ai-ui-gradient) !important;
    color: #fff !important;
    box-shadow: 0 24px 60px rgba(99, 102, 241, .28) !important;
}

.ai-study-hero::after,
.ai-study-scan-hero::after,
.ai-study-auth-hero::after {
    content: "";
    position: absolute;
    width: 260px;
    height: 260px;
    top: -90px;
    right: -80px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .22);
    filter: blur(2px);
}

.ai-study-hero h2,
.ai-study-hero p,
.ai-study-scan-hero h2,
.ai-study-scan-hero p,
.ai-study-auth-hero h2,
.ai-study-auth-hero p,
.ai-study-kicker {
    color: #fff !important;
}

.ai-study-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .20);
    backdrop-filter: blur(8px);
}

.ai-study-kicker::before { content: "✨"; }

.ai-study-primary-button,
.ai-study-secondary-button,
.ai-study-upload-button,
.ai-study-link-button,
.ai-study-logout-button,
.ai-theme-toggle {
    border: 0 !important;
    border-radius: 15px !important;
    font-weight: 900 !important;
    letter-spacing: .01em;
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}

.ai-study-primary-button,
.ai-theme-toggle {
    background: var(--ai-ui-gradient-2) !important;
    color: #fff !important;
    box-shadow: 0 14px 28px rgba(236, 72, 153, .25) !important;
}

.ai-study-secondary-button,
.ai-study-upload-button,
.ai-study-link-button {
    background: rgba(255, 255, 255, .90) !important;
    color: #4338ca !important;
    box-shadow: 0 10px 22px rgba(59, 130, 246, .14) !important;
}

html[data-theme="dark"] .ai-study-secondary-button,
html[data-theme="dark"] .ai-study-upload-button,
html[data-theme="dark"] .ai-study-link-button {
    background: rgba(30, 41, 59, .92) !important;
    color: #dbeafe !important;
}

.ai-study-primary-button:hover,
.ai-study-secondary-button:hover,
.ai-study-upload-button:hover,
.ai-study-link-button:hover,
.ai-study-logout-button:hover,
.ai-theme-toggle:hover {
    transform: translateY(-3px);
    filter: saturate(1.1);
}

.ai-theme-toggle {
    width: 100%;
    min-height: 42px;
    margin-bottom: 12px;
    cursor: pointer;
}

.ai-study-tab {
    border: 1px solid rgba(255,255,255,.34) !important;
    border-radius: 16px !important;
    background: rgba(255,255,255,.16) !important;
    color: #fff !important;
    backdrop-filter: blur(8px);
}

.ai-study-tab::before {
    content: "";
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 8px;
    border-radius: 99px;
    background: #facc15;
    box-shadow: 0 0 12px rgba(250, 204, 21, .8);
}

.ai-study-tab:hover,
.ai-study-tab.is-active {
    background: #fff !important;
    color: #4f46e5 !important;
}

html[data-theme="dark"] .ai-study-tab:hover,
html[data-theme="dark"] .ai-study-tab.is-active {
    background: linear-gradient(135deg, #312e81, #831843) !important;
    color: #fff !important;
}

.ai-study-student-profile strong,
.ai-study-section__header h2,
.ai-study-section__header h3,
.ai-study-auth-card h3,
.ai-study-buddy-card h3,
.ai-study-stat-card strong,
.ai-study-master-card h3,
.ai-study-question-card h4 {
    color: var(--ai-ui-text) !important;
}

.ai-study-student-profile span,
.ai-study-muted,
.ai-study-buddy-card p,
.ai-study-stat-card span,
.ai-study-stat-card small,
.ai-study-field-label,
.ai-study-auth-card label {
    color: var(--ai-ui-muted) !important;
}

.ai-study-buddy-card {
    border: 1px solid var(--ai-ui-border) !important;
    border-radius: 26px !important;
    background:
        radial-gradient(circle at 0% 0%, rgba(255, 255, 255, .72), transparent 210px),
        linear-gradient(135deg, rgba(236, 72, 153, .14), rgba(14, 165, 233, .16), rgba(34, 197, 94, .12)) !important;
    box-shadow: var(--ai-ui-shadow-soft) !important;
}

.ai-study-buddy-avatar,
.ai-study-camera-mark {
    background: var(--ai-ui-gradient-3) !important;
    box-shadow: 0 0 0 8px rgba(99, 102, 241, .10), 0 0 28px rgba(99, 102, 241, .38) !important;
}

.ai-study-streak-grid {
    gap: 16px !important;
}

.ai-study-streak-badge {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--ai-ui-border) !important;
    border-radius: 22px !important;
    background: var(--ai-ui-card) !important;
    color: var(--ai-ui-text) !important;
    box-shadow: var(--ai-ui-shadow-soft) !important;
}

.ai-study-streak-badge::before {
    content: "🏆";
    position: absolute;
    right: 14px;
    top: 10px;
    font-size: 24px;
    opacity: .45;
}

.ai-study-streak-badge.is-unlocked {
    background: linear-gradient(135deg, rgba(250, 204, 21, .24), rgba(34, 197, 94, .18), var(--ai-ui-card)) !important;
    border-color: rgba(250, 204, 21, .45) !important;
}

.ai-study-progress-line {
    height: 14px !important;
    padding: 3px;
    border-radius: 999px !important;
    background: rgba(148, 163, 184, .22) !important;
}

.ai-study-progress-line span {
    height: 100% !important;
    border-radius: 999px !important;
    background: var(--ai-ui-gradient) !important;
    box-shadow: 0 0 18px rgba(59, 130, 246, .35);
}

.ai-study-field-label input,
.ai-study-field-label select,
.ai-study-field-label textarea,
.ai-study-auth-card input[type="text"],
.ai-study-auth-card input[type="email"],
.ai-study-auth-card input[type="tel"],
.ai-study-auth-card input[type="password"] {
    border: 1px solid var(--ai-ui-border) !important;
    background: var(--ai-ui-card-solid) !important;
    color: var(--ai-ui-text) !important;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

.ai-study-answer-box,
.ai-study-table-lines div,
.ai-study-buddy-message {
    border: 1px solid var(--ai-ui-border) !important;
    background: rgba(255, 255, 255, .64) !important;
    color: var(--ai-ui-text) !important;
}

html[data-theme="dark"] .ai-study-answer-box,
html[data-theme="dark"] .ai-study-table-lines div,
html[data-theme="dark"] .ai-study-buddy-message {
    background: rgba(15, 23, 42, .86) !important;
}

@keyframes aiStudyFloatSoft {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.ai-study-hero__media,
.ai-study-buddy-avatar,
.ai-study-camera-mark {
    animation: aiStudyFloatSoft 4s ease-in-out infinite;
}

@media (max-width: 900px) {
    .ai-study-shell { border-radius: 22px !important; }
    .ai-study-tabs { border-right: 0 !important; }
    .ai-study-tab { min-width: max-content; }
}

@media (max-width: 560px) {
    .ai-study-dashboard { margin: 12px auto; }
    .ai-study-hero,
    .ai-study-scan-hero,
    .ai-study-auth-hero { border-radius: 22px !important; }
}

/* Fixed kids-friendly light/dark theme layer */
html[data-theme="light"],
body[data-ai-study-theme="light"] {
    --ai-ui-bg: #fff7ed;
    --ai-ui-bg-2: #e0f7ff;
    --ai-ui-card: rgba(255, 255, 255, .92);
    --ai-ui-card-solid: #ffffff;
    --ai-ui-text: #13213c;
    --ai-ui-muted: #4b5874;
    --ai-ui-border: rgba(99, 102, 241, .20);
    --ai-ui-gradient: linear-gradient(135deg, #ff5c8a 0%, #ffb703 32%, #22c55e 66%, #3b82f6 100%);
    --ai-ui-gradient-2: linear-gradient(135deg, #7c3aed 0%, #ec4899 50%, #f59e0b 100%);
    --ai-ui-gradient-3: linear-gradient(135deg, #06b6d4 0%, #6366f1 55%, #a855f7 100%);
    --ai-ui-shadow: 0 22px 60px rgba(45, 55, 99, .16);
    --ai-ui-shadow-soft: 0 12px 30px rgba(45, 55, 99, .10);
}

html[data-theme="dark"],
body[data-ai-study-theme="dark"],
.ai-study-dashboard[data-ai-study-theme="dark"] {
    --ai-ui-bg: #07111f;
    --ai-ui-bg-2: #15112a;
    --ai-ui-card: rgba(15, 23, 42, .86);
    --ai-ui-card-solid: #111827;
    --ai-ui-text: #f8fafc;
    --ai-ui-muted: #cbd5e1;
    --ai-ui-border: rgba(148, 163, 184, .28);
    --ai-ui-gradient: linear-gradient(135deg, #7f1d1d 0%, #581c87 34%, #164e63 68%, #14532d 100%);
    --ai-ui-gradient-2: linear-gradient(135deg, #312e81 0%, #831843 52%, #92400e 100%);
    --ai-ui-gradient-3: linear-gradient(135deg, #0f172a 0%, #312e81 52%, #831843 100%);
    --ai-ui-shadow: 0 24px 70px rgba(0, 0, 0, .44);
    --ai-ui-shadow-soft: 0 12px 36px rgba(0, 0, 0, .32);
}

.ai-study-dashboard[data-ai-study-theme],
.ai-study-auth-shell[data-ai-study-theme] {
    color: var(--ai-ui-text) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-shell {
    border-color: var(--ai-ui-border) !important;
    background: rgba(255, 255, 255, .42) !important;
    box-shadow: var(--ai-ui-shadow) !important;
}

.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-shell {
    background: rgba(2, 6, 23, .72) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-main {
    background:
        radial-gradient(circle at 15% 5%, rgba(255, 92, 138, .18), transparent 260px),
        radial-gradient(circle at 95% 8%, rgba(14, 165, 233, .18), transparent 280px),
        linear-gradient(135deg, var(--ai-ui-bg), var(--ai-ui-bg-2)) !important;
    color: var(--ai-ui-text) !important;
}

.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-main {
    background:
        radial-gradient(circle at 15% 5%, rgba(236, 72, 153, .18), transparent 280px),
        radial-gradient(circle at 95% 8%, rgba(14, 165, 233, .18), transparent 280px),
        linear-gradient(135deg, #020617, #111827) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tabs {
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, .36), transparent 180px),
        var(--ai-ui-gradient-3) !important;
}

.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-tabs {
    background:
        radial-gradient(circle at top left, rgba(236, 72, 153, .22), transparent 190px),
        linear-gradient(180deg, #111827, #1e1b4b 56%, #0f172a) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-student-profile,
.ai-study-dashboard[data-ai-study-theme] .ai-study-stat-card,
.ai-study-dashboard[data-ai-study-theme] .ai-study-section,
.ai-study-dashboard[data-ai-study-theme] .ai-study-result-box,
.ai-study-dashboard[data-ai-study-theme] .ai-study-subscription-box,
.ai-study-dashboard[data-ai-study-theme] .ai-study-table-builder,
.ai-study-dashboard[data-ai-study-theme] .ai-study-master-card,
.ai-study-dashboard[data-ai-study-theme] .ai-study-english-tool-card,
.ai-study-dashboard[data-ai-study-theme] .ai-study-vocab-card,
.ai-study-dashboard[data-ai-study-theme] .ai-study-buddy-card {
    border-color: var(--ai-ui-border) !important;
    background: var(--ai-ui-card) !important;
    color: var(--ai-ui-text) !important;
    box-shadow: var(--ai-ui-shadow-soft) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-hero,
.ai-study-dashboard[data-ai-study-theme] .ai-study-scan-hero {
    background: var(--ai-ui-gradient) !important;
    color: #fff !important;
}

.ai-theme-toggle {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 42px;
    margin-bottom: 12px;
    border: 0 !important;
    border-radius: 15px !important;
    background: var(--ai-ui-gradient-2) !important;
    color: #fff !important;
    cursor: pointer;
    font-weight: 900 !important;
    box-shadow: 0 14px 28px rgba(99, 102, 241, .25) !important;
}

.ai-theme-toggle::before {
    content: "Theme";
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    font-size: 11px;
}

.ai-theme-toggle[data-current-theme="dark"] {
    background: linear-gradient(135deg, #f59e0b, #ec4899) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tab {
    color: #fff !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tab:hover,
.ai-study-dashboard[data-ai-study-theme] .ai-study-tab.is-active {
    color: #fff !important;
}

/* Final theme polish: richer kids palette and readable dark menu hover */
html[data-theme="light"],
body[data-ai-study-theme="light"],
.ai-study-dashboard[data-ai-study-theme="light"] {
    --ai-ui-bg: #f5fbff;
    --ai-ui-bg-2: #fff4df;
    --ai-ui-card: rgba(255, 255, 255, .96);
    --ai-ui-card-solid: #ffffff;
    --ai-ui-text: #10203f;
    --ai-ui-muted: #475569;
    --ai-ui-border: rgba(37, 99, 235, .18);
    --ai-ui-gradient: linear-gradient(135deg, #ff4d7d 0%, #ff9f1c 32%, #16a34a 66%, #2563eb 100%);
    --ai-ui-gradient-2: linear-gradient(135deg, #be185d 0%, #7c3aed 48%, #f97316 100%);
    --ai-ui-gradient-3: linear-gradient(180deg, #7c2dff 0%, #075985 48%, #064e3b 100%);
    --ai-ui-shadow: 0 20px 54px rgba(30, 41, 59, .16);
    --ai-ui-shadow-soft: 0 12px 28px rgba(30, 41, 59, .10);
}

html[data-theme="dark"],
body[data-ai-study-theme="dark"],
.ai-study-dashboard[data-ai-study-theme="dark"] {
    --ai-ui-bg: #06111f;
    --ai-ui-bg-2: #180b2e;
    --ai-ui-card: rgba(12, 18, 35, .92);
    --ai-ui-card-solid: #0f172a;
    --ai-ui-text: #f8fafc;
    --ai-ui-muted: #cbd5e1;
    --ai-ui-border: rgba(56, 189, 248, .22);
    --ai-ui-gradient: linear-gradient(135deg, #8b1d5f 0%, #7c2d12 34%, #14532d 68%, #1d4ed8 100%);
    --ai-ui-gradient-2: linear-gradient(135deg, #111827 0%, #7f1d1d 48%, #064e3b 100%);
    --ai-ui-gradient-3: linear-gradient(180deg, #0f172a 0%, #581c87 50%, #064e3b 100%);
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-main {
    background:
        radial-gradient(circle at 10% 4%, rgba(255, 77, 125, .16), transparent 230px),
        radial-gradient(circle at 90% 8%, rgba(34, 197, 94, .14), transparent 260px),
        linear-gradient(135deg, var(--ai-ui-bg), var(--ai-ui-bg-2)) !important;
}

.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-main {
    background:
        radial-gradient(circle at 10% 4%, rgba(190, 24, 93, .20), transparent 250px),
        radial-gradient(circle at 90% 8%, rgba(34, 197, 94, .16), transparent 260px),
        linear-gradient(135deg, #020617, #111827 50%, #180b2e) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tabs {
    background: var(--ai-ui-gradient-3) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tab {
    background: rgba(255, 255, 255, .16) !important;
    border-color: rgba(255, 255, 255, .36) !important;
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .22);
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tab:nth-of-type(3n + 1):hover,
.ai-study-dashboard[data-ai-study-theme] .ai-study-tab:nth-of-type(3n + 1).is-active {
    background: linear-gradient(135deg, #020617, #14532d) !important;
    border-color: rgba(187, 247, 208, .72) !important;
    color: #fff !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tab:nth-of-type(3n + 2):hover,
.ai-study-dashboard[data-ai-study-theme] .ai-study-tab:nth-of-type(3n + 2).is-active {
    background: linear-gradient(135deg, #111827, #86198f) !important;
    border-color: rgba(245, 208, 254, .72) !important;
    color: #fff !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tab:nth-of-type(3n):hover,
.ai-study-dashboard[data-ai-study-theme] .ai-study-tab:nth-of-type(3n).is-active {
    background: linear-gradient(135deg, #030712, #075985) !important;
    border-color: rgba(186, 230, 253, .72) !important;
    color: #fff !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tab:hover::before,
.ai-study-dashboard[data-ai-study-theme] .ai-study-tab.is-active::before {
    background: #facc15 !important;
    box-shadow: 0 0 0 4px rgba(250, 204, 21, .22);
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-hero,
.ai-study-dashboard[data-ai-study-theme] .ai-study-scan-hero {
    background: linear-gradient(135deg, #ec4899 0%, #f97316 28%, #22c55e 62%, #2563eb 100%) !important;
}

.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-hero,
.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-scan-hero {
    background: linear-gradient(135deg, #831843 0%, #7c2d12 35%, #14532d 66%, #1e3a8a 100%) !important;
}

.ai-theme-toggle {
    background: linear-gradient(135deg, #be185d, #7c3aed, #f97316) !important;
    color: #fff !important;
}

.ai-theme-toggle[data-current-theme="dark"] {
    background: linear-gradient(135deg, #020617, #14532d, #86198f) !important;
}

/* EasyPadhai logo-inspired dashboard theme */
html[data-theme="light"],
body[data-ai-study-theme="light"],
.ai-study-dashboard[data-ai-study-theme="light"] {
    --ai-logo-navy: #061a55;
    --ai-logo-blue: #0969dc;
    --ai-logo-sky: #eaf6ff;
    --ai-logo-orange: #ff5a00;
    --ai-logo-gold: #ffb703;
    --ai-logo-green: #16a34a;
    --ai-ui-bg: #f7fbff;
    --ai-ui-bg-2: #fff6eb;
    --ai-ui-card: rgba(255, 255, 255, .97);
    --ai-ui-card-solid: #ffffff;
    --ai-ui-text: #061a55;
    --ai-ui-muted: #43516f;
    --ai-ui-border: rgba(9, 105, 220, .18);
    --ai-ui-gradient: linear-gradient(135deg, #061a55 0%, #0969dc 52%, #ff5a00 100%);
    --ai-ui-gradient-2: linear-gradient(135deg, #061a55 0%, #0969dc 45%, #ff5a00 100%);
    --ai-ui-gradient-3: linear-gradient(180deg, #061a55 0%, #0648a8 55%, #ff5a00 100%);
    --ai-ui-shadow: 0 22px 58px rgba(6, 26, 85, .16);
    --ai-ui-shadow-soft: 0 12px 30px rgba(6, 26, 85, .10);
}

html[data-theme="dark"],
body[data-ai-study-theme="dark"],
.ai-study-dashboard[data-ai-study-theme="dark"] {
    --ai-logo-navy: #dbeafe;
    --ai-logo-blue: #60a5fa;
    --ai-logo-sky: #0b1228;
    --ai-logo-orange: #fb923c;
    --ai-logo-gold: #facc15;
    --ai-logo-green: #4ade80;
    --ai-ui-bg: #020817;
    --ai-ui-bg-2: #0b1735;
    --ai-ui-card: rgba(8, 18, 42, .94);
    --ai-ui-card-solid: #0b1228;
    --ai-ui-text: #f8fbff;
    --ai-ui-muted: #c8d4ea;
    --ai-ui-border: rgba(96, 165, 250, .24);
    --ai-ui-gradient: linear-gradient(135deg, #05123f 0%, #0752b8 50%, #c2410c 100%);
    --ai-ui-gradient-2: linear-gradient(135deg, #020817 0%, #0752b8 48%, #ea580c 100%);
    --ai-ui-gradient-3: linear-gradient(180deg, #020817 0%, #061a55 58%, #9a3412 100%);
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-shell {
    border-color: rgba(9, 105, 220, .18) !important;
    background: linear-gradient(135deg, rgba(255,255,255,.86), rgba(234,246,255,.72)) !important;
}

.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-shell {
    border-color: rgba(96, 165, 250, .24) !important;
    background: linear-gradient(135deg, rgba(2,8,23,.92), rgba(6,26,85,.74)) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-main {
    background:
        radial-gradient(circle at 12% 6%, rgba(255, 90, 0, .13), transparent 240px),
        radial-gradient(circle at 92% 7%, rgba(9, 105, 220, .14), transparent 280px),
        linear-gradient(135deg, var(--ai-ui-bg), var(--ai-ui-bg-2)) !important;
}

.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-main {
    background:
        radial-gradient(circle at 12% 6%, rgba(251, 146, 60, .14), transparent 250px),
        radial-gradient(circle at 92% 7%, rgba(96, 165, 250, .16), transparent 280px),
        linear-gradient(135deg, #020817, #0b1735 58%, #111827) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tabs {
    background:
        radial-gradient(circle at 16% 8%, rgba(255, 183, 3, .32), transparent 92px),
        linear-gradient(180deg, #061a55 0%, #0648a8 54%, #ff5a00 100%) !important;
}

.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-tabs {
    background:
        radial-gradient(circle at 16% 8%, rgba(251, 146, 60, .22), transparent 100px),
        linear-gradient(180deg, #020817 0%, #061a55 58%, #9a3412 100%) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-student-profile {
    background: linear-gradient(160deg, #ffffff 0%, #eaf6ff 100%) !important;
    border-color: rgba(9, 105, 220, .18) !important;
}

.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-student-profile {
    background: linear-gradient(160deg, #0b1228 0%, #061a55 100%) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tab {
    background: rgba(255, 255, 255, .14) !important;
    border-color: rgba(255, 255, 255, .34) !important;
    color: #ffffff !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tab:hover,
.ai-study-dashboard[data-ai-study-theme] .ai-study-tab.is-active {
    background: linear-gradient(135deg, #061a55 0%, #0648a8 54%, #ff5a00 100%) !important;
    border-color: rgba(255, 183, 3, .86) !important;
    color: #ffffff !important;
    box-shadow: 0 12px 24px rgba(6, 26, 85, .28) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-tab:hover::before,
.ai-study-dashboard[data-ai-study-theme] .ai-study-tab.is-active::before {
    background: #ffb703 !important;
    box-shadow: 0 0 0 4px rgba(255, 183, 3, .25) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-hero,
.ai-study-dashboard[data-ai-study-theme] .ai-study-scan-hero {
    background:
        radial-gradient(circle at 88% 16%, rgba(255,255,255,.24), transparent 150px),
        linear-gradient(135deg, #061a55 0%, #0969dc 53%, #ff5a00 100%) !important;
    color: #ffffff !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-buddy-card {
    background:
        radial-gradient(circle at 0% 0%, rgba(255, 183, 3, .18), transparent 180px),
        linear-gradient(135deg, rgba(234, 246, 255, .95), rgba(255, 246, 235, .95)) !important;
}

.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-buddy-card {
    background:
        radial-gradient(circle at 0% 0%, rgba(251, 146, 60, .16), transparent 190px),
        linear-gradient(135deg, rgba(8, 18, 42, .95), rgba(6, 26, 85, .86)) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-buddy-avatar,
.ai-study-dashboard[data-ai-study-theme] .ai-study-camera-mark {
    background: linear-gradient(135deg, #0969dc, #061a55 58%, #ff5a00) !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-primary-button,
.ai-study-dashboard[data-ai-study-theme] .ai-study-link-button,
.ai-study-dashboard[data-ai-study-theme] .ai-theme-toggle {
    background: linear-gradient(135deg, #061a55 0%, #0969dc 48%, #ff5a00 100%) !important;
    color: #ffffff !important;
}

.ai-study-dashboard[data-ai-study-theme] .ai-study-logout-button {
    background: linear-gradient(135deg, #ff5a00, #ff8a3d) !important;
    color: #ffffff !important;
}

.ai-theme-toggle[data-current-theme="dark"] {
    background: linear-gradient(135deg, #020817 0%, #0648a8 50%, #ff5a00 100%) !important;
}

.ai-study-english-shortcut,
.ai-study-maths-shortcut {
    display: block;
    width: 100%;
    min-height: 118px;
    cursor: pointer;
    text-align: left;
    appearance: none;
}

.ai-study-english-shortcut h3,
.ai-study-english-shortcut p,
.ai-study-maths-shortcut h3,
.ai-study-maths-shortcut p {
    pointer-events: none;
}

.ai-study-english-shortcut:hover,
.ai-study-english-shortcut.is-selected,
.ai-study-maths-shortcut:hover,
.ai-study-maths-shortcut.is-selected {
    border-color: rgba(255, 90, 0, .72) !important;
    background: linear-gradient(135deg, #ffffff 0%, #eaf6ff 48%, #fff2e8 100%) !important;
    box-shadow: 0 18px 42px rgba(6, 26, 85, .18) !important;
}

.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-english-shortcut:hover,
.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-english-shortcut.is-selected,
.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-maths-shortcut:hover,
.ai-study-dashboard[data-ai-study-theme="dark"] .ai-study-maths-shortcut.is-selected {
    background: linear-gradient(135deg, #0b1228 0%, #061a55 55%, #7c2d12 100%) !important;
}

.ai-study-table-builder.is-selected,
.ai-study-english-tool-card.is-selected {
    border-color: rgba(255, 90, 0, .86) !important;
    box-shadow: 0 0 0 4px rgba(255, 90, 0, .14), 0 22px 52px rgba(6, 26, 85, .16) !important;
}

.ai-study-subscription-current {
    margin-top: 14px;
    border: 2px solid var(--ai-primary-light) !important;
    background: linear-gradient(135deg, #f8f5ff, #fff9f0) !important;
}

.ai-study-price {
    display: block;
    font-size: 28px;
    font-weight: 800;
    color: var(--ai-primary);
    margin: 8px 0;
}

.ai-study-subscription-box.is-current {
    border: 2px solid var(--ai-secondary) !important;
    box-shadow: 0 0 0 3px rgba(0, 206, 201, 0.2);
}

.ai-study-save-note {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #e8fff9;
    color: #00b894;
    font-weight: 700;
    font-size: 13px;
}
