/*
Theme Name: Hay Lắm Audio
Theme URI: https://duahauaudio.site/
Author: Antigravity
Author URI: https://duahauaudio.site/
Description: Theme WordPress nghe audio truyện trực tuyến hiện đại phong cách Hay Lắm Audio. Tích hợp trình phát sticky bottom bar mượt mà, hỗ trợ nhiều tập, hẹn giờ tắt, chỉnh tốc độ đọc, equalizer động và tối ưu di động.
Version: 1.1.0
Requires at least: 5.8
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: haylam-audio
*/

:root {
  --ink: #f7f9fc;
  --panel: #ffffff;
  --panel-2: #e8eff8;
  --line: #d3e0ee;
  --paper: #10243a;
  --muted: #51637a;
  --leaf: #1257b5;
  --leaf-soft: #1b74e4;
  --sprout-1: #1b74e4;
  --sprout-2: #4f9bff;
  --teal: #0e6f8a;
  --danger: #dc2626;
  --success: #047857;
  --font-display: "Be Vietnam Pro", system-ui, -apple-system, sans-serif;
  --font-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --radius: 12px;
  --player-h: 88px;
  --maxw: 1000px;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: radial-gradient(900px 480px at 82% -8%, rgba(27, 116, 228, 0.1), transparent 60%),
              radial-gradient(760px 420px at -8% 4%, rgba(14, 111, 138, 0.06), transparent 55%),
              var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.55;
}

a {
  color: var(--leaf);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
  color: var(--leaf-soft);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-top: 0;
  color: var(--paper);
}

h1 { font-size: 1.85rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.35rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.15rem; }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.danger { color: var(--danger); }
.success { color: var(--success); }

.centered {
  text-align: center;
  display: grid;
  place-items: center;
  gap: 1rem;
  min-height: 45vh;
}

.row {
  display: flex;
  align-items: center;
}

.row.gap { gap: 0.6rem; }
.row.center { justify-content: center; }

button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

input, textarea, select {
  font: inherit;
  font-size: 16px;
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--paper);
  border-radius: 9px;
  padding: 0.6rem 0.75rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(18, 87, 181, 0.16);
}

/* Primary buttons */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: linear-gradient(135deg, var(--sprout-1), var(--sprout-2));
  color: #071a2e;
  border: none;
  border-radius: 9px;
  padding: 0.65rem 1.25rem;
  font-weight: 600;
  font-family: var(--font-display);
  transition: transform 0.08s ease, box-shadow 0.2s ease, opacity 0.2s;
  box-shadow: 0 6px 20px -8px rgba(18, 87, 181, 0.55);
  text-decoration: none;
  cursor: pointer;
}

.primary-btn:hover {
  box-shadow: 0 8px 26px -8px rgba(18, 87, 181, 0.7);
  text-decoration: none;
  color: #071a2e;
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn.big {
  padding: 0.85rem 1.6rem;
  font-size: 1.05rem;
  border-radius: 12px;
}

.primary-btn.block {
  width: 100%;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--paper);
  border-radius: 9px;
  padding: 0.55rem 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.ghost-btn:hover {
  border-color: var(--leaf);
  text-decoration: none;
  color: var(--leaf);
  background: var(--panel);
}

.ghost-btn.big {
  padding: 0.8rem 1.4rem;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--paper);
  font-size: 1rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.08s;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--panel-2);
  color: var(--leaf);
}

.icon-btn.primary {
  background: linear-gradient(135deg, var(--sprout-1), var(--sprout-2));
  color: #071a2e;
  width: 48px;
  height: 48px;
  box-shadow: 0 4px 14px -4px rgba(18, 87, 181, 0.5);
}

.icon-btn.primary:hover {
  background: linear-gradient(135deg, var(--sprout-2), var(--sprout-1));
  color: #071a2e;
  transform: scale(1.04);
}

.icon-btn.play-cell {
  background: rgba(27, 116, 228, 0.12);
  color: var(--leaf);
}

.track-row:hover .play-cell,
.track-row.active .play-cell {
  background: linear-gradient(135deg, var(--sprout-1), var(--sprout-2));
  color: #071a2e;
}

/* Dynamic Equalizer animation */
.eq {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 20px;
  width: 22px;
}

.eq-bar {
  width: 3.5px;
  height: 30%;
  background: linear-gradient(var(--sprout-2), var(--sprout-1));
  border-radius: 2px;
  transition: height 0.2s ease;
}

.eq.playing .eq-bar:nth-child(1) {
  animation: eq-bounce 0.75s ease-in-out infinite alternate;
}
.eq.playing .eq-bar:nth-child(2) {
  animation: eq-bounce 0.85s ease-in-out infinite 0.2s alternate;
}
.eq.playing .eq-bar:nth-child(3) {
  animation: eq-bounce 0.65s ease-in-out infinite 0.4s alternate;
}

@keyframes eq-bounce {
  0% { height: 18%; }
  100% { height: 100%; }
}

/* App Shell & Layout */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--player-h) + 1.5rem + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.75rem 1.4rem;
  background: rgba(247, 249, 252, 0.88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--paper);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.brand:hover {
  text-decoration: none;
  color: var(--leaf);
}

.brand-mark {
  color: var(--leaf);
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--sprout-1), var(--sprout-2));
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #071a2e;
  font-weight: 800;
  font-size: 1rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
}

.nav a {
  color: var(--muted);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav a:hover {
  color: var(--paper);
  text-decoration: none;
  background: var(--panel);
}

.nav a.active {
  color: var(--paper);
  background: var(--panel-2);
  font-weight: 600;
}

.nav-cta {
  color: var(--leaf) !important;
  font-weight: 600 !important;
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.content {
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 1.8rem 1.2rem;
  flex: 1;
}

/* Badges */
.dur-badge {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 0.22rem 0.46rem;
  border-radius: 6px;
  white-space: nowrap;
}

.ai-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.05em;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 0.18rem 0.38rem;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--panel);
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--success);
  font-size: 0.76rem;
  font-weight: 600;
  font-family: var(--font-mono);
  white-space: nowrap;
}

.live-badge:before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* Hero Section */
.hero {
  text-align: center;
  padding: 2.2rem 1rem 1.6rem;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 0.8rem;
  font-weight: 600;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.hero h1 .hl {
  color: var(--leaf);
  background: linear-gradient(135deg, var(--leaf), var(--teal));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.lede {
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 580px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

/* Search Box */
.search-box {
  position: relative;
  max-width: 620px;
  margin: 0 auto 2rem;
}

.search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 1.15rem;
}

.search-input {
  font-size: 1.05rem;
  padding: 0.9rem 1.1rem 0.9rem 2.85rem;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 4px 18px -4px rgba(16, 36, 58, 0.05);
}

.search-input:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(18, 87, 181, 0.18);
}

/* Shelves / Kệ sách */
.shelf {
  margin: 2rem 0;
}

.shelf-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.shelf-head h2 {
  font-size: 1.2rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.shelf-arrows {
  display: flex;
  gap: 0.4rem;
}

.shelf-rail {
  list-style: none;
  margin: 0;
  padding: 0.2rem 0.1rem;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: min(72vw, 260px);
  gap: 0.85rem;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.shelf-rail::-webkit-scrollbar {
  display: none;
}

.shelf-card {
  scroll-snap-align: start;
  display: flex;
}

.shelf-card-link {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem;
  color: var(--paper);
  transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.1s;
}

.shelf-card-link:hover {
  text-decoration: none;
  border-color: rgba(18, 87, 181, 0.45);
  box-shadow: 0 8px 22px -12px rgba(23, 23, 40, 0.16);
  transform: translateY(-2px);
}

.shelf-rank {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--muted);
  min-width: 1.6ch;
  text-align: right;
  padding-top: 0.15rem;
}

.shelf-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  flex: 1;
}

.shelf-title {
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.shelf-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.shelf-stat {
  margin-top: auto;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Tracklist / Danh sách Audio */
.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2rem 0 0.9rem;
}

.list-head h2 {
  font-size: 1.25rem;
  margin: 0;
}

.tracklist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.track-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 0.95rem;
  padding: 0.75rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.08s;
}

.track-row:hover {
  border-color: rgba(18, 87, 181, 0.45);
  box-shadow: 0 8px 22px -16px rgba(23, 23, 40, 0.14);
}

.track-row.active {
  border-color: var(--leaf);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: 0 6px 22px -8px rgba(18, 87, 181, 0.35);
}

.track-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}


.track-order-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef4fc;
  color: #1257b5;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #c8daf8;
  letter-spacing: -0.02em;
}

.track-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  min-width: 0;
}

.track-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--paper);
  overflow-wrap: anywhere;
}

a.track-title:hover {
  color: var(--leaf);
  text-decoration: none;
}

.track-row.active .track-title {
  color: var(--leaf);
}

.track-snippet {
  margin: 0;
  font-size: 0.83rem;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.track-meta {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.15rem;
}

.track-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.stat-views {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--paper);
  font-weight: 500;
  white-space: nowrap;
}

.stat-views svg {
  color: var(--muted);
  flex-shrink: 0;
}

/* Track Detail Page */
.track-detail .detail-card {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  background: linear-gradient(155deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.8rem;
  margin-top: 0.8rem;
}

.detail-art {
  position: relative;
  flex: 0 0 auto;
  width: 130px;
  height: 130px;
  display: grid;
  place-items: center;
  font-size: 3.5rem;
  color: var(--leaf);
  background: radial-gradient(circle at 32% 28%, rgba(18, 87, 181, 0.2), transparent 70%), var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.detail-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-body {
  min-width: 0;
  flex: 1;
}

.detail-body h1 {
  margin: 0.2rem 0 0.6rem;
  overflow-wrap: anywhere;
  font-size: 1.7rem;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-bottom: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.track-desc {
  margin-top: 1.8rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem;
}

.track-desc h2 {
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
}

.track-desc-content {
  line-height: 1.7;
  color: #3b4d61;
}

/* Episode List */
.episode-list {
  margin-top: 1.8rem;
}

.episode-head {
  font-size: 1.15rem;
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.episode-rows {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0;
  margin: 0;
}

.episode-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  color: var(--paper);
  transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}

.episode-row:hover {
  border-color: var(--leaf);
  background: var(--panel);
}

.episode-row.active {
  border-color: #4f9bff;
  background: rgba(79, 155, 255, 0.14);
}

.episode-num {
  flex: 0 0 auto;
  min-width: 1.8rem;
  white-space: nowrap;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.episode-row.active .episode-num {
  color: var(--leaf);
}

.episode-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}

.episode-title {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.episode-dur {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.episode-row.active .episode-dur {
  color: var(--leaf);
}

/* Comments Section */
.comments {
  margin-top: 2.2rem;
}

.comments h2 {
  font-size: 1.18rem;
  margin-bottom: 1rem;
}

.cmt-list {
  display: grid;
  gap: 1rem;
}

.cmt {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.cmt-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--sprout-1), var(--sprout-2));
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  font-family: var(--font-display);
}

.cmt-bubble {
  display: inline-block;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 4px 16px 16px;
  padding: 0.6rem 0.9rem;
  box-shadow: 0 2px 8px -2px rgba(16, 36, 58, 0.05);
}

.cmt-name {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--paper);
}

.cmt-content {
  margin: 0.2rem 0 0;
  font-size: 0.94rem;
  line-height: 1.5;
  color: #3b4d61;
}

.cmt-box {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* Pager / Pagination */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 2rem 0 1rem;
}

.pager .page-numbers {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.pager .page-numbers:hover {
  border-color: var(--leaf);
  color: var(--leaf);
}

.pager .page-numbers.current {
  background: var(--leaf);
  border-color: var(--leaf);
  color: #fff;
}

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding: 2rem 0 1rem;
  border-top: 1px solid var(--line);
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.footer-links a {
  color: var(--muted);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--leaf);
}

.footer-copy {
  color: var(--muted);
  font-size: 0.82rem;
  margin: 0;
}

/* Sticky Bottom Player Bar */
.player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: var(--player-h);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  padding: 0 1.5rem;
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px -15px rgba(23, 23, 40, 0.15);
  transform: translateZ(0);
  transition: transform 0.25s ease;
}

.player-bar.hidden {
  transform: translateY(105%);
}

.player-meta {
  width: 240px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.player-art {
  width: 48px;
  height: 48px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--sprout-1), var(--sprout-2));
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.25rem;
  overflow: hidden;
  box-shadow: 0 3px 10px -2px rgba(18, 87, 181, 0.35);
}

.player-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-meta-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.player-title {
  font-weight: 600;
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--paper);
}

.player-sub {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.player-buttons {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.player-seek {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 580px;
}

.player-seek span {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 3.2em;
}

.player-seek span.time-cur {
  text-align: right;
}

.player-seek input[type="range"] {
  flex: 1;
  accent-color: var(--leaf);
  padding: 0;
  background: transparent;
  border: none;
  height: 6px;
  cursor: pointer;
}

.player-tools {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.player-tool {
  position: relative;
  display: inline-flex;
}

/* Popover menus: Speed & Sleep */
.player-popover {
  position: absolute;
  bottom: calc(100% + 0.7rem);
  right: 0;
  z-index: 100;
  width: 250px;
  max-width: calc(100vw - 1.6rem);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.95rem;
  box-shadow: 0 16px 36px -12px rgba(16, 36, 58, 0.2);
  display: none;
}

.player-popover.active {
  display: block;
}

.player-popover:after {
  content: "";
  position: absolute;
  top: 100%;
  right: 18px;
  border: 7px solid transparent;
  border-top-color: var(--panel);
}

.popover-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.7rem;
}

.popover-title strong {
  color: var(--leaf);
  font-family: var(--font-mono);
}

.speed-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
}

.speed-opt {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--paper);
  border-radius: 8px;
  padding: 0.45rem 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
}

.speed-opt:hover {
  border-color: var(--leaf);
}

.speed-opt.active {
  color: var(--leaf);
  border-color: rgba(18, 87, 181, 0.55);
  background: rgba(18, 87, 181, 0.12);
}

.sleep-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.sleep-opt {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--paper);
  border-radius: 8px;
  padding: 0.5rem 0.3rem;
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
}

.sleep-opt:hover {
  border-color: var(--leaf);
}

.sleep-opt.active {
  color: var(--leaf);
  border-color: rgba(18, 87, 181, 0.55);
  background: rgba(18, 87, 181, 0.12);
}

.sleep-status {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--leaf);
}

.sleep-cancel {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 8px;
  padding: 0.4rem;
  font-size: 0.8rem;
}

.sleep-cancel:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Gate Overlay Modal (Quảng cáo Shopee Checkpoint) */
.gate-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 150;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  background: rgba(0, 0, 0, 0.65);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.gate-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.gate-modal {
  position: relative;
  width: 100%;
  max-width: 430px;
  max-height: 92vh;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #dbe7f5;
  border-radius: 18px;
  padding: 2rem 1.35rem 1.35rem;
  text-align: center;
  box-shadow: 0 24px 60px -20px rgba(15, 39, 66, 0.3);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.gate-overlay.active .gate-modal {
  transform: scale(1);
}

.gate-close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1.5px solid #94a9c4;
  border-radius: 50%;
  background: #eef4fb;
  color: #1e293b;
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.gate-close:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #dc2626;
  transform: rotate(90deg);
}

.gate-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.45;
  color: #0f2742;
  margin: 0.5rem 0.6rem 0.9rem;
}

.gate-url-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  padding: 0.48rem 1.15rem;
  margin: 0 auto 1rem;
  border: 1px solid #3567a8;
  border-radius: 999px;
  background: #f8fbff;
  color: #1b4f94;
  font-family: var(--font-mono, monospace);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  word-break: break-all;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.gate-url-pill:hover {
  background: #eaf2fd;
  border-color: #1d63c6;
  text-decoration: none;
}

.gate-url-chevron {
  font-size: 1.1rem;
  line-height: 1;
  color: #3567a8;
}

.gate-img-link {
  display: block;
  text-decoration: none;
  margin-bottom: 1rem;
}

.gate-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  border-radius: 14px;
  margin: 0 auto;
}

.gate-cta-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: linear-gradient(180deg, #3b93ff 0%, #2478f0 100%);
  color: #0b1f3a;
  text-decoration: none;
  box-shadow: 0 6px 18px rgba(36, 120, 240, 0.28);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.gate-cta-btn:hover {
  filter: brightness(1.04);
  transform: translateY(-1px);
  color: #0b1f3a;
  text-decoration: none;
}

.gate-cta-label {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.gate-cta-url {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
  word-break: break-all;
}

.gate-desc {
  color: #64748b;
  font-size: 0.85rem;
  margin: 0.85rem 0 0;
  line-height: 1.5;
}

.gate-steps {
  text-align: left;
  display: grid;
  gap: 0.45rem;
  margin: 0.2rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--leaf);
  border-radius: 12px;
  background: rgba(18, 87, 181, 0.08);
}

.gate-steps-label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--leaf);
}

.gate-step {
  font-size: 0.88rem;
  color: var(--paper);
}

.gate-step b {
  color: var(--leaf);
}

.gate-reminder {
  position: fixed;
  left: 50%;
  bottom: calc(var(--player-h) + 0.8rem + env(safe-area-inset-bottom));
  transform: translate(-50%);
  z-index: 95;
  display: none;
  align-items: center;
  gap: 0.75rem;
  max-width: calc(100vw - 1.6rem);
  padding: 0.45rem 0.55rem 0.45rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--leaf);
  border-radius: 999px;
  box-shadow: 0 14px 34px -16px rgba(18, 87, 181, 0.4);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.gate-reminder.active {
  display: flex;
}

.gate-reminder-text {
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--leaf);
}

/* Mobile Responsiveness */
@media (max-width: 680px) {
  :root {
    --player-h: 116px;
  }

  .topbar {
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
  }

  .brand {
    font-size: 1.1rem;
  }

  .nav {
    display: none; /* Can be toggled with drawer or kept compact */
  }

  .content {
    padding: 1.2rem 0.85rem;
  }

  .track-row {
    grid-template-columns: 44px 1fr auto;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
  }

  .player-bar {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "meta buttons"
      "seek seek";
    align-items: center;
    gap: 0.25rem 0.8rem;
    padding: 0.45rem 0.85rem;
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom));
  }

  .player-meta {
    grid-area: meta;
    width: auto;
  }

  .player-controls {
    display: contents;
  }

  .player-buttons {
    grid-area: buttons;
    gap: 0.35rem;
  }

  .player-buttons > .icon-btn:not(.primary) {
    display: none;
  }

  .player-buttons .icon-btn.primary {
    width: 48px;
    height: 48px;
  }

  .player-seek {
    grid-area: seek;
    width: 100%;
    max-width: none;
    gap: 0.5rem;
  }

  .player-tools {
    display: none;
  }

  .track-detail .detail-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 1.2rem;
  }

  .detail-art {
    width: 100%;
    height: 140px;
  }
}

/* ==========================================================================
   Anti-Download & Anti-Theft Protection Styles
   ========================================================================== */
#haylam_player_bar,
.track-detail,
.tracklist,
.episode-list,
.shelf-card,
.gate-modal {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input, textarea {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}



/* Single Track Details Page (Exact Match to Design Mockup) */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #51637a;
  font-weight: 500;
  font-size: 0.92rem;
  text-decoration: none;
  margin-bottom: 1.25rem;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: #1257b5;
  text-decoration: none;
}

.detail-hero-card {
  background: #ffffff;
  border: 1px solid #dce6f2;
  border-radius: 16px;
  padding: 1.6rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
  box-shadow: 0 4px 18px rgba(18, 87, 181, 0.05);
  margin-bottom: 2rem;
}

@media (max-width: 600px) {
  .detail-hero-card {
    flex-direction: column;
    text-align: center;
    padding: 1.25rem;
  }
}

.detail-art-box {
  width: 130px;
  height: 130px;
  border-radius: 16px;
  background: linear-gradient(135deg, #eef4fc, #d8e5f8);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.03);
}

.detail-art-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
}

.art-wave-icon {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(18, 87, 181, 0.12);
}

.art-dur-tag {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(16, 36, 58, 0.75);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
}

.detail-content-box {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.detail-main-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: #10243a;
  line-height: 1.3;
  margin: 0;
}

.detail-chips-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.8rem;
  font-size: 0.85rem;
}

.chip-item {
  font-weight: 600;
  font-size: 0.78rem;
  padding: 3px 8px;
  border-radius: 6px;
}

.chip-blue {
  background: #eef4fc;
  color: #1257b5;
  border: 1px solid #c8daf8;
}

.chip-green {
  background: #e6f7ef;
  color: #00875a;
  border: 1px solid #b3e6d1;
}

.chip-stat {
  color: #51637a;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chip-live {
  color: #00875a;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.dot-green {
  color: #00875a;
  font-size: 0.9rem;
}

.chip-date {
  color: #64748b;
  font-size: 0.82rem;
}

.detail-btn-row {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

@media (max-width: 600px) {
  .detail-btn-row {
    justify-content: center;
  }
}

.btn-play-hero {
  background: #1257b5;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.65rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(18, 87, 181, 0.25);
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-play-hero:hover {
  background: #1b74e4;
  transform: translateY(-1px);
}

.btn-timer-hero {
  background: #f0f4fa;
  color: #10243a;
  border: 1px solid #d3e0ee;
  border-radius: 8px;
  padding: 0.65rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-timer-hero:hover {
  background: #e2ecf8;
  border-color: #b8d0ee;
}

.episodes-section {
  margin-top: 2rem;
}

.episodes-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #10243a;
  margin-bottom: 0.9rem;
}

.episodes-pill-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.ep-pill-card {
  background: #f0f5fc;
  border: 1px solid #dce6f2;
  border-radius: 12px;
  padding: 0.9rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ep-pill-card:hover {
  background: #e6effa;
  border-color: #1257b5;
  box-shadow: 0 4px 14px rgba(18, 87, 181, 0.08);
  transform: translateY(-1px);
}

.ep-pill-card.active {
  background: #e4effc;
  border-color: #1257b5;
}

.ep-pill-part {
  color: #51637a;
  font-weight: 500;
  font-size: 0.95rem;
  min-width: 65px;
  white-space: nowrap;
}

.ep-pill-center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ep-pill-name {
  font-size: 1rem;
  font-weight: 600;
  color: #10243a;
  line-height: 1.35;
}

.ep-pill-time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #64748b;
}
