:root {
    /* Pastel Palette (Light Mode Default) */
    --bg-app: #f0f4f8;
    /* Soft blue-grey */
    --bg-card: #ffffff;
    --primary: #8ac6d1;
    /* Soft Teal */
    --primary-hover: #75b3bf;
    --accent: #ffb7b2;
    /* Pastel Red/Pink */
    --text-main: #2c3e50;
    --text-muted: #7f8c8d;
    --border-subtle: #e1e8ed;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    /* Soft teal to pink */
    --gradient-blue: linear-gradient(135deg, #e0c3fc 0%, #8ec5fc 100%);

    /* Spacing & Radius */
    --radius-lg: 20px;
    --radius-md: 12px;
    --radius-sm: 8px;
    /* Modal */
    --bg-modal: #ffffff;
    --text-input: #2c3e50;
    --bg-input: #ffffff;
}

/* Dark Mode Palette (Tokyo Night / Cute Space Vibe) */
body.dark-mode {
    --bg-app: #1a1b2e;
    /* Deep Navy/Purple */
    --bg-card: #24283b;
    /* Slightly lighter Navy */
    --primary: #bb9af7;
    /* Moonlight Purple */
    --primary-hover: #9d7cd8;
    --accent: #f7768e;
    /* Soft Red/Pink */
    --text-main: #c0caf5;
    /* Off-white / Starlight */
    --text-muted: #a9b1d6;
    /* Soft blue-grey text */
    --border-subtle: #414868;
    /* Muted Navy Border */

    /* Dark Gradients */
    --gradient-primary: linear-gradient(135deg, #2d1b4e 0%, #1a1b2e 100%);
    /* Deep Space Purple */
    --gradient-blue: linear-gradient(135deg, #7aa2f7 0%, #bb9af7 100%);
    /* Blue to Purple */

    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 5px 15px -10px rgba(0, 0, 0, 0.3);

    /* Modal Dark */
    --bg-modal: #1f2335;
    --text-input: #c0caf5;
    --bg-input: #1a1b2e;
}

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

body {
    font-family: 'Quicksand', sans-serif;
    /* Friendly, rounded font */
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    user-select: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

/* Title Bar */
#title-bar {
    height: 30px;
    -webkit-app-region: drag;
    display: flex;
    align-items: center;
    padding-left: 15px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

#app-container {
    height: calc(100vh - 30px);
    position: relative;
    overflow: hidden;
}

/* Views Management */
.view {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
    transform: scale(0.98);
    background: var(--bg-app);
    display: flex;
    flex-direction: column;
}

.view.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
    z-index: 10;
}

/* Onboarding */
#view-onboarding {
    background: var(--gradient-primary);
    /* Changed from simple align-items: center to support scrolling overflow */
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Allow scrolling */
}

.onboarding-content {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 60px 50px;
    /* More padding */
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    width: 700px;
    /* Much wider for better input space */
    text-align: center;
    backdrop-filter: blur(10px);
    z-index: 100;
    /* Ensure DEFINITELY above floating cars */
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    /* Spacing between elements */
    margin: auto;
    /* Centers in flex container but allows scroll */
    min-height: max-content;
    /* Ensure it takes height needed */
    margin-top: 40px;
    margin-bottom: 40px;
}

/* ... existing avatar styles ... */

.laifu-avatar-large {
    width: 90px;
    height: 90px;
    /* background: var(--primary); Removed for img */
    /* color: white; Removed for img */
    /* font-size: 36px; Removed for img */
    /* font-weight: bold; Removed for img */
    border-radius: 50%;
    display: block;
    /* changed from flex */
    /* align-items: center; */
    /* justify-content: center; */
    margin: 0 auto 25px;
    box-shadow: 0 4px 15px rgba(138, 198, 209, 0.4);
    object-fit: cover;
    /* Ensure image fits nicely */
}

.subtitle {
    font-size: 16px;
    /* Larger text */
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.6;
}

.instruction {
    font-size: 18px;
    /* Larger prompt */
    color: var(--text-main);
    margin-bottom: 25px;
    line-height: 1.5;
}

.onboard-step h2 {
    margin-bottom: 15px;
    color: var(--primary);
    font-size: 24px;
}

.onboard-step {
    display: none;
    animation: fadeIn 0.5s ease;
}

.onboard-step.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.floating-topics {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    /* Fly BEHIND UI elements */
    pointer-events: none;
}

.floating-topics span {
    position: absolute;
    white-space: nowrap;
    display: inline-block;
    padding: 8px 18px;
    background: var(--bg-card);
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    box-shadow: 0 4px 15px rgba(138, 198, 209, 0.3);
    opacity: 0.9;
    left: -150px;
    /* Start off-screen */
    animation: flyAcross linear infinite;
}

@keyframes flyAcross {
    0% {
        transform: translateX(0) rotate(-2deg);
    }

    50% {
        transform: translateX(60vw) rotate(3deg) translateY(15px);
    }

    100% {
        transform: translateX(120vw) rotate(-2deg);
    }
}

/* Flight Paths - Even Distribution for 24 items */
.floating-topics span:nth-child(1) {
    top: 2%;
    animation-duration: 25s;
    animation-delay: -0s;
}

.floating-topics span:nth-child(2) {
    top: 6%;
    animation-duration: 28s;
    animation-delay: -10s;
    opacity: 0.7;
}

.floating-topics span:nth-child(3) {
    top: 10%;
    animation-duration: 22s;
    animation-delay: -5s;
}

.floating-topics span:nth-child(4) {
    top: 14%;
    animation-duration: 30s;
    animation-delay: -15s;
    font-size: 16px;
    z-index: 2;
}

.floating-topics span:nth-child(5) {
    top: 18%;
    animation-duration: 26s;
    animation-delay: -8s;
    opacity: 0.6;
}

.floating-topics span:nth-child(6) {
    top: 22%;
    animation-duration: 20s;
    animation-delay: -2s;
}

.floating-topics span:nth-child(7) {
    top: 26%;
    animation-duration: 32s;
    animation-delay: -12s;
    font-size: 13px;
}

.floating-topics span:nth-child(8) {
    top: 30%;
    animation-duration: 24s;
    animation-delay: -18s;
}

.floating-topics span:nth-child(9) {
    top: 34%;
    animation-duration: 29s;
    animation-delay: -4s;
}

.floating-topics span:nth-child(10) {
    top: 38%;
    animation-duration: 21s;
    animation-delay: -9s;
    font-size: 11px;
}

.floating-topics span:nth-child(11) {
    top: 42%;
    animation-duration: 27s;
    animation-delay: -14s;
}

.floating-topics span:nth-child(12) {
    top: 46%;
    animation-duration: 23s;
    animation-delay: -1s;
}

.floating-topics span:nth-child(13) {
    top: 50%;
    animation-duration: 35s;
    animation-delay: -20s;
    opacity: 0.5;
}

.floating-topics span:nth-child(14) {
    top: 54%;
    animation-duration: 25s;
    animation-delay: -6s;
}

.floating-topics span:nth-child(15) {
    top: 58%;
    animation-duration: 31s;
    animation-delay: -11s;
    font-size: 15px;
}

.floating-topics span:nth-child(16) {
    top: 62%;
    animation-duration: 19s;
    animation-delay: -3s;
}

.floating-topics span:nth-child(17) {
    top: 66%;
    animation-duration: 33s;
    animation-delay: -16s;
}

.floating-topics span:nth-child(18) {
    top: 70%;
    animation-duration: 28s;
    animation-delay: -7s;
}

.floating-topics span:nth-child(19) {
    top: 74%;
    animation-duration: 22s;
    animation-delay: -13s;
}

.floating-topics span:nth-child(20) {
    top: 78%;
    animation-duration: 26s;
    animation-delay: -19s;
}

.floating-topics span:nth-child(21) {
    top: 82%;
    animation-duration: 20s;
    animation-delay: -5s;
}

.floating-topics span:nth-child(22) {
    top: 86%;
    animation-duration: 34s;
    animation-delay: -15s;
}

.floating-topics span:nth-child(23) {
    top: 90%;
    animation-duration: 24s;
    animation-delay: -8s;
}

.floating-topics span:nth-child(24) {
    top: 94%;
    animation-duration: 30s;
    animation-delay: -2s;
}

/* Inputs & Buttons */
input,
textarea {
    width: 100%;
    padding: 18px;
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 16px;
    margin-bottom: 25px;
    transition: all 0.2s;
    resize: none;
    background: var(--bg-input);
    color: var(--text-input);
}

textarea {
    min-height: 150px;
    /* Taller by default */
}

/* API Guide Grid */
.api-guide-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
    text-align: center;
}

.guide-card {
    background: var(--bg-app);
    padding: 15px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.2s;
}

.guide-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

.guide-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.guide-card h3 {
    font-size: 13px;
    color: var(--primary);
    margin-bottom: 5px;
    text-transform: uppercase;
    font-weight: 700;
}

.guide-card p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.link-highlight {
    color: var(--primary);
    font-weight: bold;
    text-decoration: none;
    border-bottom: 1px dashed var(--primary);
}

.link-highlight:hover {
    border-bottom-style: solid;
}

.safe-note {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 15px;
}

/* API Guide Grid */
/* ... (existing styles) ... */

/* Chat Toggle & New Buttons */
.btn-icon-toggle {
    background: #f0f4f8;
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    width: 40px;
    height: 48px;
    /* Match input height */
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    filter: grayscale(100%);
    opacity: 0.6;
}

.btn-icon-toggle:hover {
    background: #e1e8ed;
    opacity: 1;
}

.btn-icon-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
    filter: grayscale(0%);
    opacity: 1;
    box-shadow: 0 0 10px rgba(138, 198, 209, 0.5);
}

.small-header-btn {
    width: 24px;
    height: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
}

.small-header-btn:hover {
    color: var(--primary);
    background: transparent;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-secondary.small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-primary.small {
    padding: 8px 16px;
    font-size: 13px;
    width: auto;
}

/* Report Links */
.report-container a {
    color: #3498db;
    text-decoration: none;
    font-weight: 500;
}

.report-container a:hover {
    text-decoration: underline;
}

/* Ensure Guide Code Styling */
code {
    background: #eee;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
}

input:focus,
textarea:focus {
    border-color: var(--primary);
    outline: none;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    transition: transform 0.1s, opacity 0.2s;
}

button:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    width: 100%;
    box-shadow: 0 4px 12px rgba(138, 198, 209, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

/* Loading */
#view-loading {
    align-items: center;
    justify-content: center;
    background: var(--bg-app);
}

.laifu-avatar-bounce {
    width: 100px;
    height: 100px;
    /* background: var(--primary); */
    border-radius: 50%;
    margin-bottom: 20px;
    animation: bounce 1s infinite alternate;
    display: block;
    /* align-items: center; */
    /* justify-content: center; */
    /* color: white; */
    /* font-size: 40px; */
    object-fit: cover;
}

@keyframes bounce {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-10px);
    }
}

.progress-bar {
    width: 200px;
    height: 6px;
    background: #e1e8ed;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-fill {
    height: 100%;
    width: 30%;
    background: var(--primary);
    border-radius: 10px;
    animation: progressIndefinite 2s infinite linear;
}

@keyframes progressIndefinite {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(400%);
    }
}

/* Report View */
#view-report {
    background: var(--bg-card);
}

.top-nav {
    height: 60px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-subtle);
}

.date-badge {
    background: var(--bg-app);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.report-container {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    max-width: 1200px;
    /* Widened from 800px */
    width: 95%;
    /* Responsive width */
    margin: 0 auto;
    user-select: text;
    /* Enable text selection */
    cursor: text;
}

.report-container h1 {
    font-family: 'Outfit', sans-serif;
    color: var(--primary);
    margin-bottom: 20px;
}

.report-container p {
    line-height: 1.6;
    margin-bottom: 15px;
    color: var(--text-main);
    font-size: 16px;
}

/* Report Styling Enhancements */
.report-container h2 {
    background: var(--bg-card);
    padding: 15px 20px;
    border-left: 5px solid var(--primary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-top: 30px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    font-size: 22px;
    color: var(--text-main);
}

.report-container ul {
    margin-bottom: 25px;
    padding-left: 20px;
    list-style-type: none;
    /* Custom bullets */
}

.report-container li {
    position: relative;
    padding-left: 15px;
    margin-bottom: 10px;
    line-height: 1.5;
    color: var(--text-main);
}

.report-container li::before {
    content: "•";
    color: var(--accent);
    font-weight: bold;
    font-size: 20px;
    position: absolute;
    left: -10px;
    top: -5px;
}

.report-container a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px dotted var(--primary);
    transition: all 0.2s;
}

.report-container a:hover {
    background: rgba(138, 198, 209, 0.1);
    border-bottom-style: solid;
}

.report-container h3 {
    margin-top: 40px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 20px;
    color: var(--text-muted);
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Chat View */
#view-chat {
    flex-direction: row;
}

.chat-sidebar {
    width: 260px;
    background: var(--bg-app);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    font-weight: bold;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.chat-item {
    padding: 10px 15px;
    margin-bottom: 5px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    color: var(--text-main);
    transition: background 0.1s;
    white-space: nowrap;
    overflow: visible;
    /* Changed to allow dropdown */
    text-overflow: clip;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding-right: 5px;
}

.chat-item-title {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.chat-menu-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: bold;
    font-size: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    /* Hidden until hover */
    transition: opacity 0.2s;
    cursor: pointer;
}

.chat-item:hover .chat-menu-btn {
    opacity: 1;
}

.chat-menu-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: var(--text-main);
}

.chat-dropdown {
    position: absolute;
    right: 10px;
    top: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    display: none;
    flex-direction: column;
    min-width: 100px;
}

.chat-dropdown.active {
    display: flex;
}

.chat-dropdown button {
    background: none;
    border: none;
    text-align: left;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-main);
    width: 100%;
}

.chat-dropdown button:hover {
    background: var(--bg-app);
    color: var(--primary);
}

.chat-dropdown button.delete-btn:hover {
    color: #e74c3c;
    background: #fceceb;
}

.chat-item:hover {
    background: rgba(138, 198, 209, 0.1);
}

.chat-item.active {
    background: var(--primary);
    color: white;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 8px 15px;
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.btn-icon-small {
    background: none;
    font-size: 18px;
    padding: 5px;
    border-radius: 50%;
}

.btn-icon-small:hover {
    background: rgba(0, 0, 0, 0.05);
}


.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
}

.chat-header {
    height: 60px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
}

.laifu-status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.laifu-avatar-small {
    width: 32px;
    height: 32px;
    /* background: var(--primary); */
    border-radius: 50%;
    /* color: white; */
    display: block;
    /* align-items: center; */
    /* justify-content: center; */
    /* font-size: 12px; */
    object-fit: cover;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #2ecc71;
    border-radius: 50%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    max-width: 70%;
    line-height: 1.5;
    font-size: 15px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    padding: 12px 18px;
    border-radius: 18px 18px 0 18px;
}

.message.laifu {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-main);
    padding: 12px 18px;
    border-radius: 18px 18px 18px 0;
    border: 1px solid var(--border-subtle);
}

.chat-input-area {
    padding: 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

#chat-input {
    flex: 1;
    margin-bottom: 0;
    min-height: 48px;
    max-height: 120px;
    border-radius: 24px;
    padding: 14px 20px;
}

#btn-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(138, 198, 209, 0.4);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-modal);
    width: 600px;
    max-height: 90vh;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-modal);
}

.modal-header h2 {
    color: var(--primary);
    font-size: 20px;
    margin: 0;
}

.btn-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.btn-close:hover {
    color: var(--accent);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
    background: var(--bg-modal);
}

.modal-body label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-footer {
    padding: 20px 30px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-modal);
    text-align: right;
}

/* Custom Toggle Switch for Settings */
.settings-toggle-row {
    margin-top: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 0.2s;
}

.settings-toggle-row:hover {
    border-color: var(--primary);
}

.toggle-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--border-subtle);
    border-radius: 20px;
    transition: background 0.2s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input[type="checkbox"].hidden-toggle {
    display: none;
}

input[type="checkbox"].hidden-toggle:checked+.toggle-switch {
    background: var(--primary);
}

input[type="checkbox"].hidden-toggle:checked+.toggle-switch::after {
    transform: translateX(24px);
}

/* Boot Splash */
#boot-splash {
    position: fixed;
    top: 30px;
    /* Below title bar */
    left: 0;
    width: 100vw;
    height: calc(100vh - 30px);
    background: var(--bg-app);
    z-index: 9999;
    /* Topmost */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s ease-in-out, visibility 0.8s;
    opacity: 0;
    visibility: hidden;
}

#boot-splash.active {
    opacity: 1;
    visibility: visible;
}

#boot-splash.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* ========================================= */
/* MOBILE RESPONSIVENESS */
/* ========================================= */

/* Helper for mobile-only elements */
.mobile-only {
    display: none !important;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 90;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block !important;
        /* Force display on mobile */
    }

    /* Onboarding */
    .onboarding-content {
        width: 90%;
        padding: 30px 20px;
    }

    .api-guide-grid {
        grid-template-columns: 1fr;
    }

    /* Report View */
    .report-container {
        padding: 20px;
        width: 100%;
    }

    .top-nav {
        padding: 0 10px;
    }

    .top-nav h2 {
        font-size: 16px;
    }

    /* Chat View */
    #view-chat {
        position: relative;
    }

    /* Sidebar becomes a drawer */
    .chat-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
        width: 280px;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        border-right: none;
    }

    .chat-sidebar.mobile-open {
        transform: translateX(0);
    }

    /* Chat Main */
    .chat-main {
        width: 100%;
    }

    .chat-header {
        padding: 0 15px;
    }

    .laifu-status span {
        font-size: 14px;
    }

    .usage-counter {
        display: none;
        /* Hide on very small screens to save space, or make smaller */
    }

    .message {
        max-width: 85%;
    }

    /* Modals */
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-body {
        padding: 20px;
    }
}