:root {
    /* ตัวแปรของ Music UI */
    --bg: #F2F2F6;
    --surface: #FFFFFF;
    --primary-text: #000000;
    --secondary-text: #666666;
    --border-color: rgba(0, 0, 0, 0.08);
    --chip-bg: rgba(0, 0, 0, 0.05);
    --chip-active: #000000;
    --hero-gradient: linear-gradient(135deg, #FF1493, #00E5FF);

    /* ตัวแปรของ TV UI (PartnersTV) */
    --tv-bg-color: #F9F9F9;
    --accent-blue: #065fd4;
    --safe-top: env(safe-area-inset-top, 20px);
    --safe-bottom: env(safe-area-inset-bottom, 20px);
    --ease-snap: cubic-bezier(0.25, 1, 0.5, 1);
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: 'Kanit', 'Inter', -apple-system, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--primary-text);
    overflow-x: hidden;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

*:focus-visible { outline: 2px solid var(--primary-text); outline-offset: 2px; }

/* =========================================
   การจัดการ VIEW (การสลับแท็บเมนูด้านล่าง)
========================================= */
.app-view { display: none; width: 100vw; min-height: 100vh; }
.app-view.active { display: block; }

/* =========================================
   1. MUSIC APP STYLES
========================================= */
.main-header {
    position: fixed; top: 0; width: 100%; z-index: 1000; background: transparent; 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease, box-shadow 0.3s ease;
    will-change: transform, background-color;
}
.main-header.scrolled { background: var(--surface); box-shadow: 0 1px 10px rgba(0,0,0,0.08); }
.header-hidden { transform: translate3d(0, -100%, 0); }
.top-nav { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; height: 60px; color: #FFFFFF; transition: color 0.3s ease; }
.main-header.scrolled .top-nav { color: var(--primary-text); }
.top-nav h1 { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px;}
.top-nav .icons { font-size: 20px; display: flex; gap: 20px; }
.category-bar { display: flex; overflow-x: auto; gap: 10px; padding: 10px 15px; border-bottom: 1px solid transparent; transition: border-color 0.3s ease; -webkit-overflow-scrolling: touch; scroll-behavior: smooth; scrollbar-width: none; }
.main-header.scrolled .category-bar { border-bottom: 1px solid var(--border-color); }
.category-bar::-webkit-scrollbar { display: none; }
.chip { padding: 6px 18px; border-radius: 20px; background: rgba(255, 255, 255, 0.25); white-space: nowrap; font-size: 14px; font-weight: 500; color: #FFFFFF; backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); transition: all 0.2s ease; cursor: pointer; transform: translateZ(0); }
.chip.active { background: #FFFFFF; color: #000000; }
.main-header.scrolled .chip { background: var(--chip-bg); color: var(--secondary-text); backdrop-filter: none; -webkit-backdrop-filter: none; }
.main-header.scrolled .chip.active { background: var(--chip-active); color: #FFFFFF; }
.hero { height: 460px; background: var(--hero-gradient); display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; margin-top: 0; padding-top: 80px; color: white; overflow: hidden; isolation: isolate; }
canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0.6; z-index: -1; pointer-events: none;}
.play-btn { width: 60px; height: 60px; background: white; border-radius: 50%; display: flex !important; align-items: center !important; justify-content: center !important; box-shadow: 0 8px 16px rgba(0,0,0,0.2); z-index: 10; cursor: pointer; transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); will-change: transform; }
.play-btn:active { transform: scale(0.9); }
.hero-title { z-index: 10; text-align: center; margin-top: 20px; }
.hero-title h2 { font-size: 24px; font-weight: 800; margin-bottom: 5px; text-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.hero-title p { font-size: 14px; opacity: 0.9; text-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.btn-outline { z-index: 10; margin-top: 20px; padding: 8px 20px; border: 1px solid white; border-radius: 20px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.15); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); cursor: pointer; }
main { padding: 20px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin: 30px 0 15px; }
.section-header h3 { font-size: 18px; font-weight: 700; }
.section-header .more { color: var(--secondary-text); font-size: 18px; }
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 25px;}
.mini-card { background: var(--surface); padding: 12px; border-radius: 12px; display: flex; align-items: center; gap: 12px; box-shadow: 0 2px 8px var(--border-color); cursor: pointer; transition: transform 0.2s; }
.mini-card:active { transform: scale(0.97); }
.square-thumb { width: 44px; height: 44px; border-radius: 10px; }
.mini-card-text { display: flex; flex-direction: column; }
.mini-card-text strong { font-size: 14px; }
.mini-card-text span { font-size: 12px; color: var(--secondary-text); }
.horizontal-scroll { display: flex; overflow-x: auto; gap: 15px; padding-bottom: 10px; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; scrollbar-width: none; }
.horizontal-scroll::-webkit-scrollbar { display: none; }
.taste-box { min-width: 150px; height: 180px; border-radius: 16px; padding: 15px; display: flex; flex-direction: column; justify-content: space-between; color: white; box-shadow: 0 4px 10px rgba(0,0,0,0.1); scroll-snap-align: start; cursor: pointer; }
.taste-box h4 { font-size: 20px; font-weight: 700; margin-bottom: 5px;}
.taste-box p { font-size: 12px; opacity: 0.9;}
.circle-play { align-self: flex-end; width: 32px; height: 32px; background: white; border-radius: 50%; display: flex !important; align-items: center !important; justify-content: center !important; }
.listen-others-section { margin-top: 35px; }
.exclusive-badge { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--secondary-text); font-weight: 700; margin-bottom: 5px; }
.exclusive-icon { width: 16px; height: 16px; border-radius: 4px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #FF00FF, #8A2BE2); }
.exclusive-icon::before { content: 'ılı'; color: white; font-size: 8px; font-weight: bold; letter-spacing: -1px; }
.listen-others-title { font-size: 22px; font-weight: 800; margin-bottom: 15px; }
.playlist-card { background: #1C1C1E; border-radius: 16px; min-width: 310px; max-width: 310px; padding-bottom: 15px; overflow: hidden; color: white; display: flex; flex-direction: column; box-shadow: 0 4px 12px rgba(0,0,0,0.15); scroll-snap-align: center; }
.playlist-header-blue { padding: 20px; position: relative; height: 150px; background: linear-gradient(135deg, #1E88E5, #1565C0); display: flex; flex-direction: column; justify-content: space-between; }
.playlist-header-purple { padding: 20px; position: relative; height: 150px; background: linear-gradient(135deg, #7E57C2, #512DA8); display: flex; flex-direction: column; justify-content: space-between; }
.playlist-match { font-size: 14px; font-weight: 700; }
.playlist-match span { opacity: 0.8; font-weight: 400; font-size: 13px; }
.playlist-info h4 { font-size: 20px; font-weight: 700; margin-bottom: 5px; }
.playlist-user { display: flex; align-items: center; gap: 8px; font-size: 13px; opacity: 0.9; }
.playlist-user img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover;}
.playlist-play-btn { width: 50px; height: 50px; background: white; border-radius: 50%; position: absolute; bottom: 15px; right: 15px; display: flex !important; align-items: center !important; justify-content: center !important; box-shadow: 0 4px 8px rgba(0,0,0,0.3); cursor: pointer; transition: transform 0.2s; }
.playlist-play-btn:active { transform: scale(0.9); }
.playlist-tracks { padding: 20px 15px 5px 15px; display: flex; flex-direction: column; gap: 15px; }
.track-mini { display: flex; align-items: center; gap: 15px; }
.track-mini-img { width: 50px; height: 50px; border-radius: 10px; background: #555; object-fit: cover; }
.track-mini-info { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-mini-title { font-size: 15px; font-weight: 600; color: white; margin-bottom: 2px; text-overflow: ellipsis; overflow: hidden;}
.track-mini-artist { font-size: 13px; color: #AAA; text-overflow: ellipsis; overflow: hidden;}
.show-more-btn { display: flex; align-items: center; justify-content: center; padding: 20px 0; font-weight: 700; color: var(--primary-text); font-size: 15px; gap: 5px; cursor: pointer; transition: opacity 0.2s; }
.show-more-btn:active { opacity: 0.6; }
.grid-2x2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pill-card { padding: 15px; border-radius: 12px; font-weight: 600; font-size: 15px; display: flex; align-items: center; color: white; background: linear-gradient(45deg, #1e3c72, #2a5298); cursor: pointer; transition: transform 0.2s; }
.pill-card:active { transform: scale(0.97); }
.track-item { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; cursor: pointer; }
.track-img { width: 55px; height: 55px; border-radius: 10px; background: #ddd; object-fit: cover;}
.track-info { flex: 1; }
.track-info .title { font-weight: 600; font-size: 16px; color: var(--primary-text); margin-bottom: 2px;}
.track-info .artist { font-size: 13px; color: var(--secondary-text); }
.track-more { color: var(--secondary-text); padding: 0 10px; font-weight: bold; font-size: 20px;}

/* =========================================
   2. TV / VIDEO APP STYLES (PartnersTV Scope)
========================================= */
#video-view { background-color: var(--tv-bg-color); position: fixed; inset: 0; overflow: hidden; font-family: 'Inter', sans-serif; }
#tube-content-area { position: absolute; inset: 0; z-index: 1; }
.tube-view { position: absolute; inset: 0; overflow-y: auto; padding-bottom: 80px; -webkit-overflow-scrolling: touch; }
.tube-view::-webkit-scrollbar { display: none; }
.tube-header { padding: calc(var(--safe-top) + 10px) 20px 10px; background: rgba(249,249,249,0.95); backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid rgba(0,0,0,0.05); }
.tube-category-bar { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 5px; }
.tube-category-bar::-webkit-scrollbar { display: none; }
.tube-chip { background: rgba(0,0,0,0.05); color: var(--primary-text); padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: 0.2s; }
.tube-chip.active { background: var(--primary-text); color: white; }
#tube-home-feed { padding: 20px; display: flex; flex-direction: column; gap: 24px; }
.tube-video-card { cursor: pointer; background: white; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 12px rgba(0,0,0,0.03); transition: transform 0.2s; }
.tube-video-card:active { transform: scale(0.98); }
.tube-thumbnail { width: 100%; aspect-ratio: 16/9; background: #eee; position: relative; }
.tube-thumb-img { width: 100%; height: 100%; object-fit: cover; }
.tube-meta { display: flex; gap: 12px; padding: 12px; }
.tube-avatar { width: 36px; height: 36px; border-radius: 50%; background: #ccc; object-fit: cover; flex-shrink: 0; }
.shorts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 10px 0; }
.short-card { position: relative; aspect-ratio: 9/16; background: #000; border-radius: 12px; overflow: hidden; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.short-card:active { transform: scale(0.98); transition: 0.2s; }
.short-thumb { width: 100%; height: 100%; object-fit: cover; opacity: 0.9; }
.short-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 12px; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); color: white; }
.short-title { font-size: 13px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 0 1px 2px rgba(0,0,0,0.5); margin-bottom: 4px; }
.short-views { font-size: 10px; opacity: 0.8; }
#infinite-scroll-trigger { height: 60px; display: flex; align-items: center; justify-content: center; opacity: 0; }
#infinite-scroll-trigger.loading { opacity: 1; }
.fa-spin { animation: fa-spin 2s infinite linear; }
@keyframes fa-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(359deg); } }
#tube-player-overlay { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; pointer-events: none; }
#tube-player-bg { position: absolute; inset: 0; background: rgba(0,0,0,0.8); z-index: -1; opacity: 0; pointer-events: auto; }
#tube-video-container { width: 100%; aspect-ratio: 16/9; background: #000; position: relative; z-index: 2; transform-origin: top left; box-shadow: 0 4px 30px rgba(0,0,0,0.3); pointer-events: auto; overflow: hidden; flex-shrink: 0; will-change: transform, width, height; }
#tube-video-container video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tube-controls-layer { position: absolute; inset: 0; background: rgba(0,0,0,0.4); display: flex; flex-direction: column; justify-content: space-between; opacity: 0; transition: opacity 0.2s; pointer-events: none; z-index: 5; }
.tube-controls-layer.show { opacity: 1; pointer-events: auto; }
.tube-ctl-top { padding: calc(var(--safe-top) + 10px) 16px; display: flex; justify-content: space-between; align-items: flex-start; }
.ctl-right-stack { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.tube-ctl-icon { color: white; cursor: pointer; text-shadow: 0 2px 4px rgba(0,0,0,0.5); border-radius: 50%; background: rgba(0,0,0,0.2); backdrop-filter: blur(4px); width: 40px; height: 40px; display: grid; place-items: center; }
.tube-ctl-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 40px; }
.tube-play-big { font-size: 50px !important; color: white; filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5)); cursor: pointer; }
.tube-ctl-bottom { padding: 10px 16px; background: linear-gradient(to top, rgba(0,0,0,0.8), transparent); }
#tube-full-controls { flex: 1; background: var(--surface); opacity: 0; overflow-y: auto; pointer-events: auto; }
.meta-row { display: flex; justify-content: space-between; align-items: center; padding: 0 16px 16px; }
.author-grp { display: flex; gap: 10px; align-items: center; }
.btn-comments { background: transparent; border: 1px solid var(--border-color); padding: 6px 12px; border-radius: 18px; font-size: 12px; font-weight: 600; color: var(--primary-text); cursor: pointer; display: flex; gap: 6px; align-items: center; }
.seek-container { padding: 15px 0; cursor: pointer; touch-action: none; }
.seek-track { width: 100%; height: 4px; background: rgba(255,255,255,0.3); border-radius: 2px; position: relative; }
.seek-fill { height: 100%; background: var(--accent-blue); width: 0%; border-radius: 2px; position: relative; }
.seek-thumb { position: absolute; right: -8px; top: -6px; width: 16px; height: 16px; background: white; border-radius: 50%; transform: scale(0); transition: transform 0.1s; box-shadow: 0 0 5px rgba(0,0,0,0.5); }
.seek-container:active .seek-thumb, .tube-controls-layer.show .seek-thumb { transform: scale(1); }
#scrub-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); display: flex; flex-direction: column; align-items: center; justify-content: center; color: white; font-family: 'JetBrains Mono', monospace; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 10; }
#scrub-overlay.active { opacity: 1; }
.scrub-time { font-size: 28px; font-weight: 700; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.player-sticky-cats { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,0.98); padding: 12px 16px; border-bottom: 1px solid rgba(0,0,0,0.05); display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.related-item { display: flex; gap: 10px; padding: 12px 16px; cursor: pointer; }
.r-thumb { width: 140px; aspect-ratio: 16/9; background: #333; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
#toast-msg { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(0,0,0,0.85); color: white; padding: 12px 24px; border-radius: 30px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 200; backdrop-filter: blur(8px); }
#toast-msg.show { opacity: 1; }
#tube-player-overlay.mode-vertical #tube-video-container { height: 100vh; aspect-ratio: unset; }
#tube-player-overlay.mode-vertical #tube-video-container video { object-fit: cover; }
#tube-player-overlay.mode-vertical #tube-full-controls { display: none; }
.tube-minimized #tube-full-controls { opacity: 0; pointer-events: none; }
.tube-minimized #tube-player-bg { opacity: 0; pointer-events: none; }
.tube-minimized .tube-controls-layer { display: none; }
.tube-minimized #scrub-overlay { display: none; }
.animating #tube-video-container { transition: transform 0.4s var(--ease-snap), width 0.3s, height 0.3s, opacity 0.3s; }
.animating #tube-player-bg, .animating #tube-full-controls { transition: all 0.3s ease; }
.tube-hidden { transform: translateY(100%); pointer-events: none; }

/* =========================================
   3. DEEPSEARCH APP STYLES (Search Scope)
========================================= */
#search-view {
    background-color: #e5e7eb;
    min-height: 100vh; position: relative; font-family: 'Noto Sans Thai', sans-serif;
}
#search-view .ds-container {
    width: 100%; background-color: #ffffff; min-height: 100vh; position: relative; overflow-x: hidden;
}
#search-view .ds-page-view {
    display: none; width: 100%; min-height: 100vh; background-color: #ffffff; padding-bottom: 120px; /* เผื่อที่ให้ Bottom Nav ของ Global ด้วย */
    will-change: transform, opacity;
}
#search-view .ds-page-view.active { display: block; }
#search-view .slide-in-right { animation: slideInRight 0.4s forwards cubic-bezier(0.175, 0.885, 0.32, 1.05); }
#search-view .slide-in-left { animation: slideInLeft 0.4s forwards cubic-bezier(0.175, 0.885, 0.32, 1.05); }

@keyframes slideInRight { from { transform: translate3d(100%, 0, 0); opacity: 0.5; } to { transform: translate3d(0, 0, 0); opacity: 1; } }
@keyframes slideInLeft { from { transform: translate3d(-100%, 0, 0); opacity: 0.5; } to { transform: translate3d(0, 0, 0); opacity: 1; } }

#search-view img { content-visibility: auto; object-fit: cover; }
#search-view .ds-top-bar { display: flex; justify-content: space-between; align-items: center; padding: 16px; background-color: #ffffff; z-index: 10; }
#search-view .ds-sticky-top { position: sticky; top: 0; border-bottom: 1px solid #f3f4f6; }
#search-view .ds-user-greeting { font-size: 16px; font-weight: 600; color: #1f2937; }
#search-view .ds-profile-pic { width: 36px; height: 36px; background-color: #f3f4f6; border-radius: 50%; display: flex; justify-content: center; align-items: center; color: #4b5563; }
#search-view .ds-top-bar-right { display: flex; gap: 12px; }
#search-view .ds-page-title { font-weight: 600; font-size: 16px; color: #111827; flex-grow: 1; text-align: center; margin-right: 36px; }
#search-view .ds-icon-btn { background: none; border: none; font-size: 20px; color: #4b5563; cursor: pointer; padding: 8px 12px; border-radius: 12px; transition: background-color 0.2s; }
#search-view .ds-icon-btn:hover { background-color: #f3f4f6; }
#search-view .ds-hero-section { padding: 24px 16px; text-align: center; }
#search-view .ds-hero-title { font-size: 28px; font-weight: 700; color: #111827; margin-bottom: 4px; }
#search-view .ds-hero-subtitle { font-size: 14px; color: #6b7280; margin-bottom: 24px; }
#search-view .ds-main-search-bar { display: flex; align-items: center; background-color: #f3f4f6; padding: 12px 16px; border-radius: 24px; gap: 12px; cursor: text; transition: box-shadow 0.2s; text-align: left; }
#search-view .ds-main-search-bar:focus-within { box-shadow: 0 0 0 2px #3b82f6; background-color: #ffffff; }
#search-view .ds-main-search-bar input { flex-grow: 1; border: none; background: transparent; font-size: 16px; outline: none; color: #1f2937; }
#search-view .ds-main-search-bar i { color: #9ca3af; font-size: 18px; }
#search-view .ds-recent-list { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 24px 16px; }
#search-view .ds-recent-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background-color: #f9fafb; border-radius: 12px; cursor: pointer; transition: background-color 0.2s; }
#search-view .ds-recent-item:hover { background-color: #f3f4f6; }
#search-view .ds-recent-icon { color: #9ca3af; margin-right: 12px; }
#search-view .ds-recent-text { flex-grow: 1; font-size: 14px; color: #374151; }
#search-view .ds-recent-remove { background: none; border: none; color: #d1d5db; cursor: pointer; padding: 4px; border-radius: 6px; transition: background-color 0.2s, color 0.2s; }
#search-view .ds-recent-remove:hover { background-color: #fee2e2; color: #ef4444; }
#search-view .ds-section-title { font-size: 16px; font-weight: 600; color: #111827; margin-bottom: 12px; padding: 0 16px; display: flex; align-items: center; gap: 8px; }
#search-view .ds-categories-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 0 16px; }
#search-view .ds-category-item { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
#search-view .ds-category-icon { width: 56px; height: 56px; background-color: #f3f4f6; border-radius: 16px; display: flex; justify-content: center; align-items: center; font-size: 24px; color: #3b82f6; transition: transform 0.2s, background-color 0.2s; }
#search-view .ds-category-item:hover .ds-category-icon { transform: scale(1.05); background-color: #e0e7ff; }
#search-view .ds-category-name { font-size: 12px; color: #4b5563; font-weight: 500; text-align: center; }
#search-view .ds-list-container { padding: 8px 16px; }
#search-view .ds-list-item { display: flex; align-items: center; padding: 16px 0; border-bottom: 1px solid #f3f4f6; cursor: pointer; gap: 16px; }
#search-view .ds-list-item:last-child { border-bottom: none; }
#search-view .ds-list-img { width: 60px; height: 60px; border-radius: 12px; object-fit: cover; background-color: #f3f4f6; }
#search-view .ds-list-info { flex-grow: 1; overflow: hidden; }
#search-view .ds-list-title { font-size: 15px; font-weight: 600; color: #111827; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#search-view .ds-list-subtitle { font-size: 13px; color: #6b7280; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#search-view .ds-chevron-icon { color: #d1d5db; font-size: 14px; }
#search-view .ds-status-message { text-align: center; padding: 40px 16px; color: #6b7280; font-size: 14px; display: flex; flex-direction: column; align-items: center; }
#search-view #ds-app-content { padding-bottom: 24px; }
#search-view .ds-main-title { font-size: 24px; font-weight: 700; padding: 0 16px; margin-bottom: 16px; color: #111827; }
#search-view .ds-gallery { display: flex; overflow-x: auto; gap: 12px; padding: 0 16px 16px 16px; scrollbar-width: none; }
#search-view .ds-gallery::-webkit-scrollbar { display: none; }
#search-view .ds-gallery img { width: 140px; height: 200px; border-radius: 12px; flex-shrink: 0; }
#search-view .ds-feedback-box { margin: 0 16px 24px 16px; padding: 16px; background-color: #f9fafb; border-radius: 12px; text-align: center; }
#search-view .ds-feedback-box p { font-size: 14px; color: #4b5563; margin-bottom: 12px; }
#search-view .ds-feedback-btns { display: flex; justify-content: center; gap: 12px; }
#search-view .ds-feedback-btn { padding: 8px 24px; border: 1px solid #d1d5db; background-color: #ffffff; border-radius: 12px; font-size: 14px; color: #374151; cursor: pointer; transition: all 0.2s; }
#search-view .ds-feedback-btn:hover { background-color: #f3f4f6; }
#search-view .ds-sources-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px 24px 16px; }
#search-view .ds-source-card { background-color: #f9fafb; border: 1px solid #f3f4f6; padding: 12px; border-radius: 12px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; transition: background-color 0.2s; }
#search-view .ds-source-card:hover { background-color: #f3f4f6; }
#search-view .ds-source-card.more { grid-column: span 2; flex-direction: row; justify-content: space-between; align-items: center; }
#search-view .ds-source-header { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
#search-view .ds-source-subtitle { font-size: 12px; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#search-view .ds-pro-badge { background-color: #ffffff; font-size: 11px; font-weight: 700; padding: 4px 8px; border-radius: 12px; display: flex; align-items: center; gap: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); color: #3b82f6; }
#search-view .ds-answer-text { padding: 0 16px; font-size: 15px; line-height: 1.6; color: #374151; margin-bottom: 16px; }
#search-view .ds-action-btns { display: flex; gap: 8px; padding: 0 16px; }
#search-view .ds-related-list { padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
#search-view .ds-related-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background-color: #f9fafb; border-radius: 12px; font-size: 14px; color: #1f2937; cursor: pointer; }

/* ช่องแชทด้านล่างของ Deepsearch จะต้องลอยเหนือ Global Bottom Nav (Bottom Nav สูง ~55px) */
#search-view .ds-bottom-bar { position: fixed; bottom: 56px; left: 0; width: 100%; background-color: #ffffff; padding: 12px 16px; border-top: 1px solid #f3f4f6; display: flex; align-items: center; gap: 12px; z-index: 20; }
#search-view .ds-search-input { flex-grow: 1; display: flex; align-items: center; background-color: #f3f4f6; padding: 10px 16px; border-radius: 20px; gap: 10px; }
#search-view .ds-search-input input { border: none; background: transparent; font-size: 14px; outline: none; width: 100%; color: #1f2937; }
#search-view .ds-search-input i { color: #9ca3af; }
#search-view .ds-send-btn { background-color: #3b82f6; color: white; border: none; width: 48px; height: 40px; border-radius: 12px; display: flex; justify-content: center; align-items: center; font-size: 16px; cursor: pointer; box-shadow: 0 4px 6px rgba(59, 130, 246, 0.2); transition: background-color 0.2s, transform 0.1s; }
#search-view .ds-send-btn:active { transform: scale(0.95); }

/* =========================================
   BOTTOM NAVIGATION MENU (Global)
========================================= */
.bottom-nav { position: fixed; bottom: 0; width: 100%; background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); display: flex; justify-content: space-around; padding: 8px 0 16px 0; min-height: 55px; border-top: 1px solid var(--border-color); z-index: 2000; transform: translateZ(0); }
.nav-icon { color: var(--secondary-text); position: relative; display: flex; flex-direction: column; align-items: center; cursor: pointer; transition: transform 0.2s;}
.nav-icon:active { transform: scale(0.9); }
.nav-icon.active { color: var(--primary-text); }
.nav-icon .material-symbols-rounded { font-size: 28px; transition: transform 0.2s; }
.nav-icon.active .material-symbols-rounded { font-variation-settings: 'FILL' 1; }
.icon-align { vertical-align: middle; }