:root {
  --primary: #10b981; 
  --primary-gradient: linear-gradient(135deg, #10b981, #059669);
  --bg: #f8fafc; 
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --danger: #ef4444;
  --border: rgba(100, 116, 139, 0.2);
  --radius: 20px; 
  --shadow-sm: 0 4px 15px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
  --grid-cols: 2; 
}

body.dark {
  --bg: #0f172a; 
  --card: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --border: rgba(148, 163, 184, 0.15);
  --shadow-sm: 0 4px 15px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.orbs-container { display: none; position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #09090b; }
body.orbs .orbs-container { display: block; }
body.orbs { 
  --bg: transparent; 
  --card: rgba(30, 41, 59, 0.55); 
  --text: #f8fafc; 
  --muted: #94a3b8; 
  --border: rgba(255, 255, 255, 0.1); 
  --shadow-sm: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}
body.orbs .header, body.orbs .bottom-nav, body.orbs .modal-content, body.orbs .card, body.orbs .search-wrap input, body.orbs .chip { 
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); 
}
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; animation: floatOrb 12s infinite alternate ease-in-out; }
.orb-1 { width: 350px; height: 350px; background: #10b981; top: -100px; left: -100px; }
.orb-2 { width: 300px; height: 300px; background: #3b82f6; bottom: -50px; right: -50px; animation-delay: -4s; }
.orb-3 { width: 250px; height: 250px; background: #8b5cf6; top: 40%; left: 30%; animation-delay: -8s; }
@keyframes floatOrb { 100% { transform: translate(60px, 80px) scale(1.2); } }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; scroll-behavior: smooth; background: var(--bg); }
body { font-family: var(--font-family, "Roboto", sans-serif); color: var(--text); transition: color .3s ease; }

img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; color: inherit; }

.card-title, h1, h2, h3, h4, p, strong, label, .history-chip, .search-result-item { color: var(--text); }

input { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 12px; }
input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }

.header { position: sticky; top: 0; z-index: 40; background: var(--card); padding: 12px 16px; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.2rem; }
.logo i { color: var(--primary); font-size: 1.3rem; }
.search-wrap { position: relative; }
.search-wrap input { width: 100%; min-height: 46px; padding: 11px 42px 11px 16px; border: 1px solid var(--border); background: var(--bg);}
.search-wrap i { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }

main { padding: 16px; padding-bottom: 160px; max-width: 1320px; margin: 0 auto; position: relative; z-index: 1;}

.latest-header-wrapper { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.top-ad-container { max-width: 100%; overflow: hidden; display: flex; justify-content: center; }

.ad-bar { position: fixed; left: 0; right: 0; bottom: 64px; z-index: 48; display: flex; justify-content: center; align-items: center; padding: 8px; background: var(--card); border-top: 1px solid var(--border); }
.ad-slot { width: 320px; max-width: 100%; min-height: 50px; border-radius: 12px; background: rgba(0,0,0,0.05); }

.section-title { font-size: 1.2rem; font-weight: 700; margin: 0; }
.latest-title { display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 999px; background: var(--primary-gradient); color: white !important; border: none; }

.carousel-shell { perspective: 1200px; height: 340px; position: relative; overflow: hidden; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); margin-bottom: 24px; border: 1px solid var(--border); }
.carousel { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform .7s cubic-bezier(0.25, 1, 0.5, 1); }
.car-item { position: absolute; left: 50%; top: 50%; width: min(74vw, 320px); aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; cursor: pointer; background: #111; transition: transform .7s cubic-bezier(0.25, 1, 0.5, 1), opacity .7s ease, filter .7s ease; box-shadow: var(--shadow-lg); }
.car-item img { width: 100%; height: 100%; object-fit: cover; }
.car-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 10px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.85)); color: #fff; font-size: .95rem; font-weight: 500; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.car-ctrl { position: absolute; top: 50%; transform: translateY(-50%); border: none; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; background: rgba(0,0,0,0.5); color: #fff; transition: background 0.3s; z-index: 10;}
.car-ctrl.left { left: 12px; } .car-ctrl.right { right: 12px; }

.chips { margin: 16px 0 20px; display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; -ms-overflow-style: none; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--border); border-radius: 999px; padding: 10px 18px; white-space: nowrap; font-weight: 500; background: var(--card); cursor: pointer; transition: all 0.3s ease; }
.chip.active { background: var(--primary-gradient); color: #fff; border-color: transparent; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(var(--grid-cols), minmax(80px, 1fr)); }
.card { background: var(--card); border-radius: 18px; overflow: hidden; cursor: pointer; border: 1px solid var(--border); box-shadow: var(--shadow-sm); transition: transform .3s; animation: floatIn .6s ease both; }
@keyframes floatIn { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }
.card .thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #ddd; }
.card-body { padding: 12px; }
.card-title { margin: 0 0 8px; font-size: .95rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: .75rem; font-weight: 500; }
.empty { text-align: center; padding: 30px; border: 2px dashed var(--border); border-radius: var(--radius); color: var(--muted); grid-column: 1 / -1; font-weight: 500; background: var(--card); }

.skeleton { border-radius: 18px; background: var(--border); animation: shimmer 1.5s infinite linear; height: 180px; }
@keyframes shimmer { 0% { opacity: 0.5; } 50% { opacity: 1; } 100% { opacity: 0.5; } }

.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); box-shadow: 0 -4px 25px rgba(0,0,0,.05); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.nav-btn { border: none; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 4px; min-height: 64px; cursor: pointer; font-size: .75rem; font-weight: 500; transition: color 0.3s; }
.nav-btn i { font-size: 1.2rem; transition: transform 0.3s; }
.nav-btn.active { color: var(--primary); font-weight: 700; }
.nav-btn.active i { transform: translateY(-3px) scale(1.1); }

.modal { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.7); display: none; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity 0.3s ease; }
.modal.open { display: flex; opacity: 1; }
.modal-content { width: min(840px, 100%); max-height: 90vh; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: 24px; padding: 20px; box-shadow: 0 20px 40px rgba(0,0,0,.5); position: relative; transform: translateY(20px) scale(0.95); transition: transform 0.3s; }
.modal.open .modal-content { transform: translateY(0) scale(1); }

.close { position: absolute; top: 16px; right: 16px; z-index: 10; border: none; background: var(--bg); color: var(--text); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); }
.player-wrap { border-radius: 16px; overflow: hidden; margin: 0 0 16px; background: #000; position: relative;}
.poster { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; display: block; opacity: 0.9; }

.seek-container { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.seek-slider { flex: 1; -webkit-appearance: none; appearance: none; width: 100%; height: 6px; background: var(--border); border-radius: 5px; outline: none; border: none; padding: 0; }
.seek-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--primary); cursor: pointer; box-shadow: 0 0 10px rgba(16, 185, 129, 0.5); }
.seek-slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--primary); cursor: pointer; border: none; }

.actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin: 16px 0; }
.btn { border: none; min-height: 48px; border-radius: 14px; padding: 10px 12px; color: #fff; font-weight: 600; font-size: 0.95rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: transform 0.2s; }
.btn-play { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.btn-download { background: var(--primary-gradient); }
.btn-like { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.btn-share { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.btn-report { background: linear-gradient(135deg, #f59e0b, #d97706); }

.waveform { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 30px; margin: 8px 0 16px; }
.waveform-bar { width: 4px; background: var(--primary); border-radius: 99px; animation: wave 1.2s ease-in-out infinite; }
@keyframes wave { 0%, 100% { height: 8px; opacity: .4; } 50% { height: 28px; opacity: 1; } }

.similar-section { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.similar-title { font-size: 1.05rem; margin: 0 0 12px 0; font-weight: 700; }
.similar-grid { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; -ms-overflow-style: none; scrollbar-width: none; }
.sim-card { min-width: 140px; width: 140px; background: var(--bg); border-radius: 14px; overflow: hidden; cursor: pointer; flex-shrink: 0; border: 1px solid var(--border); }
.sim-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.sim-card h4 { font-size: 0.85rem; padding: 8px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.settings-grid { display: grid; gap: 12px; margin-top: 16px; }
.setting-card { background: var(--bg); border-radius: 16px; padding: 16px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border); }
.custom-select-btn { cursor: pointer; transition: border 0.2s; }
.custom-select-btn:hover { border-color: var(--primary); }
.custom-select-btn .val { color: var(--muted); font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.custom-select-btn .val::after { content: '\f054'; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 0.7rem; }

.options-list { display: grid; gap: 8px; }
.option-item { padding: 14px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; cursor: pointer; font-weight: 500; display: flex; justify-content: space-between; align-items: center; transition: all 0.2s; }
.option-item.selected { border-color: var(--primary); color: var(--primary); background: rgba(16, 185, 129, 0.1); }
.option-item.selected::after { content: '\f00c'; font-family: "Font Awesome 6 Free"; font-weight: 900; }

.history-list { display: flex; flex-wrap: wrap; gap: 8px; }
.history-chip { border: 1px solid var(--border); background: var(--bg); border-radius: 999px; padding: 6px 12px; font-size: .8rem; font-weight: 500; cursor: pointer; }
.btn-clear-history { border: none; border-radius: 12px; min-height: 40px; cursor: pointer; background: rgba(239, 68, 68, 0.1); color: var(--danger); font-weight: 600; padding: 8px 14px; width: fit-content; }

#settingsModal { justify-content: flex-end; padding: 0; }
#settingsModal .side-panel { width: min(420px, 100vw); height: 100vh; border-radius: 24px 0 0 24px; transform: translateX(100%); padding-top: 24px; margin-left: auto; display: flex; flex-direction: column; transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1); }
#settingsModal.open .side-panel { transform: translateX(0); }

#searchModal { align-items: flex-start; padding: 0; }
#searchModal .modal-content { width: 100vw; height: 100vh; border-radius: 0; transform: translateY(-20px); opacity: 0; padding: 16px; }
#searchModal.open .modal-content { transform: translateY(0); opacity: 1; }
.search-panel-head { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.search-panel-input { flex: 1; min-height: 50px; font-size: 1rem; background: var(--bg); }
.search-results { margin-top: 16px; display: grid; gap: 10px; max-height: calc(100vh - 220px); overflow-y: auto; padding-right: 4px; }
.search-result-item { border: 1px solid var(--border); background: var(--bg); border-radius: 14px; padding: 12px; cursor: pointer; display: grid; gap: 6px; }

.toast-wrap { position: fixed; top: 80px; right: 16px; z-index: 100; display: grid; gap: 10px; }
.toast { background: var(--card); color: var(--text); border-left: 4px solid var(--primary); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; animation: slideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.report-list { display: grid; gap: 8px; margin-top: 16px; }
.report-item { background: var(--bg); padding: 14px; border-radius: 12px; border: 1px solid var(--border); cursor: pointer; font-weight: 500; }

.countdown { margin: 12px 0 16px; color: var(--muted); font-weight: 600; font-size: 1.1rem; text-align: center;}
.download-continue { width: 100%; max-width: 260px; margin: 0 auto; display: flex; background: var(--muted); opacity: 0.5; cursor: not-allowed; transition: all 0.3s ease; }
.download-continue:not(:disabled) { background: var(--primary-gradient); opacity: 1; cursor: pointer; color: white; }

@media (min-width: 768px) {
  .actions { grid-template-columns: repeat(3, minmax(0,1fr)); }
  main { padding: 24px; padding-bottom: 160px; }
}