/* --- Premium Splash Screen --- */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1), opacity 0.6s ease;
}

.splash-screen.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.splash-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.splash-logo {
    position: relative;
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: splashPulse 2.5s infinite ease-in-out;
    overflow: hidden;
}

.splash-img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    z-index: 2;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.splash-shimmer {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent 0%, rgba(255, 255, 255, 0.05) 50%, transparent 100%);
    animation: splashShimmer 3s infinite linear;
    z-index: 1;
}

.splash-text {
    overflow: hidden;
}

.splash-title {
    color: #fff;
    font-size: 2.2rem;
    font-weight: 800;
    margin: 0;
    letter-spacing: 0.05em;
    opacity: 0;
    transform: translateY(20px);
    animation: splashSlideIn 0.8s forwards 0.3s;
}

.splash-subtitle {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin: 5px 0 0 0;
    opacity: 0;
    transform: translateY(10px);
    animation: splashSlideIn 0.8s forwards 0.5s;
}

.splash-loader {
    width: 180px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 1rem;
    opacity: 0;
    animation: fadeIn 0.5s forwards 0.7s;
}

.loader-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    animation: splashLoad 3s cubic-bezier(0.1, 0, 0.2, 1) forwards 0.5s;
}

@keyframes splashPulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 15px 45px rgba(59, 130, 246, 0.2);
    }
}

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

@keyframes splashLoad {
    0% {
        width: 0;
    }

    30% {
        width: 40%;
    }

    60% {
        width: 45%;
    }

    80% {
        width: 90%;
    }

    100% {
        width: 100%;
    }
}

@keyframes splashShimmer {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

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

:root {
    /* Color Palette - Elegant Slate & Blue */
    --primary: #0f172a;
    --primary-light: #1e293b;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --success: #10b981;
    --bg-app: #f1f5f9;
    --bg-side: #ffffff;
    --border: #e2e8f0;
    --text-main: #334155;
    --text-dim: #64748b;
    --white: #ffffff;

    /* Shadows & Radii */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

/* --- Layout Structure --- */
.premium-app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Visual Lab Extensions */
.lab-mode-switch {
    display: flex;
    gap: 8px;
    background: #e2e8f0;
    padding: 6px;
    border-radius: 10px;
    margin-right: 20px;
}

.mode-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.mode-btn:hover {
    color: #334155;
    background: rgba(255, 255, 255, 0.5);
}

.mode-btn.active {
    background: #fff;
    color: #2563eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Expanded HUD Spacing - Removed to fix overlay size
.lab-footer-hud {
    background: #fff;
    border-top: 1px solid #e2e8f0;
    height: 140px;
    flex-shrink: 0;
    padding-bottom: env(safe-area-inset-bottom);
}

.lab-footer-hud .hud-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 40px;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 40px;
    box-sizing: border-box;
} */

/* Preview Components Styles (Dynamic Colors) */
:root {
    --preview-primary: #2563eb;
    --preview-bg: #ffffff;
    --preview-text: #1e293b;
    --preview-surface: #f8fafc;
}

.mock-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--preview-bg);
    color: var(--preview-text);
    font-family: inherit;
    /* Fonts applied by JS */
}

.mock-header {
    background: var(--preview-primary);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mock-logo {
    font-weight: 700;
    opacity: 0.95;
}

.mock-nav {
    display: flex;
    gap: 10px;
    font-size: 0.8em;
    opacity: 0.8;
}

.mock-hero {
    background: linear-gradient(135deg, var(--preview-surface) 0%, #fff 100%);
    padding: 24px 16px;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
}

.mock-hero h1 {
    margin: 0 0 10px 0;
    color: var(--preview-primary);
}

.mock-hero p {
    margin-bottom: 16px;
    opacity: 0.8;
}

.mock-btn {
    background: var(--preview-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 99px;
    font-weight: bold;
    font-size: 0.9em;
    cursor: pointer;
    display: inline-block;
}

.mock-grid {
    padding: 16px;
    display: grid;
    gap: 16px;
    background: var(--preview-surface);
    flex: 1;
}

.mock-card {
    background: #fff;
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    border-left: 4px solid var(--preview-primary);
    /* Accent */
}

/* Responsive adjustments for Mock Device Content */
.mock-device.mobile .mock-grid {
    grid-template-columns: 1fr;
}

.mock-device.tablet .mock-grid {
    grid-template-columns: 1fr 1fr;
}

.mock-device.desktop .mock-grid {
    grid-template-columns: 1fr 1fr 1fr;
}

/* Hue Slider Rainbow */
.hue-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 200px;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #00f 83%, #f00 100%);
    outline: none;
}

.hue-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #cbd5e1;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-top: -6px;
    /* Center thumb */
}

.hue-slider::-webkit-slider-runnable-track {
    height: 8px;
}

.hud-group.wide {
    flex: 2;
    min-width: 250px;
}

.btn-save-color {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
    transition: all 0.3s ease;
}

.btn-save-color:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-save-color:active {
    transform: scale(0.96);
    transform: translateY(0);
}

.lab-scope-mobile,
.lab-scope-tablet,
.lab-scope-desktop {
    transition: background-color 0.3s, color 0.3s;
}

/* Top Nav */
.top-nav {
    height: 70px;
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text h1 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.logo-text span {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.search-wrapper {
    width: 450px;
}

#previewText {
    width: 100%;
    padding: 0.75rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #f8fafc;
    font-size: 0.95rem;
    transition: all 0.2s;
}

#previewText:focus {
    outline: none;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.nav-right {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--white);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.nav-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Main CTA */
.nav-btn.preview-launch {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    padding-left: 1.2rem;
    padding-right: 1.2rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn.preview-launch:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.4);
    background: linear-gradient(135deg, #5b5ee0, #7c4df0);
}

.nav-btn.preview-launch .shortcut {
    display: none;
    /* Hide old shortcut if present */
}

.shortcut {
    font-size: 0.7rem;
    opacity: 0.6;
    padding: 1px 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Body Area */
.app-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar */
.app-sidebar {
    width: 320px;
    background: var(--bg-side);
    border-right: 1px solid var(--border);
    padding: 1.25rem;
    /* Balanced from 1rem/2rem */
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    /* Reduced from 1.25rem */
    overflow-y: auto;
}

/* Sidebar Features Enhancement */
.sidebar-group {
    margin-bottom: 0.5rem;
    /* Reduced from 0.8rem */
    padding-bottom: 0.5rem;
    border-bottom: none;
}

.sidebar-group:last-child {
    border-bottom: none;
}

.sidebar-group h3 {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-dim);
    letter-spacing: 0.1em;
    margin-bottom: 0.4rem;
    /* Balanced */
    font-weight: 800;
}

.sidebar-project-meta {
    margin-bottom: 0.35rem;
    display: flex;
    gap: 0.35rem;
}

.input-row {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.input-row label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
}

.sidebar-input {
    width: 100%;
    padding: 0.45rem 0.6rem;
    /* Slightly more compact */
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--primary);
    transition: all 0.2s;
}

.sidebar-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.05);
}

.path-display-area {
    margin-top: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.path-card {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.6rem;
}

.path-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.path-card-head label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-dim);
    text-transform: uppercase;
}

.mini-copy-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 0.6rem;
    padding: 2px 6px;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.mini-copy-btn:hover {
    background: var(--primary-light);
    transform: scale(1.05);
}

.mini-copy-btn:active {
    transform: scale(0.95);
}

.path-card code {
    display: block;
    font-size: 0.7rem;
    line-height: 1.4;
    color: var(--primary);
    word-break: break-all;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
}

.db-update-box {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.btn-db-update {
    width: 100%;
    padding: 0.8rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-db-update:hover {
    background: #f1f5f9;
    border-color: var(--accent);
}

.selected-summary {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.25rem 0;
}

.sel-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    line-height: 1.2;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot.heading {
    background: var(--accent);
}

.dot.body {
    background: var(--success);
}

.sel-item span:last-child {
    font-weight: 700;
    color: var(--primary);
}

.btn-save {
    width: 100%;
    padding: 1rem;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
    transition: all 0.2s;
}

.btn-save:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Sidebar Drop Areas (Vertical & Dashed) */
.drop-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.premium-drop {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border: 1.5px dashed var(--border);
    /* 点緁E*/
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}

.premium-drop:hover {
    border-color: var(--accent);
    background: #f8fafc;
}

.premium-drop.loaded {
    border-style: solid;
    border-color: var(--success);
    background: #f0fdf4;
}

.premium-drop.drag-active {
    border-color: var(--accent);
    border-style: solid;
    background: #eff6ff;
    transform: scale(1.02);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.premium-drop.error {
    border-color: #ef4444;
    background: #fef2f2;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.drop-icon {
    font-size: 1.1rem;
}

.drop-info strong {
    display: block;
    font-size: 0.8rem;
    color: var(--primary);
}

.drop-info span {
    font-size: 0.65rem;
    color: var(--text-dim);
}

/* Main Workspace */
.workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2rem;
    overflow: hidden;
}

.workspace-header {
    margin-bottom: 1.5rem;
}

.category-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dim);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
}

.grid-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.8rem 0 0;
    /* Clear space for hover and scrollbar */
}

.font-premium-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Fixed 3 columns as requested */
    gap: 1.5rem;
    padding: 10px 0 2rem 0;
    /* Added padding-top 10px to prevent hover clipping */
}

/* Font Card */
.font-premium-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    position: relative;
}

.active-card {
    border: 2px solid var(--accent) !important;
    background: #f0fdf9 !important;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.25) !important;
}

.card-selected-badge {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: #ecfdf5;
    color: #059669;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.1);
    z-index: 2;
}

.card-selected-badge::before {
    content: '✁E;
 font-weight: 900;
}

.font-premium-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.no-preview-font {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji" !important;
}

/* Card Footer */
.card-footer {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-kanji-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    cursor: help;
}

.kanji-label {
    font-size: 0.65rem;
    color: var(--text-dim);
    font-weight: 600;
}

.kanji-stars {
    font-size: 0.65rem;
    color: #f59e0b;
    letter-spacing: -1px;
}

.card-main-preview {
    font-size: 1.1rem;
    /* More compact for readability */
    line-height: 1.4;
    color: var(--primary);
    min-height: 45px;
    display: flex;
    align-items: center;
    word-break: break-all;
    padding: 0.4rem 0;
}

.card-btns {
    display: flex;
    gap: 0.5rem;
}

.btn-assign {
    flex: 1;
    padding: 0.6rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    background: transparent;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-assign:hover {
    border-color: var(--text-dim);
    color: var(--primary);
}

/* Active Card Buttons - Critical Feedback */
.btn-assign[data-type="heading"].active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.btn-assign[data-type="body"].active {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.3);
}

/* --- Confirmation Modal --- */
.confirm-modal {
    max-width: 420px;
}

.confirm-text {
    text-align: center;
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text-main);
    margin-bottom: 1.5rem;
}

.confirm-btns {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn-cancel {
    padding: 0.75rem 1.5rem;
    background: #f1f5f9;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #e2e8f0;
}

.btn-confirm {
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-confirm:hover {
    filter: brightness(1.1);
}

/* Result Modal */
.result-modal {
    max-width: 500px;
}

.result-content {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.5rem;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    word-break: break-all;
}

.modal-hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

.kanji-legend h3 {
    font-size: 0.9rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.kanji-legend ul {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.8rem;
    color: var(--text-dim);
}

.kanji-legend li {
    margin-bottom: 0.4rem;
    font-feature-settings: "tnum";
}

/* --- Modals & Lab --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* Ensure warnings pop over the lab */
#resultModal,
#dbConfirmModal,
#helpModal,
#labCloseConfirmModal,
#themeAnalysisModal {
    z-index: 2000;
}

/* Lab Viewport (Full Screen) */
.lab-container {
    width: 100%;
    height: 100%;
    background: #fff;
    display: flex;
    flex-direction: column;
    /* Fixed: Vertical layout */
    overflow: hidden;
    position: relative;
}

.import-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
}

.import-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    transition: background 0.2s;
}

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

.import-item:hover {
    background: #f1f5f9;
}

.import-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.import-key {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}

.import-font-val {
    font-size: 0.85rem;
    color: #64748b;
}

/* Premium Select Styling */
.import-actions {
    position: relative;
}

.import-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 32px 8px 12px;
    font-size: 0.9rem;
    color: #334155;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
}

.import-select:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.import-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.import-item.unclassified {
    background: #fffbeb;
}

.import-item.unclassified:hover {
    background: #fef3c7;
}

.badge-warn {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    background: #fef3c7;
    color: #d97706;
    padding: 2px 8px;
    border-radius: 99px;
    margin-left: 8px;
    font-weight: 600;
    border: 1px solid #fcd34d;
}

/* (Consolidated into above definition) */

.lab-toolbar {
    padding: 0.7rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    z-index: 100;
}

.lab-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #e5eaf0;
}

.badge {
    margin-left: 0.75rem;
    font-size: 0.7rem;
    background: #eff6ff;
    color: var(--accent);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
}

.lab-tabs {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.tab-group {
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    display: flex;
}

.tab-group button {
    border: none;
    padding: 0.4rem 1.2rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-group button.active {
    background: #fff;
    color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.tab-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
}

.lab-close {
    background: #f8fafc;
    border: 1px solid var(--border);
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
}

.lab-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    background: #f1f5f9;
}

/* --- Lab Footer HUD (New v5.0) --- */
/* --- Lab Footer HUD (New v5.0) --- */
.lab-footer-hud {
    position: absolute;
    bottom: 2rem;
    /* Adjusted for better visibility */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    /* More opaque */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    border-radius: 99px;
    padding: 0.6rem 1.5rem;
    /* More compact */
    z-index: 1000;
    width: auto;
    max-width: 95%;
    white-space: nowrap;
    /* Prevent items from wrapping internally */
}

.hud-input {
    width: 60px;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    font-weight: 700;
    font-family: inherit;
    color: var(--primary);
    text-align: right;
    padding: 0 4px;
    outline: none;
    transition: border-color 0.2s;
}

.hud-input:focus {
    border-bottom-color: var(--primary);
}

.hud-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.hud-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 140px;
}

.hud-group label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-dim);
    display: flex;
    justify-content: space-between;
}

.hud-divider {
    width: 1px;
    height: 30px;
    background: var(--border);
}

/* Lab Viewport (Direct DOM) */
.lab-viewport {
    flex: 1;
    overflow: hidden;
    padding: 2rem 2rem 100px;
    /* Space for HUD at the bottom */
    background: #e5eaf0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
}

.device-showcase {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: center;
    gap: 2rem;
    padding: 0;
    width: auto;
    /* Transformation handled by JS */
    transform-origin: center center;
    transition: transform 0.1s ease-out;
}

.device-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

/* --- Focus Modes (Added v5.0.2) --- */

/* Mobile Focus */
.lab-viewport.view-mode-mobile .device-wrapper:not(:nth-child(1)) {
    display: none;
}

.lab-viewport.view-mode-mobile .mock-device.mobile {
    transform: scale(1.0);
    /* Full size mobile */
    margin: 0;
}

.lab-viewport.view-mode-mobile .device-showcase {
    justify-content: center;
    padding: 2rem;
}

/* Tablet Focus */
.lab-viewport.view-mode-tablet .device-wrapper:not(:nth-child(2)) {
    display: none;
}

.lab-viewport.view-mode-tablet .mock-device.tablet {
    transform: scale(0.85);
    /* Large tablet view */
    margin: 0 -58px -154px;
    /* (768*0.15)/2 etc. */
}

.lab-viewport.view-mode-tablet .device-showcase {
    justify-content: center;
}

/* Desktop Focus */
.lab-viewport.view-mode-desktop .device-wrapper:not(:nth-child(3)) {
    display: none;
}

.lab-viewport.view-mode-desktop .mock-device.desktop {
    transform: scale(0.9);
    /* Very large PC view */
    margin: 0 -60px -80px;
}

.lab-viewport.view-mode-desktop .device-showcase {
    justify-content: center;
}

.device-label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    background: #fff;
    padding: 4px 14px;
    border-radius: 99px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#themeAnalysisModal .modern-modal {
    background: rgba(255, 255, 255, 0.95);
    padding: 3.5rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    max-width: 580px;
    width: 95%;
    transform: translateY(20px);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0;
    position: relative;
    /* For absolute elements inside */
    overflow: hidden;
    /* Clip the orb */
}

/* Premium Glow Animation */
.premium-visual-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.premium-orb {
    width: 200px;
    /* Larger */
    height: 200px;
    border-radius: 50%;
    filter: blur(80px) saturate(200%);
    /* Extra blur & vibrancy */
    opacity: 0.5;
    /* Softer */
    animation: orb-breathe 6s ease-in-out infinite alternate;
}

@keyframes orb-breathe {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 0.4;
    }

    50% {
        transform: scale(1.4) rotate(180deg);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.1) rotate(360deg);
        opacity: 0.4;
    }
}

/* Clean Browser-style Preview Frames */
.mock-device {
    background: #fff;
    border: 8px solid #334155;
    /* Solid dark bezel */
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
    transform-origin: top center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Top Bar/Bezel */
.mock-device::before {
    content: '';
    display: block;
    height: 24px;
    background: #334155;
    border-bottom: 1px solid #1e293b;
    width: 100%;
}

.screen {
    background: #fff;
    width: 100%;
    height: calc(100% - 24px);
    overflow-y: auto;
    /* Enable scrolling inside the device */
    overflow-x: hidden;
    scrollbar-width: thin;
}

/* Device Sizing & Layout Compensation */
/* Note: transform does not affect layout flow, so we use negative margins to remove whitespace */

.mock-device.mobile {
    width: 375px;
    height: 667px;
    transform: scale(0.7);
    margin: 0 -56px -200px;
    /* W: (375*0.3)/2 = 56.25 */
}

.mock-device.tablet {
    width: 768px;
    height: 1024px;
    transform: scale(0.45);
    margin: 0 -211px -563px;
    /* W: (768*0.55)/2 = 211.2 */
}

.mock-device.desktop {
    width: 1440px;
    height: 900px;
    transform: scale(0.5);
    /* Even larger PC view */
    margin: 0 -360px -450px;
    /* W: (1440*0.5=720, diff 720, /2 = 360), H: (900*0.5=450, diff 450) */
}

/* Adjust wrapper margins */
.device-showcase {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Align to bottom for desk-view feel */
    gap: 1.5rem;
    padding: 2rem;
    transform-origin: top center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Device View Modes & Premium Animations */
.device-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 1;
    transform: scale(1) translateX(0);
    /* Smooth width/opacity/transform transition for Zoom effect */
    transition:
        width 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.5s ease,
        transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
        margin 0.6s ease,
        padding 0.6s ease;
}

/* Hide non-active devices in single-view modes */
.lab-viewport.view-mode-mobile .device-wrapper:not(:has(.mobile)),
.lab-viewport.view-mode-tablet .device-wrapper:not(:has(.tablet)),
.lab-viewport.view-mode-desktop .device-wrapper:not(:has(.desktop)) {
    position: absolute;
    opacity: 0;
    transform: scale(0.8) translateY(30px);
    pointer-events: none;
    z-index: 0;
}

/* Active device in single-view modes */
.lab-viewport.view-mode-mobile .device-wrapper:has(.mobile),
.lab-viewport.view-mode-tablet .device-wrapper:has(.tablet),
.lab-viewport.view-mode-desktop .device-wrapper:has(.desktop) {
    position: relative;
    z-index: 10;
    animation: deviceEnter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* Keyframe Animations */
@keyframes deviceEnter {
    0% {
        opacity: 0;
        transform: scale(0.85) translateY(40px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes devicePulse {

    0%,
    100% {
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    }

    50% {
        box-shadow: 0 35px 60px -15px rgba(59, 130, 246, 0.3);
    }
}

/* Apply glow effect on entering */
.lab-viewport.view-mode-mobile .mock-device.mobile,
.lab-viewport.view-mode-tablet .mock-device.tablet,
.lab-viewport.view-mode-desktop .mock-device.desktop {
    animation: devicePulse 1.5s ease-in-out 0.3s;
}

/* Single-device views: centered with minimal padding */
.lab-viewport.view-mode-mobile .device-wrapper:has(.mobile),
.lab-viewport.view-mode-tablet .device-wrapper:has(.tablet),
.lab-viewport.view-mode-desktop .device-wrapper:has(.desktop) {
    justify-content: center;
    align-items: center;
    padding: 0;
    width: 100%;
    height: 100%;
}

/* Reset negative margins, use center transform-origin */
.lab-viewport.view-mode-mobile .mock-device.mobile {
    margin: 0;
    transform: scale(0.80);
    transform-origin: center center;
}

.lab-viewport.view-mode-tablet .mock-device.tablet {
    margin: 0;
    transform: scale(0.45);
    transform-origin: center center;
}

.lab-viewport.view-mode-desktop .mock-device.desktop {
    margin: 0;
    transform: scale(0.55);
    transform-origin: center center;
}

/* Hide device labels in single-view mode (redundant with tab selection) */
.lab-viewport.view-mode-mobile .device-label,
.lab-viewport.view-mode-tablet .device-label,
.lab-viewport.view-mode-desktop .device-label {
    display: none;
}

/* Desktop */

/* Show in high-res mode only or via toggle later */

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

/* Help Guide */
.modern-modal {
    background: #fff;
    width: 500px;
    padding: 2rem;
    border-radius: var(--radius-lg);
}

.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.close-icon {
    border: none;
    background: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.close-icon:hover {
    color: var(--primary);
    background: #f1f5f9;
    transform: rotate(90deg);
}

.close-icon:active {
    transform: rotate(90deg) scale(0.9);
}

.guide-step {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.guide-step p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 99px;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 10000;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-notification.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Import Modal Styles --- */
.import-modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    width: 650px;
    max-width: 90vw;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 85vh;
    /* Prevent overflow */
}

.import-header {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 15px;
}

.import-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 5px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.import-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    padding-right: 10px;
    /* Space for scrollbar */
    max-height: 400px;
    /* Scrollable area */
}

.import-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: all 0.2s;
}

.import-item:hover {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.import-item.unclassified {
    border-left: 4px solid #f59e0b;
    /* Warning Orange */
    background: #fffbeb;
}

.import-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.import-key {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
}

.import-font-val {
    font-size: 0.75rem;
    color: var(--text-dim);
}

/* Premium Select Styling */
.import-actions {
    position: relative;
}

.import-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 32px 8px 12px;
    font-size: 0.9rem;
    color: #334155;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    min-width: 140px;
}

.import-select:hover {
    border-color: #94a3b8;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.import-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Unclassified Badge */
.badge-warn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #b45309;
    font-weight: 700;
    background: #fef3c7;
    padding: 2px 8px;
    border-radius: 99px;
}

.import-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
}

/* Premium Gradient Button Styling */
.btn-save,
.btn-generate {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    width: 100%;
    border: none;
    padding: 0.8rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-save:hover,
.btn-generate:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-save-color {
    white-space: nowrap !important;
    min-width: 100px;
    padding: 0.6rem 1.5rem !important;
}

.btn-db-update,
.btn-confirm,
.glow-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%) !important;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3) !important;
    transition: all 0.3s ease !important;
}

.btn-db-update:hover,
.btn-confirm:hover,
.glow-btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4) !important;
}

/* Base style for shared action buttons */
.btn-action,
.action-btn,
.hud-control button {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Secondary & Global Hover Effects */
.lab-close,
.btn-cancel,
.tab-btn,
.adj-device-btn,
.mode-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.lab-close:hover,
.btn-cancel:hover,
.tab-btn:hover,
.adj-device-btn:hover,
.mode-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.lab-close:active,
.btn-cancel:active,
.tab-btn:active,
.adj-device-btn:active,
.mode-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Specific styling for Close & Cancel to ensure they look interactive */
.lab-close,
.btn-cancel {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    cursor: pointer;
}

.lab-close:hover,
.btn-cancel:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(30, 41, 59, 0.95);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2000;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(4px);
}

.toast-notification.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-notification .icon {
    font-size: 1.2rem;
}

/* Mini Copy Button - Crisp & Clean */
.mini-copy-btn {
    background: transparent;
    border: 1px solid #cbd5e1;
    color: #64748b;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.1s ease;
    filter: none;
    box-shadow: none;
    outline: none;
}

/* Hover: No blur, just color change */
.mini-copy-btn:hover {
    background: #f1f5f9;
    color: #3b82f6;
    border-color: #3b82f6;
    box-shadow: none;
    transform: none;
}

.mini-copy-btn:active {
    background: #e2e8f0;
}

/* --- Responsive Media Queries for Small Screens --- */
@media screen and (max-height: 800px) or (max-width: 1400px) {
    .lab-footer-hud {
        bottom: 1rem;
        padding: 0.4rem 1rem;
        transform: translateX(-50%) scale(0.9);
    }

    .hud-inner {
        gap: 0.8rem;
    }

    .hud-group {
        min-width: 110px;
    }

    .hud-group label {
        font-size: 0.65rem;
    }

    .hud-input {
        width: 45px;
        font-size: 0.8rem;
    }

    .lab-viewport.view-mode-desktop .mock-device.desktop {
        transform: scale(0.65);
    }

    .lab-viewport.view-mode-tablet .mock-device.tablet {
        transform: scale(0.5);
    }

    .lab-viewport.view-mode-mobile .mock-device.mobile {
        transform: scale(0.85);
    }

    .lab-viewport:not([class*="view-mode-"]) .mock-device.mobile {
        transform: scale(0.5);
        margin: 0 -80px -250px;
    }

    .lab-viewport:not([class*="view-mode-"]) .mock-device.tablet {
        transform: scale(0.35);
        margin: 0 -250px -500px;
    }

    .lab-viewport:not([class*="view-mode-"]) .mock-device.desktop {
        transform: scale(0.45);
        margin: 0 -300px -350px;
    }
}

@media screen and (max-width: 1200px) {
    .lab-footer-hud {
        scale: 0.8;
        max-width: 98%;
    }

    .hud-divider {
        display: none;
    }

    .hud-group {
        min-width: 90px;
    }
}

/* ===== Live Site Preview Styles ===== */

.live-preview-box {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.btn-fetch-site {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(14, 165, 233, 0.2);
}

.btn-fetch-site:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(14, 165, 233, 0.3);
}

.btn-fetch-site:active {
    transform: translateY(0);
}

.btn-fetch-site:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.site-status {
    font-size: 0.75rem;
    color: var(--text-dim);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: #f8fafc;
    display: none;
}

.site-status.visible {
    display: block;
}

.site-status.success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.site-status.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Source Switcher in Visual Lab */
.lab-source-switch {
    display: flex;
    gap: 6px;
    background: #1e293b;
    padding: 4px;
    border-radius: 8px;
    margin-right: 20px;
}

.source-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.source-btn:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.1);
}

.source-btn.active {
    background: #3b82f6;
    color: #fff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.source-btn.active[data-source="live"] {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.source-btn .icon {
    font-size: 14px;
}

/* Live Preview Container */
.live-preview-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    background: #fff;
    border-radius: 8px;
}

.live-preview-container.hidden {
    display: none;
}

.live-preview-iframe {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: none;
}

/* Ensure screen containers have height for iframe */
.mock-device .screen {
    height: 100%;
    min-height: inherit;
}

/* Element selection highlight (injected into preview) */
.gvm-highlight {
    outline: 3px solid #3b82f6 !important;
    outline-offset: 2px !important;
    cursor: pointer !important;
}

.gvm-selected {
    outline: 3px solid #10b981 !important;
    outline-offset: 2px !important;
    background-color: rgba(16, 185, 129, 0.1) !important;
}