/* ==========================================================================
   1. CSS Custom Properties (Design Tokens)
   ========================================================================== */

:root {
    --color-teal: #0d9488;
    --color-teal-light: #14b8a6;
    --color-teal-dark: #0f766e;
    --color-orange: #f97316;
    --color-orange-light: #fb923c;
    --color-orange-dark: #ea580c;
    --color-bg-primary: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-bg-tertiary: #334155;
    --color-bg-card: #1e293b;
    --color-bg-card-hover: #253348;
    --color-text-primary: #f1f5f9;
    --color-text-secondary: #94a3b8;
    --color-text-muted: #64748b;
    --color-border: #334155;
    --color-border-light: #475569;
    --font-family-base: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.75rem;
    --border-radius-lg: 1rem;
    --transition-base: all 0.2s ease-in-out;
    --transition-slow: all 0.3s ease-in-out;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --shadow-glow-teal: 0 0 20px rgba(13, 148, 136, 0.3);
    --shadow-glow-orange: 0 0 20px rgba(249, 115, 22, 0.3);
}

/* ==========================================================================
   2. Base
   ========================================================================== */

html {
    position: relative;
    min-height: 100%;
}

body {
    font-family: var(--font-family-base);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--color-teal-light);
    transition: var(--transition-base);
}

a:hover {
    color: var(--color-teal);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-text-primary);
    font-weight: 700;
}

main.app-main {
    min-height: calc(100vh - 280px);
    padding-top: 5.2rem;
}

section {
    padding: clamp(3rem, 5vw, 5rem) 0;
}

/* ==========================================================================
   3. Buttons (marketing-site parity)
   ========================================================================== */

.btn-accent-teal { background-color: var(--color-teal); border-color: var(--color-teal); color: #fff; }
.btn-accent-teal:hover { background-color: var(--color-teal-light); border-color: var(--color-teal-light); }
.btn-accent-orange {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
    border: none;
    transition: transform 0.1s, box-shadow 0.2s;
}
.btn-accent-orange:hover {
    background: linear-gradient(135deg, #ea580c, #c2410c);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}
.btn-outline-light { border-color: var(--color-border-light); color: var(--color-text-primary); }
.btn-outline-light:hover { background-color: var(--color-bg-tertiary); }

.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: var(--transition-base);
}

/* ==========================================================================
   4. Navbar (App Top Nav)
   ========================================================================== */

.app-navbar {
    background: #1a1a2e;
    border-bottom: 1px solid #2a2a4a;
    padding: 0.5rem 0;
    z-index: 1030;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: var(--transition-slow);
}

.app-navbar.navbar-scrolled {
    background: rgba(26, 26, 46, 0.98);
    box-shadow: var(--shadow-md);
}

.brand-logo {
    height: 28px;
    width: auto;
}

.navbar-toggler {
    border: none;
    padding: 0.25rem 0.5rem;
    color: var(--color-text-secondary);
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-toggler .bi-list {
    font-size: 1.75rem;
}

.app-navbar-top-row {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

.guest-auth-actions {
    margin-left: auto;
    margin-right: 0.75rem;
}

.guest-auth-actions .btn {
    font-size: 0.95rem;
    line-height: 1.2;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    white-space: nowrap;
}

.guest-auth-actions__login {
    border-color: rgba(241, 245, 249, 0.65);
    color: #f1f5f9;
}

.guest-auth-actions__login:hover,
.guest-auth-actions__login:focus {
    border-color: #f1f5f9;
    color: #f8fafc;
    background: rgba(255, 255, 255, 0.08);
}

.guest-auth-actions__signup {
    background-color: #00c9a7;
    border-color: #00c9a7;
    color: #062824;
    box-shadow: 0 0 18px rgba(0, 201, 167, 0.35);
}

.guest-auth-actions__signup:hover,
.guest-auth-actions__signup:focus {
    background-color: #21d8b8;
    border-color: #21d8b8;
    color: #05211d;
    box-shadow: 0 0 22px rgba(0, 201, 167, 0.5);
}

.app-navbar .nav-link {
    color: #c4c7d4;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    transition: color 0.2s, border-color 0.2s;
    border-bottom: 3px solid transparent;
}

.app-navbar .nav-link:hover {
    color: #00d4aa;
}

.app-navbar .nav-link.active {
    color: #00d4aa;
    border-bottom: 3px solid #00d4aa;
}

.nav-icon {
    font-size: 1.1rem;
    margin-right: 0.35rem;
    color: #8b8fa3;
    transition: color 0.2s;
}

/* Moonshine branded icon system */
.msh-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.1em;
    background-image: url('/images/moonshine/moonshine-icon-flat.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.msh-icon-sm { width: 16px; height: 16px; }
.msh-icon-md { width: 24px; height: 24px; }
.msh-icon-lg { width: 32px; height: 32px; }
.msh-icon-xl { width: 48px; height: 48px; }

.msh-icon-card {
    display: inline-block;
    width: 32px;
    height: 32px;
    background-image: url('/images/moonshine/moonshine-icon-jar-64.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.msh-icon-token {
    display: inline-block;
    width: 48px;
    height: 48px;
    background-image: url('/images/moonshine/moonshine-token-coin.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}

.msh-inline-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.app-navbar .nav-link:hover .nav-icon,
.app-navbar .nav-link.active .nav-icon {
    color: #00d4aa;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #2a2a4a;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.2rem;
}

.user-avatar-initials {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1;
}

.user-menu-trigger {
    display: inline-flex !important;
    align-items: center;
    gap: 0.5rem;
    border-bottom: none !important;
}

.user-menu-name {
    color: #c4c7d4;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.user-menu-trigger:hover .user-menu-name,
.user-menu-trigger:focus .user-menu-name {
    color: #00d4aa;
}

.user-menu-chevron {
    font-size: 0.7rem;
    color: #8b8fa3;
}

.user-menu-nav .dropdown-menu {
    background: #1e1e3a;
    border: 1px solid #2a2a4a;
    box-shadow: var(--shadow-md);
    min-width: 220px;
    border-radius: 8px;
    margin-top: 0.45rem;
    transform-origin: top right;
}

.user-menu-nav .dropdown-menu.show {
    animation: user-dropdown-fade-in 0.15s ease;
}

@keyframes user-dropdown-fade-in {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-dropdown-header {
    padding: 0.75rem 1rem 0.6rem;
}

.user-dropdown-name {
    color: #e0e0e0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
}

.user-dropdown-email {
    color: #8b8fa3;
    font-size: 0.78rem;
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item {
    color: var(--color-text-primary);
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.dropdown-item i {
    width: 1rem;
    color: #8b8fa3;
}

.dropdown-item:hover,
.dropdown-item:focus {
    color: #00d4aa;
    background: rgba(0, 212, 170, 0.08);
}

.dropdown-item:hover i,
.dropdown-item:focus i {
    color: #00d4aa;
}

.dropdown-divider {
    border-color: #2a2a4a;
}

.user-dropdown-moonshine {
    padding: 0.5rem 1rem 0.7rem;
    color: #8b8fa3;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.user-dropdown-moonshine i {
    color: #00d4aa;
}

.user-dropdown-moonshine strong {
    color: #00d4aa;
    font-weight: 600;
}

.mobile-user-header {
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    background: #1e1e3a;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.75rem;
}

.mobile-user-header__name {
    color: #e0e0e0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
}

.mobile-user-header__email {
    color: #8b8fa3;
    font-size: 0.78rem;
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-user-actions {
    margin-top: 0.9rem;
    border-top: 1px solid #2a2a4a;
    padding-top: 0.75rem;
}

/* Dropdown toggle arrow removal */
.user-menu-nav .dropdown-toggle::after {
    display: none;
}

/* ==========================================================================
   5. Hero + Landing
   ========================================================================== */

.hero-section {
    background: radial-gradient(ellipse at center, var(--color-bg-secondary) 0%, var(--color-bg-primary) 70%);
    text-align: center;
    min-height: 70vh;
    display: flex;
    align-items: center;
}

.hero-section__headline {
    font-size: clamp(2.25rem, 5vw, 3.75rem);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.hero-section__subheadline {
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    color: var(--color-text-secondary);
    max-width: 720px;
    margin: 0 auto 0.75rem;
}

.hero-tagline {
    font-style: italic;
    color: var(--color-text-secondary);
    font-size: clamp(1rem, 2.6vw, 1.15rem);
    overflow: hidden;
    opacity: 0;
    animation: tagline-reveal 1.2s ease-out 0.8s forwards;
    margin-bottom: 2rem;
}

.hero-tagline .highlight-teal {
    background: linear-gradient(135deg, var(--color-teal-light), var(--color-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    font-style: normal;
}

.hero-tagline .highlight-orange {
    background: linear-gradient(135deg, var(--color-orange-light), var(--color-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    font-style: normal;
}

.hero-tagline .highlight-teal,
.hero-tagline .highlight-orange {
    animation: subtle-glow 3s ease-in-out infinite alternate;
    animation-delay: 2s;
}

.hero-tagline .highlight-orange {
    animation-name: subtle-glow-orange;
}

@keyframes tagline-reveal {
    0% {
        opacity: 0;
        transform: translateY(20px);
        filter: blur(8px);
    }
    50% {
        opacity: 0.7;
        filter: blur(2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes subtle-glow {
    0% {
        filter: drop-shadow(0 0 0 transparent);
    }
    100% {
        filter: drop-shadow(0 0 6px rgba(13, 148, 136, 0.4));
    }
}

@keyframes subtle-glow-orange {
    0% {
        filter: drop-shadow(0 0 0 transparent);
    }
    100% {
        filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.4));
    }
}

.hero-section__actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.text-accent-teal,
.text-teal {
    color: var(--color-teal-light) !important;
}

.text-accent-orange {
    color: var(--color-orange-light) !important;
}

.stats-strip {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.stats-strip__item {
    min-width: 170px;
}

.stats-strip__number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-teal-light);
}

.stats-strip__label {
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    transition: var(--transition-slow);
}

.card:hover {
    background: var(--color-bg-card-hover);
    border-color: var(--color-border-light);
}

.feature-icon {
    font-size: 2.5rem;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
}

.feature-list li {
    position: relative;
    padding-left: 1.4rem;
    margin-bottom: 0.75rem;
    color: var(--color-text-secondary);
}

.feature-list li::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-teal);
    left: 0;
    top: 0.62rem;
}

.code-block {
    background: #0b1120;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    color: var(--color-text-secondary);
}

.pricing-card.featured {
    border-color: var(--color-teal);
    box-shadow: var(--shadow-glow-teal);
}

.pricing-price {
    color: var(--color-teal-light);
    font-size: 2.25rem;
    font-weight: 800;
}

/* ==========================================================================
   6. Dashboard
   ========================================================================== */

.dashboard-page .section-header {
    border-left: 4px solid var(--color-teal);
    padding-left: 0.75rem;
}

.section-header {
    border-left: 4px solid var(--color-teal);
    padding-left: 0.75rem;
}

.dashboard-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    transition: var(--transition-base);
}

.dashboard-card:hover {
    background: var(--color-bg-card-hover);
    box-shadow: var(--shadow-glow-teal);
}

.dashboard-stat {
    padding: 1.25rem;
    text-align: center;
}

.dashboard-stat .value {
    color: var(--color-teal-light);
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
}

.dashboard-stat .label {
    color: var(--color-text-muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.table {
    color: var(--color-text-primary);
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
    border-color: var(--color-border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.78rem;
}

.table tbody td {
    background-color: var(--color-bg-primary);
    border-color: var(--color-border);
    color: var(--color-text-secondary);
}

.table tbody tr:nth-child(even) td {
    background-color: var(--color-bg-secondary);
}

.table-hover tbody tr:hover td {
    background-color: var(--color-bg-card-hover);
}

.badge-online {
    background-color: rgba(34, 197, 94, 0.18) !important;
    color: #86efac !important;
}

.badge-offline {
    background-color: rgba(239, 68, 68, 0.18) !important;
    color: #fca5a5 !important;
}

.badge-busy {
    background-color: rgba(250, 204, 21, 0.2) !important;
    color: #fde68a !important;
}

.empty-state {
    text-align: center;
    color: var(--color-text-muted);
    padding: 2.5rem 1rem;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.7;
}

.alert {
    border-radius: var(--border-radius-sm);
}

.alert-info {
    color: var(--color-text-primary);
    border-color: var(--color-teal);
    background-color: rgba(13, 148, 136, 0.12);
}

.alert-warning {
    color: var(--color-text-primary);
    border-color: var(--color-orange);
    background-color: rgba(249, 115, 22, 0.12);
}

.form-control,
.form-select {
    background-color: var(--color-bg-primary);
    border-color: var(--color-border);
    color: var(--color-text-primary);
}

.form-control:focus,
.form-select:focus {
    background-color: var(--color-bg-primary);
    border-color: var(--color-teal);
    box-shadow: 0 0 0 0.2rem rgba(13, 148, 136, 0.25);
    color: var(--color-text-primary);
}

.modal-content {
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
}

.modal-header,
.modal-footer {
    border-color: var(--color-border);
}

/* ==========================================================================
   7. Footer
   ========================================================================== */

.site-footer {
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    padding: 3rem 0 0;
}

.footer-logo-link {
    display: inline-block;
    opacity: 0.9;
}

.footer-logo-link:hover {
    opacity: 1;
}

.footer-text {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.footer-text a {
    color: var(--color-text-secondary);
    text-decoration: none;
}

.footer-text a:hover {
    color: var(--color-teal-light);
}

.footer-nav {
    list-style: none;
    padding: 0;
}

.footer-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
}

.footer-nav a:hover {
    color: var(--color-teal-light);
}

.footer-heading {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

.footer-social {
    display: flex;
    gap: 1rem;
}

.footer-social a {
    color: var(--color-text-muted);
}

.footer-social a:hover {
    color: var(--color-teal-light);
}

.footer-social img {
    display: block;
    opacity: 0.9;
}

.footer-bottom {
    border-top: 1px solid var(--color-border);
    margin-top: 2rem;
    padding: 1.25rem 0;
    text-align: center;
}

.footer-bottom p {
    color: var(--color-text-muted);
    font-size: 0.85rem;
    margin: 0;
}

.footer-bottom a {
    color: var(--color-text-secondary);
    text-decoration: none;
}

.footer-tagline {
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 0.25rem !important;
}

/* ==========================================================================
   8. Playground
   ========================================================================== */

.playground-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100dvh - 5.2rem);
    height: calc(100dvh - 5.2rem);
    max-width: 920px;
    margin: 0 auto;
    padding: 1rem;
}

/* ── Tabs ── */

.playground-tabs {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.playground-tabs .sub-tab {
    padding: 0.45rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid var(--color-border);
    border-bottom: none;
    border-radius: var(--border-radius-sm) var(--border-radius-sm) 0 0;
    background: var(--color-bg-secondary);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: var(--transition-base);
}

.playground-tabs .sub-tab:hover {
    color: var(--color-text-primary);
    background: var(--color-bg-tertiary);
}

.playground-tabs .sub-tab.active {
    background: var(--color-bg-card);
    color: var(--color-teal-light);
    border-color: var(--color-teal);
    border-bottom: 1px solid var(--color-bg-card);
    position: relative;
    z-index: 1;
}

/* ── Panels ── */

.playground-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.playground-panel.active {
    display: flex;
}

/* ── Controls ── */

.playground-controls {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    margin-bottom: 0.5rem;
}

.playground-controls .control-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.playground-controls .control-group--model {
    flex: 1;
    min-width: 180px;
}

.playground-controls .control-group--actions {
    margin-left: auto;
}

.playground-controls label {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.playground-controls .form-range {
    width: 110px;
}

.playground-controls input[type="number"] {
    width: 90px;
}

.playground-config-collapse {
    margin-bottom: 0.5rem;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    overflow: hidden;
}

.playground-config-collapse summary {
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    user-select: none;
    display: flex;
    align-items: center;
}

.playground-config-collapse summary:hover {
    color: var(--color-text-primary);
}

.playground-config-collapse[open] summary {
    border-bottom: 1px solid var(--color-border);
}

.playground-config-collapse .playground-config {
    margin-bottom: 0;
    border: none;
    border-radius: 0;
}

.playground-config-collapse summary::-webkit-details-marker,
.playground-config-collapse summary::marker {
    color: #64748b;
}

.config-collapse-hint {
    display: none;
    margin-left: 8px;
    font-size: 0.8em;
    opacity: 0.7;
}

.playground-value-badge {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-teal-light);
    background: rgba(13, 148, 136, 0.12);
    padding: 0.15rem 0.45rem;
    border-radius: var(--border-radius-sm);
    min-width: 2rem;
    text-align: center;
}

/* ── System prompt (chat) ── */

.playground-system-prompt {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.playground-system-prompt summary {
    cursor: pointer;
    padding: 0.35rem 0;
    user-select: none;
}

.playground-system-prompt textarea {
    font-size: 0.875rem;
    resize: vertical;
}

/* ── Connection status ── */

.playground-connection-status {
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    transition: opacity 0.3s ease;
}

.status-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-icon {
    flex-shrink: 0;
    width: 1.2em;
    text-align: center;
}

.status-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-spacer {
    flex: 1;
}

.status-timer {
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
    min-width: 3em;
    text-align: right;
}

.playground-stop-btn {
    background: #dc2626;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 2px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-left: 0.5rem;
    flex-shrink: 0;
}

.playground-stop-btn:hover {
    background: #b91c1c;
}

.playground-connection-status--info {
    background: rgba(13, 148, 136, 0.1);
    color: var(--color-teal-light);
    border: 1px solid rgba(13, 148, 136, 0.25);
}

.playground-connection-status--success {
    background: rgba(34, 197, 94, 0.1);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.playground-connection-status--error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.playground-download-toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1080;
    padding: 0.45rem 0.7rem;
    border-radius: 10px;
    border: 1px solid rgba(0, 212, 170, 0.35);
    background: rgba(26, 26, 46, 0.94);
    color: #99f6e4;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.playground-download-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ── Messages (chat + generate output) ── */

.playground-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--color-bg-primary);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    margin-bottom: 0.5rem;
}

.playground-empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--color-text-muted);
}

.playground-empty-state__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.9rem;
    color: #00d4aa;
    filter: drop-shadow(0 0 10px rgba(0, 212, 170, 0.35));
    opacity: 0.95;
}

.playground-empty-state__icon svg {
    width: 100%;
    height: 100%;
}

.pg-message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    max-width: 88%;
}

.pg-message--user {
    margin-left: auto;
    flex-direction: row-reverse;
}

.pg-message-avatar {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
}

.pg-message-avatar svg {
    width: 22px;
    height: 22px;
}

.pg-message--assistant .pg-message-avatar {
    color: #00d4aa;
    filter: drop-shadow(0 0 8px rgba(0, 212, 170, 0.25));
}

.pg-message-content {
    position: relative;
    padding: 0.65rem 1rem;
    border-radius: var(--border-radius-md);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 0.925rem;
}

.pg-message--user .pg-message-content {
    background: var(--color-teal);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.pg-message--assistant .pg-message-content {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-bottom-left-radius: 4px;
    padding-right: 2.6rem;
    padding-top: 0.9rem;
}

.pg-message-actions {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    opacity: 0.7;
    transition: opacity 0.15s ease-in-out, transform 0.15s ease-in-out;
    transform: translateY(-1px);
}

.pg-message--assistant:hover .pg-message-actions,
.pg-message--assistant:focus-within .pg-message-actions {
    opacity: 1;
    transform: translateY(0);
}

.btn-copy {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid rgba(0, 212, 170, 0.2);
    background: rgba(26, 26, 46, 0.96);
    color: #cbd5e1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
}

.btn-copy:hover {
    color: #00d4aa;
    border-color: rgba(0, 212, 170, 0.5);
}

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

.btn-copy .icon-check {
    display: none;
}

.btn-copy.copied {
    color: #00d4aa;
}

.btn-copy.copied .icon-copy {
    display: none;
}

.btn-copy.copied .icon-check {
    display: block;
}

.pg-code-block {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    margin: 0.6rem 0;
    background: #0b1120;
}

.pg-code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0.65rem;
    background: #121a2e;
    border-bottom: 1px solid var(--color-border);
}

.pg-code-lang {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

.btn-copy-code {
    border: 1px solid rgba(0, 212, 170, 0.25);
    background: rgba(0, 212, 170, 0.08);
    color: #7dd3c7;
    font-size: 0.72rem;
    line-height: 1;
    padding: 0.24rem 0.5rem;
    border-radius: 999px;
    cursor: pointer;
}

.btn-copy-code:hover {
    background: rgba(0, 212, 170, 0.16);
    border-color: rgba(0, 212, 170, 0.45);
    color: #99f6e4;
}

.btn-copy-code .copied-label {
    display: none;
}

.btn-copy-code.copied .copy-label {
    display: none;
}

.btn-copy-code.copied .copied-label {
    display: inline;
    color: #00d4aa;
}

.pg-message-content pre {
    padding: 0.75rem;
    overflow-x: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
}

.pg-message-content code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
}

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

.pg-typing {
    animation: pg-pulse 1.4s ease-in-out infinite;
    color: var(--color-text-muted);
    letter-spacing: 2px;
}

@keyframes pg-pulse {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 1; }
}

/* ── Preset buttons ── */

.playground-presets {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.preset-btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 500;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.preset-btn:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    border-color: var(--color-border-light);
}

.preset-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.45);
}

.preset-dot--green {
    background: #22c55e;
}

.preset-dot--yellow {
    background: #facc15;
}

.preset-dot--red {
    background: #ef4444;
}

/* ── Chat input area ── */

.playground-input-area {
    display: flex;
    gap: 0.5rem;
    align-items: end;
}

.playground-input-area textarea {
    flex: 1;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    font-family: inherit;
    font-size: 0.925rem;
}

.playground-input-area .btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    border-radius: var(--border-radius-sm);
}

.playground-input-area .btn.sending {
    opacity: 0.6;
    cursor: wait;
}

.playground-token-count {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-align: right;
    padding: 0.25rem 0;
    min-height: 1.25rem;
}

/* ── Embed card / results ── */

.playground-embed-card,
.playground-generate-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.playground-embed-card .form-label,
.playground-generate-card .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.playground-embed-results {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    padding: 1rem;
}

.embed-meta {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
}

.embed-meta-item strong {
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
}

.embed-vector-preview pre {
    background: #0b1120;
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    border: 1px solid var(--color-border);
    font-size: 0.82rem;
    color: var(--color-teal-light);
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* ── Generate output ── */

.pg-generate-output {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-md);
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    margin-bottom: 0.5rem;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 0.925rem;
    color: var(--color-text-primary);
}

.pg-generate-output pre {
    background: #0b1120;
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    margin: 0.5rem 0;
    border: 1px solid var(--color-border);
}

.pg-generate-output code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.82rem;
}

/* ==========================================================================
   9. Feature Pages
   ========================================================================== */

.content-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.moonshine-page .moonshine-hero {
    background: #1a1a2e;
    border-color: rgba(0, 212, 170, 0.25);
}

.moonshine-page .moonshine-label {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    color: #9ca3af;
}

.moonshine-page .moonshine-balance {
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 800;
    color: #00d4aa;
}

.moonshine-page .moonshine-reset {
    color: #9ca3af;
    font-size: 0.84rem;
}

.moonshine-stat-label {
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.74rem;
}

.moonshine-stat-value {
    color: #00d4aa;
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.15;
}

.moonshine-ratio-leecher { background: rgba(239, 68, 68, 0.2); color: #fecaca; }
.moonshine-ratio-contributor { background: rgba(16, 185, 129, 0.2); color: #a7f3d0; }
.moonshine-ratio-power { background: rgba(59, 130, 246, 0.2); color: #bfdbfe; }
.moonshine-ratio-elite { background: rgba(0, 212, 170, 0.25); color: #99f6e4; }

.kinfolk-group-card:hover {
    transform: translateY(-2px);
}

.kinfolk-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: rgba(0, 212, 170, 0.2);
    color: #99f6e4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

/* ==========================================================================
   10. Responsive
   ========================================================================== */

@media (max-width: 767.98px) {
    .app-navbar-shell {
        display: flex;
        flex-wrap: wrap;
    }

    .app-navbar-top-row {
        width: 100%;
    }

    .app-navbar-toggler {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    .guest-auth-actions {
        margin-right: 0.5rem;
        gap: 0.5rem !important;
    }

    .guest-auth-actions .btn {
        padding: 0.38rem 0.7rem;
        font-size: 0.78rem;
    }

    .guest-auth-actions__signup {
        font-weight: 700;
    }

    .guest-auth-actions__login {
        display: none !important;
    }

    .app-navbar-collapse:not(.show) .primary-nav {
        display: none !important;
    }

    .app-navbar-collapse.show .primary-nav {
        display: flex !important;
        margin-top: 0.25rem;
    }

    .app-navbar-collapse {
        width: 100%;
        flex-basis: 100%;
        margin-top: 0.75rem;
        border-top: 1px solid #2a2a4a;
        padding-top: 0.75rem;
    }
    
    .nav-icon {
        font-size: 1.25rem;
        margin-right: 0.75rem;
    }
    
    .app-navbar .nav-link {
        padding: 0.75rem 1rem;
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .app-navbar .nav-link.active {
        border-bottom: none;
        border-left: 3px solid #00d4aa;
        background: rgba(0, 212, 170, 0.05);
    }
    
    .user-menu-nav {
        display: none !important;
    }

    main.app-main {
        padding-top: 4.75rem;
    }
    
    .content-container {
        padding: 16px;
    }

    .hero-section {
        min-height: auto;
        padding-top: 5.5rem;
    }

    .brand-logo {
        height: 24px;
    }

    .stats-strip {
        gap: 1.15rem;
    }

    .playground-container {
        min-height: calc(100dvh - 4.75rem);
        height: calc(100dvh - 4.75rem);
        padding: 0.75rem;
    }

    .playground-messages {
        min-height: 0;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .user-menu-name {
        display: none !important;
    }
}

@media (max-width: 575.98px) {
    .hero-section__actions {
        flex-direction: column;
        align-items: center;
    }

    .hero-section__actions .btn {
        width: 100%;
        max-width: 280px;
    }

    .playground-controls {
        gap: 0.5rem;
    }

    .playground-controls .form-range {
        width: 80px;
    }

    .pg-message {
        max-width: 95%;
    }

    .playground-presets {
        gap: 0.3rem;
    }

    .preset-btn {
        font-size: 0.72rem;
        padding: 0.25rem 0.55rem;
    }

    .playground-tabs .sub-tab {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }

    .embed-meta {
        flex-direction: column;
        gap: 0.4rem;
    }
}
