/* =====================================================================
   MY AI DISCOVERY LAB - main stylesheet
   Light "AI laboratory" theme: white / light blue, blue-purple-cyan accents
   ===================================================================== */

:root {
    --lab-blue: #3b6cf6;
    --lab-blue-dark: #2850c8;
    --lab-purple: #7c4dff;
    --lab-cyan: #14b8d4;
    --lab-pink: #ec4899;
    --lab-green: #10b981;
    --lab-orange: #f59e0b;
    --lab-ink: #1b2648;
    --lab-muted: #5d6a8a;
    --lab-bg: #f5f8ff;
    --lab-bg-2: #eaf1ff;
    --lab-card: #ffffff;
    --lab-border: #e3eaf7;
    --lab-grad: linear-gradient(135deg, #3b6cf6 0%, #7c4dff 60%, #14b8d4 120%);
    --lab-grad-soft: linear-gradient(135deg, #eef3ff 0%, #f3eeff 55%, #e8fbff 100%);
    --lab-shadow: 0 6px 24px rgba(39, 72, 160, .08);
    --lab-shadow-lg: 0 16px 40px rgba(39, 72, 160, .14);
    --lab-radius: 20px;

    --bs-primary: #3b6cf6;
    --bs-primary-rgb: 59, 108, 246;
    --bs-body-font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --bs-body-color: #1b2648;
    --bs-body-bg: #f5f8ff;
    --bs-link-color: #3b6cf6;
    --bs-link-color-rgb: 59, 108, 246;
    --bs-link-hover-color: #2850c8;
}

html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { background: var(--lab-bg); color: var(--lab-ink); font-size: 1rem; line-height: 1.6; }
h1, h2, h3, h4, h5, .brand-title, .section-title, .page-title { font-family: 'Poppins', 'Nunito', sans-serif; color: var(--lab-ink); }
a { text-decoration: none; }
img { max-width: 100%; }
.text-gradient { background: var(--lab-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.text-white-75 { color: rgba(255, 255, 255, .78); }
.skip-link { position: absolute; left: 1rem; top: .5rem; z-index: 2000; background: #fff; padding: .5rem 1rem; border-radius: 8px; }

/* ---------- Buttons ---------- */
.btn { border-radius: 12px; font-weight: 700; }
.btn-lg { font-size: 1.05rem; padding: .7rem 1.4rem; }
.btn-primary { background: var(--lab-grad); border: 0; background-size: 140% 140%; transition: background-position .4s, transform .2s, box-shadow .2s; }
.btn-primary:hover, .btn-primary:focus { background-position: 100% 0; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(59, 108, 246, .3); }
.btn-primary:disabled { opacity: .55; transform: none; box-shadow: none; }
.btn-outline-primary { --bs-btn-color: var(--lab-blue); --bs-btn-border-color: #c6d5fb; --bs-btn-hover-bg: var(--lab-blue); --bs-btn-hover-border-color: var(--lab-blue); --bs-btn-active-bg: var(--lab-blue); --bs-btn-active-border-color: var(--lab-blue); background: #fff; }
.btn-light-primary { background: #eaf0ff; color: var(--lab-blue); border: 0; }
.btn-light-primary:hover { background: var(--lab-blue); color: #fff; }
.btn-glow { box-shadow: 0 8px 22px rgba(124, 77, 255, .25); }

/* ---------- Navbar ---------- */
.lab-navbar { background: rgba(255, 255, 255, .92); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); border-bottom: 1px solid var(--lab-border); padding: .55rem 0; transition: box-shadow .2s; }
.lab-navbar.scrolled { box-shadow: 0 4px 18px rgba(30, 60, 140, .08); }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--lab-grad); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 700; font-size: 1.05rem; color: var(--lab-ink); }
.brand-sub { font-size: .75rem; color: var(--lab-muted); max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.school-logo-nav { height: 42px; width: auto; max-width: 90px; object-fit: contain; border-radius: 8px; }
.lab-navbar .nav-link { color: var(--lab-ink); font-weight: 700; border-radius: 10px; padding: .5rem .8rem !important; }
.lab-navbar .nav-link i { color: var(--lab-blue); }
.lab-navbar .nav-link:hover, .lab-navbar .nav-link.active { background: #eef3ff; color: var(--lab-blue); }
.lab-navbar .dropdown-menu { border-radius: 14px; padding: .5rem; }
.lab-navbar .dropdown-item { border-radius: 10px; padding: .5rem .75rem; font-weight: 600; }
.lab-navbar .dropdown-item i { color: var(--lab-blue); margin-right: .25rem; }
.lab-navbar .dropdown-item.active, .lab-navbar .dropdown-item:active { background: #eef3ff; color: var(--lab-blue); }
.btn-settings { background: #eef3ff; color: var(--lab-blue); font-weight: 700; }
.btn-settings:hover, .btn-settings.active { background: var(--lab-blue); color: #fff; }
.navbar-toggler { border: 0; font-size: 1.6rem; color: var(--lab-blue); }
.navbar-toggler:focus { box-shadow: 0 0 0 3px rgba(59, 108, 246, .2); }
@media (max-width: 991.98px) {
    .lab-navbar .navbar-collapse { padding: .75rem 0 .25rem; }
    .btn-settings { width: 100%; margin-top: .4rem; }
}

/* ---------- Demo mode banner ---------- */
.demo-banner { background: #c62828; color: #fff; font-size: .9rem; padding: .55rem 0; text-align: center; }
.demo-banner code { color: #fff; background: rgba(0, 0, 0, .2); padding: .05rem .35rem; border-radius: 4px; }

/* ---------- Hero ---------- */
.hero-section { position: relative; padding: 4rem 0 4.5rem; background: radial-gradient(1200px 500px at 85% 0%, #e2ebff 0%, transparent 60%), radial-gradient(800px 400px at 0% 100%, #e6f9ff 0%, transparent 60%), #fff; overflow: hidden; }
.hero-badge { display: inline-flex; align-items: center; gap: .4rem; background: #eef3ff; color: var(--lab-blue); font-weight: 800; font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; padding: .4rem .9rem; border-radius: 999px; }
.hero-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lab-cyan); box-shadow: 0 0 0 4px rgba(20, 184, 212, .2); }
.hero-title { font-size: clamp(1.9rem, 4vw, 2.9rem); font-weight: 700; line-height: 1.2; }
.hero-subtitle { font-size: 1.1rem; color: var(--lab-muted); max-width: 560px; }
.profile-card { display: flex; align-items: center; gap: 1rem; background: #fff; border: 1px solid var(--lab-border); border-radius: 18px; padding: 1rem 1.1rem; box-shadow: var(--lab-shadow); max-width: 580px; }
.profile-avatar { width: 52px; height: 52px; border-radius: 16px; background: var(--lab-grad-soft); color: var(--lab-purple); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; overflow: hidden; }
.profile-avatar img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.profile-greeting { font-weight: 800; font-size: 1.1rem; }
.profile-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; color: var(--lab-muted); font-size: .9rem; }
.profile-meta i { color: var(--lab-blue); }
.hero-stats { display: flex; gap: 1.75rem; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats strong { font-family: 'Poppins', sans-serif; font-size: 1.4rem; background: var(--lab-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-stats span { color: var(--lab-muted); font-size: .85rem; }
.hero-visual { position: relative; display: inline-block; }
.hero-img { animation: floaty 6s ease-in-out infinite; }
.float-chip { position: absolute; background: #fff; border: 1px solid var(--lab-border); box-shadow: var(--lab-shadow); padding: .4rem .8rem; border-radius: 999px; font-size: .8rem; font-weight: 800; color: var(--lab-ink); white-space: nowrap; }
.float-chip i { color: var(--lab-purple); }
.chip-1 { top: 8%; left: -2%; animation: floaty 5s ease-in-out infinite; }
.chip-2 { top: 45%; right: -4%; animation: floaty 7s ease-in-out infinite .5s; }
.chip-3 { bottom: 6%; left: 8%; animation: floaty 6s ease-in-out infinite 1s; }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@media (max-width: 575.98px) {
    .hero-section { padding: 2rem 0 3rem; }
    .float-chip { display: none; }
    .profile-card { flex-wrap: wrap; }
}

/* ---------- Sections ---------- */
.section-pad { padding: 4.5rem 0; }
.section-tint { background: linear-gradient(180deg, #fff 0%, var(--lab-bg-2) 100%); }
.section-head { max-width: 680px; margin: 0 auto 2.5rem; }
.section-kicker { display: inline-flex; gap: .4rem; align-items: center; color: var(--lab-purple); font-weight: 800; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
.section-title { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 700; margin: .4rem 0 .6rem; }
.section-lead { color: var(--lab-muted); font-size: 1.05rem; margin: 0; }

/* ---------- Project cards ---------- */
.project-card { --accent: var(--lab-blue); --accent-soft: #eaf0ff; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--lab-border); border-radius: var(--lab-radius); padding: 1.5rem; box-shadow: var(--lab-shadow); transition: transform .25s, box-shadow .25s, border-color .25s; position: relative; overflow: hidden; }
.project-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: var(--accent); }
.project-card:hover { transform: translateY(-6px); box-shadow: var(--lab-shadow-lg); border-color: transparent; }
.project-animal { --accent: #10b981; --accent-soft: #e6f8f1; }
.project-math { --accent: #3b6cf6; --accent-soft: #eaf0ff; }
.project-emotion { --accent: #ec4899; --accent-soft: #fdebf4; }
.project-story { --accent: #7c4dff; --accent-soft: #f1ebff; }
.project-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.project-num { font-size: .75rem; font-weight: 800; letter-spacing: .08em; color: var(--accent); background: var(--accent-soft); padding: .3rem .7rem; border-radius: 999px; }
.project-icon { width: 54px; height: 54px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 1.6rem; transition: transform .3s; }
.project-card:hover .project-icon { transform: rotate(-8deg) scale(1.08); }
.project-title { font-size: 1.2rem; font-weight: 700; }
.project-desc { color: var(--lab-muted); font-size: .95rem; }
.project-tech { font-size: .8rem; font-weight: 800; color: var(--accent); margin-bottom: .75rem; }
.project-features { list-style: none; padding: 0; margin: 0 0 1.25rem; font-size: .9rem; }
.project-features li { display: flex; gap: .5rem; align-items: flex-start; margin-bottom: .35rem; }
.project-features i { color: var(--accent); margin-top: .15rem; }
.btn-project { background: var(--accent-soft); color: var(--accent); font-weight: 800; transition: background .2s, color .2s; }
.btn-project:hover { background: var(--accent); color: #fff; }
.btn-project i { transition: transform .2s; }
.btn-project:hover i { transform: translateX(4px); }

/* ---------- Learn cards ---------- */
.learn-card { background: #fff; border: 1px solid var(--lab-border); border-radius: var(--lab-radius); padding: 1.5rem; box-shadow: var(--lab-shadow); transition: transform .25s; }
.learn-card:hover { transform: translateY(-4px); }
.learn-card h3 { font-size: 1.1rem; font-weight: 700; margin: .9rem 0 .5rem; }
.learn-card p { color: var(--lab-muted); font-size: .95rem; }
.learn-icon { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.bg-soft-blue { background: #eaf0ff; color: var(--lab-blue); }
.bg-soft-purple { background: #f1ebff; color: var(--lab-purple); }
.bg-soft-cyan { background: #e3f8fc; color: #0e9ab3; }
.bg-soft-pink { background: #fdebf4; color: var(--lab-pink); }
.bg-soft-green { background: #e6f8f1; color: #0b9467; }
.learn-example { background: var(--lab-bg); border-left: 4px solid var(--lab-cyan); padding: .6rem .8rem; border-radius: 10px; font-size: .88rem; }
.everyday-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.everyday-grid span { background: var(--lab-bg); border-radius: 12px; padding: .55rem .7rem; font-size: .88rem; font-weight: 600; }
.everyday-grid i { color: var(--lab-blue); margin-right: .25rem; }
@media (max-width: 575.98px) { .everyday-grid { grid-template-columns: 1fr; } }

.flow-card { background: #fff; border: 1px solid var(--lab-border); border-radius: var(--lab-radius); padding: 1.75rem; box-shadow: var(--lab-shadow); }
.flow-steps { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.flow-step { flex: 1 1 140px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.flow-step small { color: var(--lab-muted); font-size: .8rem; }
.flow-ico { width: 54px; height: 54px; border-radius: 50%; background: var(--lab-grad); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: .3rem; box-shadow: 0 6px 16px rgba(59, 108, 246, .25); }
.flow-arrow { color: #b6c6ee; font-size: 1.3rem; }
@media (max-width: 767.98px) { .flow-arrow { display: none; } .flow-step { flex-basis: 45%; } }

/* ---------- About & student cards ---------- */
.about-card { background: #fff; border: 1px solid var(--lab-border); border-radius: var(--lab-radius); padding: 1.75rem; box-shadow: var(--lab-shadow); }
.about-intro p { color: #3a4668; font-size: 1.02rem; }
.about-intro p:last-child { margin-bottom: 0; }
.student-card { background: var(--lab-grad); color: #fff; border-radius: var(--lab-radius); padding: 1.75rem; box-shadow: var(--lab-shadow-lg); }
.student-card .btn-light { color: var(--lab-blue); font-weight: 800; }
.student-card-logo { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 16px; padding: 4px; }
.student-card-logo.big, .student-card-placeholder.big { width: 110px; height: 110px; }
.student-card-placeholder { width: 64px; height: 64px; border-radius: 16px; background: rgba(255, 255, 255, .2); display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.student-card-placeholder.big { font-size: 3rem; border-radius: 24px; }
.student-dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: 0; font-size: .95rem; }
.student-dl dt { font-weight: 700; opacity: .85; }
.student-dl dd { margin: 0; font-weight: 700; word-break: break-word; }
.tech-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tech-tags span { background: rgba(255, 255, 255, .2); border-radius: 999px; padding: .2rem .6rem; font-size: .78rem; font-weight: 700; }
.mini-project { display: flex; gap: .8rem; align-items: center; background: var(--lab-bg); border-radius: 14px; padding: .8rem 1rem; color: var(--lab-ink); transition: background .2s, transform .2s; }
.mini-project:hover { background: #e6eeff; transform: translateY(-2px); color: var(--lab-ink); }
.mini-project > span { font-size: 1.8rem; }
.mini-project small { display: block; color: var(--lab-muted); }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: flex; gap: .6rem; margin-bottom: .55rem; }
.check-list i { color: var(--lab-green); margin-top: .1rem; }
.rule-tile { background: var(--lab-bg); border-radius: 14px; padding: 1rem; height: 100%; display: flex; flex-direction: column; gap: .2rem; }
.rule-tile i { font-size: 1.5rem; color: var(--lab-purple); }
.rule-tile small { color: var(--lab-muted); }

/* ---------- Inner page hero ---------- */
.page-hero { background: var(--lab-grad-soft); padding: 2.25rem 0 2rem; border-bottom: 1px solid var(--lab-border); }
.page-hero .breadcrumb { font-size: .85rem; margin-bottom: .75rem; }
.page-hero .breadcrumb a { color: var(--lab-blue); font-weight: 700; }
.page-title { font-size: clamp(1.6rem, 3.5vw, 2.3rem); font-weight: 700; margin-bottom: .4rem; }
.page-title .bi { color: var(--lab-blue); }
.page-lead { color: var(--lab-muted); font-size: 1.05rem; max-width: 720px; margin-bottom: .75rem; }
.project-num-pill { display: inline-block; background: #fff; color: var(--lab-purple); font-weight: 800; letter-spacing: .08em; font-size: .75rem; padding: .3rem .75rem; border-radius: 999px; margin-bottom: .5rem; box-shadow: var(--lab-shadow); }
.tech-pill { display: inline-flex; gap: .4rem; align-items: center; background: #fff; border: 1px solid var(--lab-border); border-radius: 999px; padding: .35rem .85rem; font-size: .85rem; font-weight: 700; color: var(--lab-blue); }
.hero-animal { background: linear-gradient(135deg, #e7f9f1 0%, #eef3ff 100%); }
.hero-math { background: linear-gradient(135deg, #e8efff 0%, #e8fbff 100%); }
.hero-emotion { background: linear-gradient(135deg, #fdeef6 0%, #f1edff 100%); }
.hero-story { background: linear-gradient(135deg, #f1ebff 0%, #e8f4ff 100%); }

/* ---------- Tool cards ---------- */
.tool-card, .settings-card, .explain-card { background: #fff; border: 1px solid var(--lab-border); border-radius: var(--lab-radius); padding: 1.5rem; box-shadow: var(--lab-shadow); }
.explain-card { background: linear-gradient(135deg, #ffffff 0%, #f3f7ff 100%); }
.tool-heading, .settings-heading { font-size: 1.1rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.tool-heading > i, .settings-heading > i { color: var(--lab-blue); }
.step-badge { width: 30px; height: 30px; border-radius: 10px; background: var(--lab-grad); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: .9rem; font-weight: 800; flex-shrink: 0; }
.small-heading { font-size: .9rem; font-weight: 800; color: var(--lab-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .6rem; font-family: 'Nunito', sans-serif; }
.form-control, .form-select { border-radius: 12px; border-color: #d5def0; padding: .65rem .9rem; }
.form-control:focus, .form-select:focus { border-color: var(--lab-blue); box-shadow: 0 0 0 .2rem rgba(59, 108, 246, .15); }
.form-label { font-weight: 700; }
.tip-box { display: flex; gap: .6rem; background: #fff9e8; border: 1px solid #fde9b0; border-radius: 14px; padding: .75rem 1rem; font-size: .88rem; }
.tip-box > i { color: var(--lab-orange); font-size: 1.1rem; }

/* Drop zone */
.drop-zone { position: relative; border: 2.5px dashed #bccbf2; border-radius: 18px; background: var(--lab-bg); min-height: 250px; display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; overflow: hidden; padding: 1rem; }
.drop-zone:hover, .drop-zone:focus, .drop-zone.dragover { border-color: var(--lab-blue); background: #eef3ff; outline: none; }
.drop-zone.has-image { border-style: solid; padding: .5rem; background: #fff; }
.drop-empty { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.drop-icon { width: 70px; height: 70px; border-radius: 50%; background: #fff; color: var(--lab-blue); display: flex; align-items: center; justify-content: center; font-size: 2rem; box-shadow: var(--lab-shadow); margin-bottom: .4rem; }
.drop-preview { max-height: 340px; width: auto; border-radius: 12px; object-fit: contain; }

/* Results */
.result-card { min-height: 360px; }
.result-placeholder { min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--lab-ink); }
.emoji-row { font-size: 2.2rem; letter-spacing: .25rem; }
.loading-box { min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: .75rem; }
.ai-loader { position: relative; width: 84px; height: 84px; }
.ai-loader span { position: absolute; inset: 0; border-radius: 50%; border: 4px solid transparent; border-top-color: var(--lab-blue); animation: spin 1.1s linear infinite; }
.ai-loader span:nth-child(2) { inset: 10px; border-top-color: var(--lab-purple); animation-duration: 1.6s; animation-direction: reverse; }
.ai-loader span:nth-child(3) { inset: 20px; border-top-color: var(--lab-cyan); animation-duration: .9s; }
.ai-loader i { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--lab-purple); animation: pulse 1.4s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: .5; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.05); } }
.loading-dots::after { content: ""; animation: dots 1.5s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.result-hero { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding-bottom: 1rem; border-bottom: 1px solid var(--lab-border); margin-bottom: 1rem; }
.result-emoji { font-size: 3rem; line-height: 1; }
.result-label { font-size: .8rem; font-weight: 800; text-transform: uppercase; color: var(--lab-muted); letter-spacing: .05em; }
.result-name { font-size: 1.7rem; font-weight: 700; font-family: 'Poppins', sans-serif; line-height: 1.2; }
.confidence-ring { --p: 0; --c: var(--lab-blue); width: 92px; height: 92px; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), #e8eef9 0); display: flex; align-items: center; justify-content: center; margin-left: auto; flex-shrink: 0; }
.confidence-ring > span { width: 72px; height: 72px; border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 800; font-size: 1.15rem; line-height: 1; }
.confidence-ring small { font-size: .62rem; color: var(--lab-muted); font-weight: 700; margin-top: 2px; }
.badge-soft { display: inline-flex; gap: .3rem; align-items: center; padding: .3rem .7rem; border-radius: 999px; font-weight: 800; font-size: .8rem; background: #eaf0ff; color: var(--lab-blue); }
.badge-soft.green { background: #e6f8f1; color: #0b8a5f; }
.badge-soft.orange { background: #fff4e0; color: #b86e00; }
.badge-soft.pink { background: #fdebf4; color: #c2266f; }
.pred-row { margin-bottom: .65rem; }
.pred-row .d-flex { font-size: .92rem; font-weight: 700; }
.pred-bar { height: 10px; border-radius: 999px; background: #edf1fa; overflow: hidden; }
.pred-bar > div { height: 100%; border-radius: 999px; background: var(--lab-grad); width: 0; transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.info-tile { background: var(--lab-bg); border-radius: 14px; padding: .9rem 1rem; }
.info-tile h3 { font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--lab-purple); margin-bottom: .35rem; font-family: 'Nunito', sans-serif; }
.info-tile p, .info-tile ul { margin: 0; font-size: .92rem; }
.info-tile ul { padding-left: 1.1rem; }
.info-tile.wide { grid-column: 1 / -1; }
@media (max-width: 575.98px) { .info-grid { grid-template-columns: 1fr; } .confidence-ring { margin-left: 0; } }
.source-note { font-size: .78rem; color: var(--lab-muted); margin-top: 1rem; display: flex; gap: .4rem; align-items: flex-start; }
.alert-soft { border-radius: 14px; border: 0; }
.alert-disclaimer { background: #fff7ec; border: 1px solid #fde1b5; color: #6b4a12; border-radius: 16px; margin-bottom: 1.5rem; }
.alert-disclaimer i { color: var(--lab-orange); }

/* Math */
.question-box { position: relative; }
.question-box textarea { font-size: 1.05rem; padding-bottom: 1.8rem; resize: vertical; min-height: 120px; }
.char-count { position: absolute; right: .8rem; bottom: .45rem; font-size: .75rem; color: var(--lab-muted); }
.chip-list { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip { border: 1px solid #d5e0fa; background: #fff; color: var(--lab-ink); border-radius: 999px; padding: .35rem .8rem; font-size: .85rem; font-weight: 700; transition: all .2s; }
.chip i { color: var(--lab-blue); }
.chip:hover { background: var(--lab-blue); color: #fff; border-color: var(--lab-blue); }
.chip:hover i { color: #fff; }
.example-list { display: flex; flex-direction: column; gap: .4rem; }
.example-q { text-align: left; background: var(--lab-bg); border: 0; border-radius: 12px; padding: .55rem .85rem; font-weight: 600; color: var(--lab-ink); transition: background .2s, transform .2s; }
.example-q i { color: var(--lab-purple); margin-right: .3rem; }
.example-q:hover { background: #e3ebff; transform: translateX(3px); }
.math-question { background: var(--lab-grad-soft); border-radius: 14px; padding: .9rem 1.1rem; font-weight: 700; font-size: 1.05rem; }
.math-steps { list-style: none; padding: 0; margin: 0; counter-reset: step; }
.math-steps li { position: relative; padding: .2rem 0 1rem 3rem; counter-increment: step; }
.math-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--lab-grad); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.math-steps li::after { content: ""; position: absolute; left: 1.03rem; top: 2.3rem; bottom: .2rem; width: 2px; background: #dbe4f8; }
.math-steps li:last-child::after { display: none; }
.math-steps strong { display: block; }
.formula-box { background: #f1ebff; border: 1px dashed #b9a4ff; border-radius: 14px; padding: .8rem 1rem; font-family: 'Courier New', monospace; font-weight: 700; color: #4b2bb5; font-size: 1.05rem; word-break: break-word; }
.answer-box { background: #e6f8f1; border-radius: 14px; padding: .9rem 1.1rem; border-left: 5px solid var(--lab-green); }
.answer-box .result-label { color: #0b8a5f; }
.answer-box p { margin: 0; font-weight: 800; font-size: 1.1rem; }
.section-mini { font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--lab-purple); margin: 1.2rem 0 .5rem; font-family: 'Nunito', sans-serif; }
.practice-q { background: #fff9e8; border: 1px solid #fde9b0; border-radius: 14px; padding: 1rem 1.1rem; font-weight: 700; font-size: 1.05rem; }

/* Story */
.pick-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .7rem; }
@media (max-width: 991.98px) { .pick-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 479.98px) { .pick-grid { grid-template-columns: repeat(2, 1fr); } }
.pick-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; text-align: center; padding: .9rem .5rem; background: var(--lab-bg); border: 2px solid transparent; border-radius: 16px; font-weight: 700; font-size: .9rem; cursor: pointer; transition: all .2s; min-height: 104px; user-select: none; }
.pick-emoji { font-size: 2rem; line-height: 1; transition: transform .2s; }
.pick-tile:hover { background: #e9efff; }
.pick-tile:hover .pick-emoji { transform: scale(1.12); }
.btn-check:checked + .pick-tile { background: #fff; border-color: var(--lab-purple); box-shadow: 0 6px 18px rgba(124, 77, 255, .18); color: var(--lab-purple); }
.btn-check:focus-visible + .pick-tile { outline: 3px solid rgba(59, 108, 246, .4); outline-offset: 2px; }
.story-paper { background: #fff; border: 1px solid var(--lab-border); border-radius: var(--lab-radius); box-shadow: var(--lab-shadow-lg); overflow: hidden; }
.story-head { background: var(--lab-grad); color: #fff; padding: 1.75rem; }
.story-head h2 { color: #fff; font-size: clamp(1.4rem, 3vw, 2rem); margin: 0; }
.story-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.story-tags span { background: rgba(255, 255, 255, .2); padding: .2rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 700; }
.story-body { padding: 1.75rem; font-size: 1.08rem; line-height: 1.85; color: #2a3558; }
.story-body p:first-child::first-letter { font-family: 'Poppins', sans-serif; font-size: 3rem; float: left; line-height: .9; padding: .3rem .5rem 0 0; color: var(--lab-purple); font-weight: 700; }
.story-side { padding: 0 1.75rem 1.75rem; }
.character-chip { background: var(--lab-bg); border-radius: 14px; padding: .7rem .9rem; height: 100%; }
.character-chip strong { display: block; color: var(--lab-purple); }
.moral-box { background: #fff9e8; border: 1px solid #fde9b0; border-radius: 16px; padding: 1rem 1.2rem; display: flex; gap: .8rem; align-items: flex-start; }
.moral-box i { font-size: 1.6rem; color: var(--lab-orange); }

/* Settings */
.logo-preview { aspect-ratio: 1 / 1; border: 2px dashed #c6d5fb; border-radius: 18px; background: var(--lab-bg); display: flex; align-items: center; justify-content: center; padding: .75rem; overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-box { background: var(--lab-grad-soft); border-radius: 16px; padding: 1rem; }
.preview-name { font-weight: 800; font-size: 1.1rem; }
.mini-logo { height: 32px; width: auto; max-width: 70px; object-fit: contain; border-radius: 6px; }

/* ---------- Footer ---------- */
.lab-footer { background: linear-gradient(135deg, #22356f 0%, #3b2a7a 100%); color: #fff; }
.lab-footer a { color: rgba(255, 255, 255, .85); }
.lab-footer a:hover { color: #fff; }
.footer-heading { font-size: .95rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #9fd8ff; margin-bottom: .9rem; font-family: 'Nunito', sans-serif; }
.footer-links li { margin-bottom: .45rem; }
.footer-profile li { margin-bottom: .35rem; }
.footer-profile i { color: #9fd8ff; margin-right: .3rem; }
.footer-rule { border-color: rgba(255, 255, 255, .25); margin: 2rem 0 1.25rem; }
.school-logo-footer { height: 40px; width: auto; max-width: 80px; object-fit: contain; background: #fff; border-radius: 8px; padding: 2px; }
.back-to-top-fab { position: fixed; right: 1.1rem; bottom: 1.1rem; width: 46px; height: 46px; border-radius: 50%; background: var(--lab-grad); color: #fff; border: 0; box-shadow: var(--lab-shadow-lg); opacity: 0; pointer-events: none; transform: translateY(10px); transition: all .25s; z-index: 1030; font-size: 1.2rem; }
.back-to-top-fab.show { opacity: 1; pointer-events: auto; transform: none; }
.back-to-top-fab:hover { color: #fff; transform: translateY(-2px); }

/* Fade-in on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
.fade-in { animation: fadeIn .45s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    .reveal { opacity: 1; transform: none; }
}

/* ---------- Print (stories) ---------- */
@media print {
    body { background: #fff; }
    .lab-navbar, .lab-footer, .page-hero, #storyForm, .story-actions, .back-to-top-fab, .toast-container, .skip-link { display: none !important; }
    .section-pad { padding: 0 !important; }
    .story-paper { box-shadow: none; border: 0; }
    .story-head { background: none !important; color: #000; padding: 0 0 1rem; border-bottom: 2px solid #000; }
    .story-head h2 { color: #000; }
    .story-tags span { background: none; border: 1px solid #999; color: #000; }
    .story-body { padding: 1rem 0; font-size: 12pt; color: #000; }
    .story-side { padding: 0; }
    .print-only { display: block !important; }
}
.print-only { display: none; }
