/* =============================================================================
   1. CORE & LANDING & AUTH STYLES (จาก index.css)
   ============================================================================= */
:root {
    --bg-color: #ffffff; 
    --text-color: white;
    --border-color-1: #dd2476; 
    --border-color-2: #ff512f; 
    --btn-bg-inner: rgba(20, 20, 20, 0.95);
    
    /* Variables from feed.css merged here for global scope */
    --primary-color-feed: #1877f2;
    --background-color-feed: #f0f2f5;
    --card-background-feed: #fff;
    --text-primary-feed: #050505;
    --text-secondary-feed: #65676b;
    --divider-color-feed: #e4e6eb;
    --hover-overlay-feed: rgba(0,0,0,0.05);
    --header-height-feed: 56px;
    --tabs-height-feed: 56px;
    --total-header-height-feed: 112px;
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
    --anim-duration: 0.4s;
    --z-content: 1;
    --z-header: 110;
    --z-bottom-nav: 110;
    --z-overlay: 2100;
    --z-modal: 1000;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; outline: none; scrollbar-width: none; }

/* Fix font boosting on Android & Text rendering on iOS */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Noto Sans Thai', sans-serif;
    overflow: hidden;
    background-color: #ffffff;
    overscroll-behavior: none;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
}

.hidden { display: none !important; }
.fade-out { opacity: 0; pointer-events: none; transition: opacity 0.5s ease; }

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
    will-change: transform, opacity;
}

/* --- Landing Page --- */
#view-landing {
    position: fixed; inset: 0; z-index: 10;
    background: #ffffff;
    display: flex; justify-content: center; align-items: center;
    transition: transform 0.5s ease, opacity 0.5s ease;
    will-change: transform, opacity;
}
.glow-effect {
    position: absolute; top: 30%; left: 50%; transform: translate3d(-50%, -50%, 0);
    width: 100vw; height: 100vw;
    background: radial-gradient(circle, rgba(255, 20, 147, 0.5) 0%, rgba(38, 197, 243, 0.3) 120%, transparent 100%);
    filter: blur(100px); z-index: 0; opacity: 0;
    animation: glowAppear 2s ease-in-out forwards 2.5s, glowPulse 1.7s infinite alternate 2s;
    pointer-events: none;
}
.mascot-layer {
    position: absolute; top: 53%; left: 50%; clip-path: inset(0 0 2% 0);
    width: 380px; max-width: 90vw; z-index: 1; opacity: 0;
    transform: translate3d(-50%, -55%, 0); 
    animation: slideUpFade 3s cubic-bezier(0.3, 1, 0.1, 1) forwards; animation-delay: 1.3s;
}
.content-stack {
    position: relative; z-index: 10; display: flex; flex-direction: column;
    align-items: center; justify-content: center; margin-top: 150px;
}
.text-back-glow {
    position: absolute; top: 40%; left: 50%; transform: translate3d(-50%, -50%, 0);
    width: 140%; height: 80%;
    background: radial-gradient(ellipse at center, var(--border-color-1) 0%, var(--border-color-2) 50%, transparent 70%);
    filter: blur(45px); z-index: -1; opacity: 0;
    animation: textGlowAppear 2s ease forwards; animation-delay: 3s; pointer-events: none;
}
.text-hello {
    font-size: 8rem; font-weight: 900; line-height: 1;
    background: linear-gradient(90deg, var(--border-color-1), var(--border-color-2), var(--border-color-1));
    background-size: 200% 100%; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; animation: gradientFlow 5s infinite; margin-bottom: -30px; z-index: 3; position: relative;
    will-change: background-position;
}
.text-partners {
    font-size: 5rem; font-weight: 900;
    background: linear-gradient(90deg, var(--border-color-1), var(--border-color-2), var(--border-color-1));
    background-size: 200% 200%; -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; animation: gradientFlow 5s infinite; line-height: 1; margin-bottom: -25px; z-index: 2; position: relative;
    will-change: background-position;
}
.google-btn {
    position: relative; display: flex; align-items: center; gap: 12px;
    padding: 18px 40px; border-radius: 50px; font-size: 1.3rem; font-weight: 600;
    color: white; background: var(--bg-color); border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.8); z-index: 4; overflow: hidden; cursor: pointer;
    -webkit-user-select: none; user-select: none;
    touch-action: manipulation;
}
.google-btn::before {
    content: ''; position: absolute; top: 50%; left: 50%; width: 300%; height: 300%; 
    background: conic-gradient(from 0deg, transparent 0%, transparent 70%, var(--border-color-2) 85%, var(--border-color-1) 100%);
    transform: translate(-50%, -50%); z-index: -2; opacity: 0; transition: opacity 0.3s ease;
    will-change: transform;
}
.google-btn::after {
    content: ''; position: absolute; inset: 3px; background: var(--btn-bg-inner); border-radius: 50px; z-index: -1;
}
.google-btn:hover::before, .google-btn.simulate-hover::before { opacity: 1; animation: snakeRotate 2s linear infinite; }
.google-icon { width: 28px; height: 28px; }

/* Optimized Keyframes */
@keyframes slideUpFade { from { opacity: 0; transform: translate3d(-50%, -55%, 0); } to { opacity: 1; transform: translate3d(-50%, -65%, 0); } }
@keyframes glowPulse { 0% { opacity: 0.9; } 100% { opacity: 1; } }
@keyframes gradientFlow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes snakeRotate { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes textGlowAppear { from { opacity: 0; } to { opacity: 0.6; } }

@media (max-width: 480px) {
    .text-hello { font-size: 6rem; margin-bottom: -10px; }
    .text-partners { font-size: 4rem; margin-bottom: -80px; }
    .google-btn { padding: 14px 30px; width: 280px; font-size: 1rem; margin-top: 80px;}
    .mascot-layer { width: 300px; transform: translate3d(-50%, -60%, 0); margin-top: -70px; }
    .content-stack { margin-top: 120px; }
    @keyframes slideUpFade { from { opacity: 0; transform: translate3d(-50%, -50%, 0); } to { opacity: 1; transform: translate3d(-50%, -60%, 0); } }
}

/* --- Auth/PIN Views --- */
#view-auth {
    position: fixed; inset: 0; z-index: 20;
    background-color: rgb(248, 250, 252);
    display: flex; justify-content: center; align-items: center;
    transform: translateZ(0);
}
.particles { position:absolute; inset:0; z-index:0; pointer-events:none; }
.particle { position:absolute; border-radius:50%; background:rgba(155,37,249,.1); animation:float 15s infinite linear; will-change:transform; }
@keyframes float { 0%{transform:translateY(0) rotate(0deg);opacity:0} 50%{opacity:.5} 100%{transform:translateY(-100vh) rotate(360deg);opacity:0} }

.auth-container { position:absolute; inset:0; display:flex; flex-direction:column; justify-content:center; align-items:center; transition:opacity .3s ease; z-index:10; padding:1rem; background-color:rgb(248, 250, 252); }
.page-hidden { opacity:0; pointer-events:none; visibility:hidden; display: none; }
.page-visible { opacity:1; visibility:visible; display: flex; }

.welcome-title { font-size:2.25rem; background:linear-gradient(90deg,#9b25f9,#26c5f3); -webkit-background-clip:text; -webkit-text-fill-color:transparent; margin:0 0 2rem 0; text-align:center; font-weight:700; }
.title-sm { font-size:1.5rem; }
.text-muted { color:#64748b; font-size:.9rem; }
.text-center { text-align:center; }

.input-wrapper { position:relative; width:300px; max-width:100%; height:56px; z-index:20; }
.input-wrapper.error { animation:shake .4s cubic-bezier(.36,.07,.19,.97) both; }
.input-box { 
    width:100%; height:100%; padding:0 20px; font-size:1.25rem; border:none; border-radius:16px; 
    background:#1e293b; color:#fff; text-align:center; letter-spacing:2px; 
    box-shadow:0 4px 6px -1px rgba(0,0,0,.1); transition:box-shadow .2s;
    -webkit-appearance: none; appearance: none; margin: 0;
}
.input-box:focus { outline:none; box-shadow:0 10px 15px -3px rgba(0,0,0,.2); }
.input-box::placeholder { color:#94a3b8; letter-spacing:normal; font-size:1rem; }

.animated-gradient-border { position:absolute; inset:-2px; z-index:-1; border-radius:18px; background:linear-gradient(90deg,#9b25f9,#26c5f3,#9b25f9); background-size:200% 100%; opacity:0; transition:opacity .3s; will-change: opacity, background-position; }
.input-wrapper:focus-within .animated-gradient-border { opacity:1; animation:gradientFlow 3s linear infinite; }

.btn-group { display:flex; gap:1rem; width:300px; margin-top:1.5rem; }
.btn-pin { flex:1; padding:.875rem; border-radius:12px; font-weight:600; border:none; cursor:pointer; font-family:inherit; transition:transform .1s; -webkit-appearance: none; }
.btn-pin:active { transform:scale(.98); }
.btn-pin:disabled { opacity:.5; cursor:not-allowed; }
.btn-primary-pin { background:linear-gradient(135deg,#9b25f9,#26c5f3); color:#fff; }
.btn-secondary-pin { background:#fff; color:#0f172a; border:1px solid #e2e8f0; }

.top-notification { position:fixed; top:16px; left:16px; right:16px; width:auto; background:#fff; padding:16px; border-radius:16px; box-shadow:0 20px 25px -5px rgba(0,0,0,.1); z-index:9999; transform:translateY(-150%); transition:transform .4s cubic-bezier(.34,1.56,.64,1); display:flex; align-items:center; justify-content:center; font-weight:500; will-change: transform; }
.top-notification.visible { transform:translateY(0); }
.top-notification.success { border-left:6px solid #10B981; color:#065F46; }
.top-notification.error { border-left:6px solid #EF4444; color:#7F1D1D; }
.debug-link { position:fixed; bottom:20px; color:#cbd5e1; font-size:.75rem; text-decoration:none; -webkit-tap-highlight-color: transparent; }
@keyframes shake { 10%,90%{transform:translate3d(-1px,0,0)} 20%,80%{transform:translate3d(2px,0,0)} 30%,50%,70%{transform:translate3d(-4px,0,0)} 40%,60%{transform:translate3d(4px,0,0)} }

/* --- Registration Overlay --- */
#reg-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    opacity: 0; visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}
#reg-overlay.active { opacity: 1; visibility: visible; }

#reg-sheet {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 85%;
    background: #ffffff;
    border-top-left-radius: 20px; border-top-right-radius: 20px;
    box-shadow: 0 -5px 30px rgba(0,0,0,0.2);
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    display: flex; flex-direction: column;
    will-change: transform;
}
#reg-overlay.active #reg-sheet { transform: translateY(0); }

.sheet-handle { width: 40px; height: 5px; background: #e2e8f0; border-radius: 10px; margin: 12px auto; flex-shrink: 0; }
.reg-app { flex: 1; padding: 0 1.5rem 5rem 1.5rem; overflow-y: auto; position: relative; color: #334155; -webkit-overflow-scrolling: touch; }
.step-card { display: none; flex-direction: column; padding-top: 2rem; animation: slideFadeIn 0.6s ease; }
.step-card.active { display: flex; }
.step-header {
    display: flex; align-items: center; gap: 1rem;
    position: sticky; top: 0; left: 0; right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    padding: 0.75rem 1rem; border-radius: 12px;
    border: 1px solid #e2e8f0; z-index: 10;
    margin-bottom: 1rem;
}
.step-number { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; color: white; background: linear-gradient(135deg, #f97316, #fb923c); flex-shrink: 0; }
.progress-container { flex: 1; }
.progress-bar { height: 8px; background: #f1f5f9; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(135deg, #f97316, #fb923c); border-radius: 999px; transition: width 0.6s ease; width: 0%; will-change: width; }
.step-title { font-size: 14px; color: #64748b; }
.welcome-hero h1 { font-size: 3rem; font-weight: 700; background: linear-gradient(135deg, #f87171, #60a5fa, #fb923c); -webkit-background-clip: text; -webkit-text-fill-color: transparent; text-align: center; margin-bottom: 1rem; }
.welcome-hero p { text-align: center; color: #64748b; line-height: 1.6; margin-bottom: 2rem; }
.form-group { margin-bottom: 1.5rem; display: flex; flex-direction: column; }
.form-label { font-size: 14px; color: #64748b; margin-bottom: 0.5rem; font-weight: 500; }
.form-input, .form-select, .form-textarea { 
    padding: 1rem; border: 1px solid #e2e8f0; 
    background: #f8fafc; border-radius: 12px; color: #1e293b; font-size: 16px; width: 100%; 
    -webkit-appearance: none; appearance: none;
}
.form-input:focus { outline: none; border-color: #3b82f6; background: white; }
.button-group { position: absolute; bottom: 0; left: 0; right: 0; padding: 1rem 1.5rem; background: linear-gradient(to top, #ffffff 50%, rgba(255,255,255,0)); z-index: 101; }
.button-group-grid { display: grid; gap: 0.75rem; }
.btn-reg { padding: 1rem; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer; width: 100%; display: flex; justify-content: center; align-items: center; transition: transform 0.1s ease; }
.btn-reg:active { transform: scale(0.98); }
.btn-primary-reg { background: linear-gradient(135deg, #3b82f6, #60a5fa); color: white; box-shadow: 0 4px 12px rgba(59,130,246,0.3); }
.btn-secondary-reg { background: white; color: #64748b; border: 1px solid #cbd5e1; }
.btn-reg:disabled { opacity: 0.5; cursor: not-allowed; background: #e2e8f0; color: #94a3b8; box-shadow: none; }
.preview-card { background: #f8fafc; padding: 1.5rem; border-radius: 12px; margin-top: 1rem; color: #64748b; border: 1px solid #e2e8f0; }
@keyframes slideFadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }


/* =============================================================================
   2. FEED & MAIN APP STYLES (จาก feed.css)
   ============================================================================= */
/* Header & Tabs */
.header-feed {
    background-color: var(--card-background-feed);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: fixed; top: 0; left: 0; right: 0; z-index: var(--z-header);
    height: calc(var(--header-height-feed) + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
    transition: transform var(--anim-duration) var(--ease-out-expo);
    will-change: transform;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}
.header-feed.header-hidden-feed { transform: translateY(-100%); }
.header-top-feed { display: flex; justify-content: space-between; align-items: center; padding: 0 16px; height: 100%; }
.header-left-feed { display: flex; align-items: center; gap: 10px; }
.header-left-feed h1 { display: flex; align-items: center; gap: 8px; }
.header-title-icon-feed { width: 30px; height: 30px; flex-shrink: 0; filter: none; }
.header-left-feed h1 span { font-size: 24px; font-weight: 700; letter-spacing: -0.5px; }
.search-box-feed { display: none; }
.header-right-feed { display: flex; gap: 8px; align-items: center; }
.icon-btn-feed { width: 40px; height: 40px; background-color: var(--divider-color-feed); border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 18px; color: var(--text-primary-feed); border: 0; padding: 0; transition: background-color 0.2s ease; -webkit-touch-callout: none; }
.icon-btn-feed:hover { background-color: #d8dadf; }

.tab-navigation-feed {
    background-color: var(--card-background-feed);
    position: fixed;
    top: calc(var(--header-height-feed) + env(safe-area-inset-top));
    left: 0; right: 0; z-index: 90;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    height: var(--tabs-height-feed);
    transition: transform var(--anim-duration) var(--ease-out-expo), top var(--anim-duration) var(--ease-out-expo);
    will-change: top, transform;
}
.tab-navigation-feed.tabs-scrolled-feed { top: env(safe-area-inset-top); }
.tabs-container-feed { display: flex; justify-content: center; gap: 2px; }
.tab-btn-feed {
    flex: 1; max-width: 120px; height: var(--tabs-height-feed);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
    border-bottom: 3px solid transparent; color: var(--text-secondary-feed);
    position: relative; transition: color 0.2s ease, border-bottom-color 0.2s ease;
    background: 0; border-left: 0; border-right: 0; border-top: 0; padding: 0; font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}
.tab-btn-feed i { display: none; }
.tab-btn-icon-svg { width: 24px; height: 24px; filter: grayscale(100%); transition: filter 0.2s ease; }
.tab-btn-feed.active .tab-btn-icon-svg { filter: none; }
.tab-btn-feed.active { color: var(--primary-color-feed); border-bottom-color: var(--primary-color-feed); }
.tab-btn-feed:hover { background-color: var(--hover-overlay-feed); }

/* Page Container */
.page-container-feed {
    display: flex; width: 100%; height: 100vh; height: 100dvh;
    margin-top: calc(var(--total-header-height-feed) + env(safe-area-inset-top));
    transition: transform var(--anim-duration) var(--ease-out-expo), margin-top var(--anim-duration) var(--ease-out-expo);
    will-change: transform, margin-top;
    touch-action: pan-y pinch-zoom;
}
.page-container-feed.page-container-scrolled-feed { margin-top: calc(var(--tabs-height-feed) + env(safe-area-inset-top)); }

.page-feed {
    flex: 0 0 100%; width: 100%;
    height: calc(100vh - var(--total-header-height-feed) - env(safe-area-inset-top));
    height: calc(100dvh - var(--total-header-height-feed) - env(safe-area-inset-top));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}
.page-container-scrolled-feed .page-feed {
    height: calc(100vh - var(--tabs-height-feed) - env(safe-area-inset-top));
    height: calc(100dvh - var(--tabs-height-feed) - env(safe-area-inset-top));
}

.page-content-wrapper-feed { max-width: none; margin: 0; padding: 0; }
.avatar-feed { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #667eea 0, #764ba2 100%); flex-shrink: 0; }
.post-card-feed { background: var(--card-background-feed); margin-bottom: 12px; }

/* Stories */
.stories-feed { background: var(--card-background-feed); border-radius: 8px; padding: 16px; margin: 0 0 12px 0; box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.stories-container-feed { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; }
.story-card-feed { min-width: 112px; height: 200px; border-radius: 12px; position: relative; cursor: pointer; overflow: hidden; transform: translateZ(0); }
.story-card-feed img { width: 100%; height: 100%; object-fit: cover; }
.story-avatar-feed { position: absolute; top: 8px; left: 8px; width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--primary-color-feed); background: linear-gradient(135deg, #f093fb 0, #f5576c 100%); }
.story-name-feed { position: absolute; bottom: 8px; left: 8px; color: white; font-weight: 600; font-size: 13px; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }

/* Post Components */
.post-header-feed { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; }
.post-author-feed { display: flex; align-items: center; gap: 8px; }
.post-author-info-feed h3 { font-size: 15px; font-weight: 600; }
.post-time-feed { font-size: 13px; color: var(--text-secondary-feed); }
.post-menu-feed { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 20px; color: var(--text-secondary-feed); border: 0; background: 0; padding: 0; transition: background-color 0.2s ease; }
.post-menu-feed:hover { background-color: var(--hover-overlay-feed); }
.post-content-feed { padding: 0 16px 12px; font-size: 15px; line-height: 1.5; }
.post-image-feed { width: 100%; max-height: 600px; object-fit: cover; background-color: var(--background-color-feed); }
.post-stats-feed { padding: 12px 16px; display: flex; justify-content: space-between; font-size: 15px; color: var(--text-secondary-feed); border-bottom: 1px solid var(--divider-color-feed); }
.post-actions-feed { display: flex; padding: 4px 16px; border-bottom: 1px solid var(--divider-color-feed); }
.action-btn-feed { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 0; border-radius: 6px; cursor: pointer; color: var(--text-secondary-feed); font-weight: 600; transition: background-color 0.2s ease; }
.action-btn-feed:hover { background-color: var(--hover-overlay-feed); }
.action-btn-feed i { font-size: 18px; }

/* Comments */
.post-comment-section-feed { padding: 12px 16px; }
.comment-feed { display: flex; gap: 8px; margin-bottom: 12px; }
.comment-avatar-feed { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg, #e3c15c 0, #de9a19 100%); }
.comment-content-feed { flex-grow: 1; background-color: var(--background-color-feed); padding: 8px 12px; border-radius: 18px; }
.comment-author-feed { font-weight: 600; font-size: 13px; }
.comment-text-feed { font-size: 14px; line-height: 1.3; }
.comment-actions-feed { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary-feed); margin-left: 40px; margin-top: -8px; margin-bottom: 12px; }
.comment-actions-feed span:first-child { font-weight: 600; cursor: pointer; }
.comments-section-feed { display: none; }
.write-comment-feed { display: flex; gap: 8px; align-items: center; width: 100%; }
.write-comment-input-feed { flex: 1; background-color: var(--background-color-feed); border: 0; border-radius: 18px; padding: 8px 12px; font-size: 15px; outline: 0; font-family: inherit; width: calc(100% - 52px); -webkit-appearance: none; }
.send-comment-btn-feed { background: var(--primary-color-feed); color: white; border: 0; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-left: auto; }

/* Video Grid */
.video-category-grid { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 8px; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; }
.video-category-grid::-webkit-scrollbar { display: none; }
.video-category-btn { background-color: var(--divider-color-feed); border: 0; padding: 8px 12px; border-radius: 18px; font-size: 14px; cursor: pointer; flex-shrink: 0; font-family: inherit; transition: background-color 0.2s ease, transform 0.1s ease; }
.video-category-btn:active { transform: scale(0.95); }
.video-category-btn.active { background-color: var(--primary-color-feed); color: white; font-weight: 600; }
.featured-videos-container-feed { display: flex; gap: 12px; overflow-x: auto; padding: 0 16px 8px; scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; }
.featured-videos-container-feed::-webkit-scrollbar { display: none; }
.all-videos-stories-grid-feed { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 0 16px; }
.all-video-story-card-feed { aspect-ratio: 9/16; border-radius: 8px; overflow: hidden; position: relative; cursor: pointer; background: var(--divider-color-feed); border: 0; padding: 0; transition: transform 0.2s ease; transform: translateZ(0); }
.all-video-story-card-feed:active { transform: scale(0.98); }
.all-video-story-overlay-feed { position: absolute; bottom: 0; left: 0; right: 0; padding: 12px 8px; background: linear-gradient(0deg, rgba(0,0,0,0.7) 0, rgba(0,0,0,0) 100%); color: white; }
.all-video-story-title-feed { font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.all-video-story-meta-feed { font-size: 12px; opacity: 0.8; margin-top: 4px; }
.all-video-story-play-icon-feed { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 32px; opacity: 0.8; }

/* Overlays & Modals */
.video-detail-overlay-feed, .post-detail-overlay-feed {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--background-color-feed);
    transition: transform 0.4s var(--ease-out-expo);
    transform: translateX(100%); z-index: var(--z-modal);
    will-change: transform;
}
.video-detail-overlay-feed.active, .post-detail-overlay-feed.active { transform: translateX(0); }
.video-detail-panel-feed, .post-video-detail-panel-feed { height: 100%; display: flex; flex-direction: column; }
.video-player-container-feed, .post-video-player-container-feed { aspect-ratio: 16/9; background: black; position: relative; }
.video-player-feed { width: 100%; height: 100%; display: block; object-fit: cover; }
.video-info-feed, .post-video-info-feed { padding: 16px; }
.video-title-feed { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.video-meta-feed { display: flex; align-items: center; gap: 10px; color: var(--text-secondary-feed); font-size: 13px; margin-bottom: 12px; }
.video-author-feed { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.video-stats-feed { display: flex; gap: 10px; font-size: 13px; }
.video-description-feed { font-size: 14px; line-height: 1.5; margin-bottom: 16px; }
.video-comments-feed, .post-video-comments-feed { flex-grow: 1; overflow-y: auto; padding: 0 16px; -webkit-overflow-scrolling: touch; }
.video-close-btn-feed, .post-video-close-btn-feed { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,0.5); border: 0; width: 36px; height: 36px; border-radius: 50%; color: white; font-size: 16px; cursor: pointer; z-index: 10; }

.overlay-page-feed {
    position: fixed; top: 0; left: 0; width: 85vw; max-width: 400px; height: 100vh; height: 100dvh;
    background-color: var(--background-color-feed); z-index: var(--z-overlay);
    transform: translateX(-100%);
    transition: transform 0.4s var(--ease-out-expo);
    display: flex; flex-direction: column;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    will-change: transform;
}
.overlay-page-feed.active { transform: translateX(0); }
.overlay-header-feed { display: flex; align-items: center; padding: 0 16px; height: calc(var(--header-height-feed) + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); background-color: var(--card-background-feed); box-shadow: 0 2px 4px rgba(0,0,0,0.1); flex-shrink: 0; }
.overlay-header-feed h2 { font-size: 18px; }
.overlay-back-btn-feed { font-size: 18px; cursor: pointer; margin-right: 16px; border: 0; background: 0; padding: 8px; color: var(--text-primary-feed); line-height: 1; }
.overlay-content-feed { flex-grow: 1; overflow-y: auto; padding: 16px; padding-bottom: 40px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

#footer-video {
    position: fixed; bottom: 0; left: 0; right: 0;
    background-color: var(--card-background-feed,#fff);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    transform: translateY(100%);
    height: auto;
    transition: transform 0.4s var(--ease-out-expo);
    z-index: 99;
    padding-bottom: env(safe-area-inset-bottom);
}
#footer-video.active { transform: translateY(-37px); border-top-left-radius: 12px; border-top-right-radius: 12px; z-index: 100; }
.video-categories-grid { display: grid; grid-auto-flow: column; grid-auto-columns: max-content; gap: 8px; overflow-x: auto; padding: 4px 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.video-categories-grid::-webkit-scrollbar { display: none; }

.main-backdrop-overlay-feed { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.3); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); z-index: 2009; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.main-backdrop-overlay-feed.active { opacity: 1; visibility: visible; }

.comment-overlay-feed { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.5); z-index: 600; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.comment-overlay-feed.active { opacity: 1; visibility: visible; }
.comment-panel-feed {
    position: absolute; bottom: 0; left: 0; right: 0; max-height: 85%; height: 70%;
    background-color: var(--card-background-feed);
    border-top-left-radius: 16px; border-top-right-radius: 16px;
    display: flex; flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s var(--ease-out-expo);
    padding-bottom: env(safe-area-inset-bottom);
}
.comment-overlay-feed.active .comment-panel-feed { transform: translateY(0); }
.comment-panel-header-feed { padding: 8px 12px; border-bottom: 1px solid var(--divider-color-feed); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.comment-panel-header-feed h3 { font-size: 14px; font-weight: 600; }
.comment-panel-close-btn-feed { font-size: 18px; color: var(--text-secondary-feed); cursor: pointer; background: 0; border: 0; padding: 0; line-height: 1; }
.comment-panel-content-feed { flex-grow: 1; overflow-y: auto; padding: 12px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.comment-panel-footer-feed { flex-shrink: 0; padding: 8px 12px 12px; border-top: 1px solid var(--divider-color-feed); background-color: var(--card-background-feed); }

.list-item-feed { display: flex; align-items: center; gap: 12px; padding: 12px; background-color: var(--card-background-feed); border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: background-color 0.2s ease; }
.list-item-feed:hover { background-color: var(--hover-overlay-feed); }
.list-item-content-feed { flex-grow: 1; }
.list-item-title-feed { font-weight: 600; font-size: 15px; }
.list-item-subtitle-feed { font-size: 13px; color: var(--text-secondary-feed); }
.list-item-time-feed { font-size: 12px; color: var(--text-secondary-feed); margin-left: auto; }
.unread-feed { background-color: #e7f3ff; }

@keyframes skeleton-loading { 0% { background-position: 100% 50% } 100% { background-position: -100% 50% } }
.skeleton { background-color: #e4e6eb; background-image: linear-gradient(90deg, var(--divider-color-feed), var(--card-background-feed), var(--divider-color-feed)); background-size: 200% 100%; background-repeat: no-repeat; border-radius: 4px; animation: skeleton-loading 1.5s infinite linear; will-change: background-position; }
.skeleton-text { width: 100%; height: 16px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-text-short { width: 40%; height: 16px; border-radius: 4px; }
.skeleton-avatar { width: 40px; height: 40px; border-radius: 50%; }
.skeleton-image { width: 100%; aspect-ratio: 16/9; margin-top: 12px; }
.skeleton-post-card { background: var(--card-background-feed); margin-bottom: 12px; padding: 12px 16px; }
.skeleton-post-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.skeleton-author-info { flex: 1; }
.skeleton-profile-header { display: flex; flex-direction: column; align-items: center; padding: 20px 16px; background-color: var(--card-background-feed); border-bottom: 1px solid var(--divider-color-feed); }
.skeleton-profile-avatar { width: 80px; height: 80px; border-radius: 50%; margin-bottom: 16px; }
.skeleton-profile-name { width: 60%; height: 20px; margin-bottom: 8px; }
.skeleton-profile-text { width: 85%; height: 16px; margin-bottom: 8px; }
.skeleton-list-item { display: flex; align-items: center; gap: 12px; padding: 12px; background-color: var(--card-background-feed); border-radius: 8px; margin-bottom: 8px; }
.skeleton-list-content { flex-grow: 1; }

@media(min-width:768px) {
    .search-box-feed { display: flex; background-color: var(--background-color-feed); border-radius: 50px; padding: 8px 16px; align-items: center; gap: 8px; }
    .search-box-feed input { border: 0; background: 0; outline: 0; font-size: 15px; width: 200px; }
}

/* =============================================================================
   3. HELLO & HOME OVERLAY STYLES (จาก hello.css)
   ============================================================================= */
#hi-js-overlay-feed {
    --hi-bg-color: #ffffff;
    --hi-text-color: white;
    --hi-border-color-1: #dd2476;
    --hi-border-color-2: #ff512f;
    --hi-btn-bg-inner: rgba(20, 20, 20, 0.95);
    font-family: 'NOTO SANS THAI', 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--text-primary-feed);
    position: fixed;
    top: var(--header-height-feed, 56px);
    bottom: 0; left: 0; right: 0; width: 100%;
    background-color: var(--background-color-feed, #fff);
    z-index: 100;
    opacity: 0; visibility: hidden;
    transform: scale(0.95);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, visibility 0.3s ease;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 4px 30px rgba(0,0,0,0.1);
}
#hi-js-overlay-feed.active { opacity: 1; visibility: visible; transform: scale(1); }
#hi-js-overlay-feed .hi-js-container { width: 100%; height: 100%; border: none; overflow: hidden; flex: 1; background: var(--hi-bg-color); display: flex; justify-content: center; align-items: center; position: relative; }
#hi-js-overlay-feed * { box-sizing: border-box; }

.main-selection-wrapper { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; position: relative; transform: translateY(18%); padding-bottom: env(safe-area-inset-bottom); }
.main-glow-effect { position: absolute; top: 30%; left: 50%; transform: translate(-50%, -50%); width: 100vw; height: 100vw; background: radial-gradient(circle, rgba(255, 20, 147, 0.5) 0%, rgba(38, 197, 243, 0.3) 120%, transparent 100%); filter: blur(100px); z-index: 0; opacity: 0; will-change: opacity; animation: hi-glowAppear 2s ease-in-out forwards 2.5s, hi-glowPulse 1.7s infinite alternate 2s; }
.main-mascot-head-glow { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); width: 280px; height: 280px; background: radial-gradient(circle, #2962ff 0%, #00bbff 60%, transparent 85%); filter: blur(25px); z-index: 1; opacity: 0; animation: hi-textGlowAppear 2s ease forwards; animation-delay: 2s; pointer-events: none; }
.main-mascot-layer { position: absolute; top: 55%; left: 50%; clip-path: inset(0 0 2% 0); width: 380px; max-width: 90vw; z-index: 2; opacity: 0; will-change: transform, opacity; animation: hi-slideUpFade 3s cubic-bezier(0.3, 1, 0.1, 1) forwards; animation-delay: 1.3s; }
.main-content-stack { position: relative; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; margin-top: 190px; }
.main-text-back-glow { position: absolute; top: 35%; left: 50%; transform: translate(-50%, -50%); width: 160%; height: 100%; background: radial-gradient(ellipse at center, #4285f4 0%, #9c27b0 60%, transparent 80%); filter: blur(30px); z-index: 5; opacity: 0; animation: hi-textGlowFadeWeak 2s ease forwards; animation-delay: 3s; pointer-events: none; }
.main-text-hello { font-size: 8rem; font-weight: 900; line-height: 1; background: linear-gradient(90deg, var(--hi-border-color-1), var(--hi-border-color-2), var(--hi-border-color-1)); background-size: 200% 100%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; -webkit-text-stroke: 2px white; animation: hi-gradientFlow 5s infinite; margin-bottom: -30px; z-index: 20; position: relative; text-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.main-text-partners { font-size: 5rem; font-weight: 900; background: linear-gradient(90deg, var(--hi-border-color-1), var(--hi-border-color-2), var(--hi-border-color-1)); background-size: 200% 200%; -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; -webkit-text-stroke: 2px white; animation: hi-gradientFlow 5s infinite; line-height: 1; margin-bottom: -25px; z-index: 19; position: relative; text-shadow: 0 10px 30px rgba(0,0,0,0.1); }
.main-google-btn { position: relative; display: flex; align-items: center; gap: 12px; padding: 18px 40px; border-radius: 50px; font-size: 1.3rem; font-weight: 600; color: white; background: var(--hi-bg-color); border: 1px solid rgba(255,255,255,0.1); box-shadow: 0 10px 30px rgba(0,0,0,0.8); z-index: 25; overflow: hidden; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform 0.2s; }
.main-google-btn:active { transform: scale(0.98); }
.main-google-btn::before { content: ''; position: absolute; top: 50%; left: 50%; width: 300%; height: 300%; background: conic-gradient(from 0deg, transparent 0%, transparent 70%, var(--hi-border-color-2) 85%, var(--hi-border-color-1) 100%); transform: translate(-50%, -50%); z-index: -2; opacity: 0; transition: opacity 0.3s ease; will-change: transform, opacity; }
.main-google-btn::after { content: ''; position: absolute; inset: 3px; background: var(--hi-btn-bg-inner); border-radius: 50px; z-index: -1; }
.main-google-btn:hover::before, .main-google-btn.main-simulate-hover::before { opacity: 1; animation: hi-snakeRotate 2s linear infinite; }
.main-google-icon { width: 28px; height: 28px; }
.main-login-info { margin-top: 25px; text-align: center; color: #888; font-size: 0.85rem; font-weight: 400; z-index: 25; opacity: 0; animation: hi-textGlowAppear 1s ease forwards 3.8s; }
.main-login-info p { margin-bottom: 5px; }
.main-login-info a { color: var(--hi-border-color-2); text-decoration: none; font-weight: 600; transition: all 0.3s; }
.main-login-info a:hover { text-decoration: underline; }

@keyframes hi-slideUpFade { from { opacity: 0; transform: translate(-50%, -55%); } to { opacity: 1; transform: translate(-50%, -65%); } }
@keyframes hi-glowPulse { 0% { opacity: 0.9; } 100% { opacity: 1; } }
@keyframes hi-gradientFlow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes hi-snakeRotate { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes hi-textGlowAppear { from { opacity: 0; } to { opacity: 1; } }
@keyframes hi-textGlowFadeWeak { from { opacity: 0; } to { opacity: 0.2; } }
@keyframes hi-glowAppear { from { opacity: 0; } to { opacity: 1; } }

#home-overlay-feed {
    position: fixed; top: var(--header-height-feed, 45px); bottom: 35px; left: 0; right: 0; width: 100%;
    background: linear-gradient(180deg, #eef2f3 10%, #8e9eab 100%);
    z-index: 90; opacity: 0; visibility: hidden; transform: scale(0.8);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, visibility 0.3s ease;
    display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 4px 30px rgba(0,0,0,0.1);
    --home-font-stack: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
    --home-glass-bg: rgba(255, 255, 255, 0.75);
    --home-glass-border: rgba(255, 255, 255, 0.5);
    --home-text-primary: #1d1d1f;
    --home-text-secondary: #5e5e63;
    --home-shadow-soft: 0 20px 40px rgba(0,0,0,0.15);
    --home-anim-speed: 0.5s;
    --home-skeleton-bg: rgba(200, 200, 200, 0.4);
    --home-color-up: #34c759;
    --home-color-down: #ff3b30;
}
#home-overlay-feed.active { opacity: 1; visibility: visible; transform: scale(1); }
#home-screen-home { position: relative; width: 100%; height: 100%; padding: 20px; display: grid; grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(4, 1fr); gap: 15px; z-index: 1; overflow-y: auto; padding-bottom: 80px; }
.widget-home { background: var(--home-glass-bg); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); border: 1px solid var(--home-glass-border); border-radius: 24px; padding: 18px; box-shadow: var(--home-shadow-soft); display: flex; flex-direction: column; overflow: hidden; }
.widget-large-home { grid-column: span 2; grid-row: span 2; }
.widget-tall-home { grid-row: span 2; }
.widget-wide-home { grid-column: span 2; }
.widget-small-home { grid-column: span 1; grid-row: span 1; }
.widget-header-home { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.widget-title-home { font-size: 0.8rem; font-weight: 600; color: var(--home-text-secondary); text-transform: uppercase; letter-spacing: 0.5px; display: flex; align-items: center; gap: 5px; }
.widget-content-home { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.widget-data-home { color: var(--home-text-primary); line-height: 1.1; font-weight: 500; }
.widget-subtitle-home { font-size: 0.85rem; color: var(--home-text-secondary); margin-top: 4px; font-weight: 400; }
#home-overlay-feed .fade-slide { transition: opacity 0.4s ease, transform 0.4s ease; opacity: 1; transform: translateY(0); }
#home-overlay-feed .fade-slide.out { opacity: 0; transform: translateY(-5px); }
#home-overlay-feed .fade-slide.in { opacity: 1; transform: translateY(0); }
#home-overlay-feed .skeleton { background: var(--home-skeleton-bg); border-radius: 4px; color: transparent !important; min-width: 40%; display: inline-block; animation: home-pulse 1.5s infinite; }
@keyframes home-pulse { 0% { opacity: 0.6; } 50% { opacity: 1; } 100% { opacity: 0.6; } }

#overlay-home { position: absolute; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(5px); z-index: 10; opacity: 0; visibility: hidden; transition: all 0.4s ease; }
#overlay-home.active-home { opacity: 1; visibility: visible; }
.glass-panel-base-home { position: absolute; background: #f2f2f7; border: 1px solid var(--home-glass-border); box-shadow: var(--home-shadow-soft); z-index: 20; transition: transform var(--home-anim-speed) cubic-bezier(0.32, 0.72, 0, 1); overflow: hidden; color: var(--home-text-primary); display: flex; flex-direction: column; align-items: center; }
#right-panel-home { top: 15px; bottom: 15px; right: 15px; width: 70%; border-radius: 32px; transform: translateX(calc(100% + 20px)); background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(40px); }
#right-panel-home.open-home { transform: translateX(0); }
#left-panel-home { top: 15px; bottom: 15px; left: 15px; width: 70%; border-radius: 32px; transform: translateX(calc(-100% - 20px)); background: rgba(255, 255, 255, 0.95); backdrop-filter: blur(40px); }
#left-panel-home.open-home { transform: translateX(0); }
#top-panel-home { top: 0 !important; left: 0; width: 100%; height: 60%; border-radius: 0 0 32px 32px; transform: translateY(-100%); background: rgba(245, 245, 247, 0.98); backdrop-filter: blur(50px); color: #1d1d1f; padding: 20px; z-index: 120; display: flex; justify-content: center; align-items: center; }
#top-panel-home.open-home { transform: translateY(0); }
.panel-header-area { width: 100%; padding: 25px; text-align: center; border-bottom: 1px solid rgba(0,0,0,0.05); background: rgba(255,255,255,0.8); }
.panel-header-title { font-size: 1.3rem; font-weight: 600; }
.panel-list-container { width: 100%; flex: 1; overflow-y: auto; padding: 0 20px; }
.list-item-row { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid rgba(0,0,0,0.05); }
.item-main { font-size: 1rem; font-weight: 500; }
.item-sub { font-size: 0.8rem; color: var(--home-text-secondary); }
.item-val { font-size: 1rem; font-weight: 600; }
.trend-up { color: var(--home-color-up); }
.trend-down { color: var(--home-color-down); }

#bottom-footer { position: absolute; bottom: 0; left: 0; width: 100%; height: auto; margin: 0; display: grid; grid-template-columns: repeat(5, 1fr); align-items: center; justify-items: center; background: rgba(255, 255, 255, 0.9); border-radius: 20px 20px 0 0; box-shadow: 0 -5px 20px rgba(0,0,0,0.08); padding-top: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom)); min-height: calc(35px + env(safe-area-inset-bottom)); transform: translateY(0); transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1); z-index: 130; overflow: visible !important; }
#bottom-footer.hide-footer { transform: translateY(100%); }
.bottom-icon-btn { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; transition: all 0.2s; background: transparent; }
.bottom-icon-btn:active { transform: scale(0.9); background: rgba(0,0,0,0.05); }
.bottom-icon-svg { width: 30px; height: 30px; fill: var(--home-text-primary); opacity: 0.8; }
.center-logo-wrapper-home { width: 45px; height: 45px; background: #1d1d1f; border-radius: 14px; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 15px rgba(0,0,0,0.2); cursor: pointer; position: relative; margin-top: -35px; border: 4px solid rgba(255,255,255,0.9); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); opacity: 0; transform: scale(0.5); }
.center-logo-img { width: 36px; height: 36px; object-fit: contain; }
#bottom-footer.open-home .center-logo-wrapper-home { opacity: 1; transform: scale(1); }
.center-logo-wrapper-home:active { transform: scale(0.9) !important; }
.calendar-wrapper { width: 100%; max-width: 400px; padding: 10px; }
.calendar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; font-weight: 700; font-size: 1.5rem; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; text-align: center; }
.calendar-day-name { font-weight: 600; color: var(--home-text-secondary); font-size: 0.9rem; margin-bottom: 10px; }
.calendar-day { padding: 10px; border-radius: 12px; font-size: 1rem; transition: background 0.2s; }
.calendar-day.today { background: var(--home-text-primary); color: white; font-weight: 600; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.calendar-day.empty { pointer-events: none; }
.detail-view-container { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 20px; text-align: center; }
.detail-view-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; color: var(--home-text-primary); }
.detail-view-content { width: 100%; overflow-y: auto; text-align: left; }
.mini-list-container { width: 100%; display: flex; flex-direction: column; gap: 8px; margin-top: 5px; }
.mini-list-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,0.05); }
.mini-list-row:last-child { border-bottom: none; }
.mini-list-left { font-size: 1rem; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.mini-list-right { font-size: 0.95rem; font-weight: 600; opacity: 0.8; }

/* =============================================================================
   4. GLOBAL FOOTER & SIDE MENU STYLES (Common)
   ============================================================================= */
.app-footer-feed {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: auto; min-height: 38px;
    background: var(--card-background-feed, #fff);
    border-top: 1px solid var(--divider-color-feed, #e4e6eb);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px calc(5px + env(safe-area-inset-bottom));
    z-index: 100;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
    overflow: visible !important;
    border-top-left-radius: 14px; border-top-right-radius: 14px;
}
.footer-icon-btn {
    background: var(--background-color-feed);
    border: none; cursor: pointer; font-size: 14px;
    color: var(--text-secondary-feed, #65676b);
    width: 26px; height: 26px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    padding: 0; transition: background-color 0.2s ease;
}
.footer-icon-btn:hover { background-color: var(--hover-overlay-feed); }
.footer-content-middle { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--primary-color-feed, #1877f2); }
.footer-chat-btn {
    width: 80px; height: 80px;
    background-color: transparent; border: none; box-shadow: none; border-radius: 0;
    display: flex; align-items: center; justify-content: center;
    position: absolute; left: 50%; top: -35px;
    transform: translateX(-50%) scale(0);
    opacity: 0; cursor: pointer; z-index: 105;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    pointer-events: none;
}
.footer-chat-btn img { width: 45px; height: 45px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.2)); transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.footer-chat-btn:active img { transform: scale(0.9); }

.sidebar-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0,0,0,0.3); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); z-index: 1999; opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease; }
.sidebar-overlay.active { opacity: 1; visibility: visible; }
.sidebar { position: fixed; top: 0; bottom: 0; width: 80vw; max-width: 400px; z-index: 2000; background-color: var(--card-background-feed, #fff); box-shadow: 0 4px 20px rgba(0,0,0,0.1); transition: transform 0.3s ease-in-out; display: flex; flex-direction: column; }
.sidebar.sidebar-left { left: 0; transform: translateX(-100%); }
.sidebar.sidebar-right { right: 0; transform: translateX(100%); }
.sidebar.active { transform: translateX(0); }
.sidebar-submenu { z-index: 2001; }
.sidebar .p-6 { overflow-y: auto; flex-grow: 1; padding-top: calc(24px + env(safe-area-inset-top)); padding-bottom: calc(24px + env(safe-area-inset-bottom)); padding-left: calc(24px + env(safe-area-inset-left)); padding-right: calc(24px + env(safe-area-inset-right)); }
.sidebar-skeleton-header { display: flex; align-items: center; margin-bottom: 24px; }
.sidebar-skeleton-avatar { width: 40px; height: 40px; border-radius: 8px; margin-right: 12px; }
.sidebar-skeleton-title { flex: 1; }
.sidebar-skeleton-item { display: flex; align-items: center; padding: 12px 8px; margin-bottom: 8px; }
.sidebar-skeleton-icon { width: 24px; height: 24px; border-radius: 4px; margin-right: 16px; }
.sidebar-skeleton-text { height: 16px; width: 70%; border-radius: 4px; }
.sidebar .material-icons { font-family: 'Material Icons'; font-size: 24px; display: inline-block; line-height: 1; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
.sidebar .btn-icon { background: none; border: none; cursor: pointer; padding: 4px; border-radius: 50%; }
.sidebar .btn-icon:hover { background-color: rgba(0,0,0,0.05); }
.sidebar .text-muted { color: #65676b; }
.sidebar .text-text-primary { color: #050505; }
.sidebar .text-text-secondary { color: #333; }
.sidebar .text-secondary { color: #6c757d; }
.sidebar .text-success { color: #4caf50; }
.sidebar .glass { background-color: rgba(240, 242, 245, 0.7); }

/* =============================================================================
   5. DASHBOARD & UTILITIES (จาก goldbal.css)
   ============================================================================= */
.widget-scroll-view { display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; height: 100%; width: 100%; scrollbar-width: none; }
.widget-scroll-view::-webkit-scrollbar, .scroll-page.vertical::-webkit-scrollbar { display: none; }
.scroll-page { flex: 0 0 100%; width: 100%; height: 100%; scroll-snap-align: center; padding: 16px; display: flex; flex-direction: column; justify-content: space-between; position: relative; }
.scroll-page.vertical { justify-content: flex-start; overflow-y: auto; }
.v-list-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--divider-color-feed); font-size: 0.8rem; }
.v-list-item:last-child { border-bottom: none; }
.stock-name { font-weight: 600; font-size: 0.85rem; }
.stock-detail { font-size: 0.7rem; color: var(--text-secondary-feed); }
.w-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.w-title { font-size: 0.75rem; color: var(--text-secondary-feed); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.w-value { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.5px; }
.w-value-lg { font-size: 2.6rem; font-weight: 500; letter-spacing: -1px; line-height: 1; }
.badge { padding: 4px 8px; border-radius: 6px; font-size: 0.6rem; font-weight: 700; text-transform: uppercase; }
.bg-bull { background: rgba(0, 184, 148, 0.15); color: #00b894; }
.bg-bear { background: rgba(255, 82, 82, 0.15); color: #ff5252; }
.bg-wait { background: rgba(241, 196, 15, 0.15); color: #d35400; }
.c-bull { color: #00b894; }
.c-bear { color: #ff5252; }
.c-sec { color: var(--text-secondary-feed); }
.c-pri { color: var(--text-primary-feed); }
.c-wait { color: #d35400; }
.page-dots { position: absolute; bottom: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 5px; pointer-events: none; }
.p-dot { width: 5px; height: 5px; background: rgba(0, 0, 0, 0.15); border-radius: 50%; transition: all 0.3s; }
.p-dot.active { background: var(--text-primary-feed); width: 15px; border-radius: 10px; }
.panel-content { padding: 25px; height: 100%; overflow-y: auto; }
.panel-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; color: var(--text-primary-feed); display: flex; align-items: center; gap: 10px; }
.animating { transition: transform 0.5s var(--ease-out-expo) !important; }
.dragging { transition: none !important; }
.mode-hint { position: fixed; top: 40%; left: 50%; transform: translate(-50%, -50%); background: rgba(0, 0, 0, 0.75); color: white; padding: 12px 24px; border-radius: 30px; font-size: 0.95rem; font-weight: 500; pointer-events: none; opacity: 0; transition: opacity 0.3s; z-index: 100; backdrop-filter: blur(8px); box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3); }
.nav-active #home-screen { filter: blur(5px) brightness(0.9); transition: all 0.3s ease; }
.nav-active .mode-hint { opacity: 1; top: 50%; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.data-table th { text-align: left; color: var(--text-secondary-feed); padding-bottom: 10px; font-weight: 500; font-size: 0.75rem; }
.data-table td { padding: 8px 0; border-bottom: 1px solid var(--divider-color-feed); }
.data-table tr:last-child td { border-bottom: none; }
#calc-display { width: 100%; background: rgba(0, 0, 0, 0.05); border-radius: 12px; padding: 20px; text-align: right; font-size: 2.5rem; font-weight: 500; margin-bottom: 20px; color: var(--text-primary-feed); overflow: hidden; }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; flex: 1; }
.calc-btn { background: white; border: none; border-radius: 12px; font-size: 1.2rem; font-weight: 500; color: var(--text-primary-feed); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05); cursor: pointer; transition: background 0.2s; }
.calc-btn:active { background: #eee; }
.calc-btn.op { background: #f0f0f0; color: var(--text-secondary-feed); }
.calc-btn.op-eq { background: var(--text-primary-feed); color: white; }
@keyframes shimmer { 0% { background-position: -200% 0 } 100% { background-position: 200% 0 } }
.skel-load { background: linear-gradient(90deg, #eee 25%, #f5f5f5 50%, #eee 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; color: transparent !important; border-radius: 4px; user-select: none; }
.marquee-container { width: 100%; overflow: hidden; white-space: nowrap; display: flex; }
.marquee-content { display: inline-block; animation: marquee 20s linear infinite; padding-left: 100%; }
.marquee-content span { display: inline-block; font-size: 0.9rem; padding: 0 10px; font-weight: 500; }
.marquee-content .divider { color: #ddd; font-weight: 300; }
@keyframes marquee { 0% { transform: translate(0, 0) } 100% { transform: translate(-100%, 0) } }
