/* ==========================================================================
   EXAM INTELLIGENCE ASSISTANT — SOLID WARM CREAMY & PREMIUM AESTHETIC
   ========================================================================== */

:root {
    /* Solid Warm Cream & Linen Palette */
    --bg-main: #f5f2eb;            /* Rich solid warm cream / linen */
    --bg-surface: #fdfcf9;         /* Warm ivory surface */
    --bg-subtle: #eae5d9;          /* Gentle warm stone tint */
    --bg-card: #fdfcf9;            /* Crisp porcelain cream */
    --bg-input: #ffffff;           /* Clean white input */

    --border-subtle: #e3ddd0;      /* Warm stone border */
    --border-hover: #d1c8b8;       /* Medium warm border */
    --border-focus: #b45309;       /* Warm amber focus */

    --text-primary: #1c1917;       /* Deep warm espresso stone */
    --text-secondary: #44403c;     /* Warm charcoal */
    --text-muted: #78716c;         /* Warm muted taupe */
    --text-on-accent: #ffffff;

    --accent-primary: #b45309;     /* Warm terracotta / amber bronze */
    --accent-hover: #92400e;       /* Deep warm bronze */
    --accent-light: #fef3c7;       /* Soft butter amber */
    --accent-ring: rgba(180, 83, 9, 0.22);

    /* Exam Question Badges (Warm Harmony) */
    --tag-year-bg: #e0f2fe;
    --tag-year-text: #0369a1;
    --tag-sem-bg: #f3e8ff;
    --tag-sem-text: #6b21a8;
    --tag-marks-bg: #fef3c7;
    --tag-marks-text: #92400e;

    --status-green: #059669;
    --status-red: #dc2626;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --shadow-sm: 0 1px 3px 0 rgba(68, 64, 60, 0.06);
    --shadow-md: 0 4px 10px -2px rgba(68, 64, 60, 0.08), 0 2px 4px -2px rgba(68, 64, 60, 0.04);
    --shadow-lg: 0 10px 24px -4px rgba(68, 64, 60, 0.09), 0 4px 8px -4px rgba(68, 64, 60, 0.04);
    --shadow-float: 0 14px 34px -4px rgba(68, 64, 60, 0.12), 0 4px 12px -2px rgba(68, 64, 60, 0.06);

    --radius-xl: 18px;
    --radius-lg: 14px;
    --radius-md: 10px;
    --radius-sm: 6px;
}

/* ==========================================================================
   GLOBAL RESET & COMPLETE SCROLLBAR HIDING
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Completely hide scrollbars across all modern browsers */
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

*::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

html, body {
    height: 100%;
    width: 100%;
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* App Full Layout with Warm Solid Cream Backdrop */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    background-color: var(--bg-main);
}

/* ==========================================================================
   1. APP HEADER (Solid Warm Translucent Cream)
   ========================================================================== */
.app-header {
    height: 64px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(245, 242, 235, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    z-index: 20;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background: transparent;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-icon:hover {
    transform: scale(1.05);
}

.brand-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(68, 64, 60, 0.16);
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.brand-title {
    font-size: 1.18rem;
    font-weight: 800;
    color: #18181b;
    letter-spacing: -0.025em;
    line-height: 1.15;
    white-space: nowrap;
}

.brand-subtitle {
    font-size: 0.76rem;
    font-weight: 600;
    color: #78716c;
    letter-spacing: -0.01em;
    line-height: 1.25;
    margin-top: 1px;
    white-space: nowrap;
}

/* Header Actions Group */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-hero-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.btn-hero-toggle:hover {
    background: #faf6ee;
    color: var(--accent-primary);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-hero-toggle:active {
    transform: translateY(0);
}

/* Status Indicator */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    user-select: none;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--status-red);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* Connecting & Offline: Red and Blinking */
.status-badge.connecting .status-dot,
.status-badge.offline .status-dot {
    background-color: #ef4444;
    animation: pulse-red-dot 1.15s infinite ease-in-out;
}

.status-badge.connecting {
    border-color: rgba(239, 68, 68, 0.3);
}

.status-badge.connecting .status-text {
    color: #ef4444;
}

/* Online / Connected: Solid Glowing Green */
.status-badge.online .status-dot {
    background-color: var(--status-green);
    box-shadow: 0 0 8px rgba(5, 150, 105, 0.6);
    animation: pulse-green-subtle 3s infinite ease-in-out;
}

.status-badge.online {
    border-color: rgba(5, 150, 105, 0.3);
}

.status-badge.online .status-text {
    color: var(--text-secondary);
}

@keyframes pulse-red-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.75);
    }
    50% {
        opacity: 0.3;
        transform: scale(0.85);
        box-shadow: 0 0 8px 3px rgba(239, 68, 68, 0.35);
    }
}

@keyframes pulse-green-subtle {
    0%, 100% {
        box-shadow: 0 0 6px rgba(5, 150, 105, 0.4);
    }
    50% {
        box-shadow: 0 0 12px rgba(5, 150, 105, 0.8);
    }
}

/* ==========================================================================
   2. MAIN CHAT CONTAINER
   ========================================================================== */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}

/* Message Feed */
.chat-feed {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px 84px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

/* ==========================================================================
   3. HERO POSTER SECTION (Premium Academic-Tech Poster Aesthetic)
   ========================================================================== */
.hero-poster {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 24px 26px 20px;
    margin: 4px 0 16px;
    box-shadow: 0 10px 32px -4px rgba(68, 64, 60, 0.08), 0 3px 10px -2px rgba(68, 64, 60, 0.04);
    transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), margin 0.28s ease;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    animation: heroSlideFade 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes heroSlideFade {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.hero-poster.hero-poster-closing {
    opacity: 0;
    transform: translateY(-14px) scale(0.98);
    pointer-events: none;
    overflow: hidden;
}

/* Cancel / Dismiss Button — Icon Only */
.hero-cancel-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(250, 246, 239, 0.92);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.18s ease;
    z-index: 10;
    padding: 0;
    flex-shrink: 0;
}

.hero-cancel-btn:hover {
    background: #f0e8d8;
    color: var(--accent-hover);
    border-color: #c8bfb0;
    transform: scale(1.08) rotate(90deg);
}

.hero-cancel-btn:active {
    transform: scale(0.92);
}

/* ──────────────────────────────────────────────────────────────
   NEW POSTER LAYOUT — Creative Editorial Structure
   ────────────────────────────────────────────────────────────── */

/* ── ROW 1: Top Split Layout ── */
.poster-split-top {
    display: grid;
    grid-template-columns: 1fr 290px;
    gap: 24px;
    margin-bottom: 22px;
    align-items: start;
}

/* Left: Editorial Identity Column */
.poster-split-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
    padding-right: 0;
}

.poster-split-left .hero-eyebrow {
    margin-bottom: 12px;
}

.eyebrow-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 0.70rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 999px;
}

.eyebrow-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #d97706;
    animation: gentlePulse 1.6s infinite ease-in-out;
}

.poster-main-heading {
    font-size: 2.05rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.04em;
    line-height: 1.15;
    margin-bottom: 8px;
    margin-top: 0;
}

.poster-tagline {
    font-size: 1.0rem;
    font-weight: 700;
    color: #92400e;
    letter-spacing: -0.01em;
    line-height: 1.35;
    margin-bottom: 14px;
    opacity: 0.88;
}

/* Attribution chips */
.poster-attribution-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.attr-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.71rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 999px;
    border: 1px solid;
    white-space: nowrap;
}

.attr-chip-maker {
    background: #f0fdf4;
    border-color: #86efac;
    color: #15803d;
}

.attr-chip-college {
    background: #eff6ff;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.attr-chip-dept {
    background: #faf5ff;
    border-color: #d8b4fe;
    color: #7e22ce;
}

.attr-chip-scope {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.poster-intro {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.62;
    margin-bottom: 18px;
    max-width: 100%;
}

.poster-intro strong {
    color: var(--text-primary);
    font-weight: 600;
}

.poster-actions-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 4px;
}

.hero-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #b45309 0%, #92400e 100%);
    color: #ffffff;
    border: none;
    outline: none;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: var(--font-sans);
    padding: 10px 20px;
    border-radius: 9px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(180, 83, 9, 0.28);
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    min-height: 40px;
}

.hero-cta-btn:hover {
    background: linear-gradient(135deg, #92400e 0%, #78350f 100%);
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(180, 83, 9, 0.36);
}

.hero-cta-btn:hover svg { transform: translateX(3px); }
.hero-cta-btn svg { transition: transform 0.2s ease; }
.hero-cta-btn:active { transform: translateY(0); }

.poster-microcopy {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 500;
    line-height: 1.4;
}

.poster-microcopy svg {
    color: #059669;
    flex-shrink: 0;
}

/* ── Right: Dark Pipeline Terminal Card ── */
.poster-pipeline-card {
    background: #1c1917;
    border-radius: 16px;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    min-width: 0;
    align-self: start;
}

.pipeline-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    background: #252220;
    border-bottom: 1px solid #3c3834;
}

.pipeline-card-title {
    display: flex;
    align-items: center;
    gap: 9px;
}

.pipeline-dot-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pdot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
}

.pdot-red    { background: #ef4444; }
.pdot-yellow { background: #f59e0b; }
.pdot-green  { background: #22c55e; }

.pipeline-card-label {
    font-size: 0.69rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: #a8a29e;
    text-transform: uppercase;
}

.pipeline-card-badge {
    font-size: 0.61rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.25);
    padding: 2px 6px;
    border-radius: 4px;
}

.pipeline-steps {
    flex: 1;
    padding: 4px 0;
}

.pipeline-step {
    display: flex;
    align-items: stretch;
    gap: 0;
    padding: 0 16px;
}

.pipe-step-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 30px;
    flex-shrink: 0;
    padding: 9px 0;
}

.pipe-num {
    font-family: 'Courier New', monospace;
    font-size: 0.67rem;
    font-weight: 700;
    color: #d97706;
    line-height: 1;
    flex-shrink: 0;
}

.pipe-num-accent {
    color: #fbbf24;
    background: rgba(251, 191, 36, 0.12);
    width: 21px;
    height: 21px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.61rem;
}

.pipe-line-seg {
    flex: 1;
    width: 1px;
    background: #3c3834;
    margin-top: 4px;
    min-height: 12px;
}

.pipe-body {
    display: flex;
    flex-direction: column;
    padding: 8px 0 8px 10px;
    flex: 1;
    border-bottom: 1px solid #292524;
    gap: 3px;
}

.pipeline-step-last .pipe-body {
    border-bottom: none;
}

.pipe-title {
    font-size: 0.79rem;
    font-weight: 600;
    color: #fafaf9;
    line-height: 1.3;
}

.pipe-title-accent {
    color: #fbbf24;
}

.pipe-sub {
    font-size: 0.66rem;
    color: #78716c;
    font-family: 'Courier New', monospace;
    line-height: 1.3;
}

.pipeline-card-footer {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 9px 16px;
    background: #252220;
    border-top: 1px solid #3c3834;
    flex-wrap: wrap;
}

.pcf-tag {
    font-size: 0.63rem;
    font-weight: 600;
    color: #a8a29e;
    background: #292524;
    border: 1px solid #3c3834;
    padding: 2px 7px;
    border-radius: 4px;
}

.pcf-tag-gem {
    color: #86efac;
    border-color: rgba(134, 239, 172, 0.25);
    background: rgba(134, 239, 172, 0.07);
}

/* ── ROW 2: STRUCTURED METRICS & TECH BAR ── */
.poster-infobar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #faf7f2;
    border: 1px solid #e6dfd2;
    border-radius: 14px;
    padding: 13px 18px;
    margin-bottom: 22px;
}

/* Upper Tier: Archive Metrics Row */
.infobar-stats-row {
    display: flex;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.infobar-badge-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    flex-shrink: 0;
    min-width: 180px;
}

.infobar-archive-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 6px;
}

.infobar-archive-desc {
    font-size: 0.73rem;
    color: #78716c;
    font-weight: 600;
    line-height: 1.25;
}

.infobar-stats-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
    align-items: center;
    gap: 0;
    width: 100%;
}

.istat {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    text-align: center;
}

.istat:first-child { padding-left: 0; }
.istat:last-child { padding-right: 0; }

.istat-num {
    font-size: 1.26rem;
    font-weight: 800;
    color: #1c1917;
    letter-spacing: -0.03em;
    line-height: 1;
    white-space: nowrap;
}

.istat-label {
    font-size: 0.60rem;
    color: #78716c;
    text-align: center;
    margin-top: 3px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.istat-sep {
    width: 1px;
    height: 28px;
    background: #e3ddd0;
    flex-shrink: 0;
}

/* Horizontal separator between metrics and tech */
.infobar-divider-line {
    width: 100%;
    height: 1px;
    background: #e6dfd2;
}

/* Lower Tier: Tech Stack Row */
.infobar-tech-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.infobar-tech-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.64rem;
    font-weight: 800;
    color: #b45309;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    flex-shrink: 0;
}

.infobar-tech-pills {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.tpill {
    font-size: 0.70rem;
    font-weight: 600;
    color: #44403c;
    background: #ffffff;
    border: 1px solid #e3ddd0;
    padding: 2.5px 9px;
    border-radius: 6px;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.tpill:hover {
    border-color: #cbd5e1;
    color: #1e293b;
    background: #f8fafc;
}

.tpill-accent {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
    font-weight: 700;
}

/* ── ROW 3: Demo Panel ── */
.poster-demo-panel {
    border: 1px solid #e6dfd2;
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 16px;
}

.demo-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f5f0e8;
    border-bottom: 1px solid #e6dfd2;
}

.demo-header-left {
    display: flex;
    align-items: baseline;
    gap: 9px;
}

.demo-header-eyebrow {
    font-size: 0.60rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #b45309;
    white-space: nowrap;
}

.demo-header-title {
    font-size: 0.83rem;
    font-weight: 700;
    color: var(--text-primary);
}

.demo-tag {
    font-size: 0.65rem;
    font-weight: 600;
    color: #78716c;
    background: #ede8de;
    border: 1px solid #d6cfc0;
    padding: 2px 8px;
    border-radius: 5px;
    white-space: nowrap;
}

.demo-panel-body {
    padding: 14px 16px;
}

/* Query Strip */
.demo-query-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 8px 14px;
    margin-bottom: 14px;
}

.demo-query-label {
    font-size: 0.64rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #92400e;
    flex-shrink: 0;
    white-space: nowrap;
}

.demo-query-text {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1c1917;
    font-style: italic;
}

/* Two-column demo */
.demo-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.demo-col {
    border-radius: 9px;
    overflow: hidden;
    border: 1px solid #e6dfd2;
}

.demo-col-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    background: #f5f0e8;
    border-bottom: 1px solid #e6dfd2;
    flex-wrap: wrap;
}

.demo-col-pill {
    font-size: 0.64rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.demo-pill-concept {
    background: #dbeafe;
    color: #1d4ed8;
}

.demo-pill-pyq {
    background: #dcfce7;
    color: #15803d;
}

.demo-col-note {
    font-size: 0.64rem;
    color: #78716c;
    font-weight: 500;
}

/* Concept list */
.demo-concept-list {
    padding: 11px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.demo-concept-item {
    display: flex;
    align-items: baseline;
    gap: 7px;
}

.dci-term {
    font-size: 0.74rem;
    font-weight: 700;
    color: #1d4ed8;
    white-space: nowrap;
    flex-shrink: 0;
}

.dci-desc {
    font-size: 0.73rem;
    color: var(--text-secondary);
    line-height: 1.42;
}

/* PYQ list */
.demo-pyq-list {
    padding: 11px 14px;
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.demo-pyq-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.demo-pyq-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}

.dpyq-tag {
    font-size: 0.61rem;
    font-weight: 600;
    padding: 1.5px 6px;
    border-radius: 4px;
    white-space: nowrap;
}

.tag-yr  { background: #fef3c7; color: #92400e; }
.tag-sm  { background: #f3f4f6; color: #374151; }
.tag-mk  { background: #fce7f3; color: #9d174d; }
.tag-qn  { background: #ede9fe; color: #5b21b6; }
.tag-fl  { background: #f0fdf4; color: #166534; }

.demo-pyq-text {
    font-size: 0.75rem;
    color: var(--text-primary);
    line-height: 1.48;
    font-style: italic;
    margin: 0;
}

.demo-pyq-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    font-size: 0.63rem;
    color: #78716c;
    background: #f5f0e8;
    border-top: 1px solid #e6dfd2;
    font-family: 'Courier New', monospace;
}

/* ── Footer Scope Notice ── */
.poster-scope-notice {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 14px;
    background: #fffbf5;
    border: 1px solid #fed7aa;
    border-radius: 9px;
    font-size: 0.75rem;
    color: #78350f;
    line-height: 1.5;
}

.poster-scope-notice svg {
    color: #b45309;
    flex-shrink: 0;
    margin-top: 1px;
}

.poster-scope-notice strong {
    font-weight: 700;
    color: #92400e;
}


/* ==========================================================================
   4. WELCOME HERO CARD (Creamy Ceramic Porcelain)
   ========================================================================== */
.welcome-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 36px 32px;
    text-align: center;
    margin: auto 0;
    box-shadow: var(--shadow-lg);
}

.welcome-icon {
    margin-bottom: 16px;
    display: inline-block;
}

.welcome-logo-img {
    width: 68px;
    height: 68px;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: 0 10px 28px rgba(68, 64, 60, 0.14);
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.welcome-logo-img:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow: 0 14px 34px rgba(68, 64, 60, 0.20);
}

.welcome-card h2 {
    font-size: 1.45rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

.welcome-card p {
    font-size: 0.94rem;
    color: var(--text-secondary);
    max-width: 560px;
    margin: 0 auto 28px;
    line-height: 1.6;
}

.suggestions-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 12px;
}

.suggestion-chip {
    background: #fbf9f4;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 13px 16px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    line-height: 1.4;
}

.suggestion-chip:hover {
    background: var(--bg-surface);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ==========================================================================
   4. CHAT MESSAGES & TYPOGRAPHY STRUCTURE
   ========================================================================== */
.message {
    display: flex;
    width: 100%;
    min-width: 0;
    animation: slideUpFade 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* User Message Bubble (Warm Deep Espresso Stone) */
.message-user {
    justify-content: flex-end;
}

.message-user .message-content {
    background: linear-gradient(135deg, #292524 0%, #1c1917 100%);
    color: var(--text-on-accent);
    border-radius: var(--radius-lg) var(--radius-lg) 4px var(--radius-lg);
    padding: 13px 19px;
    max-width: 76%;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.55;
    box-shadow: 0 4px 14px rgba(28, 25, 23, 0.25);
    overflow-wrap: break-word;
    word-break: break-word;
}

/* AI Message Container (Editorial Academic Layout) */
.message-ai {
    justify-content: flex-start;
    min-width: 0;
}

.message-ai .message-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    max-width: 95%;
    width: 100%;
    min-width: 0;
    font-size: 0.95rem;
    line-height: 1.72;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* AI Message Top Meta Bar */
.message-meta-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.ai-source-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-primary);
    background: #fdf5ea;
    border: 1px solid #fed7aa;
    padding: 3px 10px;
    border-radius: 999px;
}

.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-copy:hover {
    background: var(--bg-main);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-copy.copied {
    background: #ecfdf5;
    color: #059669;
    border-color: #a7f3d0;
}

/* Markdown Hierarchy & Text Structure */
.message-body h1,
.message-body h2,
.message-body h3,
.message-body h4 {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.message-body h1 {
    font-size: 1.3rem;
    border-bottom: 2px solid var(--border-subtle);
    padding-bottom: 6px;
    margin: 20px 0 12px;
}

.message-body h2 {
    font-size: 1.16rem;
    color: var(--accent-primary);
    margin: 20px 0 10px;
}

.message-body h3 {
    font-size: 1.04rem;
    color: #292524;
    margin: 18px 0 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.message-body h3:first-child {
    margin-top: 0;
}

.message-body p {
    margin-bottom: 12px;
    color: var(--text-secondary);
    line-height: 1.72;
}

.message-body p:last-child {
    margin-bottom: 0;
}

.message-body strong {
    color: var(--text-primary);
    font-weight: 700;
}

/* Lists */
.message-body ul,
.message-body ol {
    margin: 10px 0 16px 20px;
    color: var(--text-secondary);
}

.message-body li {
    margin-bottom: 6px;
    padding-left: 4px;
    line-height: 1.65;
}

.message-body li::marker {
    color: var(--accent-primary);
    font-weight: bold;
}

/* Code Blocks */
.message-body pre {
    background: #1c1917;
    border: 1px solid #292524;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin: 14px 0;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.86rem;
    color: #f5f5f4;
    box-shadow: var(--shadow-sm);
}

.message-body code {
    background: #ede8dc;
    color: #92400e;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.88em;
    font-weight: 600;
}

.message-body pre code {
    background: none;
    padding: 0;
    color: inherit;
    font-weight: normal;
}

/* Tables */
.message-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-sm);
}

.message-body th,
.message-body td {
    border: 1px solid var(--border-subtle);
    padding: 10px 14px;
    text-align: left;
}

.message-body th {
    background: var(--bg-subtle);
    font-weight: 700;
    color: var(--text-primary);
}

.message-body tr:nth-child(even) td {
    background: #fbf9f4;
}

/* Blockquotes / Exam Callouts */
.message-body blockquote {
    border-left: 4px solid var(--accent-primary);
    background: #fef7ed;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    padding: 12px 18px;
    margin: 14px 0;
    color: #7c2d12;
    font-style: normal;
}

/* ==========================================================================
   5. SLEEK EDITORIAL PREVIOUS-YEAR QUESTIONS ARCHIVE (No boxy cards)
   ========================================================================== */
.pyq-editorial-block {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border-subtle);
}

.pyq-ref-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.pyq-ref-title-group {
    display: flex;
    align-items: center;
    gap: 9px;
}

.pyq-ref-badge {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #ffffff;
    background: var(--accent-primary);
    padding: 2px 7px;
    border-radius: 4px;
}

.pyq-ref-heading {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.pyq-ref-count {
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
}

.pyq-ref-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #faf7f0;
}

.pyq-ref-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: transparent;
    transition: background-color 0.15s ease;
}

.pyq-ref-item:last-child {
    border-bottom: none;
}

.pyq-ref-item:hover {
    background-color: #f3eee2;
}

.pyq-ref-num {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--accent-primary);
    background: #fdf5ea;
    border: 1px solid #fed7aa;
    padding: 3px 8px;
    border-radius: 6px;
    flex-shrink: 0;
    margin-top: 2px;
    line-height: 1;
}

.pyq-ref-body {
    flex: 1;
    min-width: 0;
}

.pyq-ref-question {
    font-size: 0.91rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 7px !important;
}

.pyq-ref-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    font-size: 0.73rem;
    color: var(--text-muted);
}

.pyq-ref-meta .meta-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 600;
}

.pyq-ref-meta .tag-yr {
    background: var(--tag-year-bg);
    color: var(--tag-year-text);
}

.pyq-ref-meta .tag-sm {
    background: var(--tag-sem-bg);
    color: var(--tag-sem-text);
}

.pyq-ref-meta .tag-mk {
    background: var(--tag-marks-bg);
    color: var(--tag-marks-text);
    font-weight: 700;
}

.pyq-ref-meta .meta-dot {
    color: var(--border-hover);
    font-weight: bold;
}

.pyq-note-block {
    margin-top: 14px;
    padding: 10px 14px;
    background: #fbf9f4;
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Source Attribution Bar (Compact, Subtle Footer) */
.message-sources-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-subtle);
    font-size: 0.76rem;
}

.sources-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.70rem;
}

.sources-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.source-file-pill {
    display: inline-flex;
    align-items: center;
    background: #fdf6ec;
    border: 1px solid #fed7aa;
    color: #92400e;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    padding: 2px 7px;
    border-radius: 4px;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.15s ease;
}

.source-file-pill:hover {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #78350f;
}

/* ==========================================================================
   6. TYPING INDICATOR (Gentle Amber Warm Pulse)
   ========================================================================== */
.typing-msg .message-content {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    background: var(--bg-surface);
}

.typing-indicator {
    display: flex;
    gap: 5px;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--accent-primary);
    animation: gentlePulse 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes gentlePulse {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.35; }
    40% { transform: scale(1.15); opacity: 1; }
}

.typing-text {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 500;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.typing-text.fade-step {
    animation: typingStepFade 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes typingStepFade {
    0% {
        opacity: 0;
        transform: translateY(3px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   7. CHAT INPUT AREA (Solid Porcelain Floating Bar)
   ========================================================================== */
.chat-input-wrapper {
    padding: 10px 20px 16px;
    background: linear-gradient(to top, var(--bg-main) 75%, transparent);
    flex-shrink: 0;
}

.input-form {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 9px 14px 9px 20px;
    box-shadow: var(--shadow-float);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.input-form:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px var(--accent-ring), var(--shadow-float);
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.96rem;
    line-height: 1.5;
    resize: none;
    max-height: 140px;
    padding: 5px 0;
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.btn-send {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--accent-primary);
    border: none;
    outline: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.28);
}

.btn-send:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-send:active {
    transform: scale(0.96);
}

.btn-send:disabled {
    background-color: var(--bg-subtle);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.input-footer {
    text-align: center;
    margin-top: 9px;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.input-footer kbd {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    color: var(--text-secondary);
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}

/* ==========================================================================
   8. RESPONSIVE DESIGN FOR TABLETS & PHONES
   ========================================================================== */

/* Medium Screens & Small Laptops */
@media (max-width: 960px) {
    .poster-split-top {
        grid-template-columns: 1fr 280px;
        gap: 16px;
    }
    .poster-infobar {
        gap: 10px;
    }
    .istat-num {
        font-size: 1.05rem;
    }
}

/* Tablets & Medium Screens */
@media (max-width: 768px) {
    .app-header {
        padding: 0 18px;
    }
    .chat-container {
        max-width: 100%;
    }
    .chat-feed {
        padding: 20px 18px 24px;
        gap: 18px;
    }
    .chat-input-wrapper {
        padding: 10px 18px 18px;
    }
    .message-ai .message-content {
        max-width: 98%;
        padding: 20px 22px;
    }
    .message-user .message-content {
        max-width: 85%;
    }

    /* Poster on Tablets: stack the split */
    .hero-poster {
        padding: 22px 18px 20px;
        border-radius: 18px;
    }
    .poster-split-top {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .poster-pipeline-card {
        min-height: unset;
    }
    .poster-main-heading {
        font-size: 1.9rem;
    }
    .demo-two-col {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .poster-infobar {
        flex-wrap: wrap;
        gap: 10px;
    }
    .infobar-divider-v {
        display: none;
    }
    .infobar-tech {
        width: 100%;
        padding-top: 8px;
        border-top: 1px solid #e6dfd2;
    }
}

/* Mobile Phones (Standard & Compact) */
@media (max-width: 640px) {
    /* Layout & Viewport */
    .app-layout {
        height: 100dvh;
        width: 100vw;
        overflow: hidden;
    }

    .app-header {
        height: 56px;
        padding: 0 10px;
        gap: 8px;
    }

    .header-brand {
        gap: 8px;
        min-width: 0;
        flex: 1;
    }

    .brand-icon {
        width: 34px;
        height: 34px;
        border-radius: 9px;
        flex-shrink: 0;
    }

    .brand-img {
        border-radius: 9px;
    }

    .brand-text {
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        overflow: hidden;
    }

    .brand-title {
        font-size: 0.94rem;
        font-weight: 800;
        line-height: 1.15;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        color: #18181b;
    }

    .brand-subtitle {
        display: block !important;
        font-size: 0.64rem;
        font-weight: 600;
        color: #78716c;
        line-height: 1.15;
        margin-top: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Header Actions Group Mobile: icon-only button and dot-only badge */
    .header-actions {
        display: flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
    }

    /* Overview button: keep only the (i) icon on mobile */
    .btn-hero-toggle {
        width: 32px;
        height: 32px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .btn-hero-toggle span {
        display: none !important;
    }

    .btn-hero-toggle svg {
        width: 15px;
        height: 15px;
    }

    /* Status badge: keep only the green dot on mobile */
    .status-badge {
        width: 26px;
        height: 26px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .status-badge .status-text {
        display: none !important;
    }

    .status-dot {
        width: 8px;
        height: 8px;
        margin: 0;
    }

    /* Main Container & Message Feed */
    .chat-container {
        height: calc(100dvh - 56px);
        width: 100%;
    }

    .chat-feed {
        padding: 14px 10px 76px;
        gap: 14px;
    }

    /* About Project Poster on Mobile & Tablet */
    .hero-poster {
        padding: 20px 16px 18px;
        border-radius: 16px;
        margin: 4px 0 16px;
    }

    .hero-cancel-btn {
        top: 12px;
        right: 12px;
        width: 28px;
        height: 28px;
    }

    .poster-split-top {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 20px;
    }

    .poster-main-heading {
        font-size: 1.68rem;
        line-height: 1.20;
        margin-bottom: 8px;
    }

    .poster-tagline {
        font-size: 0.94rem;
        line-height: 1.35;
        margin-bottom: 12px;
    }

    .poster-attribution-row { gap: 6px; margin-bottom: 14px; }
    .attr-chip { font-size: 0.68rem; padding: 3px 8px; }

    .poster-intro {
        font-size: 0.88rem;
        line-height: 1.62;
        margin-bottom: 16px;
    }

    .poster-actions-row { width: 100%; gap: 12px; margin-top: 4px; margin-bottom: 4px; }
    .hero-cta-btn { width: 100%; padding: 11px 20px; font-size: 0.88rem; min-height: 42px; }
    .poster-microcopy { font-size: 0.74rem; line-height: 1.4; }

    .poster-pipeline-card {
        border-radius: 14px;
    }

    .pipeline-card-header {
        padding: 10px 14px;
    }

    .pipe-step-left {
        padding: 8px 0;
    }

    .pipe-body {
        padding: 8px 0 8px 10px;
        gap: 3px;
    }

    .pipe-title {
        font-size: 0.78rem;
        line-height: 1.3;
    }

    .pipe-sub {
        font-size: 0.66rem;
        line-height: 1.3;
    }

    .pipeline-card-footer {
        padding: 8px 14px;
        gap: 6px;
    }

    /* Info Bar Mobile & Tablet */
    .poster-infobar {
        padding: 12px 14px;
        gap: 12px;
        margin-bottom: 20px;
    }

    .infobar-stats-row {
        display: flex;
        align-items: center;
        gap: 16px;
        width: 100%;
    }

    .infobar-badge-box {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
        flex-shrink: 0;
        min-width: 165px;
    }

    .infobar-archive-desc {
        font-size: 0.70rem;
    }

    .infobar-stats-grid {
        flex: 1;
        display: grid;
        grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
        align-items: center;
        width: 100%;
    }

    .istat {
        padding: 0 4px;
    }

    .istat-num {
        font-size: 1.15rem;
    }

    .istat-label {
        font-size: 0.58rem;
    }

    .istat-sep {
        display: block;
        width: 1px;
        height: 24px;
        background: #e3ddd0;
    }

    .infobar-tech-row {
        gap: 8px;
    }

    .infobar-tech-pills {
        gap: 5px;
    }

    .tpill {
        font-size: 0.67rem;
        padding: 2px 7px;
    }

    .poster-demo-panel {
        margin-bottom: 18px;
        border-radius: 12px;
    }
    .demo-panel-header { flex-direction: column; align-items: flex-start; gap: 6px; padding: 10px 14px; }
    .demo-header-left { flex-direction: column; gap: 3px; }
    .demo-panel-body { padding: 12px 14px; }
    .demo-query-strip { flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 12px; margin-bottom: 14px; }
    .demo-two-col { grid-template-columns: 1fr; gap: 14px; }
    .demo-col-header { padding: 7px 10px; gap: 6px; }
    .demo-concept-list { padding: 10px 12px; gap: 8px; }
    .demo-concept-item { gap: 6px; line-height: 1.45; }
    .demo-pyq-list { padding: 10px 12px; gap: 11px; }
    .demo-pyq-item { gap: 5px; }
    .demo-pyq-text { line-height: 1.48; font-size: 0.74rem; }
    .demo-pyq-footer { padding: 7px 12px; font-size: 0.62rem; }

    .poster-scope-notice { padding: 9px 12px; font-size: 0.74rem; line-height: 1.5; }

    /* Welcome Card */
    .welcome-card {
        padding: 22px 14px;
        border-radius: 14px;
        margin: 8px 0;
    }

    .welcome-icon {
        margin-bottom: 10px;
    }

    .welcome-logo-img {
        width: 52px;
        height: 52px;
        border-radius: 14px;
    }

    .welcome-card h2 {
        font-size: 1.18rem;
        margin-bottom: 6px;
    }

    .welcome-card p {
        font-size: 0.84rem;
        line-height: 1.5;
        margin-bottom: 16px;
    }

    .suggestions-label {
        font-size: 0.72rem;
        margin-bottom: 10px;
    }

    .suggestions-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .suggestion-chip {
        padding: 9px 12px;
        font-size: 0.81rem;
        border-radius: 8px;
    }

    /* User Message */
    .message-user .message-content {
        max-width: 88%;
        padding: 10px 14px;
        font-size: 0.90rem;
        line-height: 1.45;
        border-radius: 14px 14px 3px 14px;
    }

    /* AI Message Container */
    .message-ai {
        width: 100%;
    }

    .message-ai .message-content {
        max-width: 100%;
        width: 100%;
        padding: 15px 14px;
        border-radius: 14px;
        font-size: 0.91rem;
        line-height: 1.62;
        box-shadow: var(--shadow-sm);
    }

    /* AI Message Header / Meta Bar */
    .message-meta-bar {
        padding-bottom: 10px;
        margin-bottom: 12px;
    }

    .ai-source-label {
        font-size: 0.68rem;
        padding: 2px 8px;
        gap: 4px;
    }

    .btn-copy {
        padding: 3px 8px;
        font-size: 0.70rem;
        gap: 4px;
    }

    /* Typography inside AI Message Body */
    .message-body h1 {
        font-size: 1.15rem;
        margin: 14px 0 8px;
        padding-bottom: 4px;
    }

    .message-body h2 {
        font-size: 1.02rem;
        margin: 14px 0 6px;
    }

    .message-body h3 {
        font-size: 0.94rem;
        margin: 12px 0 6px;
    }

    .message-body p {
        font-size: 0.90rem;
        line-height: 1.62;
        margin-bottom: 10px;
    }

    .message-body ul,
    .message-body ol {
        margin: 8px 0 12px 18px;
    }

    .message-body li {
        font-size: 0.90rem;
        line-height: 1.55;
        margin-bottom: 5px;
    }

    .message-body pre {
        padding: 10px 12px;
        font-size: 0.78rem;
        border-radius: 8px;
        margin: 10px 0;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .message-body code {
        font-size: 0.84em;
        padding: 1px 5px;
    }

    .message-body blockquote {
        padding: 10px 12px;
        font-size: 0.86rem;
        margin: 10px 0;
    }

    .message-body table {
        font-size: 0.80rem;
        margin: 12px 0;
    }

    .message-body th,
    .message-body td {
        padding: 7px 10px;
    }

    /* Past Exam Questions Archive */
    .pyq-editorial-block {
        margin-top: 18px;
        padding-top: 14px;
    }

    .pyq-ref-header {
        margin-bottom: 10px;
        flex-wrap: wrap;
        gap: 6px;
    }

    .pyq-ref-title-group {
        gap: 6px;
    }

    .pyq-ref-heading {
        font-size: 0.86rem;
    }

    .pyq-ref-badge {
        font-size: 0.64rem;
        padding: 2px 6px;
    }

    .pyq-ref-count {
        font-size: 0.70rem;
    }

    .pyq-ref-list {
        border-radius: 10px;
    }

    .pyq-ref-item {
        padding: 10px 11px;
        gap: 10px;
    }

    .pyq-ref-num {
        font-size: 0.68rem;
        padding: 2px 6px;
        border-radius: 4px;
        margin-top: 1px;
    }

    .pyq-ref-question {
        font-size: 0.86rem;
        line-height: 1.45;
        margin-bottom: 6px !important;
    }

    .pyq-ref-meta {
        gap: 4px 6px;
        font-size: 0.70rem;
    }

    .pyq-ref-meta .meta-tag {
        font-size: 0.66rem;
        padding: 2px 6px;
    }

    /* Hide bullet dots on mobile so tag pills wrap naturally */
    .pyq-ref-meta .meta-dot {
        display: none;
    }

    .pyq-note-block {
        padding: 8px 10px;
        font-size: 0.78rem;
        margin-top: 10px;
    }

    /* Sources Attribution Bar */
    .message-sources-bar {
        margin-top: 14px;
        padding-top: 10px;
        gap: 6px;
    }

    .sources-label {
        font-size: 0.66rem;
    }

    .sources-tags {
        gap: 5px;
        width: 100%;
    }

    .source-file-pill {
        max-width: 100%;
        font-size: 0.68rem;
        padding: 2px 6px;
    }

    /* Chat Input Area (Fixed Bottom) */
    .chat-input-wrapper {
        padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
        background: linear-gradient(to top, var(--bg-main) 88%, transparent);
    }

    .input-form {
        padding: 6px 8px 6px 14px;
        gap: 8px;
        border-radius: 20px;
        box-shadow: var(--shadow-md);
    }

    /* 16px font-size prevents unwanted iOS Safari zoom */
    .chat-input {
        font-size: 16px !important;
        line-height: 1.4;
        padding: 6px 0;
        max-height: 100px;
    }

    .btn-send {
        width: 36px;
        height: 36px;
        border-radius: 50%;
    }

    .btn-send svg {
        width: 16px;
        height: 16px;
    }

    .input-footer {
        display: none;
    }
}

/* Small Mobile Phones (width <= 580px) */
@media (max-width: 580px) {
    .infobar-stats-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .infobar-badge-box {
        min-width: 0;
        width: 100%;
    }

    .infobar-stats-grid {
        grid-template-columns: repeat(4, 1fr);
        background: #f5f0e8;
        padding: 8px 4px;
        border-radius: 8px;
    }

    .istat-sep {
        display: none;
    }
}

/* Extra Small Phones (width <= 380px) */
@media (max-width: 380px) {
    .app-header {
        padding: 0 8px;
        gap: 6px;
    }

    .header-brand {
        gap: 6px;
    }

    .brand-icon {
        width: 30px;
        height: 30px;
    }

    .brand-title {
        font-size: 0.86rem;
    }

    .brand-subtitle {
        display: block !important;
        font-size: 0.58rem;
    }

    .btn-hero-toggle {
        width: 28px;
        height: 28px;
        padding: 0;
    }

    .btn-hero-toggle svg {
        width: 14px;
        height: 14px;
    }

    .status-badge {
        width: 24px;
        height: 24px;
        padding: 0;
    }

    .status-dot {
        width: 7px;
        height: 7px;
    }

    .hero-poster {
        padding: 14px 10px 14px;
        border-radius: 12px;
    }

    .poster-main-heading {
        font-size: 1.28rem;
    }

    .poster-tagline {
        font-size: 0.92rem;
    }

    .poster-intro {
        font-size: 0.82rem;
        line-height: 1.5;
    }

    .hero-cta-btn {
        font-size: 0.84rem;
        padding: 9px 14px;
    }

    .demo-two-col {
        grid-template-columns: 1fr;
    }

    .pyq-meta-tag {
        font-size: 0.62rem;
        padding: 1px 5px;
    }

    .chat-feed {
        padding: 10px 8px 14px;
    }

    .message-ai .message-content {
        padding: 12px 10px;
    }

    .pyq-ref-item {
        padding: 8px 9px;
        gap: 8px;
    }

    .chat-input-wrapper {
        padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
    }
}
