/* ================================================================
   TRENDING AI — PREMIUM STUDIO REDESIGN
   Presentation-only layer. Does not alter application logic or APIs.
   ================================================================ */

:root {
    --brand: #8b72ff;
    --brand-l: #a694ff;
    --brand-d: #6752d8;
    --accent: #42d6cf;
    --accent-l: #79eee4;
    --bg: #090e19;
    --surface: #101827;
    --surface-card: rgba(18, 28, 45, .88);
    --surface-elevated: #182338;
    --border: rgba(166, 185, 220, .13);
    --border-subtle: rgba(166, 185, 220, .075);
    --border-active: rgba(139, 114, 255, .52);
    --text: #f7f8ff;
    --text-m: #c3cce0;
    --text-s: #8d9bb5;
    --radius: 16px;
    --kling-bg: #090e19;
    --kling-surface: #101827;
    --kling-surface-card: rgba(18, 28, 45, .82);
    --kling-border: rgba(166, 185, 220, .13);
    --kling-border-glow: rgba(139, 114, 255, .36);
    --kling-violet: #8b72ff;
    --kling-cyan: #42d6cf;
    --kling-gradient: linear-gradient(120deg, #8b72ff 0%, #42d6cf 100%);
    --kling-glow: 0 12px 36px -14px rgba(139, 114, 255, .55);
}

html,
body {
    background: #090e19 !important;
    color: var(--text);
}

body {
    isolation: isolate;
    font-family: 'Tajawal', 'Cairo', sans-serif;
    background-image:
        radial-gradient(ellipse at 12% 8%, rgba(78, 89, 190, .17), transparent 34%),
        radial-gradient(ellipse at 88% 82%, rgba(29, 164, 165, .10), transparent 32%),
        linear-gradient(145deg, #0b1020 0%, #090e19 46%, #0b1322 100%) !important;
    letter-spacing: .005em;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: .16;
    background-image: radial-gradient(rgba(180, 196, 230, .28) .65px, transparent .65px);
    background-size: 24px 24px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,.65), transparent 74%);
}


::selection {
    color: #fff;
    background: rgba(139, 114, 255, .55);
}

::-webkit-scrollbar-thumb {
    background: rgba(135, 153, 190, .35);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(139, 114, 255, .62);
}

/* Global interaction clarity */
button,
[role="button"],
label[for] {
    -webkit-tap-highlight-color: transparent;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
    outline: 2px solid rgba(66, 214, 207, .9) !important;
    outline-offset: 3px !important;
}

/* App header */
#app-header {
    min-height: 68px !important;
    height: 68px !important;
    padding-inline: clamp(12px, 2.1vw, 30px) !important;
    gap: 16px;
    background: rgba(10, 16, 29, .88) !important;
    border-bottom: 1px solid rgba(164, 183, 221, .13) !important;
    box-shadow: 0 12px 34px rgba(0, 0, 0, .18);
    backdrop-filter: blur(24px) saturate(145%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(145%) !important;
}

#app-header > div:first-child img {
    border-radius: 10px !important;
}

#app-header > div:first-child > div:first-child {
    width: 40px !important;
    height: 40px !important;
    border-radius: 13px !important;
    padding: 2px !important;
    box-shadow: 0 5px 18px rgba(107, 91, 232, .22) !important;
}

#app-header .brand-title,
#app-header > div:first-child > div:last-child > div:first-child span {
    font-size: 14px !important;
    letter-spacing: -.025em;
}

#guest-subtitle {
    color: #8795b1 !important;
    font-size: 10px !important;
}

#kling-nav-tabs {
    padding: 4px !important;
    gap: 4px !important;
    border-radius: 15px !important;
    background: rgba(18, 28, 46, .72) !important;
    border: 1px solid rgba(166, 185, 220, .11) !important;
    box-shadow: inset 0 1px rgba(255,255,255,.035);
}

.kling-nav-tab {
    min-height: 38px;
    padding: 8px 15px !important;
    border-radius: 11px !important;
    color: #9aa8c0 !important;
    font-size: 12px !important;
}
.kling-nav-tab:hover {
    background: rgba(139, 114, 255, .10) !important;
    color: #fff !important;
    transform: none !important;
}
.kling-nav-tab.active {
    color: #fff !important;
    background: linear-gradient(135deg, rgba(128, 105, 246, .30), rgba(58, 190, 190, .13)) !important;
    border-color: rgba(151, 135, 255, .36) !important;
    box-shadow: inset 0 1px rgba(255,255,255,.09), 0 5px 15px rgba(0,0,0,.16) !important;
}
.kling-nav-tab.active i {
    color: #b7aaff !important;
    filter: none !important;
}

.hbtn {
    min-height: 36px;
    padding: 7px 12px !important;
    border-radius: 11px !important;
    font-size: 11px !important;
}
.hbtn-ghost {
    color: #d4dcef !important;
    background: rgba(255,255,255,.045) !important;
    border: 1px solid rgba(166,185,220,.13) !important;
}
.hbtn-ghost:hover {
    color: #fff !important;
    background: rgba(139,114,255,.14) !important;
    border-color: rgba(139,114,255,.38) !important;
}
#btn-upgrade {
    border-radius: 11px !important;
    box-shadow: 0 5px 18px rgba(245, 158, 11, .16);
}

/* Main studio shell */
main {
    background: transparent !important;
    min-height: 0;
}
#result-section {
    min-width: 0;
    background: rgba(9, 14, 25, .34) !important;
}
#edit-toolbar {
    min-height: 54px !important;
    height: 54px !important;
    padding-inline: 16px !important;
    background: rgba(13, 21, 36, .84) !important;
    border-bottom: 1px solid rgba(166,185,220,.11) !important;
    backdrop-filter: blur(18px);
}
.toolbar-btn {
    min-height: 34px;
    border-radius: 10px !important;
    color: #bac6dc !important;
}
.toolbar-btn:hover {
    color: #fff !important;
    background: rgba(139,114,255,.13) !important;
}

#tool-sidebar {
    width: 64px !important;
    background: rgba(13, 20, 34, .94) !important;
    border-inline-end: 1px solid rgba(166,185,220,.12) !important;
    border-inline-start: 0 !important;
    padding-top: 14px !important;
    gap: 7px !important;
    backdrop-filter: blur(18px);
}
.tool-btn-side {
    width: 44px !important;
    height: 44px !important;
    border-radius: 13px !important;
    color: #9cabc5 !important;
}
.tool-btn-side:hover {
    color: #fff !important;
    background: rgba(139,114,255,.13) !important;
    border-color: rgba(139,114,255,.18) !important;
}
.tool-btn-side.active {
    color: #c9c0ff !important;
    background: linear-gradient(145deg, rgba(139,114,255,.25), rgba(66,214,207,.08)) !important;
    border-color: rgba(151,135,255,.42) !important;
    box-shadow: inset 0 1px rgba(255,255,255,.07), 0 5px 18px rgba(95,78,200,.16) !important;
}
.tool-btn-side::after {
    background: #172238 !important;
    border-color: rgba(166,185,220,.18) !important;
    border-radius: 9px !important;
}

#workspace-container {
    background-color: transparent !important;
    background-image:
        radial-gradient(ellipse at 50% 42%, rgba(46, 67, 112, .23), transparent 58%),
        linear-gradient(rgba(160,180,220,.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(160,180,220,.025) 1px, transparent 1px) !important;
    background-size: auto, 36px 36px, 36px 36px !important;
    padding: clamp(14px, 2.4vw, 34px) !important;
}
#workspace-inner {
    width: min(100%, 1000px) !important;
    max-width: 1000px !important;
}
#empty-state {
    width: 100% !important;
    max-width: 940px !important;
    padding: clamp(18px, 3vw, 38px) !important;
    animation-duration: .4s;
}
#empty-state > div:first-child {
    margin-bottom: 25px !important;
}
#empty-state > div:first-child > div:first-child span {
    padding: 7px 14px !important;
    border-radius: 999px !important;
    border-color: rgba(145, 129, 255, .28) !important;
    color: #c8c0ff !important;
    background: rgba(116, 98, 223, .10) !important;
    letter-spacing: .015em;
}
#empty-state h2 {
    margin-top: 8px !important;
    margin-bottom: 7px !important;
    font-size: clamp(27px, 3vw, 42px) !important;
    line-height: 1.25 !important;
    letter-spacing: -.045em !important;
    background: linear-gradient(100deg, #fff 18%, #c9c4ff 57%, #7ce6de 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
#home-user-status-banner {
    max-width: 620px !important;
    color: #9eacc4 !important;
    font-size: 13px !important;
}
#btn-home-quick-gallery {
    color: #9be9e2 !important;
    background: rgba(66,214,207,.09) !important;
    border-color: rgba(66,214,207,.19) !important;
    border-radius: 999px !important;
    padding: 6px 11px !important;
}

/* The three primary journeys */
#home-primary-tasks {
    gap: 12px !important;
    margin-bottom: 18px !important;
}
.home-task-card {
    min-height: 94px !important;
    padding: 15px 16px !important;
    gap: 13px !important;
    border-radius: 17px !important;
    background: linear-gradient(150deg, rgba(24,35,57,.88), rgba(16,25,42,.92)) !important;
    border: 1px solid rgba(166,185,220,.13) !important;
    box-shadow: 0 10px 26px rgba(0,0,0,.15), inset 0 1px rgba(255,255,255,.035);
    backdrop-filter: blur(16px);
}
.home-task-card:hover {
    transform: translateY(-3px) !important;
    background: linear-gradient(150deg, rgba(30,43,69,.96), rgba(17,29,47,.96)) !important;
    box-shadow: 0 18px 34px rgba(0,0,0,.24) !important;
}
.home-task-card.card-task-image:hover { border-color: rgba(151,135,255,.55) !important; }
.home-task-card.card-task-edit:hover { border-color: rgba(66,214,207,.48) !important; }
.home-task-card.card-task-video:hover { border-color: rgba(245,184,91,.48) !important; }
.home-task-icon-wrap {
    width: 48px !important;
    height: 48px !important;
    border-radius: 15px !important;
    box-shadow: inset 0 1px rgba(255,255,255,.08);
}
.home-task-card h3 {
    font-size: 13px !important;
    line-height: 1.5;
}
.home-task-card p {
    color: #96a5bf !important;
    line-height: 1.55;
}

/* Prompt composer */
#home-prompt-box {
    padding: clamp(16px, 2vw, 22px) !important;
    border-radius: 20px !important;
    background: linear-gradient(145deg, rgba(19,30,49,.96), rgba(13,22,38,.96)) !important;
    border: 1px solid rgba(151,135,255,.24) !important;
    box-shadow: 0 20px 48px rgba(0,0,0,.23), inset 0 1px rgba(255,255,255,.055) !important;
    position: relative;
    overflow: hidden;
}
#home-prompt-box::before {
    content: "";
    position: absolute;
    top: 0;
    right: 7%;
    left: 7%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(168,153,255,.75), rgba(66,214,207,.45), transparent);
}
#home-prompt-box > div:first-child {
    margin-bottom: 12px !important;
}
#home-prompt-box textarea,
#prompt-input,
.prompt-area {
    min-height: 96px;
    padding: 15px 16px !important;
    color: #f5f7ff !important;
    background: rgba(6, 12, 23, .72) !important;
    border: 1px solid rgba(166,185,220,.17) !important;
    border-radius: 14px !important;
    line-height: 1.8 !important;
    font-size: 14px !important;
    box-shadow: inset 0 2px 8px rgba(0,0,0,.12);
}
#home-prompt-box textarea:focus,
#prompt-input:focus,
.prompt-area:focus {
    border-color: rgba(139,114,255,.65) !important;
    box-shadow: 0 0 0 4px rgba(139,114,255,.10), inset 0 2px 8px rgba(0,0,0,.12) !important;
}
#home-prompt-box textarea::placeholder,
#prompt-input::placeholder,
.prompt-area::placeholder {
    color: #71809b !important;
}
#btn-home-generate,
#btn-generate,
#mobile-btn-generate,
#btn-generate-video-action {
    border: 1px solid rgba(255,255,255,.13) !important;
    border-radius: 13px !important;
    background: linear-gradient(115deg, #7868ed 0%, #7164db 48%, #279f9f 100%) !important;
    box-shadow: 0 9px 24px rgba(101,84,211,.22), inset 0 1px rgba(255,255,255,.16) !important;
    letter-spacing: .01em;
}
#btn-home-generate {
    min-height: 52px;
    padding-inline: 24px !important;
}
#btn-home-generate:hover,
#btn-generate:hover,
#btn-generate-video-action:hover {
    filter: brightness(1.09) saturate(1.05);
    transform: translateY(-2px) !important;
    box-shadow: 0 14px 28px rgba(101,84,211,.30), inset 0 1px rgba(255,255,255,.2) !important;
}
#btn-home-generate:active,
#btn-generate:active,
#btn-generate-video-action:active {
    transform: translateY(0) scale(.99) !important;
}
#home-generation-cost-badge {
    color: #f7d18a !important;
    background: rgba(210,156,64,.12) !important;
    border-color: rgba(210,156,64,.23) !important;
}
#home-user-balance-val {
    color: #b9adff !important;
}

.prompt-preset-chip,
.chip,
.aspect-chip-inner,
.ratio-card {
    border-radius: 10px !important;
}
.prompt-preset-chip {
    min-height: 35px;
    padding: 7px 12px !important;
    color: #c4cde0 !important;
    background: rgba(255,255,255,.045) !important;
    border: 1px solid rgba(166,185,220,.12) !important;
}
.prompt-preset-chip:hover,
.chip:hover {
    color: #fff !important;
    background: rgba(139,114,255,.14) !important;
    border-color: rgba(139,114,255,.32) !important;
}
#home-prompt-presets-container {
    border-color: rgba(166,185,220,.10) !important;
}

/* Advanced tools cards */
#home-advanced-tools-section {
    gap: 14px !important;
    padding-top: 12px;
}
#upload-area,
#camera-upload-area {
    min-height: 48px;
    border-radius: 12px !important;
    background: rgba(255,255,255,.035) !important;
    border-color: rgba(166,185,220,.18) !important;
}
.clipdrop-card {
    border-radius: 15px !important;
    background: linear-gradient(155deg, rgba(24,35,57,.94), rgba(14,23,40,.96)) !important;
    border: 1px solid rgba(166,185,220,.12) !important;
    box-shadow: 0 8px 20px rgba(0,0,0,.14);
}
.clipdrop-card:hover {
    border-color: rgba(139,114,255,.45) !important;
    box-shadow: 0 14px 30px rgba(0,0,0,.28) !important;
}
.clipdrop-gif-wrap {
    background: #0b1424 !important;
}
.clipdrop-content {
    padding: 11px 12px 13px !important;
}
.clipdrop-title {
    color: #f2f5ff !important;
    font-size: 12px !important;
}
.clipdrop-desc {
    color: #8999b5 !important;
    line-height: 1.55;
}

/* Inspector / layer panel */
#layers-panel,
.studio-panel {
    background: rgba(13, 21, 36, .97) !important;
    border-color: rgba(166,185,220,.12) !important;
    box-shadow: -12px 0 40px rgba(0,0,0,.20) !important;
}
#layers-panel > div:nth-child(2) {
    background: rgba(21,31,51,.96) !important;
    border-color: rgba(166,185,220,.12) !important;
}
#layers-panel .studio-group-card {
    padding: 14px !important;
    border-radius: 15px !important;
    background: rgba(23,35,57,.72) !important;
    border-color: rgba(166,185,220,.11) !important;
    box-shadow: 0 8px 22px rgba(0,0,0,.12) !important;
}
#layers-panel .studio-group-card:hover {
    border-color: rgba(139,114,255,.27) !important;
}
#layers-panel .prop-accordion-group {
    border-radius: 13px !important;
    border-color: rgba(166,185,220,.12) !important;
    background: rgba(255,255,255,.025) !important;
}
#layers-panel .prop-accordion-header {
    min-height: 48px;
    border-radius: 12px !important;
}
#btn-tab-layers-list,
#btn-tab-layers-props,
#btn-tab-studio-generate {
    min-height: 38px;
    border-radius: 10px !important;
}

#history-drawer-panel {
    background: rgba(13,21,36,.98) !important;
    border-color: rgba(166,185,220,.12) !important;
    box-shadow: 12px 0 34px rgba(0,0,0,.18);
}
#history-drawer-panel > div:first-child,
#history-drawer-panel > div:last-child {
    background: rgba(21,31,51,.96) !important;
}

/* Feed / explore */
#view-feed {
    background:
        radial-gradient(ellipse at 50% 0%, rgba(92,86,190,.14), transparent 45%),
        transparent !important;
}
#view-feed h2 {
    letter-spacing: -.025em;
}
.kling-feed-card {
    border-radius: 18px !important;
    background: #101a2b !important;
    border-color: rgba(166,185,220,.14) !important;
    box-shadow: 0 10px 26px rgba(0,0,0,.16);
}
.kling-feed-card:hover {
    border-color: rgba(139,114,255,.48) !important;
    box-shadow: 0 18px 36px rgba(0,0,0,.27), 0 0 24px rgba(139,114,255,.10) !important;
}
.kling-feed-overlay {
    background: linear-gradient(180deg, rgba(5,10,18,.02) 12%, rgba(5,10,18,.30) 45%, rgba(5,10,18,.94) 100%) !important;
}

/* Video studio and common dialogs */
#video-studio-modal {
    background: rgba(4,8,16,.88) !important;
    backdrop-filter: blur(18px) saturate(140%) !important;
}
#video-settings-panel,
#video-studio-workspace,
#video-editor-mode-panel {
    background-color: #101a2b !important;
    border-color: rgba(166,185,220,.13) !important;
}
#video-settings-panel,
#video-studio-modal .studio-group-card {
    border-radius: 16px !important;
}
#video-studio-modal input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
#video-studio-modal textarea,
#video-studio-modal select,
#layers-panel input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
#layers-panel textarea,
#layers-panel select {
    background-color: rgba(6,12,23,.76) !important;
    border-color: rgba(166,185,220,.16) !important;
    border-radius: 11px !important;
}
#video-studio-modal button,
#layers-panel button {
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
#video-studio-modal button:not(:disabled):hover,
#layers-panel button:not(:disabled):hover {
    border-color: rgba(139,114,255,.32);
}
#delete-confirm-modal .modal-card,
#home-action-modal > div,
#server-settings-modal > div {
    border-color: rgba(166,185,220,.17) !important;
    border-radius: 20px !important;
    background: linear-gradient(145deg, #18243a, #101a2b) !important;
    box-shadow: 0 28px 80px rgba(0,0,0,.48) !important;
}

/* Mobile navigation */
#mobile-kling-dock {
    min-height: 66px;
    padding: 7px 8px max(8px, env(safe-area-inset-bottom)) !important;
    background: rgba(11,17,30,.96) !important;
    border-top: 1px solid rgba(166,185,220,.13) !important;
    box-shadow: 0 -12px 32px rgba(0,0,0,.22);
    backdrop-filter: blur(22px) saturate(150%) !important;
}
.kling-dock-btn {
    min-height: 48px;
    border-radius: 13px !important;
    color: #8190aa !important;
    transition: all .2s ease;
}
.kling-dock-btn.active {
    color: #d4ceff !important;
    background: linear-gradient(145deg, rgba(139,114,255,.20), rgba(66,214,207,.08)) !important;
    border: 1px solid rgba(139,114,255,.22) !important;
}
#mobile-dock {
    background: rgba(11,17,30,.96) !important;
    border-color: rgba(166,185,220,.13) !important;
}
#mobile-prompt-bar {
    background: rgba(13,21,36,.96) !important;
    border-color: rgba(166,185,220,.14) !important;
}
#mobile-prompt-bar textarea {
    background: rgba(5,11,21,.8) !important;
    border-color: rgba(166,185,220,.18) !important;
    border-radius: 12px !important;
}

/* Tooltips, popovers and floating controls */
#app-floating-tooltip,
#smart-popup,
#shapes-popover-menu,
#doc-popover-menu {
    background: rgba(19,30,49,.97) !important;
    border-color: rgba(166,185,220,.19) !important;
    border-radius: 14px !important;
    box-shadow: 0 20px 50px rgba(0,0,0,.42) !important;
}
#active-tool-indicator {
    background: rgba(17,28,47,.94) !important;
    border-color: rgba(166,185,220,.17) !important;
    border-radius: 14px !important;
}

/* Respect reduced-motion preferences and keep all controls legible */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}

@media (max-width: 1024px) {
    #app-header {
        gap: 8px !important;
        padding-inline: 12px !important;
    }
    #edit-toolbar {
        padding-inline: 10px !important;
    }
    #empty-state {
        max-width: 820px !important;
    }
}

@media (max-width: 767px) {
    #app-header {
        min-height: 54px !important;
        height: 54px !important;
        padding-inline: 10px !important;
        gap: 6px !important;
    }
    #app-header > div:first-child > div:first-child {
        width: 32px !important;
        height: 32px !important;
    }
    #app-header .brand-title,
    #app-header > div:first-child > div:last-child > div:first-child span {
        font-size: 13px !important;
    }
    #edit-toolbar {
        min-height: 48px !important;
        height: 48px !important;
        padding-inline: 8px !important;
    }
    #tool-sidebar {
        width: 48px !important;
    }
    .tool-btn-side {
        width: 36px !important;
        height: 36px !important;
        border-radius: 11px !important;
    }
    #workspace-container {
        padding: 10px !important;
    }
    #empty-state {
        padding: 18px 12px 24px !important;
    }
    #empty-state > div:first-child {
        margin-bottom: 17px !important;
    }
    #empty-state h2 {
        font-size: clamp(25px, 7vw, 34px) !important;
    }
    #home-user-status-banner {
        font-size: 11px !important;
    }
    #home-primary-tasks {
        gap: 8px !important;
        margin-bottom: 13px !important;
    }
    .home-task-card {
        min-height: 72px !important;
        padding: 10px 11px !important;
        border-radius: 14px !important;
        gap: 10px !important;
    }
    .home-task-icon-wrap {
        width: 40px !important;
        height: 40px !important;
        border-radius: 12px !important;
    }
    .home-task-card h3 {
        font-size: 11px !important;
    }
    .home-task-card p {
        font-size: 10px !important;
    }
    #home-prompt-box {
        padding: 13px !important;
        border-radius: 16px !important;
        margin-bottom: 12px !important;
    }
    #home-prompt-box textarea,
    #prompt-input,
    .prompt-area {
        min-height: 84px;
        font-size: 13px !important;
        padding: 12px !important;
    }
    #btn-home-generate {
        min-height: 46px;
        width: 100%;
    }
    #home-prompt-presets-container {
        margin-top: 9px !important;
        padding-top: 9px !important;
    }
    #layers-panel {
        border-radius: 20px 20px 0 0 !important;
        background: rgba(13,21,36,.99) !important;
        border-top: 1px solid rgba(166,185,220,.20) !important;
    }
    #sheet-drag-bar {
        background: rgba(21,31,51,.96) !important;
    }
    #mobile-kling-dock {
        padding-bottom: max(8px, env(safe-area-inset-bottom)) !important;
    }
}

@media (max-width: 420px) {
    #home-primary-tasks {
        grid-template-columns: 1fr !important;
    }
    .home-task-card {
        min-height: 66px !important;
    }
    #empty-state > div:first-child > div:first-child span {
        font-size: 9.5px !important;
        padding: 6px 10px !important;
    }
}

/* ═══════════════════════════════════════════════
   📱 MOBILE VIEWPORT & NAVBAR OVERFLOW FIXES (≤ 640px)
═══════════════════════════════════════════════ */
@media (max-width: 640px) {
    #app-header {
        min-height: 50px !important;
        height: 50px !important;
        padding: 0 6px !important;
        padding-inline: 6px !important;
        gap: 4px !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
    }
    #app-header > div:first-child {
        max-width: 130px !important;
        gap: 5px !important;
        flex-shrink: 0 !important;
        min-width: 0 !important;
        display: flex !important;
        align-items: center !important;
    }
    #app-header > div:first-child > div:first-child {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        border-radius: 8px !important;
        padding: 1px !important;
        box-shadow: none !important;
    }
    #app-header .brand-title,
    #app-header > div:first-child > div:last-child > div:first-child span {
        font-size: 11.5px !important;
        line-height: 1.15 !important;
    }
    #user-credits-display {
        margin-top: 1px !important;
    }
    #user-credits-display span,
    #credits-count {
        font-size: 9px !important;
        line-height: 1 !important;
    }
    #mobile-header-actions {
        display: flex !important;
        align-items: center !important;
        gap: 3px !important;
        flex-shrink: 0 !important;
        min-width: 0 !important;
    }
    #btn-header-gallery-mob,
    #btn-upgrade-mob {
        height: 28px !important;
        min-height: 28px !important;
        padding: 0 6px !important;
        font-size: 10px !important;
        font-weight: 800 !important;
        border-radius: 8px !important;
        gap: 3px !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
    }
    #btn-header-gallery-mob i,
    #btn-upgrade-mob i {
        font-size: 12px !important;
    }
    #btn-reset-mob,
    #btn-mobile-menu-toggle {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        min-height: 28px !important;
        border-radius: 8px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
    }
    /* Toolbar adjustments when editing on mobile */
    #edit-toolbar {
        min-height: 44px !important;
        height: 44px !important;
        padding: 0 6px !important;
        padding-inline: 6px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
    #edit-tools {
        min-width: 0 !important;
        width: 100% !important;
        gap: 4px !important;
    }
    #edit-tools .toolbar-btn {
        min-height: 30px !important;
        height: 30px !important;
        padding: 0 6px !important;
        font-size: 10px !important;
        border-radius: 8px !important;
    }
    #btn-undo, #btn-redo, #btn-remove-upload, #btn-show-comparison {
        width: 28px !important;
        height: 28px !important;
        min-width: 28px !important;
        padding: 0 !important;
        justify-content: center !important;
    }
}

/* Narrow screen responsive adjustments (≤ 380px) */
@media (max-width: 380px) {
    #app-header {
        padding: 0 4px !important;
        padding-inline: 4px !important;
        gap: 2px !important;
    }
    #app-header > div:first-child {
        max-width: 110px !important;
        gap: 4px !important;
    }
    #app-header > div:first-child > div:first-child {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
    }
    #app-header .brand-title,
    #app-header > div:first-child > div:last-child > div:first-child span {
        font-size: 10.5px !important;
    }
    #btn-header-gallery-mob span {
        display: none !important;
    }
    #btn-header-gallery-mob {
        width: 28px !important;
        min-width: 28px !important;
        padding: 0 !important;
        justify-content: center !important;
    }
    #btn-upgrade-mob {
        padding: 0 5px !important;
        font-size: 9.5px !important;
    }
    #btn-reset-mob,
    #btn-mobile-menu-toggle {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
    }
}

