*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #0a0a0a; --surface: #1a1a1a; --surface2: #242424; --border: #2e2e2e;
  --text: #ffffff; --text2: #8c8c8c; --accent: #2979ff; --pink: #e91e8c;
  --topbar-h: 52px; --tabs-h: 46px; --bottom-h: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

html { height: 100%; }
body {
  font-family: 'Sarabun', sans-serif; background: var(--bg); color: var(--text);
  width: 100%; min-height: 100%; padding-bottom: calc(var(--bottom-h) + var(--safe-bottom) + 70px);
  overflow-x: hidden; font-size: clamp(13px, 3.8vw, 16px);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: contain; touch-action: pan-y;
}

/* STICKY HEADER & TABS */
.sticky-header { position: fixed; top: 0; left: 0; right: 0; z-index: 200; background: var(--bg); will-change: transform; }
.topbar { display: flex; align-items: center; padding: 0 16px; padding-top: var(--safe-top); height: calc(var(--topbar-h) + var(--safe-top)); transition: max-height 0.32s cubic-bezier(0.4,0,0.2,1), opacity 0.28s ease, padding 0.32s ease; overflow: hidden; opacity: 1; }
.sticky-header.scrolled-down .topbar { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
.sticky-header.scrolled-down .tabs-wrapper { border-top: 1px solid var(--border); padding-top: calc(var(--safe-top) + 4px); }
.topbar .back { font-size: 20px; color: var(--text); cursor: pointer; padding: 8px 8px 8px 0; }
.topbar h2 { flex: 1; text-align: center; font-size: clamp(15px, 4.5vw, 18px); font-weight: 800; display: flex; justify-content: center; align-items: center; gap: 8px;}
.topbar-icons { display: flex; gap: clamp(12px, 4vw, 20px); font-size: clamp(18px, 5vw, 22px); cursor: pointer;}
.tabs-wrapper { background: var(--bg); padding-bottom: 8px; transition: border-top 0.3s, padding-top 0.32s; }
.tabs { display: flex; gap: 8px; padding: 6px 16px 0; overflow-x: auto; scrollbar-width: none; align-items: center; }
.tabs::-webkit-scrollbar { display: none; }
.tab { white-space: nowrap; padding: 7px 16px; border-radius: 20px; font-size: clamp(12px, 3.5vw, 14px); font-weight: 600; cursor: pointer; border: none; background: var(--surface2); color: var(--text2); transition: all 0.18s; flex-shrink: 0; font-family: 'Sarabun', sans-serif; }
.tab.active { background: var(--text); color: #000; }
.content { padding-top: calc(var(--topbar-h) + var(--tabs-h) + var(--safe-top)); }

/* HERO & CARDS */
.hero { margin: 12px 16px 16px; border-radius: clamp(12px, 4vw, 20px); overflow: hidden; position: relative; height: clamp(160px, 50vw, 220px); background: linear-gradient(135deg, #e91e8c 0%, #9c27b0 40%, #3f51b5 100%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; user-select: none; }
.hero-play { width: clamp(44px, 13vw, 56px); height: clamp(44px, 13vw, 56px); border-radius: 50%; background: rgba(255,255,255,0.25); display: flex; align-items: center; justify-content: center; font-size: clamp(18px, 5.5vw, 24px); cursor: pointer; backdrop-filter: blur(4px); border: 1px solid rgba(255,255,255,0.3); }
.hero h3 { font-size: clamp(16px, 5.2vw, 22px); font-weight: 800; text-align: center; text-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.hero p { font-size: clamp(11px, 3vw, 13px); color: rgba(255,255,255,0.85); }
.hero .btn-setup { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.35); color: #fff; border-radius: 20px; padding: 7px 22px; font-size: clamp(12px, 3.5vw, 14px); font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; backdrop-filter: blur(4px); font-family: 'Sarabun', sans-serif; }
.swipe-hint { text-align: center; color: var(--text2); font-size: clamp(11px, 3vw, 13px); padding: 6px 0 14px; }
.quick-cards { display: flex; gap: clamp(8px, 2.5vw, 12px); padding: 0 16px 20px; }
.quick-card { flex: 1; border-radius: clamp(10px, 3vw, 14px); padding: clamp(10px, 3vw, 14px); display: flex; align-items: center; gap: 10px; font-size: clamp(12px, 3.5vw, 14px); font-weight: 700; cursor: pointer; background: var(--surface2); }
.quick-card .icon { width: clamp(36px, 10vw, 44px); height: clamp(36px, 10vw, 44px); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: clamp(16px, 5vw, 20px); background: rgba(255,255,255,0.2); }
.qc-tracks { background: linear-gradient(135deg, #e91e8c, #9c27b0); }
.qc-recent { background: linear-gradient(135deg, #00bcd4, #009688); }

/* SECTIONS & GRIDS */
.section-title { padding: 0 16px 12px; font-size: clamp(14px, 4.2vw, 17px); font-weight: 800; }
.section-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 0 16px 12px; }
.section-header h3 { font-size: clamp(14px, 4.2vw, 17px); font-weight: 800; }
.section-header .see-all { color: var(--text2); font-size: 22px; cursor: pointer; }
.taste-cards { display: flex; gap: clamp(8px, 2.5vw, 12px); padding: 0 16px 20px; }
.taste-card { flex: 1; border-radius: clamp(12px, 4vw, 18px); height: clamp(120px, 38vw, 155px); position: relative; overflow: hidden; cursor: pointer; }
.tc-discovery .bg { position: absolute; inset:0; background: linear-gradient(135deg, #7b1fa2, #4a148c, #1a237e); }
.tc-new .bg { position: absolute; inset:0; background: linear-gradient(135deg, #00897b, #0097a7, #006064); }
.taste-card .tc-label { position: absolute; top: 12px; left: 12px; }
.taste-card .tc-label h4 { font-size: clamp(15px, 4.5vw, 19px); font-weight: 800; }
.taste-card .tc-play { position: absolute; bottom: 10px; right: 10px; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.genres-grid, .moods-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(6px, 2vw, 10px); padding: 0 16px 20px; }
.genre-btn { border-radius: clamp(10px, 3vw, 14px); padding: clamp(14px, 4.5vw, 18px) 14px; display: flex; align-items: center; gap: 8px; font-size: clamp(13px, 4vw, 15px); font-weight: 700; cursor: pointer; border: none; color: #fff; background: linear-gradient(135deg, #3f51b5, #1a237e); font-family: 'Sarabun', sans-serif;}
.mood-btn { border-radius: clamp(10px, 3vw, 14px); height: clamp(65px, 18vw, 80px); display: flex; align-items: center; gap: 10px; padding: 0 clamp(12px, 4vw, 18px); font-size: clamp(13px, 4vw, 16px); font-weight: 800; cursor: pointer; border: none; color: #fff; font-family: 'Sarabun', sans-serif;}
.genre-btn .play-icon, .mood-btn .play-icon { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 10px; flex-shrink: 0; }
.mb-happy   { background: linear-gradient(135deg, #ffa726, #ff7043); }
.mb-sad     { background: linear-gradient(135deg, #42a5f5, #1565c0); }
.mb-work    { background: linear-gradient(135deg, #26a69a, #004d40); }
.mb-workout { background: linear-gradient(135deg, #ef5350, #b71c1c); }

/* SKELETON LOADING */
.skeleton { background: linear-gradient(90deg, var(--surface2) 25%, #333 50%, var(--surface2) 75%); background-size: 200% 100%; animation: skeletonLoad 1.5s infinite linear; border-radius: 4px; }
@keyframes skeletonLoad { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-box { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); width: 100%; }
.skeleton-avatar { width: clamp(42px, 12vw, 50px); height: clamp(42px, 12vw, 50px); border-radius: 10px; flex-shrink: 0; }
.skeleton-text { height: 12px; margin-bottom: 8px; border-radius: 6px; }

/* LISTS & SCROLLS */
.track-list { padding: 0 16px 20px; }
.track-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); cursor: pointer; transition: opacity 0.15s; }
.track-avatar { width: clamp(42px, 12vw, 50px); height: clamp(42px, 12vw, 50px); border-radius: 10px; background: var(--surface2); display: flex; align-items: center; justify-content: center; font-size: clamp(18px, 5vw, 22px); flex-shrink: 0; }
.track-info { flex: 1; min-width: 0; }
.track-info .artist { font-size: clamp(13px, 3.8vw, 15px); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-info .meta { font-size: clamp(11px, 3vw, 13px); color: var(--text2); margin-top: 2px; }
.track-menu { color: var(--text2); font-size: 20px; padding: 6px; }
.podcasts-scroll, .editors-scroll { display: flex; gap: 12px; padding: 0 16px 20px; overflow-x: auto; scrollbar-width: none; }
.podcasts-scroll::-webkit-scrollbar, .editors-scroll::-webkit-scrollbar { display: none; }
.podcast-card, .editor-card { flex-shrink: 0; width: clamp(130px, 38vw, 155px); cursor: pointer; }
.podcast-thumb { width: 100%; aspect-ratio: 1/1; border-radius: 14px; background: var(--surface2); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; overflow: hidden; }
.podcast-title { font-size: clamp(12px, 3.5vw, 14px); font-weight: 700; margin-bottom: 3px; }
.editor-thumb { width: 100%; aspect-ratio: 1/1; position: relative; overflow: hidden; border-radius: 14px; }
.et-bg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; position: relative; }
.et-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; padding: 10px; }
.et-say { font-size: clamp(9px, 2.5vw, 11px); color: rgba(255,255,255,0.6); letter-spacing: 1.5px; text-transform: uppercase; }
.et-love { font-size: clamp(26px, 8vw, 34px); font-weight: 900; font-style: italic; line-height: 1; color: #fff; }
.editor-label { font-size: clamp(10px, 2.8vw, 12px); color: var(--text2); margin-top: 6px; padding: 0 2px; line-height: 1.4; }
.divider { height: 1px; background: var(--border); margin: 4px 16px 20px; }

/* DETAIL PAGE (SLIDE FROM RIGHT) */
.detail-page { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--bg); z-index: 250; transform: translateX(100%); transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1); overflow-y: auto; padding-bottom: calc(var(--bottom-h) + var(--safe-bottom) + 80px); }
.detail-page.active { transform: translateX(0); }
.detail-header { display: flex; align-items: center; gap: 16px; padding: calc(var(--safe-top) + 16px) 16px 16px; position: sticky; top: 0; background: rgba(10,10,10,0.95); backdrop-filter: blur(10px); z-index: 10; border-bottom: 1px solid var(--border); }
.detail-header .back-btn { background: none; border: none; color: var(--text); font-size: 20px; cursor: pointer; padding: 4px; }

/* === MINI PLAYER (Now Playing) === */
.now-playing { position: fixed; bottom: calc(var(--bottom-h) + var(--safe-bottom) + 8px); left: 16px; right: 16px; background: var(--surface); border-radius: 16px; padding: 10px 14px; display: none; align-items: center; gap: 10px; z-index: 300; box-shadow: 0 -4px 30px rgba(0,0,0,0.6); cursor: grab; animation: slideUp 0.35s ease; touch-action: none; }
.now-playing:active { cursor: grabbing; }
.now-playing.show { display: flex; }
@keyframes slideUp { from { transform: translateY(80px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.np-thumb { width: 40px; height: 40px; border-radius: 10px; background: linear-gradient(135deg,#e91e8c,#9c27b0); flex-shrink:0; display:flex;align-items:center;justify-content:center;font-size:18px; }
.np-info { flex: 1; min-width: 0; pointer-events: none; }
.np-title { font-size: clamp(12px,3.5vw,14px); font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.np-artist { font-size: clamp(10px,2.8vw,12px); color:var(--text2); margin-top:1px; }
.np-progress { height:2px; background:var(--border); border-radius:2px; margin-top:6px; overflow:hidden; }
.np-progress-fill { height:100%; background:var(--pink); border-radius:2px; width:0%; transition:width 0.2s linear; }
.np-controls { display:flex; gap:8px; align-items:center; }
.np-controls button { background:none; border:none; color:var(--text); font-size:clamp(18px,5.5vw,22px); cursor:pointer; padding:6px; pointer-events: auto; }

/* === FULL SCREEN PLAYER (ใหม่!) === */
.full-player {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, var(--surface2) 0%, var(--bg) 100%);
  z-index: 500; display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform; overflow: hidden;
}
.full-player.dragging { transition: none; }
.full-player.open { transform: translateY(0); }

.fp-header { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-top) + 20px) 20px 10px; cursor: grab; touch-action: none; }
.fp-header:active { cursor: grabbing; }
.fp-minimize, .fp-menu { background: none; border: none; color: var(--text); font-size: 24px; padding: 10px; cursor: pointer; }
.fp-header-title { font-size: 12px; font-weight: 700; color: var(--text2); letter-spacing: 1px; text-transform: uppercase; pointer-events: none;}

.fp-cover-container { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px 40px; pointer-events: none; }
.fp-cover { width: 100%; aspect-ratio: 1/1; max-height: 350px; max-width: 350px; border-radius: 20px; background: linear-gradient(135deg,#e91e8c,#9c27b0); display: flex; align-items: center; justify-content: center; font-size: 100px; box-shadow: 0 20px 50px rgba(0,0,0,0.6); }

.fp-info-container { padding: 0 30px; margin-bottom: 20px; }
.fp-info-container h2 { font-size: 24px; font-weight: 800; margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-info-container p { font-size: 16px; color: var(--text2); }

.fp-progress-container { padding: 0 30px; margin-bottom: 30px; }
.fp-progress-bg { height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; position: relative; }
.fp-progress-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: var(--text); border-radius: 2px; transition: width 0.2s linear; }
.fp-time { display: flex; justify-content: space-between; font-size: 12px; color: var(--text2); margin-top: 10px; font-variant-numeric: tabular-nums; }

.fp-controls { display: flex; align-items: center; justify-content: space-between; padding: 0 30px 50px; }
.fp-btn-side { background: none; border: none; color: var(--text2); font-size: 20px; padding: 10px; cursor: pointer; }
.fp-btn-main { background: none; border: none; color: var(--text); font-size: 32px; padding: 10px; cursor: pointer; }
.fp-btn-play { width: 70px; height: 70px; border-radius: 50%; background: var(--text); color: #000; border: none; font-size: 28px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.1s; }
.fp-btn-play:active { transform: scale(0.95); }

/* BOTTOM NAV */
.bottom-nav { position:fixed; bottom:0; left:0; right:0; background:rgba(10,10,10,0.96); backdrop-filter:blur(24px); border-top:1px solid var(--border); display:flex; padding-top:10px; padding-bottom:calc(10px + var(--safe-bottom)); z-index:400; }
.nav-item { flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; font-size:clamp(9px,2.5vw,11px); color:var(--text2); cursor:pointer; }
.nav-item.active { color:var(--text); }
.nav-item .nav-icon { font-size:clamp(20px,6vw,24px); line-height:1; }