/*
 * TutorLab
 * Typography: 19px base, 1.7 line-height, ~65ch max width
 * Font: Lora (serif)
 */

/* =====================
   ASCII Loading Animation
   ===================== */
#ascii-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #0a0a0a;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 1s cubic-bezier(0.4, 0, 0.2, 1);
}

#ascii-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

#ascii-output {
    margin: 0;
    padding: 0;
    font-family: 'Courier New', Courier, monospace;
    font-weight: normal;
    color: #fff;
    background: transparent;
    text-align: center;
    user-select: none;
    pointer-events: none;
}

/* Hide main content initially */
body.loading .container,
body.loading .ui {
    opacity: 0;
    pointer-events: none;
}

body:not(.loading) .container {
    animation: contentReveal 0.6s ease-out forwards;
}

body:not(.loading) .ui {
    opacity: 1;
}

@keyframes contentReveal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

:root {
    --ink: #111;
    --ink-soft: #555;
    --paper: #fff;
    --font-serif: 'Lora', Georgia, serif;
    --font-system: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html[data-theme="night"] {
    --ink: #efefef;
    --ink-soft: #888;
    --paper: #0a0a0a;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Focus Styles */
:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.ui a:focus-visible,
.ui button:focus-visible,
.footer-nav a:focus-visible,
.footer-nav button:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
    border-radius: 2px;
}

html {
    font-size: 118.75%; /* 19px */
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--ink);
    background: var(--paper);
    /* Prevent iOS overscroll bounce that causes flickering */
    overscroll-behavior-y: none;
}

::selection {
    background: var(--ink);
    color: var(--paper);
}

/* Container */
.container {
    max-width: 36rem;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* =====================
   Navigation
   ===================== */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 1.25rem 1.5rem;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.nav.scrolled {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

html[data-theme="night"] .nav.scrolled {
    background: rgba(10,10,10,0.95);
    box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}

.nav-inner {
    max-width: 72rem;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo {
    font-family: var(--font-system);
    font-size: 0.833rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink);
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-logo:hover {
    color: var(--ink-soft);
}

/* Desktop Nav Menu */
.nav-menu {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.nav-menu .nav-links {
    display: flex;
    align-items: center;
    gap: 1.75rem;
    margin: 0;
}

.nav-menu .nav-links a {
    font-family: var(--font-system);
    font-size: 0.833rem;
    color: var(--ink-soft);
    text-decoration: none;
    transition: color 0.25s ease;
    border: none;
    padding: 0.25rem 0;
    margin: 0;
    position: relative;
}

.nav-menu .nav-links a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 1px;
    background: var(--ink);
    transition: width 0.25s ease;
}

.nav-menu .nav-links a:hover {
    color: var(--ink);
}

.nav-menu .nav-links a:hover::after {
    width: 100%;
}

.nav-menu .nav-links a.active {
    color: var(--ink);
}

.nav-menu .nav-links a.active::after {
    width: 100%;
}

/* Nav Controls (Language + Theme) */
.nav-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1.5rem;
    border-left: 1px solid rgba(0,0,0,0.1);
}

html[data-theme="night"] .nav-controls {
    border-left-color: rgba(255,255,255,0.1);
}

.nav-lang {
    font-family: var(--font-system);
    font-size: 0.778rem;
}

.nav-lang a {
    color: var(--ink-soft);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
    padding: 0.2rem 0.1rem;
}

.nav-lang a:hover {
    color: var(--ink);
}

.nav-lang a.active {
    color: var(--ink);
    font-weight: 500;
}

.nav-lang .sep {
    color: var(--ink-soft);
    opacity: 0.35;
    margin: 0 0.25rem;
    user-select: none;
}

.nav-theme {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--ink-soft);
    cursor: pointer;
    padding: 0.3rem;
    transition: color 0.2s ease, transform 0.3s ease;
    line-height: 1;
}

.nav-theme:hover {
    color: var(--ink);
    transform: rotate(20deg);
}

/* Nav focus states */
.nav-logo:focus-visible,
.nav-menu .nav-links a:focus-visible,
.nav-lang a:focus-visible,
.nav-theme:focus-visible,
.nav-toggle:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
    border-radius: 2px;
}

/* Hamburger Toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 24px;
    height: 24px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.nav-toggle-line {
    display: block;
    width: 100%;
    height: 1.5px;
    background: var(--ink);
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:first-child {
    transform: translateY(3.25px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:last-child {
    transform: translateY(-3.25px) rotate(-45deg);
}

/* Hide nav during loading */
body.loading .nav {
    opacity: 0;
    pointer-events: none;
}

body:not(.loading) .nav {
    opacity: 1;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mobile Navigation */
@media (max-width: 1100px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        width: min(320px, 85vw);
        height: 100vh;
        height: 100dvh;
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        gap: 0;
        padding: 5rem 2rem 2rem;
        background: var(--paper);
        box-shadow: -4px 0 30px rgba(0,0,0,0.1);
        transform: translateX(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        z-index: 1000;
    }

    html[data-theme="night"] .nav-menu {
        box-shadow: -4px 0 30px rgba(0,0,0,0.5);
    }

    .nav-menu.open {
        transform: translateX(0);
    }

    .nav-menu .nav-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        width: 100%;
    }

    .nav-menu .nav-links a {
        font-size: 1.1rem;
        padding: 1rem 0;
        width: 100%;
        border-bottom: 1px solid rgba(0,0,0,0.06);
    }

    .nav-menu .nav-links a::after {
        display: none;
    }

    html[data-theme="night"] .nav-menu .nav-links a {
        border-bottom-color: rgba(255,255,255,0.08);
    }

    .nav-menu .nav-links a:last-child {
        border-bottom: none;
    }

    .nav-controls {
        margin-top: auto;
        padding-left: 0;
        padding-top: 1.5rem;
        padding-bottom: 1rem;
        border-left: none;
        border-top: 1px solid rgba(0,0,0,0.1);
        width: 100%;
        justify-content: space-between;
    }

    html[data-theme="night"] .nav-controls {
        border-top-color: rgba(255,255,255,0.1);
    }

    .nav-lang {
        font-size: 0.95rem;
    }

    .nav-theme {
        font-size: 1.25rem;
    }
}

/* Nav overlay for mobile */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 999;
}

.nav-overlay.visible {
    opacity: 1;
    visibility: visible;
}

html[data-theme="night"] .nav-overlay {
    background: rgba(0,0,0,0.6);
}

/* Site Name */
.site-name {
    font-family: var(--font-system);
    font-size: 0.778rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 2rem;
}

/* Hero Header */
header.hero {
    padding: 7rem 0 5rem;
    min-height: 70vh;
    min-height: 70svh;
    display: flex;
    align-items: center;
}

/* Page Header */
header.page {
    padding: 6rem 0 3rem;
}

.back {
    display: inline-block;
    font-family: var(--font-system);
    font-size: 0.833rem;
    color: var(--ink-soft);
    text-decoration: none;
    margin-bottom: 2rem;
    transition: color 0.2s;
}

.back:hover {
    color: var(--ink);
}

/* Headings */
h1 {
    font-size: clamp(1.9rem, 5.5vw, 2.75rem);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 1.25rem;
    text-wrap: balance;
}

header.page h1 {
    font-size: clamp(1.6rem, 4.5vw, 2rem);
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 1rem;
    letter-spacing: 0.005em;
}

h3 {
    font-size: 1rem;
    font-weight: 500;
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
}

h3:first-child {
    margin-top: 0;
}

/* Text */
.lead {
    font-size: 1.1rem;
    color: var(--ink-soft);
    letter-spacing: 0.005em;
}

.subtitle {
    color: var(--ink-soft);
    font-size: 1rem;
}

p {
    margin-bottom: 1.1rem;
}

p:last-child {
    margin-bottom: 0;
}

.muted {
    color: var(--ink-soft);
}

em {
    font-style: italic;
}

/* Table of Contents */
.toc {
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(17,17,17,0.1);
}

html[data-theme="night"] .toc {
    border-bottom-color: rgba(239,239,239,0.1);
}

.toc p {
    font-family: var(--font-system);
    font-size: 0.9rem;
    color: var(--ink-soft);
    margin: 0;
}

.toc a {
    color: var(--ink-soft);
    text-decoration: none;
    transition: color 0.2s;
}

.toc a:hover {
    color: var(--ink);
}

/* Scroll offset for anchor links (accounts for fixed nav) */
section[id],
h2[id],
h3[id] {
    scroll-margin-top: 5rem;
}

/* Back to Top Link */
.back-to-top {
    margin-top: 2rem;
    font-family: var(--font-system);
    font-size: 0.85rem;
}

.back-to-top a {
    color: var(--ink-soft);
    text-decoration: none;
    transition: color 0.2s;
}

.back-to-top a:hover {
    color: var(--ink);
}

/* Mobile Next Page Navigation */
.mobile-next {
    display: none;
    text-align: center;
    padding: 2rem 0;
    margin-top: 2rem;
    border-top: 1px solid rgba(17,17,17,0.1);
}

html[data-theme="night"] .mobile-next {
    border-top-color: rgba(239,239,239,0.1);
}

.mobile-next a {
    font-family: var(--font-system);
    font-size: 1rem;
    color: var(--ink);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--ink);
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
}

.mobile-next a:hover {
    background-color: var(--ink);
    color: var(--paper);
}

@media (max-width: 600px) {
    .mobile-next {
        display: block;
    }
}

/* Main */
main {
    padding-bottom: 5rem;
}

section {
    margin-bottom: 4rem;
}

/* Details List */
dl {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0.3rem 1rem;
    margin-top: 1.25rem;
    font-size: 0.95rem;
}

dt {
    color: var(--ink-soft);
}

dl + p {
    margin-top: 2.5rem;
}

/* Links */
.email {
    display: inline-block;
    margin-top: 0.35rem;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--ink-soft);
    transition: border-color 0.2s;
}

.email:hover {
    border-color: var(--ink);
}

.text-link {
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px solid var(--ink-soft);
    transition: color 0.2s, border-color 0.2s;
}

.text-link:hover {
    color: var(--ink);
    border-color: var(--ink);
}

/* Posts (Field Notes) */
.post {
    padding: 2.25rem 0;
    border-top: 1px solid rgba(17,17,17,0.1);
}

html[data-theme="night"] .post {
    border-top-color: rgba(239,239,239,0.1);
}

.post:first-child {
    border-top: none;
    padding-top: 0;
}

.post-date {
    font-family: var(--font-system);
    font-size: 0.778rem;
    color: var(--ink-soft);
    margin-bottom: 0.6rem;
    letter-spacing: 0.02em;
}

.post-title {
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 0.85rem;
}

.post p {
    margin-bottom: 1.1rem;
}

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

/* Field Notes: Expandable Cards */
.field-notes .post {
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin: 0 -1rem;
    padding: 2.25rem 1rem;
    border-radius: 4px;
}

.field-notes .post:first-child {
    padding-top: 1.5rem;
}

.field-notes .post:hover {
    background-color: rgba(17,17,17,0.02);
}

html[data-theme="night"] .field-notes .post:hover {
    background-color: rgba(239,239,239,0.02);
}

.field-notes .post-title {
    margin-bottom: 0;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.field-notes .post-title::after {
    content: '+';
    font-family: var(--font-system);
    font-weight: 300;
    font-size: 1.25rem;
    color: var(--ink-soft);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.field-notes .post.expanded .post-title::after {
    content: '−';
}

.field-notes .post-content {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s ease;
}

.field-notes .post.expanded .post-content {
    grid-template-rows: 1fr;
}

.field-notes .post-content > div {
    overflow: hidden;
}

.field-notes .post-content p {
    padding-top: 1rem;
    margin-bottom: 0;
}

/* View Transitions */
@supports (view-transition-name: none) {
    .field-notes .post {
        view-transition-name: var(--post-id);
    }

    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: 0.25s;
    }
}

/* Faster animation on mobile */
@media (max-width: 600px) {
    .field-notes .post-content {
        transition: grid-template-rows 0.2s ease;
    }

    .field-notes .post-title::after {
        transition: transform 0.2s ease;
    }
}

@media (prefers-reduced-motion: reduce) {
    .field-notes .post-content {
        transition: none;
    }
}

/* Inline links in body text */
main p a:not(.email) {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--ink-soft);
    text-underline-offset: 0.15em;
    transition: text-decoration-color 0.2s;
}

main p a:not(.email):hover {
    text-decoration-color: var(--ink);
}

/* Footer */
footer {
    padding: 3rem 0 2rem;
    text-align: center;
    font-family: var(--font-system);
    font-size: 0.833rem;
    color: var(--ink-soft);
}

.footer-contact {
    margin-bottom: 0.75rem;
}

.footer-contact a {
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--ink-soft);
    transition: border-color 0.2s;
}

.footer-contact a:hover {
    border-color: var(--ink);
}

.footer-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.footer-controls .sep {
    opacity: 0.3;
}

.footer-lang {
    display: inline-flex;
    align-items: center;
}

.footer-lang a {
    color: var(--ink-soft);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    padding: 0.15rem 0.1rem;
}

.footer-lang a:hover {
    color: var(--ink);
}

.footer-lang a.active {
    color: var(--ink);
    font-weight: 500;
}

.footer-lang .sep {
    opacity: 0.35;
    margin: 0 0.2rem;
}

.footer-theme {
    background: none;
    border: none;
    font-size: 1rem;
    color: var(--ink-soft);
    cursor: pointer;
    padding: 0.15rem;
    transition: color 0.2s ease, transform 0.3s ease;
    line-height: 1;
}

.footer-theme:hover {
    color: var(--ink);
    transform: rotate(20deg);
}

.footer-copy {
    opacity: 0.7;
}

.footer-nav {
    margin-bottom: 0.75rem;
}

.footer-nav a {
    color: var(--ink-soft);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.footer-nav a:hover, .footer-nav a.active,
.footer-nav button:hover {
    color: var(--ink);
}

.footer-nav button {
    background: none;
    border: none;
    font: inherit;
    color: var(--ink-soft);
    cursor: pointer;
    padding: 0;
    transition: color 0.2s;
}

.footer-nav .sep {
    opacity: 0.4;
    margin: 0 0.35rem;
}

footer a {
    color: var(--ink-soft);
    text-decoration: none;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--ink);
}

/* Language Switching */
/* Only hide elements when their language doesn't match */
html:not([lang="de"]) [data-de] { display: none; }
html[lang="de"] [data-en] { display: none; }

/* Responsive */
@media (max-width: 600px) {
    html { font-size: 112.5%; }
    .container { padding: 0 1.25rem; }

    .nav {
        padding: 1rem 1.25rem;
    }

    header.hero {
        padding: 5rem 0 3rem;
        min-height: auto;
    }

    header.page {
        padding: 5rem 0 2rem;
    }

    h1 { font-size: 1.7rem; }
    header.page h1 { font-size: 1.5rem; }
    section { margin-bottom: 3rem; }

    dl {
        grid-template-columns: 1fr;
        gap: 0.15rem;
        margin-top: 0.85rem;
    }

    dt { margin-top: 0.5rem; }
    dt:first-child { margin-top: 0; }
    html[lang="de"] dt[data-de]:nth-of-type(2) { margin-top: 0; }

    .post { padding: 1.75rem 0; }

    .site-name {
        margin-bottom: 1.5rem;
    }
}

@media (max-width: 360px) {
    h1 { font-size: 1.5rem; }
    header.page h1 { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .nav, .nav-menu, .nav-overlay, .nav-toggle-line { transition: none; }
}

@media print {
    .nav, .footer-nav { display: none; }
}

/* =====================
   Chat Interface (Explore)
   ===================== */
.chat-container {
    margin-bottom: 2rem;
}

.chat-intro {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(17,17,17,0.1);
}

html[data-theme="night"] .chat-intro {
    border-bottom-color: rgba(239,239,239,0.1);
}

.chat-messages {
    min-height: 200px;
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 1.5rem;
    scroll-behavior: smooth;
}

.chat-message {
    margin-bottom: 1.25rem;
    animation: messageIn 0.3s ease-out;
}

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

.chat-message-tutor {
    padding-right: 2rem;
}

.chat-message-user {
    padding-left: 2rem;
    text-align: right;
}

.chat-message-label {
    font-family: var(--font-system);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    margin-bottom: 0.35rem;
}

.chat-message-content {
    line-height: 1.65;
}

.chat-message-user .chat-message-content {
    display: inline-block;
    text-align: left;
    background: rgba(17,17,17,0.04);
    padding: 0.75rem 1rem;
    border-radius: 4px;
}

html[data-theme="night"] .chat-message-user .chat-message-content {
    background: rgba(239,239,239,0.06);
}

/* Chat Input */
.chat-input-container {
    position: sticky;
    bottom: 0;
    background: var(--paper);
    padding-top: 1rem;
}

.chat-form {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    background: transparent;
    border: 1px solid rgba(17,17,17,0.2);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    resize: none;
    min-height: 2.75rem;
    max-height: 8rem;
    transition: border-color 0.2s;
}

html[data-theme="night"] .chat-input {
    border-color: rgba(239,239,239,0.2);
}

.chat-input:focus {
    outline: none;
    border-color: var(--ink);
}

.chat-input::placeholder {
    color: var(--ink-soft);
    opacity: 0.6;
}

.chat-submit {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    color: var(--paper);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

.chat-submit:hover {
    opacity: 0.85;
}

.chat-submit:active {
    transform: scale(0.96);
}

.chat-submit:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.chat-submit-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.chat-hint {
    font-family: var(--font-system);
    font-size: 0.75rem;
    color: var(--ink-soft);
    margin-top: 0.5rem;
    opacity: 0.7;
}

/* Loading indicator */
.chat-loading {
    display: flex;
    gap: 0.3rem;
    padding: 0.5rem 0;
}

.chat-loading-dot {
    width: 6px;
    height: 6px;
    background: var(--ink-soft);
    border-radius: 50%;
    animation: loadingPulse 1.2s ease-in-out infinite;
}

.chat-loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes loadingPulse {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Error state */
.chat-error {
    color: #c0392b;
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
    background: rgba(192, 57, 43, 0.08);
    border-radius: 4px;
    margin-bottom: 1rem;
}

html[data-theme="night"] .chat-error {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .chat-message-tutor {
        padding-right: 1rem;
    }

    .chat-message-user {
        padding-left: 1rem;
    }

    .chat-messages {
        max-height: 50vh;
    }
}
