
.code-scroll::-webkit-scrollbar { height: 8px; }
.code-scroll::-webkit-scrollbar-track { background: #1e1e1e; border-bottom-left-radius: 8px; border-bottom-right-radius: 8px; }
.code-scroll::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }
.code-scroll::-webkit-scrollbar-thumb:hover { background: #666; }
body { 
    background-color: #050505; 
    color: white; 
    margin: 0; 
    width: 100%; 
    height: calc(100dvh - 77px); 
    display: flex; 
    flex-direction: column; 
    transition: all 0.5s ease; 
    padding-bottom: env(safe-area-inset-bottom, 20px); 
}
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.4);
}

body.theme-dark ::-webkit-scrollbar-thumb,
body.theme-midnight ::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
}

body.theme-dark ::-webkit-scrollbar-thumb:hover,
body.theme-midnight ::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.4);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

body.theme-dark *, 
body.theme-midnight * {
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}
body.started #middle-zone { flex: 0 0 auto; justify-content: flex-end; padding-bottom: clamp(20px, 5dvh, 40px); }
#app-container { width: 100%; padding: 0 4px}
.island-box { margin-bottom: 10px; }
#star-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
#custom-scrollbar { position: absolute; right: 6px; top: 20px; bottom: 20px; width: 4px; z-index: 60; display: none; pointer-events: none; }
#scroll-thumb { position: absolute; width: 8px; height: 8px; right: -2px; background: white; border-radius: 50%; box-shadow: 0 0 10px 2px rgba(255,255,255,0.8); cursor: pointer; pointer-events: auto; transition: transform 0.1s; }
#scroll-thumb:hover, #scroll-thumb.dragging { transform: scale(1.5); }
#main-layout { display: flex; width: 100%; height: 100%; position: relative; transition: all 0.5s ease; }
#left-panel { flex: 1; display: flex; flex-direction: column; height: 100%; position: relative; transition: all 0.5s ease; justify-content: center; }
#right-panel { flex: 0; width: 0; opacity: 0; overflow: hidden; border-left: 1px solid rgba(255,255,255,0.1); background: #0a0a0a; transition: all 0.5s ease; display: flex; flex-direction: column; }
body.mode-code #left-panel { flex: 0 0 50%; }
body.mode-code #right-panel { flex: 1; opacity: 1; width: auto; padding: 20px; }
body:not(.started) #top-zone { flex: 0 0 0; opacity: 0; height: 0; padding: 0; overflow: hidden; }
body:not(.started) #middle-zone { flex: 1; justify-content: center; padding-bottom: 20px; }
body.started #top-zone { flex: 1; min-height: 0; opacity: 1; padding-bottom: 12px; }
body.started #middle-zone { flex: 0 0 auto; justify-content: flex-end; padding-bottom: 20px; }
#top-zone { width: 100%; max-width: 600px; margin: 0 auto; display: flex; flex-direction: column; position: relative; transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
#middle-zone { width: 90%; max-width: 600px; margin: 0 auto; display: flex; flex-direction: column; z-index: 50; transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.island-box { width: 100%; background: rgba(10, 10, 10, 0.85); backdrop-filter: blur(40px); box-shadow: 0 0 25px rgba(255, 255, 255, 0.12); border-radius: 28px; position: relative; overflow: hidden; transition: transform 0.3s; border: 1px solid rgba(255, 255, 255, 0.1); }
#loader-overlay { position: absolute; inset: 0; border-radius: 28px; background: rgba(255, 255, 255, 0.9); display: flex; align-items: center; justify-content: center; z-index: 100; opacity: 0; pointer-events: none; transition: opacity 0.3s; box-shadow: 0 0 50px 10px rgba(255,255,255,0.6); }
#loader-overlay.active { opacity: 1; pointer-events: auto; animation: white-glow 1.5s infinite alternate; }
@keyframes white-glow { from { box-shadow: 0 0 20px rgba(255,255,255,0.5); } to { box-shadow: 0 0 60px rgba(255,255,255,0.9); } }
.app-grid { width: 100%; display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 12px; justify-items: center; max-height: 100px; overflow: hidden; transition: opacity 0.3s; }
.app-item { width: 44px; height: 44px; border-radius: 50%; box-shadow: 0 0 5px rgba(255, 255, 255, 0.12); background: rgba(255,255,255,0.05); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; }
.app-item:hover { background: rgba(255,255,255,0.2); }
.app-item img { width: 22px; height: 22px; border-radius: 50%; opacity: 0.85; }
.btn-icon { color: rgba(255,255,255,0.3); transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
.btn-submit { background: white; color: black; border-radius: 50%; transition: all 0.2s; }
.btn-submit:hover { transform: scale(1.05); box-shadow: 0 0 15px rgba(255,255,255,0.5); }
.btn-submit.stop-mode { background: #ff4444; color: white; }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(5px); z-index: 100; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-box { background: #151515; border: 1px solid rgba(255,255,255,0.15); border-radius: 24px; padding: 24px; width: 90%; max-width: 320px; text-align: center; transform: scale(0.95); transition: transform 0.3s; box-shadow: 0 20px 50px rgba(0,0,0,0.8); }
.modal-overlay.show .modal-box { transform: scale(1); }
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%) translateY(-10px); background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid rgba(255, 255, 255, 0.4); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08); color: #333; padding: 10px 20px; border-radius: 99px; font-weight: 400; font-size: 0.8rem; letter-spacing: 0.03em; opacity: 0; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); pointer-events: none; z-index: 200; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#img-preview-container { margin-top: 15px; width: 100%; display: none; animation: fadeIn 0.3s ease; }
#img-preview-container.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.custom-scrollbar-code::-webkit-scrollbar { height: 6px; }
.custom-scrollbar-code::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
.custom-scrollbar-code::-webkit-scrollbar-track { background: transparent; }
#progress-bar { height: 100%; background: white; width: 0; transition: all 0.3s; box-shadow: 0 0 15px 2px rgba(255, 255, 255, 0.8); }
@media (max-width: 768px) {
    body.mode-code #left-panel { flex: 1 0 100% !important; width: 100% !important; max-width: 100% !important; }
    #right-panel { display: none !important; width: 0 !important; flex: 0 !important; }
    #right-panel.mobile-active { display: flex !important; position: fixed !important; top: 0; left: 0; right: 0; bottom: 0; width: 100% !important; height: 100% !important; z-index: 9999 !important; background: #151515; opacity: 1 !important; padding: 0 !important; margin: 0 !important; }
}
.store-item, .fixed-app-item { position: relative; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.05); border-radius: 12px; width: 100%; aspect-ratio: 1/1; cursor: pointer; transition: all 0.2s; border: 1px solid rgba(255,255,255,0.05); }
.fixed-app-item { width: 48px; height: 48px; flex-shrink: 0; }
.store-item:hover, .fixed-app-item:hover { background: rgba(255,255,255,0.15); transform: scale(1.05); border-color: rgba(255,255,255,0.2); }
.store-item img, .fixed-app-item img, .fixed-app-item i { width: 50%; height: 50%; object-fit: contain; transition: transform 0.2s; filter: brightness(0) invert(1); opacity: 0.8; }
.store-item:hover img, .fixed-app-item:hover img { opacity: 1; }
.store-item span { display: none; }
.fixed-delete-btn { position: absolute; top: -5px; right: -5px; width: 18px; height: 18px; background: #ef4444; color: white; border-radius: 50%; display: flex; align-items: center; justify-content: center; opacity: 0; transform: scale(0.8); transition: all 0.2s; z-index: 10; border: 1px solid rgba(255,255,255,0.2); }
.fixed-delete-btn i { font-size: 12px; width: auto !important; height: auto !important; filter: none !important; }
.fixed-app-item:hover .fixed-delete-btn { opacity: 1; transform: scale(1); }
#store-panel { max-height: 0; opacity: 0; overflow: hidden; transition: all 0.3s ease-in-out; margin: 0; padding: 0 16px; }
#store-panel.open { max-height: 800px; opacity: 1; margin-top: 8px; margin-bottom: 8px; padding-bottom: 8px}
#store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); gap: 10px; max-height: 350px; overflow-y: auto; padding: 4px; padding-right: 8px; }
#store-grid::-webkit-scrollbar { width: 6px; display: block; }
#store-grid::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 3px; }
#store-grid::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 3px; }
#store-grid::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.5); }
.app-letter-icon { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; color: white; border-radius: 12px; text-transform: uppercase; position: absolute; top: 0; left: 0; z-index: 0; }
.store-item img, .fixed-app-item img { filter: none !important; width: 100%; height: 100%; object-fit: cover; opacity: 1; }
.fixed-delete-btn i { filter: none; }
.store-filter-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; color: #888; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.05); transition: all 0.2s; flex-shrink: 0; }
.store-filter-btn:hover { background: rgba(255,255,255,0.15); color: white; transform: scale(1.05); }
.store-filter-btn.active { background: white; color: black; border-color: white; }
body { width: 100%; overflow-x: hidden; }
@media (max-width: 768px) {
    #middle-zone { width: 100%; max-width: 100vw; margin: 0 auto; padding-left: 12px; padding-right: 12px; }
    .island-box, textarea, #store-category-filters { max-width: 100%; }
}
.btn-share-no-hover { transition: none !important; transform: none !important; }
.btn-share-no-hover:hover { transform: none !important; opacity: 1 !important; background-color: rgba(0, 0, 0, 0.5) !important; }
#img-preview-container { display: none; transition: opacity 0.3s ease; }
#img-preview-container.active { display: block !important; opacity: 1 !important; visibility: visible !important; }
#preview-img { pointer-events: auto; max-height: 80vh; }
#chat-box { display: flex; flex-direction: column; height: 100%; overflow-y: auto; }
.mt-auto { margin-top: auto !important; }
#chat-box > div:first-child { margin-top: auto !important; }
:root { --bg-main: #080808; --bg-island: rgba(20, 20, 20, 0.8); --accent: #ffffff; --accent-text: #000000; --text-main: #e5e5e5; --text-dim: rgba(255, 255, 255, 0.35); --border: rgba(255, 255, 255, 0.08); }
body { background-color: var(--bg-main) !important; color: var(--text-main) !important; transition: background 0.4s ease; }
.island-box { background: var(--bg-island) !important; }
#prompt-input { color: var(--text-main) !important; caret-color: var(--accent) !important; }
#prompt-input::placeholder { color: var(--text-dim) !important; }
.btn-icon { color: var(--text-dim) !important; transition: all 0.3s ease; }
.btn-icon.active, .btn-icon:hover { color: var(--accent) !important; transform: scale(1.1); text-shadow: 0 0 3px var(--accent); }
.btn-submit { background: var(--accent) !important; color: var(--accent-text) !important; }
.btn-submit i { color: var(--accent-text) !important; }
#progress-bar { background: var(--accent) !important; box-shadow: 0 0 10px var(--accent) !important; }
#right-panel, #code-editor { background: var(--bg-main) !important; color: var(--text-main) !important; }
#code-tabs { background: var(--bg-island) !important; border-color: var(--border) !important; }
#chat-box div { border-color: var(--border) !important; }
#welcome-msg { background: var(--border) !important; color: var(--text-main) !important; border: none !important; border-radius: 16px !important; padding: 10px 16px !important; }
.app-item, .store-item, .fixed-app-item { background: var(--border) !important; border: 1.5px solid var(--border-strong) !important; transition: all 0.3s ease; }
#bg-visual-layer { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -2; transition: all 0.8s ease; display: none !important; }
body.theme-midnight #bg-visual-layer { background: linear-gradient(180deg, #0f172a 0%, #020617 100%); }
body.theme-midnight::after { content: ''; position: fixed; inset: 0; z-index: -1; background: radial-gradient(circle at 50% -20%, rgba(0, 168, 255, 0.15), transparent); }
body.theme-forest #bg-visual-layer { background: #0a0c0a; }
body.theme-forest::after { content: ''; position: fixed; inset: 0; z-index: -1; background: radial-gradient(circle at 80% 20%, rgba(20, 83, 45, 0.2), transparent); }
body.theme-sky .sky { background-color: rgb(255 255 255 / 0.8) !important; color: #555 !important; }
body.theme-light, body.theme-sky { background-color: #ffffff !important; background-image: radial-gradient(circle at 50% 40%, rgba(255, 200, 210, 0.25) 0%, rgba(200, 230, 255, 0.25) 30%, rgba(255, 255, 255, 0) 70%) !important; color: #1a1a1a !important; }
body, body.theme-dark, body.theme-midnight { background-color: #0a0a0a !important; background-image: radial-gradient(circle at 50% 40%, rgba(50, 60, 100, 0.4) 0%, rgba(30, 30, 40, 0.4) 40%, rgba(10, 10, 10, 0) 80%) !important; background-attachment: fixed !important; color: #e5e5e5 !important; }
.island-box { box-shadow: none !important; backdrop-filter: blur(15px) !important; -webkit-backdrop-filter: blur(15px) !important; border-radius: 24px !important; }
body.theme-light .island-box, body.theme-sky .island-box { background: rgba(255, 255, 255, 0.4) !important; }
body.theme-light #prompt-input { color: #000 !important; }
body.theme-light #prompt-input::placeholder { color: rgba(0,0,0,0.4) !important; }
body.theme-dark .island-box, body.theme-midnight .island-box { background: rgba(30, 30, 30, 0.4) !important; }
body.theme-dark #prompt-input { color: #fff !important; }
body.theme-dark #prompt-input::placeholder { color: rgba(255,255,255,0.3) !important; }
.app-item, .store-item, .fixed-app-item { width: 48px !important; height: 48px !important; border-radius: 14px !important; transition: all 0.2s ease-out !important; display: flex; align-items: center; justify-content: center; box-shadow: none !important; }
body.theme-light .app-item, body.theme-light .store-item { background: rgba(255, 255, 255, 0.5) !important; }

body.theme-light .app-item img { filter: none !important; opacity: 0.8; }
body.theme-dark .app-item, body.theme-dark .store-item { background: rgba(255, 255, 255, 0.05) !important; }
body.theme-dark .app-item img, body.theme-dark .store-item img { filter: brightness(0) invert(1) !important; opacity: 0.7 !important; }

.btn-submit { box-shadow: none !important; width: 40px !important; height: 40px !important; }
body.theme-light .btn-submit { background: #000 !important; color: #fff !important; }
body.theme-dark .btn-submit { background: #fff !important; color: #000 !important; }
body.theme-dark .btn-submit i { color: #000 !important; }
body.theme-light .btn-icon { color: #999 !important; }
body.theme-light .btn-icon:hover { color: #000 !important; background: transparent !important; }
body.theme-dark .btn-icon { color: #666 !important; }
body.theme-dark .btn-icon:hover, body.theme-dark .btn-icon.active { color: #fff !important; background: transparent !important; }
body.theme-light #welcome-msg { background: rgba(0,0,0,0.04) !important; color: #444 !important; }
body.theme-dark #welcome-msg { background: rgba(255,255,255,0.06) !important; color: #ccc !important; }
#app-grid { max-height: 120px !important; overflow-y: auto !important; overflow-x: hidden !important; padding-right: 4px !important; padding-bottom: 5px !important; align-content: start !important; }
#app-grid::-webkit-scrollbar { width: 4px; }
#app-grid::-webkit-scrollbar-track { background: transparent; }
#app-grid::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.2); border-radius: 10px; }
body.theme-dark #app-grid::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); }
#app-container { width: 100% !important; overflow: hidden !important; position: relative; mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%); -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%)}
#app-grid { display: flex !important; flex-wrap: nowrap !important; gap: 16px !important; width: max-content !important; max-height: none !important; overflow: visible !important; padding: 0 20px !important; animation: scroll-loop 30s linear infinite; }
.app-item, .store-item, .fixed-app-item { flex: 0 0 auto !important; }
@keyframes scroll-loop { 0% { transform: translateX(0); } 100% { transform: translateX(-33.33%); } }
#app-container:hover #app-grid { animation-play-state: paused; }
body.theme-dark .app-item img, body.theme-dark .store-item img, body.theme-midnight .app-item img { filter: none !important; opacity: 1 !important; mix-blend-mode: normal !important; }
#store-grid { justify-content: center !important; text-align: center; }

body.theme-light, body.theme-sky { background-image: radial-gradient(circle at 50% 40%, rgba(255, 170, 190, 0.45) 0%, rgba(170, 210, 255, 0.45) 30%, rgba(255, 255, 255, 0) 70%) !important; }
body, body.theme-dark, body.theme-midnight { background-image: radial-gradient(circle at 50% 40%, rgba(70, 80, 160, 0.55) 0%, rgba(50, 50, 70, 0.6) 40%, rgba(10, 10, 10, 0) 80%) !important; }
.island-box, .app-item, .store-item, .fixed-app-item, #welcome-msg, .store-filter-btn, #prompt-input, .btn-submit { border: none !important; outline: none !important; box-shadow: none !important; }
body.theme-light .island-box { background: rgba(255, 255, 255, 0.55) !important; }
body.theme-light .app-item, body.theme-light .store-item { background: rgba(255, 255, 255, 0.6) !important; }
body.theme-dark .island-box { background: rgba(40, 40, 40, 0.5) !important; }
body.theme-dark .app-item, body.theme-dark .store-item { background: rgba(255, 255, 255, 0.08) !important; }

body.theme-light, body.theme-sky { background-color: #ffffff !important; background-image: radial-gradient(at 0% 0%, rgba(255, 130, 130, 0.55) 0px, transparent 55%), radial-gradient(at 100% 0%, rgba(100, 180, 255, 0.55) 0px, transparent 55%), radial-gradient(at 100% 100%, rgba(255, 210, 120, 0.55) 0px, transparent 55%), radial-gradient(at 0% 100%, rgba(180, 140, 255, 0.55) 0px, transparent 55%) !important; background-attachment: fixed; background-size: 100% 100%; }
body, body.theme-dark, body.theme-midnight { background-color: #050505 !important; background-image: radial-gradient(at 10% 10%, rgba(110, 60, 180, 0.65) 0px, transparent 50%), radial-gradient(at 90% 10%, rgba(40, 100, 180, 0.65) 0px, transparent 50%), radial-gradient(at 90% 90%, rgba(30, 140, 110, 0.55) 0px, transparent 50%), radial-gradient(at 10% 90%, rgba(160, 40, 100, 0.55) 0px, transparent 50%) !important; background-attachment: fixed; background-size: 100% 100%; }
body { background-color: var(--bg-base, #ffffff) !important; background-image: radial-gradient(at 0% 0%, var(--bg-1) 0px, transparent 55%), radial-gradient(at 100% 0%, var(--bg-2) 0px, transparent 55%), radial-gradient(at 100% 100%, var(--bg-3) 0px, transparent 55%), radial-gradient(at 0% 100%, var(--bg-4) 0px, transparent 55%) !important; background-attachment: fixed !important; background-size: 100% 100% !important; transition: background 1s ease; }
.island-box, .app-item, .store-item { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#store-grid { 
    gap: 6px !important; 
    padding: 0 4px !important; 
    align-items: center !important; 
    height: 86px !important; 
    min-height: 56px !important;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 85%, transparent 100%);
}

#store-grid::-webkit-scrollbar {
    display: none;
}
#app-grid, #app-grid.search-scroll { padding: 4px 0 !important; gap: 12px !important; align-items: center !important; height: 60px !important; min-height: 60px !important; }
.island-box, .app-item, .store-item, .fixed-app-item { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
body.theme-light .island-box { background: #ffffff !important; }
body.theme-light .app-item, body.theme-light .store-item { background: #ffffff !important; }
body.theme-dark .island-box, body.theme-midnight .island-box { background: #181818 !important; }
body.theme-dark .app-item, body.theme-dark .store-item, body.theme-midnight .app-item, body.theme-midnight .store-item { background: #111111 !important; }

#app-grid.search-scroll { display: flex !important; flex-wrap: nowrap !important; justify-content: flex-start !important; align-items: center !important; width: max-content !important; height: auto !important; animation: search-scroll-loop 60s linear infinite !important; }
@keyframes search-scroll-loop { 0% { transform: translateX(0); } 100% { transform: translateX(-33.3333%); } }
#app-container.searching { mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%); -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%); }
#app-grid { animation: none !important; cursor: grab; touch-action: pan-y; }
#app-grid:active { cursor: grabbing; }
#app-grid img, #app-grid div, #app-grid a { user-select: none; -webkit-user-drag: none; }
