:root {
    color-scheme: dark;
    --primary-color: #8ab4f8; 
    --favorite-color: #ffffff; 
    --featured-border: #e8eaed; 
    --doodled-border: #ffffff; 
    --text-color: #e8eaed; 
    --bg-color: #121212; 
    --gray-light: #202124; 
    --border-color: #3c4043; 
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Arial, sans-serif; }
html { overflow-y: scroll; background-color: var(--bg-color); }
body { color: var(--text-color); background-color: var(--bg-color); padding-bottom: 60px; }

header {
    display: flex; align-items: center; justify-content: space-between; padding: max(15px, env(safe-area-inset-top)) 30px 5px 30px;
    position: sticky; top: 0; border: none;
    background: transparent; z-index: 100; gap: 20px;
    pointer-events: none; 
}
header > * { pointer-events: auto; } 

.navigation-zone { 
    position: sticky; top: 60px; border: none;
    background: transparent;
    padding: 5px 10px 20px 30px; 
    display: flex; align-items: center; gap: 12px; flex-wrap: nowrap;
    z-index: 99; transition: opacity 0.2s ease, transform 0.2s ease;
    width: 100%; overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none;
    -webkit-overflow-scrolling: touch; 
    cursor: grab; pointer-events: auto;
}
.navigation-zone::-webkit-scrollbar { display: none; }
.navigation-zone:active { cursor: grabbing; }

body.is-searching .navigation-zone { display: none !important; }

.header-left { display: flex; align-items: center; gap: 12px; flex-grow: 1; justify-content: flex-start; }

.tab-btn, .ctrl-btn, .copy-path-btn, .lightbox-star-toggle, .lightbox-rotate-btn, .lightbox-fullscreen-btn, .draw-tool-btn, .action-batch-btn {
    -webkit-appearance: none; appearance: none; background: transparent; -webkit-tap-highlight-color: transparent;
}

.logo { font-size: 20px; font-weight: 600; color: var(--text-color); cursor: pointer; letter-spacing: 0.5px; text-shadow: 0 2px 10px rgba(0,0,0,0.9), 0 0 4px rgba(0,0,0,0.6); flex-shrink: 0; }

.search-container { flex-grow: 0; position: relative; }
.search-input {
    width: 38px; height: 38px; padding: 0; border-radius: 50%;
    background-color: rgba(30, 30, 30, 0.6); backdrop-filter: blur(8px);
    background-color: rgba(30, 30, 30, 0.6); backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1); color: transparent;
    cursor: pointer; outline: none; box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    font-size: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8eaed' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; background-size: 18px 18px;
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); 
    white-space: nowrap; overflow: hidden;
    will-change: width, padding;
}
.search-input::placeholder { color: transparent; }
.search-input:hover { background-color: rgba(60, 60, 60, 0.8); }

.search-input:focus, .search-input:not(:placeholder-shown) {
    width: 260px; border-radius: 20px; background-color: rgba(30, 30, 30, 0.9);
    border-color: var(--border-color); color: var(--text-color); padding: 10px 15px 10px 40px;
    background-position: 12px center; background-size: 16px 16px; cursor: text;
}
.search-input:focus::placeholder { color: #9aa0a6; }

.category-tabs { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.tab-btn {
    padding: 8px 18px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.1);
    background: rgba(30, 30, 30, 0.6); backdrop-filter: blur(8px); box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    color: #e8eaed; font-size: 14px; font-weight: 500;
    cursor: pointer; transition: all 0.15s; outline: none; white-space: nowrap; flex-shrink: 0;
}
.tab-btn:hover { background: rgba(60, 60, 60, 0.8); }
.tab-btn.active { background: var(--text-color); color: var(--bg-color); border-color: var(--text-color); box-shadow: 0 2px 6px rgba(232, 234, 237, 0.4); font-weight: 600;}

.breadcrumb { font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; flex-shrink: 0; }
.breadcrumb span { cursor: pointer; display: flex; align-items: center; flex-shrink: 0;}
.breadcrumb span:hover { text-decoration: underline; }
.breadcrumb .search-query { color: #fff; font-weight: 600; cursor: default; flex-shrink: 0;}
.breadcrumb .search-query:hover { text-decoration: none; }
.path-separator { color: #9aa0a6; display: flex; align-items: center; justify-content: center; padding: 0 2px; flex-shrink: 0;}

.container { padding: 20px 0 0 0; }
.grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(15px, 1fr)); grid-auto-rows: 15px; gap: 8px; grid-auto-flow: row; }

.grid-item { position: relative; grid-row-end: span 10; grid-column-end: span 10; border-radius: 8px; overflow: hidden; background-color: var(--gray-light); cursor: grab; box-shadow: 0 1px 3px rgba(0,0,0,0.2); will-change: transform; }
.grid-item[draggable="false"] { cursor: pointer; }
.grid-item:active:not([draggable="false"]) { cursor: grabbing; }

.grid-item img:not(.doodle-overlay), .grid-item video, .doodle-overlay, .grid-item img {
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.grid-item.is-dragging { opacity: 0.3; transform: scale(0.95); box-shadow: 0 10px 25px rgba(0,0,0,0.5); border: 2px dashed var(--text-color); z-index: 999; pointer-events: none !important; }
body.is-dragging-grid .grid-item * { pointer-events: none !important; -webkit-user-drag: none !important; }
.grid-item.is-animating { pointer-events: none !important; z-index: 0 !important; }

@keyframes perfectShimmer { 
    0% { background-position: 200% 0; } 
    100% { background-position: -100% 0; } 
}

.is-loading { 
    position: relative; 
    background-color: #202124 !important; 
    background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 50%, transparent 100%) !important;
    background-size: 200% 100% !important; 
    background-repeat: no-repeat !important;
    animation: perfectShimmer 1.5s infinite linear !important;
    overflow: hidden; 
}

.is-loading::after, 
.lightbox-loading-placeholder::after { 
    display: none !important; 
}

.is-loading img:not(.doodle-overlay), .is-loading video { opacity: 0 !important; }

.folder-thumb-container img:not(.doodle-overlay), .folder-thumb-container video, .media-wrapper img:not(.doodle-overlay), .media-wrapper video { transition: opacity 0.3s ease-in; }
.doodle-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; z-index: 2; }

.folder-card { border-radius: 60px; border: 1px solid var(--border-color); display: flex; flex-direction: column; z-index: 2;}
.folder-card.virtual-featured { border: 2px solid var(--featured-border); box-shadow: 0 4px 12px rgba(232, 234, 237, 0.15); }
.folder-card.virtual-featured .folder-info { border-top: 1px solid var(--border-color); }
.folder-card.virtual-featured .folder-name { color: var(--featured-border); font-weight: 600; }
.folder-card.virtual-featured::after { content: "★"; position: absolute; top: 10px; right: 10px; left: auto; color: var(--favorite-color); font-size: 18px; text-shadow: 0 1px 3px rgba(0,0,0,0.5); z-index: 4;}

.folder-card.virtual-doodled { border: 2px solid var(--doodled-border); box-shadow: 0 4px 16px rgba(255, 255, 255, 0.15); }
.folder-card.virtual-doodled .folder-info { border-top: 1px solid var(--border-color); }
.folder-card.virtual-doodled .folder-name { color: var(--doodled-border); font-weight: 600; }
.folder-card.virtual-doodled::after { 
    content: ""; position: absolute; top: 12px; right: 12px; left: auto; width: 15px; height: 15px;
    background-color: var(--doodled-border);
    -webkit-mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/%3E%3C/svg%3E") no-repeat center / contain;
    z-index: 4; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.folder-thumb-container { width: 100%; height: 72%; background-color: #303134; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; pointer-events: none; transition: transform 0.2s; }
.folder-thumb-container img:not(.doodle-overlay), .folder-thumb-container video { width: 100%; height: 100%; object-fit: cover; }
.folder-icon-fallback { font-size: 40px; color: #5f6368; }
.folder-info { height: 28%; display: flex; align-items: center; padding: 0 10px; background: var(--gray-light); border-top: 1px solid var(--border-color); pointer-events: none;}
.folder-name { font-size: 12px; font-weight: 500; text-align: left; word-break: break-all; color: var(--text-color); line-height: 1.3; max-height: 2.6em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;}

.folder-card.is-selected { background-color: #303134; box-shadow: inset 0 0 0 1px var(--text-color); }
.folder-card.is-selected .folder-thumb-container { transform: scale(0.88) translateY(4%); border-radius: 4px; }

.media-card { z-index: 1; transform: translateZ(0); }
.media-wrapper { width: 100%; height: 100%; overflow: hidden; position: relative; border-radius: 0; pointer-events: none; transition: transform 0.2s;}
.media-wrapper img:not(.doodle-overlay), .media-wrapper video { width: 100%; height: 100%; object-fit: cover; display: block; }

.grid-item:hover:not(.is-dragging) { box-shadow: 0 8px 24px rgba(0,0,0,0.5); z-index: 10; }
.media-card.is-selected { background-color: #3c4043; }
.media-card.is-selected .media-wrapper { transform: scale(0.85); border-radius: 4px; }

.thumb-comment-tag {
    position: absolute; bottom: 0; left: 0; width: 100%; background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.6) 60%, rgba(0, 0, 0, 0) 100%);
    color: #ffffff; font-size: 18px; padding: 35px 10px 8px 10px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-weight: 600; letter-spacing: 0.5px; z-index: 3; display: none; pointer-events: none; 
}
.thumb-progress-bar { position: absolute; bottom: 0; left: 0; width: 100%; height: 4px; background: rgba(255, 255, 255, 0.25); z-index: 5; pointer-events: none; }
.thumb-progress-fill { height: 100%; background: #e8eaed; border-radius: 0 2px 2px 0; }

@keyframes starPopBounce { 0% { transform: scale(1); } 40% { transform: scale(1.4) rotate(-15deg); } 70% { transform: scale(0.9) rotate(10deg); } 100% { transform: scale(1) rotate(0deg); } }

.star-switch-btn { position: absolute; top: 5px; right: 8px; width: 30px; height: 30px; border: none; color: rgba(255, 255, 255, 0.8); text-shadow: 0 1px 4px rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; font-size: 22px; z-index: 5; cursor: pointer; opacity: 0; transition: opacity 0.15s, color 0.1s; }
.media-card:hover .star-switch-btn { opacity: 1; }
.star-switch-btn:hover { color: #ffffff; transform: scale(1.1); }
.media-card.is-favorite .star-switch-btn { color: var(--favorite-color); opacity: 1; text-shadow: 0 1px 6px rgba(255,255,255,0.4); }

.select-checkbox-btn { position: absolute; bottom: 8px; right: 8px; width: 22px; height: 22px; background: rgba(0,0,0,0.5); border: 1.5px solid rgba(255,255,255,0.8); border-radius: 50%; z-index: 6; cursor: pointer; opacity: 0; transition: opacity 0.15s; pointer-events: auto; }
.folder-card .select-checkbox-btn { top: auto; right: 8px; bottom: 8px; }
.grid-item:hover .select-checkbox-btn { opacity: 1; }
.grid-item.is-selected .select-checkbox-btn { background: var(--text-color); border-color: var(--text-color); opacity: 1; }
.grid-item.is-selected .select-checkbox-btn::after { content: '✓'; color: var(--bg-color); font-weight: bold; font-size: 13px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
body.is-selecting-mode .star-switch-btn { display: none !important; }
.video-badge { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,0.6); border-radius: 50%; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; z-index: 4; pointer-events: none; font-size: 0; }
.video-badge svg, .video-badge img { display: none !important; }
.video-badge::before {
    content: "";
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 6px 0 6px 10px;
    border-color: transparent transparent transparent #fff;
    margin-left: 2px;
}

.scroll-sentinel { grid-column: 1 / -1; height: 20px; pointer-events: none; opacity: 0; }

.selection-marquee { position: absolute; background-color: rgba(154, 160, 166, 0.15); border: 1px solid rgba(154, 160, 166, 0.8); border-radius: 2px; pointer-events: none; z-index: 9999; display: none; box-shadow: 0 0 10px rgba(154, 160, 166, 0.1); }

.selection-action-bar { position: fixed; bottom: 0; left: 0; width: 100%; height: 64px; background: rgba(32, 33, 36, 0.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid rgba(255,255,255,0.08); box-shadow: 0 -4px 16px rgba(0,0,0,0.3); display: flex; align-items: center; justify-content: center; z-index: 2000; transform: translateY(100%); opacity: 0; visibility: hidden; transition: transform 0.25s ease-out, opacity 0.25s ease-out, visibility 0.25s; }
.selection-action-bar.active { transform: translateY(0); opacity: 1; visibility: visible; transition: transform 0.25s ease-out, opacity 0.25s ease-out, visibility 0s; }
.action-bar-content { display: flex; align-items: center; justify-content: center; gap: 15px; width: auto; padding: 0 20px; }
.action-close-btn { background: none; border: none; font-size: 28px; color: #9aa0a6; cursor: pointer; display: flex; align-items: center; padding-bottom: 2px; }
.action-close-btn:hover { color: var(--text-color); transform: scale(1.1); }
.action-select-all-btn { color: #9aa0a6; margin-left: 5px; margin-right: 5px;}
.action-select-all-btn:hover { color: #fff; transform: scale(1.15); filter: drop-shadow(0 2px 6px rgba(255,255,255,0.4)); }
.action-count-text { font-size: 16px; font-weight: 600; color: var(--text-color); margin: 0 10px; }
.action-batch-btn { border: none; font-size: 26px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; outline: none; }
.action-batch-star-btn { color: #5f6368; }
.action-batch-star-btn:hover { color: var(--favorite-color); transform: scale(1.15); }
.action-batch-star-btn.all-starred { color: var(--favorite-color); text-shadow: 0 1px 4px rgba(251, 188, 5, 0.4); }
.action-batch-clear-btn { color: #9aa0a6; }
.action-batch-clear-btn:hover { color: #ff8a8a; transform: scale(1.1) rotate(-8deg); filter: drop-shadow(0 2px 6px rgba(255,138,138,0.4)); }

.lightbox { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: #000; z-index: 1000; overflow: hidden; }
/* 💡 燈箱內關閉瀏覽器原生觸控手勢:杜絕放大平移時被下拉刷新/原生捲動搶走手勢,造成立刻彈回 */
.lightbox { touch-action: none !important; }
.lightbox-view { touch-action: none !important; }
body.lightbox-open { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
.lightbox-top-wrapper, .lightbox-bottom-wrapper, .drawing-toolbox, .lightbox-close-btn { transition: opacity 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) !important; }

.lightbox.ui-hidden .lightbox-top-wrapper, 
.lightbox.ui-hidden .drawing-toolbox, 
.lightbox.ui-hidden .lightbox-close-btn,
.lightbox.ui-hidden .lightbox-bottom-wrapper { 
    opacity: 0 !important; 
    pointer-events: none !important; 
}

.lightbox-close-btn { position: absolute; top: 20px; right: 30px; color: #9aa0a6; font-size: 40px; cursor: pointer; transition: transform 0.2s, color 0.2s, opacity 0.3s ease; z-index: 1050; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.8)); }
.lightbox-close-btn:hover { transform: scale(1.1); color: #fff; }

.lightbox-view { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: visible; z-index: 1; cursor: grab; user-select: none; -webkit-user-select: none; }
.lightbox-view:active { cursor: grabbing; }

.lightbox-top-wrapper { position: absolute; top: 15px; left: 0; width: 100%; display: flex; justify-content: center; z-index: 1010; pointer-events: none; }
.lightbox-path-panel { pointer-events: auto; width: auto; max-width: 90vw; height: 44px; background: transparent; padding: 0 16px; display: flex; flex-direction: row; align-items: center; gap: 12px; }
#lightbox-file-path { display: none !important; }
.path-toast {
    position: fixed; bottom: 25px; right: 30px; max-width: 80vw;
    background: rgba(30, 30, 30, 0.96); color: #e8eaed;
    padding: 12px 20px; border-radius: 16px; font-size: 14px;
    z-index: 10000000; box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    border: 1px solid rgba(232,234,237,0.3);
    opacity: 0; transform: translateY(20px); pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.path-toast.show { opacity: 1; transform: translateY(0); }
.path-toast span { display: block; font-weight: 600; margin-bottom: 4px; color: #8ab4f8; }
.path-toast .path-toast-path { font-size: 13px; word-break: break-all; color: #e8eaed; }
.lightbox-bottom-wrapper { position: absolute; left: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; z-index: 1010; pointer-events: none; transition: opacity 0.3s ease, transform 0.3s ease; }
.lightbox.is-photo .lightbox-bottom-wrapper { bottom: 50px; }
.lightbox.is-video .lightbox-bottom-wrapper { bottom: 20px; }

.lightbox-comment-panel { pointer-events: auto; width: 90vw; max-width: 1200px; background: transparent; padding: 0; box-shadow: none; border: none; display: flex; flex-direction: column; align-items: stretch; justify-content: center; margin: 0 auto; }

.video-control-bar { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; width: 100%; gap: 12px; pointer-events: auto; }
.video-control-bar > button[onclick*="skipVideo"] { display: none !important; }
.video-control-bar > button[onclick*="toggleVideoPlay"] { order: 1; margin: 0; }
.video-control-bar > button[onclick*="toggleVideoMute"] { order: 2; margin: 0; }
.video-control-bar > .progress-wrapper { order: 3; flex-grow: 1; margin: 0 15px; }
.video-control-bar > .time-wrapper-fix { order: 4; margin: 0; }
.video-control-bar > span.ctrl-time { display: none !important; }

.ctrl-btn { border: none; color: var(--text-color); cursor: pointer; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; transition: background 0.2s; padding: 0; filter: drop-shadow(0 1px 4px rgba(0,0,0,0.8)); margin: 0; background: rgba(30,30,30,0.6); backdrop-filter: blur(8px); }
.ctrl-btn:hover { background: rgba(60,60,60,0.8); }
.ctrl-btn svg { width: 24px !important; height: 24px !important; margin: 0; display: block; }

.time-wrapper-fix { display: flex; align-items: center; justify-content: center; gap: 4px; color: #ffffff; font-weight: bold; font-size: 18px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 4px rgba(0,0,0,0.8); white-space: nowrap; margin-left: 10px; height: 48px; }

.copy-path-btn { flex-shrink: 0; border: 1px solid transparent; color: var(--text-color); border-radius: 6px; width: 45px; height: 45px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; padding: 0; margin: 0; filter: drop-shadow(0 1px 4px rgba(0,0,0,0.8)); }
.copy-path-btn svg { width: 24px !important; height: 24px !important; display: block; margin: 0; }
.copy-path-btn:hover { background: rgba(255,255,255,0.1); color: #fff; transform: scale(1.05); }
.copy-path-btn:active { transform: scale(0.95); }
.copy-path-btn.copied { color: #4caf50; }

.lightbox-rotate-btn { background: rgba(30,30,30,0.6) !important; backdrop-filter: blur(8px); border-radius: 50%; }
.lightbox-rotate-btn:hover, .lightbox-fullscreen-btn:hover { color: #ffffff; transform: scale(1.15); }
.lightbox-rotate-btn svg, .lightbox-fullscreen-btn svg { width: 32px !important; height: 32px !important; display: block; margin: 0; }

.lightbox-star-toggle { border: none; cursor: pointer; font-size: 36px; color: rgba(255,255,255,0.3); transition: all 0.2s; flex-shrink: 0; padding: 0; margin: 0; outline: none; display: flex; align-items: center; justify-content: center; filter: drop-shadow(0 1px 4px rgba(0,0,0,0.8)); width: 50px; height: 50px; line-height: 1; }
.lightbox-star-toggle:hover { color: rgba(255,255,255,0.8); transform: scale(1.15); }
.lightbox-star-toggle.active { color: var(--favorite-color); text-shadow: 0 0 8px rgba(255,255,255,0.6); }

.comment-box-wrapper { display: flex; align-items: center; justify-content: center; gap: 20px; width: 100%; height: 57px; }

.comment-input { 
    width: 57px; height: 57px; padding: 0; border-radius: 50%;
    background-color: rgba(30, 30, 30, 0.6); backdrop-filter: blur(8px);
    border: none !important; color: transparent; margin: 0;
    cursor: pointer; outline: none; box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    font-size: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e8eaed' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: center; background-size: 27px 27px;
    transition: all 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
    white-space: nowrap; overflow: hidden; flex-shrink: 0;
    will-change: width, padding;
}
.comment-input::placeholder { color: transparent; }
.comment-input:hover { background-color: rgba(60, 60, 60, 0.8); }
.comment-input:focus, .comment-input:not(:placeholder-shown) {
    width: 480px; border-radius: 30px; background-color: rgba(20, 20, 20, 0.95);
    border: none !important; color: var(--text-color); padding: 15px 22px 15px 60px; font-size: 18px;
    background-position: 18px center; background-size: 24px 24px; cursor: text; box-shadow: 0 8px 32px rgba(0,0,0,0.9);
}
.comment-input:focus::placeholder { color: #9aa0a6; }

.progress-wrapper { position: relative; flex-grow: 1; display: flex; align-items: center; justify-content: center; height: 48px; min-width: 150px; filter: drop-shadow(0 1px 4px rgba(0,0,0,0.8)); margin: 0; }

.video-hover-preview {
    position: absolute;
    bottom: 50px; 
    left: 0;
    transform: translateX(-50%);
    background: #000;
    border: 2px solid rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    display: none; 
    flex-direction: column;
    align-items: center;
    z-index: 1050;
    box-shadow: 0 4px 16px rgba(0,0,0,0.8);
    pointer-events: none; 
    overflow: hidden;
}
.video-hover-preview.active { display: flex; }
#preview-video { width: 180px; height: auto; max-height: 120px; background: #000; display: block; }
#preview-time { font-size: 13px; font-weight: 600; color: #fff; padding: 4px 0; background: rgba(0,0,0,0.85); width: 100%; text-align: center; letter-spacing: 0.5px; }

.ctrl-progress-bg { position: absolute; left: 0; right: 0; height: 6px; background: rgba(255,255,255,0.15); border-radius: 3px; pointer-events: none; }
.ctrl-progress-buffered { position: absolute; left: 0; height: 6px; background: rgba(255,255,255,0.4); border-radius: 3px; width: 0%; pointer-events: none; transition: width 0.3s; }
.ctrl-progress-played { position: absolute; left: 0; height: 6px; background: var(--text-color); border-radius: 3px; width: 0%; pointer-events: none; z-index: 1; transition: none; }
.ctrl-progress { width: 100%; position: absolute; left: 0; -webkit-appearance: none; appearance: none; background: transparent; height: 24px; cursor: pointer; z-index: 2; outline: none; margin: 0; padding: 0; }
.ctrl-progress::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; background: var(--text-color); border-radius: 50%; cursor: pointer; margin-top: -6px; box-shadow: 0 1px 4px rgba(0,0,0,0.5); transition: transform 0.1s; }
.ctrl-progress:active::-webkit-slider-thumb { transform: scale(1.3); }
.ctrl-progress::-webkit-slider-runnable-track { width: 100%; height: 6px; background: transparent; border-radius: 3px; }

.video-skip-zone { position: absolute; top: 0; bottom: 0; width: 20%; z-index: 1040; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s ease-in-out, background-color 0.2s; pointer-events: none; background-color: rgba(255, 255, 255, 0); }
.video-skip-zone.left { left: 0; }
.video-skip-zone.right { right: 0; }
.skip-indicator { color: rgba(255, 255, 255, 0.95); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 18px; font-weight: bold; letter-spacing: 1px; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.8)); }
@keyframes skipFlashAnim { 0% { background-color: rgba(255,255,255,0.05); opacity: 1; } 30% { background-color: rgba(255,255,255,0.35); opacity: 1; } 100% { background-color: rgba(255,255,255,0); opacity: 0; } }
.video-skip-zone.flash { animation: skipFlashAnim 0.5s ease-out; }

.video-center-indicator { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100px; height: 100px; background: rgba(0,0,0,0.6); border-radius: 50%; display: flex; align-items: center; justify-content: center; pointer-events: none; opacity: 0; z-index: 1060; box-shadow: 0 4px 16px rgba(0,0,0,0.5); color: white; }
.video-center-indicator svg { width: 50px; height: 50px; fill: currentColor; }
@keyframes centerPop { 0% { opacity: 1; transform: translate(-50%, -50%) scale(0.8); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); } }
.video-center-indicator.animate { animation: centerPop 0.6s ease-out forwards; }

.lightbox-media-wrapper { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center; pointer-events: none; padding-bottom: 70px; }
.lightbox-inner-container { position: relative; display: inline-flex; justify-content: center; align-items: center; max-width: 90vw; max-height: calc(100vh - 200px); min-width: 0; min-height: 0; pointer-events: auto; transform-origin: center center; will-change: transform; backface-visibility: hidden; perspective: 1000px; transform: translateZ(0); }
.lightbox-rotate-container { position: relative; display: inline-flex; justify-content: center; align-items: center; width: 100%; height: 100%; transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); transform-origin: center center; }

.lightbox-media { max-width: 90vw; max-height: calc(100vh - 200px); width: auto; height: auto; outline: none; user-select: none; -webkit-user-drag: none; border-radius: 4px; display: block; opacity: 0; transition: opacity 0.4s ease-out; pointer-events: none; }
.lightbox-media.loaded { opacity: 1; }

.lightbox-loading-placeholder { position: absolute; width: 240px; height: 240px; border-radius: 32px; z-index: -1; background-color: #202124; background-image: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.08) 50%, transparent 100%); background-size: 200% 100%; animation: perfectShimmer 1.5s infinite linear; box-shadow: 0 16px 40px rgba(0,0,0,0.8); overflow: hidden; }

.drawing-canvas { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: auto; z-index: 15; border-radius: 4px; 
    opacity: 1; transition: opacity 0.25s ease-in-out;
}
.lightbox.hide-doodle .drawing-canvas { opacity: 0 !important; pointer-events: none !important; }

.video-drag-shield { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 10; cursor: grab; }
.video-drag-shield:active { cursor: grabbing; }

.drawing-toolbox { position: absolute; width: 52px; background: rgba(30, 30, 30, 0.95); border-radius: 26px; border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 8px 32px rgba(0,0,0,0.8); display: flex; flex-direction: column; align-items: center; padding: 16px 0; gap: 12px; z-index: 1020; pointer-events: auto; user-select: none; }
.draw-tool-btn { border: none; color: #9aa0a6; font-size: 18px; cursor: pointer; width: 34px; height: 34px; border-radius: 50%; display: flex; justify-content: center; align-items: center; transition: 0.2s; }
.draw-tool-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.draw-tool-btn.active { background: var(--text-color); color: var(--bg-color); border-color: var(--text-color); box-shadow: 0 2px 6px rgba(232, 234, 237, 0.15); font-weight: 600;}
.draw-tool-btn.disabled { opacity: 0.3; cursor: not-allowed; }
.draw-color-picker { width: 28px; height: 28px; border: none; border-radius: 50%; cursor: pointer; padding: 0; background: transparent; overflow: hidden; }
.draw-color-picker::-webkit-color-swatch-wrapper { padding: 0; border-radius: 50%; }
.draw-color-picker::-webkit-color-swatch { border: 2px solid #5f6368; border-radius: 50%; }
.draw-size-vertical { -webkit-appearance: slider-vertical; writing-mode: vertical-lr; direction: rtl; width: 16px; height: 120px; cursor: pointer; accent-color: var(--text-color); margin: 10px 0; outline: none; }
.draw-size-preview { display: none; position: absolute; right: 65px; bottom: 70px; border-radius: 50%; border: 1.5px solid #ffffff; box-shadow: 0 4px 12px rgba(0,0,0,0.5), inset 0 0 4px rgba(0,0,0,0.3); pointer-events: none; z-index: 1030; transform: translateY(50%); backdrop-filter: blur(2px); }
.color-palette-popup { display: none; position: absolute; right: 60px; top: 50%; transform: translateY(-50%); width: 120px; height: 120px; background: rgba(30, 30, 30, 0.95); border: 1px solid rgba(255,255,255,0.1); border-radius: 50%; box-shadow: 0 8px 32px rgba(0,0,0,0.8); z-index: 1030; }
.color-dot { position: absolute; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; border: 1.5px solid rgba(255,255,255,0.2); transition: transform 0.15s, border-color 0.15s; }
.color-dot:hover { transform: scale(1.3); border-color: #fff; z-index: 2; }

/* === 置頂不規則純白發光波浪特效 === */
.update-wave-container {
    position: fixed;
    top: calc(max(15px, env(safe-area-inset-top, 0px)) + 28px);
    left: 0;
    width: 100vw;
    height: 45px;
    pointer-events: none;
    z-index: 90;
    
    opacity: 0;
    visibility: hidden;
    transition: opacity 1.5s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 1.5s;
    
    mix-blend-mode: screen;
    overflow: hidden;
    background: transparent !important;
    
    /* 💡 雙重遮罩技術 (Mask Composite)：
       1. 橫向: 左邊實體保留光澤，往右側優雅淡出
       2. 直向: 柔化上下邊界
    */
    mask-image: linear-gradient(to right, rgba(0,0,0,1) 0%, rgba(0,0,0,0.8) 20%, rgba(0,0,0,0) 90%),
                linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 20%, rgba(0,0,0,0.8) 60%, rgba(0,0,0,0) 100%);
    mask-composite: intersect;
    -webkit-mask-image: linear-gradient(to right, rgba(0,0,0,1) 0%, rgba(0,0,0,0.8) 20%, rgba(0,0,0,0) 90%),
                        linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 20%, rgba(0,0,0,0.8) 60%, rgba(0,0,0,0) 100%);
    -webkit-mask-composite: source-in;
    
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.update-wave-container.is-scanning {
    /* 💡 配合左側的實體遮罩，將總體不透明度大幅拉高，確保左邊明顯且不黯淡 */
    opacity: 0.85;
    visibility: visible;
    transition: opacity 1.5s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s;
}
body.lightbox-open .update-wave-container { display: none !important; }

.wave-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 200vw;
    height: 100%;
    background-repeat: repeat-x;
    background-size: 800px 100%; 
    /* 💡 加入 background-position-x 讓 JS 引擎驅動時享有 GPU 加速 */
    will-change: transform, background-position-x; 
    pointer-events: none;
}

/* 1. 底層純白薄霧充填 */
.wave-layer.w-fill {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0%25' stop-color='rgba(255, 255, 255, 0.2)'/%3E%3Cstop offset='100%25' stop-color='rgba(255, 255, 255, 0)'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M 0 100 C 200 200, 400 200, 600 100 C 800 0, 1000 0, 1200 100 L 1200 0 L 0 0 Z' fill='url(%23g)'/%3E%3C/svg%3E");
}

/* 2. 主動態細線 1 */
.wave-layer.w-cyan {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'%3E%3Cpath d='M 0 100 C 200 0, 400 0, 600 100 C 800 200, 1000 200, 1200 100' fill='none' stroke='rgba(255, 255, 255, 0.65)' stroke-width='4.5'/%3E%3C/svg%3E");
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

/* 3. 反向交疊細線 2 */
.wave-layer.w-pink {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'%3E%3Cpath d='M 0 100 C 250 200, 350 200, 600 100 C 850 0, 950 0, 1200 100' fill='none' stroke='rgba(255, 255, 255, 0.45)' stroke-width='3'/%3E%3C/svg%3E");
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.4));
}

/* 4. 實心能量軌跡 */
.wave-layer.w-particles {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 200' preserveAspectRatio='none'%3E%3Cpath d='M 0 100 C 300 0, 300 0, 600 100 C 900 200, 900 200, 1200 100' fill='none' stroke='rgba(255, 255, 255, 0.75)' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E");
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
}

/* === 💡 行動裝置(手機端)專屬優化 === */
@media (max-width: 768px) {
    .update-wave-container {
        top: calc(max(15px, env(safe-area-inset-top, 0px)) + 22px); 
        height: 38px;
    }
}

.lightbox.is-fullscreen { padding: 0 !important; margin: 0 !important; }
.lightbox.is-fullscreen .lightbox-media-wrapper { 
    padding: 0 !important; margin: 0 !important; border: none !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
}
.lightbox.is-fullscreen .lightbox-inner-container { 
    width: 100vw !important; height: 100vh !important; 
    max-width: none !important; max-height: none !important;
    padding: 0 !important; margin: 0 !important; border: none !important;
    display: flex; justify-content: center; align-items: center;
}
.lightbox.is-fullscreen .lightbox-rotate-container { 
    max-width: none !important; max-height: none !important;
    padding: 0 !important; margin: 0 !important; border: none !important;
    display: inline-flex; justify-content: center; align-items: center;
}
.lightbox.is-fullscreen .lightbox-media { 
    max-width: none !important; max-height: none !important;
    border-radius: 0 !important; margin: 0 !important; padding: 0 !important;
}

.lightbox.ui-hidden .lightbox-top-wrapper, 
.lightbox.ui-hidden .drawing-toolbox, 
.lightbox.ui-hidden .lightbox-close-btn,
.lightbox.ui-hidden .lightbox-bottom-wrapper { 
    opacity: 0 !important; 
    pointer-events: none !important; 
}
.lightbox.is-fullscreen .comment-input,
.lightbox.is-fullscreen .copy-path-btn,
.lightbox.is-fullscreen .lightbox-rotate-btn,
.lightbox.is-fullscreen .lightbox-fullscreen-btn,
.lightbox.is-fullscreen .lightbox-star-toggle {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.lightbox.is-fullscreen.is-video .lightbox-bottom-wrapper {
    position: fixed !important; bottom: 0 !important; left: 0 !important; 
    width: 100vw !important; padding: 40px 30px 20px 30px !important; margin: 0 !important;
    background: linear-gradient(to top, rgba(0,0,0,0.85), transparent) !important; 
    pointer-events: none; z-index: 1050 !important; display: flex !important;
}
.lightbox.is-fullscreen .video-control-bar { padding: 0 40px; pointer-events: auto; }
.lightbox.is-fullscreen.is-photo .lightbox-bottom-wrapper { display: none !important; }

@media (max-width: 768px) {
    header { flex-direction: row; justify-content: flex-start; align-items: center; padding: 15px 15px 5px 15px; gap: 12px; }
    .header-left { gap: 12px; width: 100%; }
    .logo { font-size: 15px; white-space: nowrap; }
    .search-input:focus, .search-input:not(:placeholder-shown) { width: calc(100vw - 165px); }
    .navigation-zone { padding: 5px 10px 10px 15px; top: 55px; }
    .category-tabs { gap: 6px; }
    .tab-btn { padding: 6px 12px; font-size: 12px; }
    .container { padding: 8px 0px 0px 0px; }
    .grid-item { border-radius: 8px; -webkit-user-drag: none; user-drag: none; -webkit-touch-callout: none; }
    .folder-card { border-radius: 40px; }
    .folder-icon-fallback { font-size: 24px; }
    .folder-name { font-size: 11px; -webkit-line-clamp: 1; }
    .action-bar-content { padding: 0 14px; gap: 16px; }
    .action-count-text { font-size: 15px; }
    .action-batch-btn { font-size: 30px; width: 46px; height: 46px; }
    .action-close-btn { font-size: 34px; }
    .action-select-all-btn { transform: scale(1.2); }
    .lightbox-close-btn { top: max(15px, env(safe-area-inset-top)); right: 15px; font-size: 32px; }
    .lightbox-media { max-width: 100vw; max-height: calc(100vh - 220px); }
    .lightbox-fullscreen-btn { display: none !important; }
    .lightbox-inner-container { max-width: 100vw; max-height: 100vh; }
    .lightbox-comment-panel { width: 95vw; }
    .comment-input { width: 34px; height: 34px; background-size: 16px 16px; }
    .comment-input:focus, .comment-input:not(:placeholder-shown) { width: calc(100vw - 140px); padding: 8px 12px 8px 34px; font-size: 16px; background-position: 10px center; }
    .drawing-toolbox { transform: scale(0.85); transform-origin: right center; }

    .lightbox.is-fullscreen.is-photo .lightbox-bottom-wrapper { 
        display: flex !important; 
        bottom: max(12px, env(safe-area-inset-bottom)) !important; 
        top: auto !important;
    }
    .lightbox.is-fullscreen .lightbox-star-toggle,
    .lightbox.is-fullscreen .lightbox-rotate-btn,
    .lightbox.is-fullscreen .copy-path-btn {
        display: flex !important; opacity: 1 !important; pointer-events: auto !important; visibility: visible !important;
    }
    .lightbox.is-fullscreen .comment-input {
        display: inline-block !important; opacity: 1 !important; pointer-events: auto !important; visibility: visible !important;
    }

    .lightbox.is-fullscreen.is-video .lightbox-bottom-wrapper { padding: 40px 12px max(16px, env(safe-area-inset-bottom)) 12px !important; }
    .lightbox.is-fullscreen .video-control-bar { padding: 0; justify-content: center; }

    html, body { touch-action: pan-x pan-y; }

    .lightbox-rotate-btn { background: rgba(30,30,30,0.6) !important; backdrop-filter: blur(8px); border-radius: 50%; }

    .lightbox .lightbox-star-toggle {
        position: fixed !important;
        top: max(15px, env(safe-area-inset-top)) !important;
        left: 12px !important;
        right: auto !important;
        width: 44px !important; height: 44px !important;
        font-size: 26px !important;
        border-radius: 50% !important;
        background: rgba(30,30,30,0.6) !important;
        backdrop-filter: blur(8px) !important;
        z-index: 1061 !important;
    }
    .lightbox .copy-path-btn {
        position: fixed !important;
        top: max(15px, env(safe-area-inset-top)) !important;
        left: 62px !important;
        width: 44px !important; height: 44px !important;
        border-radius: 50% !important;
        background: rgba(30,30,30,0.6) !important;
        backdrop-filter: blur(8px) !important;
        z-index: 1061 !important;
    }
    .lightbox #photo-comment-input {
        position: fixed !important;
        top: max(18px, calc(env(safe-area-inset-top) + 3px)) !important;
        left: 112px !important;
        margin: 0 !important;
        z-index: 1061 !important;
    }
    .lightbox #photo-comment-input:focus,
    .lightbox #photo-comment-input:not(:placeholder-shown) {
        left: 112px !important;
        width: calc(100vw - 128px) !important;
    }
}

@media (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
    html, body { touch-action: pan-x pan-y; }
    .lightbox-fullscreen-btn { display: none !important; }

    .lightbox.is-fullscreen.is-photo .lightbox-bottom-wrapper {
        display: flex !important;
        bottom: max(8px, env(safe-area-inset-bottom)) !important;
        top: auto !important;
    }
    .lightbox.is-fullscreen.is-video .lightbox-bottom-wrapper {
        position: fixed !important; bottom: 0 !important; top: auto !important; left: 0 !important;
        width: 100vw !important;
        padding: 30px 12px max(8px, env(safe-area-inset-bottom)) 12px !important;
        background: linear-gradient(to top, rgba(0,0,0,0.85), transparent) !important;
        display: flex !important; z-index: 1050 !important;
    }
    .lightbox.is-fullscreen .video-control-bar { padding: 0; justify-content: center; }

    .lightbox.is-fullscreen .lightbox-star-toggle,
    .lightbox.is-fullscreen .lightbox-rotate-btn,
    .lightbox.is-fullscreen .copy-path-btn {
        display: flex !important; opacity: 1 !important; pointer-events: auto !important; visibility: visible !important;
    }
    .lightbox.is-fullscreen .comment-input {
        display: inline-block !important; opacity: 1 !important; pointer-events: auto !important; visibility: visible !important;
    }
}

.grid-item * {
    -webkit-touch-callout: none !important;
    -webkit-user-drag: none !important;
    user-drag: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

.grid-item {
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
}

body.is-dragging-grid, body.is-dragging-grid * {
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-touch-callout: none !important;
}
.grid-item img {
    pointer-events: none !important;
}

.drag-ghost { border-radius: 8px; overflow: hidden; }
.drag-ghost * { animation: none !important; opacity: 1 !important; }

@media (min-width: 769px) {
    .lightbox .lightbox-star-toggle {
        position: fixed;
        top: 13px;
        left: 16px;
        width: 45px; height: 45px;
        font-size: 30px;
        border-radius: 50%;
        background: rgba(30,30,30,0.6);
        backdrop-filter: blur(8px);
        z-index: 1061;
    }
    .lightbox .copy-path-btn {
        position: fixed;
        top: 18px;
        left: 70px;
        width: 45px; height: 45px;
        border-radius: 50%;
        background: rgba(30,30,30,0.6);
        backdrop-filter: blur(8px);
        z-index: 1061;
    }
    .lightbox #photo-comment-input {
        position: fixed;
        top: 12px;
        left: 127px;
        margin: 0;
        z-index: 1061;
    }
    .lightbox #photo-comment-input:focus,
    .lightbox #photo-comment-input:not(:placeholder-shown) {
        left: 127px;
    }
}

@media (max-width: 768px) and (orientation: portrait) {
    .grid-container { grid-template-columns: repeat(auto-fill, minmax(8px, 1fr)); grid-auto-rows: 8px; gap: 4px; }
}

/* === 燈箱下排(修正版 2) === */

/* 影片模式:播放/靜音/時間軸 → 移除整條底塊,恢復各自原本的圓形玻璃鈕 */
.video-control-bar {
    width: 100% !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* 旋轉/全螢幕那排 → 依「按鈕+間隔」總寬的膠囊長玻璃底塊 */
.comment-box-wrapper {
    width: fit-content !important;
    margin: 0 auto !important;
    position: relative;
    padding: 6px 20px;
    border-radius: 32px;
}

/* 💡 用 ::before 做玻璃底,避免 backdrop-filter 把左上角固定圖示吸下來 */
.comment-box-wrapper::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    z-index: -1;
    pointer-events: none;
}

/* 按鈕本身拿掉各自圓底,只靠膠囊托住 → 桌機旋轉鈕風格統一 */
.comment-box-wrapper .lightbox-rotate-btn,
.comment-box-wrapper .lightbox-fullscreen-btn {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}
/* 💡 移除下排所有按鈕的邊框/外框(桌機白框、手機黑框) */
.lightbox .comment-box-wrapper .lightbox-rotate-btn,
.lightbox .comment-box-wrapper .lightbox-fullscreen-btn,
.lightbox .comment-box-wrapper .lightbox-star-toggle,
.lightbox .comment-box-wrapper .copy-path-btn,
.lightbox .video-control-bar .ctrl-btn,
.lightbox .video-control-bar .copy-path-btn {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
}
/* 💡 下排旋轉/全螢幕鈕:統一灰色,點按閃白(桌機手機一致) */
.lightbox .comment-box-wrapper .lightbox-rotate-btn,
.lightbox .comment-box-wrapper .lightbox-fullscreen-btn {
    color: #9aa0a6 !important;              /* 平時灰色,不要藍 */
    -webkit-tap-highlight-color: transparent !important;
    transition: color 0.15s, background 0.15s;
}

/* 滑鼠移上(桌機)→ 變亮白 */
.lightbox .comment-box-wrapper .lightbox-rotate-btn:hover,
.lightbox .comment-box-wrapper .lightbox-fullscreen-btn:hover {
    color: #ffffff !important;
}

/* 點按瞬間 → 閃白(桌機點擊、手機觸控都一致) */
.lightbox .comment-box-wrapper .lightbox-rotate-btn:active,
.lightbox .comment-box-wrapper .lightbox-fullscreen-btn:active {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.25) !important;
    border-radius: 50% !important;
}

/* 聚焦時不要藍框/藍色(手機點完殘留的藍就是這個) */
.lightbox .comment-box-wrapper .lightbox-rotate-btn:focus,
.lightbox .comment-box-wrapper .lightbox-fullscreen-btn:focus,
.lightbox .comment-box-wrapper .lightbox-rotate-btn:focus-visible,
.lightbox .comment-box-wrapper .lightbox-fullscreen-btn:focus-visible {
    color: #9aa0a6 !important;
    outline: none !important;
}
.video-control-bar { width: 90vw !important; max-width: 1100px; }

.ctrl-btn { background: transparent !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
.ctrl-btn:hover { background: rgba(255, 255, 255, 0.12) !important; }
/* 💡 桌機:游標移到下排按鈕時不要放大 */
.lightbox .comment-box-wrapper .lightbox-rotate-btn:hover,
.lightbox .comment-box-wrapper .lightbox-fullscreen-btn:hover {
    transform: none !important;
}

/* 💡 手機(觸控):旋轉/全螢幕鈕點按時不要變大、不變白,維持灰色 */
@media (hover: none), (pointer: coarse) {
    /* 平時 + 移上 + 聚焦:灰色、不放大 */
    .lightbox .comment-box-wrapper .lightbox-rotate-btn,
    .lightbox .comment-box-wrapper .lightbox-fullscreen-btn,
    .lightbox .comment-box-wrapper .lightbox-rotate-btn:hover,
    .lightbox .comment-box-wrapper .lightbox-fullscreen-btn:hover,
    .lightbox .comment-box-wrapper .lightbox-rotate-btn:focus,
    .lightbox .comment-box-wrapper .lightbox-fullscreen-btn:focus {
        color: #9aa0a6 !important;
        background: transparent !important;
        transform: none !important;
        border-radius: 50% !important;
    }
    /* 💡 點按瞬間 → 閃白(跟桌機統一),但維持不放大 */
    .lightbox .comment-box-wrapper .lightbox-rotate-btn:active,
    .lightbox .comment-box-wrapper .lightbox-fullscreen-btn:active {
        color: #ffffff !important;
        background: rgba(255, 255, 255, 0.25) !important;
        transform: none !important;
        border-radius: 50% !important;
    }
}
/* --- 隱藏原本已經不用的工具 --- */
.drawing-toolbox, .draw-tool-btn, .draw-color-picker, .draw-size-vertical, .draw-size-preview { display: none !important; }

/* --- 1. S/M/L 完美置中，底色改為純白搭配黑字 --- */
.tool-size-badge {
    position: absolute; top: -3px; right: -3px;
    background: #ffffff; color: #121212 !important; /* 底色白、字體黑，與按鈕變白完美呼應 */
    font-size: 11px; font-weight: bold; font-family: Arial, sans-serif;
    width: 16px; height: 16px; border-radius: 50%;
    display: none; align-items: center; justify-content: center;
    line-height: 1; padding-top: 1px; /* 微調英文字絕對置中 */
    pointer-events: none; z-index: 10; box-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.tool-size-badge.active-badge { display: flex !important; }

/* --- 2. 筆刷快速消失的中央閃爍圓圈 --- */
.brush-preview-toast {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    border: 2px solid #ffffff; border-radius: 50%; pointer-events: none;
    z-index: 10000; box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    opacity: 0; transition: opacity 0.4s ease-out, transform 0.1s;
}

/* --- 3. 手機隱藏全螢幕、色盤位置對齊鉛筆 --- */
@media (max-width: 768px) { #fullscreen-btn, .lightbox-fullscreen-btn { display: none !important; } }
.color-palette-popup { width: 160px !important; height: 160px !important; }
.color-palette-popup.bottom-up { top: auto !important; bottom: 55px !important; right: 50% !important; transform: translateX(50%) !important; }
.color-dot { width: 28px !important; height: 28px !important; }

/* --- 2. 放大色盤並移至按鈕正上方 --- */
.color-palette-popup {
    width: 160px !important;
    height: 160px !important;
}
.color-palette-popup.bottom-up {
    top: auto !important;
    bottom: 60px !important; /* 確保在按鈕上方 */
    right: 50% !important;
    transform: translateX(50%) !important;
}
.color-dot {
    width: 28px !important;
    height: 28px !important;
}

/* --- 3. 確保圖示變白的最高優先級 --- */
#doodle-tools-container button.lightbox-rotate-btn {
    color: #9aa0a6 !important;
    background-color: transparent !important;
}

#doodle-tools-container button.lightbox-rotate-btn.tool-active {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.25) !important;
}

.tool-active {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.25) !important;
}

/* 💡 強制桌機版 Hover 反白，拿掉 coarse 限制並使用高權重 ID 覆蓋所有衝突設定 */
@media (hover: hover) {
    body #lightbox .comment-box-wrapper button.lightbox-rotate-btn:hover,
    body #lightbox .comment-box-wrapper button.lightbox-fullscreen-btn:hover,
    body #lightbox .comment-box-wrapper button.lightbox-star-toggle:hover,
    body #lightbox .comment-box-wrapper button.copy-path-btn:hover {
        background-color: rgba(255, 255, 255, 0.25) !important;
        color: #ffffff !important;
        border-radius: 50% !important;
        transform: none !important;
    }
}

/* 💡 強制桌機與手機版：塗鴉列按鈕「點擊瞬間」的閃白效果與微縮回饋 */
body #lightbox .comment-box-wrapper button.lightbox-rotate-btn:active,
body #lightbox .comment-box-wrapper button.lightbox-fullscreen-btn:active,
body #lightbox .comment-box-wrapper button.copy-path-btn:active {
    background-color: rgba(255, 255, 255, 0.4) !important;
    color: #ffffff !important;
    border-radius: 50% !important;
    transform: scale(0.92) !important;
    transition: none !important;
}

/* 確保SVG不會被錯誤判定阻擋了點擊，讓按鈕確實接收Active狀態 */
#doodle-tools-container button svg, #standard-tools-container button svg {
    pointer-events: none;
}

@keyframes slideFadeIn {
    0% { opacity: 0; transform: translateX(25px) translateZ(0); }
    100% { opacity: 1; transform: translateX(0) translateZ(0); }
}

/* 提高硬體加速順滑度 */
#standard-tools-container, #doodle-tools-container {
    backface-visibility: hidden;
    perspective: 1000px;
}

/* === Cloud auth and upload UI === */
.header-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; pointer-events: auto; }
.login-btn, .user-avatar-btn {
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(30, 30, 30, 0.66);
    color: var(--text-color);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    cursor: pointer;
    height: 38px;
    transition: background 0.15s, transform 0.15s;
}
.login-btn { border-radius: 20px; padding: 0 18px; font-size: 13px; font-weight: 700; letter-spacing: 0.4px; }
.user-avatar-btn { width: 38px; border-radius: 50%; align-items: center; justify-content: center; font-size: 15px; font-weight: 800; }
.user-avatar-btn.is-guest { color: #121212; background: #ffffff; border-color: #ffffff; }
.login-btn:hover, .user-avatar-btn:hover { background: rgba(60,60,60,0.84); transform: translateY(-1px); }

.empty-legal-links {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    z-index: 30;
    color: #8f949d;
}
.has-gallery-items .empty-legal-links { display: none; }
.empty-legal-links button {
    border: none;
    background: transparent;
    color: #8f949d;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.empty-legal-links button:hover { color: #ffffff; }

.upload-dock {
    position: fixed;
    right: 24px;
    bottom: 24px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    z-index: 650;
}
.upload-main-btn {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.16);
    background: #e8eaed;
    color: #121212;
    font-size: 36px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0,0,0,0.45);
    transition: transform 0.15s, box-shadow 0.15s;
}
.upload-main-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,0,0,0.5); }
.upload-menu {
    position: absolute;
    right: 0;
    bottom: 70px;
    min-width: 190px;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(30, 30, 30, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 12px 34px rgba(0,0,0,0.55);
    gap: 4px;
}
.upload-menu button, .user-menu-popover button {
    width: 100%;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-color);
    text-align: left;
    padding: 11px 12px;
    cursor: pointer;
    font-size: 14px;
}
.upload-menu button:hover, .user-menu-popover button:hover { background: rgba(255,255,255,0.09); }
.upload-status-pill {
    height: 38px;
    padding: 0 14px;
    border-radius: 19px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(30, 30, 30, 0.9);
    color: #ffffff;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 8px 22px rgba(0,0,0,0.45);
}
.upload-progress-panel {
    position: absolute;
    right: 68px;
    bottom: 48px;
    width: min(360px, calc(100vw - 38px));
    max-height: 50vh;
    overflow-y: auto;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(24, 24, 24, 0.96);
    box-shadow: 0 16px 40px rgba(0,0,0,0.6);
}
.upload-job-row { padding: 8px; border-radius: 6px; background: rgba(255,255,255,0.04); margin-bottom: 8px; }
.upload-job-row:last-child { margin-bottom: 0; }
.upload-job-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #e8eaed; font-size: 12px; line-height: 1.3; }
.upload-job-top span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-job-bar { height: 5px; background: rgba(255,255,255,0.14); border-radius: 999px; overflow: hidden; margin-top: 8px; }
.upload-job-bar div { height: 100%; background: #e8eaed; border-radius: inherit; transition: width 0.15s; }
.upload-job-error { color: #ff9b9b; font-size: 12px; margin-top: 6px; }

.drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 2200;
    align-items: center;
    justify-content: center;
    background: rgba(18, 18, 18, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
}
.drop-overlay-inner {
    border: 1px dashed rgba(255,255,255,0.55);
    border-radius: 8px;
    padding: 28px 40px;
    color: #ffffff;
    background: rgba(30,30,30,0.82);
    font-weight: 700;
    box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}

.modal-root { position: fixed; inset: 0; z-index: 3000; }
.modal-backdrop { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(0,0,0,0.66); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.modal-panel {
    position: relative;
    width: min(520px, calc(100vw - 30px));
    max-height: min(720px, calc(100vh - 36px));
    overflow: auto;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.13);
    background: #1c1d20;
    color: var(--text-color);
    padding: 26px;
    box-shadow: 0 24px 70px rgba(0,0,0,0.7);
}
.modal-panel h2 { font-size: 20px; font-weight: 700; margin-bottom: 18px; letter-spacing: 0; }
.modal-close { position: absolute; top: 12px; right: 14px; width: 34px; height: 34px; border: none; border-radius: 50%; background: transparent; color: #9aa0a6; cursor: pointer; font-size: 26px; line-height: 1; }
.modal-close:hover { color: #ffffff; background: rgba(255,255,255,0.08); }
.auth-form, .settings-panel { display: grid; gap: 13px; }
.auth-form label, .settings-panel label { display: grid; gap: 7px; color: #c7cbd1; font-size: 13px; }
.auth-form input, .settings-panel input {
    width: 100%;
    height: 42px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.14);
    background: #111214;
    color: var(--text-color);
    padding: 0 12px;
    font-size: 15px;
    outline: none;
}
.auth-form input:focus, .settings-panel input:focus { border-color: rgba(255,255,255,0.45); }
.primary-action {
    width: 100%;
    min-height: 42px;
    border: none;
    border-radius: 6px;
    background: #e8eaed;
    color: #121212;
    cursor: pointer;
    font-weight: 800;
    font-size: 14px;
    margin-top: 6px;
}
.primary-action:disabled { opacity: 0.35; cursor: not-allowed; }
.auth-secondary-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.auth-secondary-actions button { border: none; background: transparent; color: #b8bdc5; cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.modal-message, .modal-hint { color: #b8bdc5; font-size: 13px; line-height: 1.6; margin-top: 12px; }
.form-error { color: #ff9b9b; background: rgba(255, 80, 80, 0.08); border: 1px solid rgba(255, 120, 120, 0.22); border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; }
.legal-scroll {
    height: 280px;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    background: #111214;
    color: #d6d9de;
    padding: 14px;
    line-height: 1.7;
    font-size: 13px;
    margin-bottom: 14px;
}
.legal-scroll.static { height: min(430px, 58vh); margin-bottom: 0; }
.user-menu-popover {
    position: fixed;
    width: 240px;
    z-index: 1200;
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(30,30,30,0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 14px 40px rgba(0,0,0,0.58);
}
.menu-title { color: #ffffff; font-weight: 800; font-size: 14px; padding: 8px 10px 4px 10px; word-break: break-all; }
.menu-copy { color: #b8bdc5; font-size: 12px; line-height: 1.55; padding: 2px 10px 8px 10px; }

@media (max-width: 768px) {
    .header-left { width: auto; flex: 1; min-width: 0; }
    .header-right { margin-left: auto; }
    .login-btn { height: 34px; padding: 0 12px; font-size: 12px; }
    .user-avatar-btn { width: 34px; height: 34px; }
    .empty-legal-links { width: 100%; gap: 14px; }
    .upload-dock { right: 14px; bottom: max(14px, env(safe-area-inset-bottom)); }
    .upload-main-btn { width: 54px; height: 54px; font-size: 34px; }
    .upload-progress-panel { right: 0; bottom: 66px; }
    .modal-panel { padding: 22px 18px; }
    .auth-secondary-actions { flex-direction: column; align-items: stretch; }
}