/* ═══════════════════════════════════════════
   APP SPECIFIC STYLES — "Paper UI + Soft Futuristic"
   ═══════════════════════════════════════════ */

.app-body {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 24px 36px;
    font-family: 'Outfit', sans-serif;
    background:
        radial-gradient(circle, rgba(0, 0, 0, 0.045) 1px, transparent 1.5px),
        radial-gradient(circle, rgba(0, 0, 0, 0.045) 1px, transparent 1.5px),
        #ffffff !important;
    background-size: 14px 14px, 14px 14px, 100% 100% !important;
    background-position: 0 0, 7px 7px, 0 0 !important;
    position: relative;
}

/* Subtle ambient grain texture */
.app-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.025'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

/* ─── Top Nav ─── */
.top-nav {
    margin-bottom: 16px;
    position: relative;
    z-index: 2;
}

/* Mobile-only title — hidden on desktop */
.app-mobile-title {
    display: none;
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 400;
    color: #1a1a2e;
    letter-spacing: -0.5px;
    white-space: nowrap;
    margin: 0;
}

@property --go-back-progress {
    syntax: '<percentage>';
    initial-value: 0%;
    inherits: false;
}

.go-back-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    color: #3d4a5c;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.4s ease, border-color 0.3s ease, filter 0.4s ease, background 0.3s ease;
    z-index: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 6px 20px rgba(0, 0, 0, 0.04);
}

.go-back-btn::before {
    content: '';
    position: absolute;
    border-radius: 1px;
    inset: -2px;
    border-radius: 12px;
    padding: 2px;
    background: conic-gradient(from 0deg,
            var(--accent-blue) 0%,
            var(--accent-blue) var(--go-back-progress),
            transparent var(--go-back-progress),
            transparent calc(100% - var(--go-back-progress)),
            var(--accent-blue) calc(100% - var(--go-back-progress)),
            var(--accent-blue) 100%);
    --go-back-progress: 0%;
    transition: --go-back-progress 0.6s ease;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.go-back-btn:hover {
    color: var(--accent-blue);
    border-color: transparent;
    background: rgba(255, 255, 255, 0.9);
    filter: drop-shadow(0 0 8px rgba(74, 125, 255, 0.2));
}

.go-back-btn:hover::before {
    --go-back-progress: 50%;
}

/* ─── Main Glass Container ─── */
.app-glass-container {
    flex: 1;
    min-height: 0;
    background: rgba(233, 236, 240, 0.55);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.16);
    border-radius: 20px;
    padding: 28px 36px;
    display: flex;
    flex-direction: column;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 12px 40px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

/* ─── Workspace Panels ─── */
.workspace-panels {
    display: flex;
    gap: 60px;
    flex: 1;
    position: relative;
    min-height: 0;
    margin-bottom: 20px;
}

.panel {
    flex: 1;
    background: #f4f6f9;
    /* Dimmed down from pure white (#ffffff) for a softer, premium visual look */
    backdrop-filter: blur(10px);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.04),
        0 10px 30px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.16);
    overflow: hidden;
}

/* ─── Panel Header ─── */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 28px;
}

.right-header {
    padding-top: 16px;
    padding-bottom: 16px;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #2d3444;
}

/* ─── Copy Button (white default → blue hover) ─── */
.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--text-light);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Outfit', sans-serif;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.copy-btn:hover {
    background: var(--accent-blue);
    color: #ffffff;
    border-color: var(--accent-blue);
    box-shadow: 0 4px 16px rgba(74, 125, 255, 0.3);
    transform: translateY(-1px);
}

.copy-btn:hover svg {
    stroke: #ffffff;
}

.copy-btn.copied {
    background: #2b9c73;
    color: #ffffff;
    border-color: #2b9c73;
    box-shadow: 0 2px 8px rgba(43, 156, 115, 0.25);
}

.copy-btn.copied svg {
    stroke: #ffffff;
}

/* ─── Text Areas ─── */
.text-area {
    flex: 1;
    min-height: 0;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    resize: none;
    padding: 16px 26px 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    line-height: 1.75;
    color: #2d3444;
    background: #ffffff;
    /* Crisp white sheet background for maximum readability on the dimmed panel container */
    border-radius: 12px;
    margin: 0 14px;
    width: calc(100% - 28px);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.04);
}

.text-area::placeholder {
    color: #7b8190;
}

.text-area:focus {
    outline: none;
}

.output-area {
    overflow-y: auto;
    white-space: pre-wrap;
    min-height: 0;
    overflow-x: hidden;
    word-break: break-word;
}

/* ─── Panel Footer ─── */
.panel-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
}

.char-count {
    font-size: 0.8rem;
    color: #7b8190;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #2b9c73;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(43, 156, 115, 0.4);
}

.success-footer {
    justify-content: flex-start;
    gap: 8px;
    font-size: 0.85rem;
    color: #2b9c73;
    font-weight: 500;
}

.changes-text {
    white-space: nowrap;
    margin-right: 8px;
}

/* ─── Center Action (Structure Button) ─── */
.center-action {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: none;
}

.structure-btn {
    padding: 16px 36px;
    border-width: 1px;
    border-color: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    background: linear-gradient(135deg, #5d8dff, #4a7dff);
    color: #ffffff;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    pointer-events: auto;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
        letter-spacing 0.4s ease;
    box-shadow:
        0 4px 16px rgba(74, 125, 255, 0.3),
        0 10px 30px rgba(74, 125, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Shimmer sweep on hover */
.structure-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.25) 50%,
            transparent 100%);
    transition: left 0.6s ease;
    z-index: 1;
}

.structure-btn:hover {
    transform: scale(1.06);
    box-shadow:
        0 8px 28px rgba(74, 125, 255, 0.4),
        0 16px 44px rgba(74, 125, 255, 0.15),
        0 0 0 4px rgba(74, 125, 255, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    letter-spacing: 1px;
}

.structure-btn:hover::before {
    left: 100%;
}

.structure-btn:active {
    transform: scale(0.98);
    box-shadow: 0 2px 12px rgba(74, 125, 255, 0.3);
}

/* ─── Bottom Action ─── */
.bottom-action {
    display: flex;
    justify-content: center;
}

/* Clear All Button (blue default → white hover) */
.clear-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--accent-blue);
    border: 1px solid var(--accent-blue);
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(74, 125, 255, 0.2);
}

.clear-btn:hover {
    background: #ffffff;
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    box-shadow: 0 4px 20px rgba(74, 125, 255, 0.12);
    transform: translateY(-2px);
}

.clear-btn:hover svg {
    stroke: var(--accent-blue);
}

.clear-btn svg {
    stroke: #ffffff;
    transition: stroke 0.3s ease;
}

/* ─── Custom Scrollbar ─── */
::-webkit-scrollbar {
    width: 5px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.14);
}

/* ─── Vertical Dotted Center Line ─── */
.center-line {
    position: fixed;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(to bottom,
            transparent 5%,
            rgba(74, 125, 255, 0.1) 30%,
            rgba(74, 125, 255, 0.14) 50%,
            rgba(74, 125, 255, 0.1) 70%,
            transparent 95%);
    transform: translateX(-50%);
}

/* ─── Floating Geometric Shapes ─── */
.app-geo-shapes {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.app-geo-shape {
    position: absolute;
    border: 1.5px solid rgba(74, 125, 255, 0.8);
    background: rgba(74, 125, 255, 0.06);
    animation: app-geo-drift linear infinite;
}

.app-geo-circle {
    border-radius: 50%;
}

.app-geo-square {
    border-radius: 3px;
}

.app-geo-diamond {
    border-radius: 2px;
    transform: rotate(45deg);
}

@keyframes app-geo-drift {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }

    25% {
        transform: translate(20px, -30px) rotate(90deg) scale(1.2);
    }

    50% {
        transform: translate(-15px, -60px) rotate(180deg) scale(0.85);
    }

    75% {
        transform: translate(30px, -20px) rotate(270deg) scale(1.1);
    }

    100% {
        transform: translate(0, 0) rotate(360deg) scale(1);
    }
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .workspace-panels {
        flex-direction: column;
        gap: 20px;
    }

    .center-action {
        display: block;
        position: static;
        transform: none;
        pointer-events: auto;
        width: 100%;
    }

    .structure-btn {
        width: 100%;
        min-height: 54px;
        border-radius: 16px;
        font-size: 1rem;
        font-weight: 600;
        padding: 16px 24px;
    }

    .center-line {
        display: none;
    }

    .app-geo-shapes {
        display: none;
    }
}

/* ═══════════════════════════════════════════
   THEME TOGGLE BUTTON STYLES
   ═══════════════════════════════════════════ */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    color: #3d4a5c;
    border: 1.5px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 6px 20px rgba(0, 0, 0, 0.04);
    font-family: 'Outfit', sans-serif;
}

.theme-toggle-btn:hover {
    color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(74, 125, 255, 0.2);
    filter: drop-shadow(0 0 8px rgba(74, 125, 255, 0.15));
}

.theme-toggle-btn .sun-icon {
    display: none;
}

.theme-toggle-btn .moon-icon {
    display: inline-block;
}

/* ═══════════════════════════════════════════
   DARK MODE OVERRIDES
   Matched to reference image:
   - Background: gradient from muted steel-blue to dark slate
   - Container: medium gray-blue, semi-transparent
   - Panels: light off-white (#edf0f4)
   - Buttons: dark charcoal (#2d3540)
   ═══════════════════════════════════════════ */

/* Background: diagonal gradient from light steel-blue (top-left) → dark blue-slate (bottom-right) */
.dark-mode {
    background:
        radial-gradient(circle, rgba(255, 255, 255, 0.04) 1px, transparent 1.5px),
        radial-gradient(circle, rgba(255, 255, 255, 0.04) 1px, transparent 1.5px),
        linear-gradient(135deg, #9aabb8 0%, #7a8d9e 30%, #6a7d8e 60%, #526475 100%) !important;
    background-size: 14px 14px, 14px 14px, 100% 100% !important;
    background-position: 0 0, 7px 7px, 0 0 !important;
}

/* Toggle Sun/Moon icons in dark mode */
.dark-mode .theme-toggle-btn .sun-icon {
    display: inline-block;
}

.dark-mode .theme-toggle-btn .moon-icon {
    display: none;
}

/* Go Back & Theme Toggle: dark charcoal pill matching image */
.dark-mode .go-back-btn,
.dark-mode .theme-toggle-btn {
    background: #2d3540;
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.22);
    /* Enhanced border visibility in dark mode */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.dark-mode .go-back-btn:hover,
.dark-mode .theme-toggle-btn:hover {
    background: #3a4550;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.12));
}

/* Override the blue conic border to white in dark mode */
.dark-mode .go-back-btn::before {
    background: conic-gradient(from 0deg,
            rgba(255, 255, 255, 0.6) 0%,
            rgba(255, 255, 255, 0.6) var(--go-back-progress),
            transparent var(--go-back-progress),
            transparent calc(100% - var(--go-back-progress)),
            rgba(255, 255, 255, 0.6) calc(100% - var(--go-back-progress)),
            rgba(255, 255, 255, 0.6) 100%);
}

/* Main Glass Container: medium muted gray-blue from image */
.dark-mode .app-glass-container {
    background: rgba(120, 135, 150, 0.55);
    border: 2px solid rgba(255, 255, 255, 0.24);
    /* Crisper and more distinct container border in dark mode */
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.1),
        0 12px 40px rgba(0, 0, 0, 0.2);
}

/* Panels: light off-white like the image — keeps text readable */
.dark-mode .panel {
    background: #e2e8f0;
    /* Dimmed down from #edf0f4 for a softer look in slate dark mode */
    border: 1.5px solid rgba(0, 0, 0, 0.16);
    /* Sharp border to match light mode contrast */
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.06),
        0 8px 24px rgba(0, 0, 0, 0.08);
}

/* Panel headers remain dark text on light panels */
.dark-mode .header-title {
    color: #2d3444;
}

/* Copy button: light background on the light panel */
.dark-mode .copy-btn {
    background: rgba(255, 255, 255, 0.8);
    color: #4a5568;
    border-color: rgba(0, 0, 0, 0.18);
    /* Enhanced button border contrast */
}

.dark-mode .copy-btn:hover {
    background: #2d3540;
    color: #ffffff;
    border-color: #2d3540;
    box-shadow: 0 4px 12px rgba(45, 53, 64, 0.25);
}

.dark-mode .copy-btn.copied {
    background: #2b9c73;
    color: #ffffff;
    border-color: #2b9c73;
    box-shadow: 0 2px 8px rgba(43, 156, 115, 0.3);
}

.dark-mode .copy-btn.copied svg {
    stroke: #ffffff;
}

/* Text areas: very light, near-white — like the image */
.dark-mode .text-area {
    background: #f8fafc;
    /* Dimmed down from pure white / bright rgba to a softer, comfortable off-white background */
    color: #2d3444;
    border-color: rgba(0, 0, 0, 0.16);
    /* Crisper, well-defined border around text input fields */
}

.dark-mode .text-area::placeholder {
    color: #8a95a5;
}

/* Structure button: dark charcoal circle from image */
.dark-mode .structure-btn {
    background: #4a5562;
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    /* High contrast bright border on the action button */
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.dark-mode .structure-btn:hover {
    background: #5a6572;
    box-shadow:
        0 8px 28px rgba(0, 0, 0, 0.3),
        0 0 0 4px rgba(255, 255, 255, 0.06);
}

/* Clear All button: dark charcoal matching image */
.dark-mode .clear-btn {
    background: #4a5562;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    /* Clean white border matching action buttons */
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dark-mode .clear-btn:hover {
    background: #5a6572;
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
    /* Brighter border glow on hover */
}

.dark-mode .clear-btn svg {
    stroke: #ffffff;
}

/* Footer text colors on light panels */
.dark-mode .char-count {
    color: #7b8190;
}

.dark-mode .panel-footer {
    color: #5a6374;
}

.dark-mode .changes-text {
    color: #2b9c73;
}

.dark-mode .success-footer {
    color: #2b9c73;
}

/* Center line: subtle in dark mode */
.dark-mode .center-line {
    background: linear-gradient(to bottom,
            transparent 5%,
            rgba(255, 255, 255, 0.08) 30%,
            rgba(255, 255, 255, 0.12) 50%,
            rgba(255, 255, 255, 0.08) 70%,
            transparent 95%);
}

/* Geometric shapes: muted in dark mode */
.dark-mode .app-geo-shape {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
}

/* Scrollbar in dark mode */
.dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Status dot stays green */
.dark-mode .status-dot {
    background-color: #2b9c73;
    box-shadow: 0 0 6px rgba(43, 156, 115, 0.4);
}


/* ═══════════════════════════════════════════
   PHONE VIEW — max-width: 480px
   Single-column stacked layout
   ═══════════════════════════════════════════ */
@media (max-width: 480px) {

    /* ─── Body: scrollable, tighter padding ─── */
    .app-body {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 20px 1.25rem;
    }

    /* ─── Nav: 3-column grid ─── */
    .top-nav {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 12px;
        margin-bottom: 24px;
        width: 100%;
    }

    /* Show mobile title */
    .app-mobile-title {
        display: block;
        text-align: center;
        font-family: 'Outfit', sans-serif;
        font-size: 1.35rem;
        font-weight: 700;
        /* Bold title */
        color: #1a1a2e;
    }

    /* Go back: outlined pill button with 1px black border */
    .go-back-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
        border-radius: 12px;
        gap: 6px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        background: #ffffff;
        border: 1px solid var(--text-light) !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
        color: #2d3444;
    }

    .go-back-btn svg {
        width: 12px;
        height: 12px;
        stroke-width: 2.5px;
    }

    /* Theme toggle: icon-only outlined button with 1px black border */
    .theme-toggle-btn {
        padding: 8px 12px;
        border-radius: 12px;
        min-height: 44px;
        min-width: 44px;
        justify-content: center;
        background: #ffffff;
        border: 1px solid var(--text-light) !important;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
        color: #2d3444;
    }

    #theme-toggle-text {
        display: none;
    }

    /* ─── Glass container: invisible wrapper on mobile ─── */
    .app-glass-container {
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none;
        border-radius: 0;
        padding: 0;
        box-shadow: none;
        overflow: visible;
        flex: none;
    }

    /* ─── Workspace: vertical stack ─── */
    .workspace-panels {
        flex-direction: column;
        gap: 16px;
        margin-bottom: 16px;
    }

    /* ─── Panels: full width cards with identical symmetric height ─── */
    .panel {
        flex: none;
        border-radius: 16px;
        background: #f4f6f9;
        border: 1px solid rgba(0, 0, 0, 0.12);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
        display: flex;
        flex-direction: column;
    }

    /* Set symmetric sizing for both panels */
    .input-panel,
    .output-panel {
        min-height: 380px !important;
        height: 380px !important;
    }

    /* Panel header style inside cards */
    .panel-header {
        padding: 22px 24px 14px 24px;
        background: transparent;
        flex: none;
    }

    .right-header {
        padding: 22px 24px 14px 24px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex: none;
    }

    .header-title {
        font-size: 0.95rem;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 8px;
        color: #1a1a2e;
    }

    /* Text areas: TWO-LAYER LAYOUT (crisp white floating inner sheet) */
    .text-area {
        margin: 0 20px 20px 20px;
        width: calc(100% - 40px);
        padding: 16px 20px;
        font-size: 0.88rem;
        background: #ffffff !important;
        /* Crisp white sheet background */
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        /* 1px inner border */
        border-radius: 12px !important;
        /* Beautiful rounded sheet */
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02) !important;
        resize: none;
        flex: 1;
        /* Stretch symmetrically */
        min-height: 0;
        /* Enable flex-sizing */
        outline: none !important;
        box-sizing: border-box;
    }

    /* Panel footer */ 
    .panel-footer {
        padding: 0 24px 20px 24px;
        background: transparent;
        flex: none;
    }

    /* ─── Structure button: solid blue, full width ─── */
    .center-action {
        display: block;
        position: static;
        transform: none;
        pointer-events: auto;
        width: 100%;
    }

    .structure-btn {
        width: 100%;
        min-height: 54px;
        border-radius: 16px;
        font-size: 1rem;
        font-weight: 600;
        padding: 16px 24px;
        background: linear-gradient(135deg, #5d8dff, #4a7dff);
        box-shadow: 0 4px 14px rgba(74, 125, 255, 0.25);
    }

    /* Copy button: small, outlined, neat */
    .copy-btn {
        padding: 8px 18px;
        font-size: 0.8rem;
        border-radius: 10px;
        min-height: 44px;
        background: #ffffff;
        border: 1px solid var--text-light;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    }

    /* Success footer: only show when there is actual output content! */
    .success-footer {
        font-size: 0.82rem;
        flex-wrap: wrap;
        padding: 0 24px 20px 24px;
    }

    /* Hide success footer if output area is empty */
    .output-area:empty+.success-footer {
        display: none !important;
    }

    /* ─── Clear all: full width, outlined matching structure button shape ─── */
    .bottom-action {
        width: 100%;
        margin-top: 8px;
    }

    .clear-btn {
        width: 100%;
        min-height: 54px;
        justify-content: center;
        background: transparent;
        color: var(--accent-blue);
        border: 1.5px solid var(--accent-blue);
        border-radius: 16px;
        box-shadow: none;
        font-size: 1rem;
        font-weight: 600;
        transition: all 0.3s ease;
    }

    .clear-btn svg {
        stroke: var(--accent-blue);
        width: 16px;
        height: 16px;
    }

    .clear-btn:hover {
        background: var(--accent-blue);
        color: #ffffff;
    }

    .clear-btn:hover svg {
        stroke: #ffffff;
    }

    /* ─── Floating shapes: sit behind cards nicely ─── */
    .app-geo-shapes {
        display: block;
        z-index: 0;
    }

    .app-geo-shape {
        opacity: 0.18 !important;
    }

    /* ─── Center line: keep hidden ─── */
    .center-line {
        display: none;
    }

    /* ─── Dark mode mobile overrides matching the desktop dark Slate/Paper aesthetic ─── */
    .dark-mode.app-body {
        overflow-x: hidden;
    }

    .dark-mode .app-mobile-title {
        color: #ffffff;
    }

    .dark-mode .go-back-btn,
    .dark-mode .theme-toggle-btn {
        background: #2d3540;
        color: #e2e8f0;
        border-color: rgba(255, 255, 255, 0.3) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }

    /* Remove the glass container on phone — keep it invisible like light mode */
    .dark-mode .app-glass-container {
        background: transparent !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        overflow: visible !important;
    }

    /* Panels: light off-white matching the desktop dark mode panels */
    .dark-mode .panel {
        background: #e2e8f0;
        border: 1px solid rgba(0, 0, 0, 0.16);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }

    .dark-mode .header-title {
        color: #2d3444;
    }

    /* Text areas: crisp white floating inner sheets matching desktop */
    .dark-mode .text-area {
        background: #ffffff !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        color: #2d3444 !important;
    }

    .dark-mode .text-area::placeholder {
        color: #8a95a5;
    }

    /* Copy button: matches desktop dark mode copy button */
    .dark-mode .copy-btn {
        background: rgba(255, 255, 255, 0.8);
        color: #4a5568;
        border-color: rgba(0, 0, 0, 0.18);
    }

    /* Structure button: dark charcoal pill matching the desktop dark mode button */
    .dark-mode .structure-btn {
        background: #4a5562 !important;
        color: #ffffff !important;
        border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2) !important;
    }

    .dark-mode .structure-btn:hover {
        background: #5a6572 !important;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
    }

    /* Clear All button: dark charcoal matching the desktop dark mode button */
    .dark-mode .clear-btn {
        background: #4a5562 !important;
        border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
        color: #ffffff !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    }

    .dark-mode .clear-btn svg {
        stroke: #ffffff !important;
    }

    .dark-mode .clear-btn:hover {
        background: #5a6572 !important;
        color: #ffffff !important;
        border-color: rgba(255, 255, 255, 0.35) !important;
    }

    /* Footer text colors */
    .dark-mode .char-count {
        color: #7b8190;
    }

    .dark-mode .panel-footer {
        color: #5a6374;
    }

    .dark-mode .success-footer {
        color: #2b9c73;
    }
}