/* ThaiMethod Radio — Glass Blue */
:root {
  --rd-night: #020617;
  --rd-night-2: #0b1229;
  --rd-glass: rgba(15, 23, 42, 0.42);
  --rd-glass-2: rgba(30, 58, 138, 0.28);
  --rd-stroke: rgba(186, 230, 253, 0.35);
  --rd-stroke-strong: rgba(125, 211, 252, 0.55);
  --rd-cyan: #22d3ee;
  --rd-sky: #38bdf8;
  --rd-blue: #3b82f6;
  --rd-deep: #1d4ed8;
  --rd-ice: #e0f2fe;
  --rd-text: #f8fafc;
  --rd-muted: #94a3b8;
  --font-ui: "Outfit", system-ui, sans-serif;
  --font-thai: "Sarabun", "Thai", sans-serif;
  --rd-blur: blur(18px) saturate(1.35);
  --rd-radius: 24px;
  --rd-shadow: 0 18px 50px rgba(2, 6, 23, 0.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.radio-page {
  font-family: var(--font-ui);
  color: var(--rd-text);
  background: var(--rd-night);
  position: relative;
  overflow-x: hidden;
}
.rd-ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 520px at 12% -10%, rgba(56, 189, 248, 0.22), transparent 58%),
    radial-gradient(760px 480px at 95% 8%, rgba(37, 99, 235, 0.32), transparent 55%),
    radial-gradient(600px 400px at 50% 100%, rgba(14, 165, 233, 0.12), transparent 60%),
    linear-gradient(180deg, #020617 0%, #0b1229 45%, #020617 100%);
}
.rd-wrap {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 12px 14px 56px;
}

/* Shared glass card */
.rd-glass {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02) 40%, var(--rd-glass-2));
  border: 1px solid var(--rd-stroke);
  backdrop-filter: var(--rd-blur);
  -webkit-backdrop-filter: var(--rd-blur);
  box-shadow: var(--rd-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  border-radius: var(--rd-radius);
}

.tm-hero-radio {
  margin: 0 0 14px;
  padding: 16px 16px 18px;
}
.tm-hero-radio .tm-kicker {
  color: var(--rd-cyan);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.68rem;
  margin: 0 0 6px;
}
.tm-hero-radio h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 4.5vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.tm-hero-radio h1 .th {
  display: block;
  font-family: var(--font-thai);
  font-size: 0.72em;
  color: var(--rd-ice);
  font-weight: 600;
  margin-top: 2px;
  opacity: 0.92;
}
.tm-hero-radio .tm-lead {
  margin: 0;
  color: #cbd5e1;
  font-weight: 500;
  line-height: 1.45;
  font-size: 0.95rem;
}
.tm-hero-radio .tm-lead .th {
  display: block;
  font-family: var(--font-thai);
  color: #bae6fd;
  margin-top: 4px;
  font-weight: 600;
}

.rd-player {
  display: grid;
  gap: 14px;
}

/* Now playing — glass stage */
.rd-stage {
  position: relative;
  overflow: hidden;
  padding: 28px 20px 22px;
  text-align: center;
}
.rd-stage-glow {
  position: absolute;
  inset: auto;
  left: 50%;
  top: -20%;
  width: 280px;
  height: 280px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.28), transparent 68%);
  pointer-events: none;
  filter: blur(8px);
}
.rd-player.is-active .rd-stage {
  border-color: var(--rd-stroke-strong);
  box-shadow:
    var(--rd-shadow),
    0 0 0 1px rgba(34, 211, 238, 0.25),
    0 0 40px rgba(34, 211, 238, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.rd-orb {
  position: relative;
  width: 96px;
  height: 96px;
  margin: 0 auto 16px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(186, 230, 253, 0.4);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    0 12px 30px rgba(2, 6, 23, 0.35);
}
.rd-orb-ring {
  position: absolute;
  inset: -6px;
  border-radius: 32px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  opacity: 0.7;
  animation: rdRing 3.2s ease-in-out infinite;
}
.rd-player.is-active .rd-orb-ring {
  animation-duration: 1.4s;
  border-color: rgba(34, 211, 238, 0.7);
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.35);
}
.rd-orb-flag { font-size: 2.4rem; line-height: 1; }
@keyframes rdRing {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.04); opacity: 1; }
}

.rd-kicker {
  position: relative;
  margin: 0 0 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rd-cyan);
}
.rd-en {
  position: relative;
  margin: 0 0 6px;
  font-size: clamp(1.65rem, 5.2vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  word-break: break-word;
  text-shadow: 0 2px 24px rgba(2, 6, 23, 0.35);
}
.rd-th {
  position: relative;
  margin: 0 0 6px;
  font-family: var(--font-thai);
  font-size: clamp(1.25rem, 3.8vw, 1.65rem);
  font-weight: 600;
  color: #bae6fd;
  line-height: 1.35;
  word-break: break-word;
}
.rd-is {
  position: relative;
  margin: 0 0 8px;
  font-family: var(--font-thai);
  font-size: 1.05rem;
  font-weight: 700;
  color: #fde68a;
}

/* Soft waveform */
.rd-wave {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  height: 28px;
  margin: 12px auto 8px;
  opacity: 0.45;
}
.rd-wave i {
  display: block;
  width: 3px;
  border-radius: 99px;
  background: linear-gradient(180deg, var(--rd-cyan), var(--rd-blue));
  height: 30%;
  animation: rdWave 1.2s ease-in-out infinite;
}
.rd-wave i:nth-child(1) { animation-delay: 0s; height: 35%; }
.rd-wave i:nth-child(2) { animation-delay: 0.08s; height: 55%; }
.rd-wave i:nth-child(3) { animation-delay: 0.16s; height: 40%; }
.rd-wave i:nth-child(4) { animation-delay: 0.24s; height: 70%; }
.rd-wave i:nth-child(5) { animation-delay: 0.32s; height: 45%; }
.rd-wave i:nth-child(6) { animation-delay: 0.4s; height: 85%; }
.rd-wave i:nth-child(7) { animation-delay: 0.48s; height: 50%; }
.rd-wave i:nth-child(8) { animation-delay: 0.56s; height: 65%; }
.rd-wave i:nth-child(9) { animation-delay: 0.64s; height: 40%; }
.rd-wave i:nth-child(10) { animation-delay: 0.72s; height: 75%; }
.rd-wave i:nth-child(11) { animation-delay: 0.8s; height: 45%; }
.rd-wave i:nth-child(12) { animation-delay: 0.88s; height: 55%; }
.rd-player.is-active .rd-wave { opacity: 1; }
.rd-player.is-active .rd-wave i {
  animation-name: rdWavePlay;
}
@keyframes rdWave {
  0%, 100% { transform: scaleY(0.7); opacity: 0.6; }
  50% { transform: scaleY(1); opacity: 1; }
}
@keyframes rdWavePlay {
  0%, 100% { transform: scaleY(0.45); }
  50% { transform: scaleY(1.15); }
}

.rd-clip {
  position: relative;
  margin: 4px 0 12px;
  min-height: 1.25em;
  font-size: 0.84rem;
  font-weight: 500;
  color: #94a3b8;
}
.rd-bar-wrap {
  position: relative;
  max-width: 320px;
  margin: 0 auto;
}
.rd-bar {
  height: 6px;
  border-radius: 99px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(2, 6, 23, 0.35);
}
.rd-bar span {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22d3ee, #38bdf8 45%, #e0f2fe);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.75), 0 0 2px #fff;
  transition: width 0.3s ease;
}
.rd-prog {
  margin: 8px 0 0;
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #7dd3fc;
  letter-spacing: 0.02em;
}

/* Controls glass */
.rd-controls { padding: 16px; }
.rd-tools {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
@media (min-width: 560px) {
  .rd-tools { grid-template-columns: 1.15fr 1.25fr 0.7fr; }
}
.rd-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #7dd3fc;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.rd-field select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(186, 230, 253, 0.28);
  background: rgba(2, 6, 23, 0.45);
  color: #f8fafc;
  padding: 10px 12px;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.84rem;
  backdrop-filter: blur(8px);
}
.rd-main-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.rd-extra {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}
.rd-btn {
  border: 1px solid rgba(186, 230, 253, 0.3);
  background: rgba(255, 255, 255, 0.06);
  color: #f8fafc;
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 700;
  font-size: 0.88rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.rd-btn:hover {
  background: rgba(56, 189, 248, 0.18);
  border-color: rgba(125, 211, 252, 0.55);
}
.rd-btn:active { transform: scale(0.97); }
.rd-btn.rd-round {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.rd-btn.rd-play {
  min-width: 8.5rem;
  height: 52px;
  padding: 0 22px;
  font-size: 1rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #f8fafc, #e0f2fe);
  color: #0c4a6e;
  border-color: transparent;
  box-shadow: 0 8px 24px rgba(56, 189, 248, 0.25);
}
.rd-btn.rd-play.is-playing {
  background: linear-gradient(135deg, #22d3ee, #38bdf8);
  color: #082f49;
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.45);
}
.rd-btn.ghost {
  background: transparent;
  color: #bae6fd;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.8rem;
}
.rd-btn.ghost.on,
.rd-btn.on {
  background: rgba(34, 211, 238, 0.2);
  color: #ecfeff;
  border-color: rgba(34, 211, 238, 0.65);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.2);
}

/* Album-card playlist */
.rd-playlist-panel {
  overflow: hidden;
  padding: 0;
}
.rd-pl-head {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(186, 230, 253, 0.18);
}
.rd-pl-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.rd-pl-sub {
  display: block;
  margin-top: 2px;
  font-family: var(--font-thai);
  font-size: 0.78rem;
  font-weight: 600;
  color: #7dd3fc;
}
.rd-pl-head em {
  margin-left: auto;
  font-style: normal;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--rd-cyan);
  font-size: 0.95rem;
}
.rd-playlist {
  list-style: none;
  margin: 0;
  padding: 10px;
  /* Extra bottom pad so the playing track can sit mid-list, clear of the dock */
  padding-bottom: calc(10px + 72px + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 8px;
  max-height: min(54vh, 520px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scroll-padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  scroll-padding-top: 12px;
}
.rd-track {
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 12px;
  border-radius: 16px;
  cursor: pointer;
  color: #f1f5f9;
  background: linear-gradient(135deg, rgba(30, 64, 175, 0.45), rgba(14, 165, 233, 0.18));
  border: 1px solid rgba(147, 197, 253, 0.22);
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.22);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease, background 0.15s ease;
  scroll-margin-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  scroll-margin-top: 8px;
}
.rd-track:hover {
  border-color: rgba(125, 211, 252, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.3);
}
.rd-track.playing {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.35), rgba(34, 211, 238, 0.22));
  border-color: rgba(34, 211, 238, 0.7);
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.35),
    0 0 28px rgba(34, 211, 238, 0.22),
    0 12px 28px rgba(2, 6, 23, 0.3);
}
.rd-track .n {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: #e0f2fe;
  background: rgba(2, 6, 23, 0.35);
  border: 1px solid rgba(186, 230, 253, 0.2);
}
.rd-track.playing .n {
  background: rgba(34, 211, 238, 0.25);
  border-color: rgba(34, 211, 238, 0.55);
  color: #ecfeff;
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.35);
}
.rd-track .t {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.rd-track .t strong {
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}
.rd-track .t em {
  font-style: normal;
  font-family: var(--font-thai);
  font-size: 0.95rem;
  font-weight: 600;
  color: #bae6fd;
}
.rd-track .t b {
  font-family: var(--font-thai);
  font-size: 0.82rem;
  font-weight: 700;
  color: #fde68a;
}
.rd-track .cat {
  font-size: 0.62rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7dd3fc;
  opacity: 0.85;
  align-self: start;
  padding-top: 4px;
}

.rd-footer {
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--rd-muted);
}
.rd-footer a { color: #7dd3fc; text-decoration: none; }
.rd-footer a:hover { color: #e0f2fe; }

/* Mobile dock — same pattern as /translate */
.mobile-dock {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9998;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-top: 2px solid rgba(56, 189, 248, 0.55);
}
.mobile-dock button,
.mobile-dock a.dock-link {
  min-height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border-radius: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  font-size: 0.62rem;
  line-height: 1.1;
  padding: 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  text-decoration: none;
}
.mobile-dock a.dock-link.primary {
  background: rgba(14, 165, 233, 0.55);
  border-color: #38bdf8;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}
.dock-ico { font-size: 1.1rem; }
.dock-th {
  font-family: var(--font-thai);
  font-size: 0.68rem;
}
.dock-lbl { opacity: 0.9; }

.rd-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(2, 6, 23, 0.6);
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
.rd-menu-overlay.open { display: flex; }
.rd-menu-sheet {
  width: min(480px, 100%);
  background: linear-gradient(160deg, #0f172a, #1e3a8a);
  color: #f8fafc;
  border-radius: 18px;
  padding: 16px;
  border: 1px solid rgba(125, 211, 252, 0.35);
  box-shadow: 0 20px 50px rgba(2, 6, 23, 0.5);
}
.rd-menu-sheet h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 800;
}
.rd-menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.rd-menu-grid a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(147, 197, 253, 0.28);
  background: rgba(15, 23, 42, 0.45);
  text-decoration: none;
  color: inherit;
  font-weight: 700;
}
.rd-menu-grid a:hover {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(14, 165, 233, 0.2);
}
.rd-menu-grid a .th { font-family: var(--font-thai); }
.rd-menu-grid a .en { font-size: 0.75rem; color: #7dd3fc; }
.rd-menu-close {
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(125, 211, 252, 0.4);
  background: rgba(56, 189, 248, 0.2);
  color: #e0f2fe;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
}

.rd-status {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  background: rgba(2, 6, 23, 0.85);
  color: #e0f2fe;
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 0.78rem;
  font-weight: 650;
  backdrop-filter: blur(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 80;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.4);
}
.rd-status.show { opacity: 1; }

@media (max-width: 900px) {
  .mobile-dock { display: grid; }
  body.radio-page {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
  .rd-status { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
  .rd-playlist {
    max-height: min(48vh, 460px);
    padding-bottom: calc(12px + 88px + env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 480px) {
  .rd-en { font-size: clamp(1.45rem, 7vw, 1.9rem); }
  .rd-playlist { padding-left: 8px; padding-right: 8px; padding-top: 8px; }
  .rd-wrap { padding-bottom: calc(24px + 72px + env(safe-area-inset-bottom, 0px)); }
}

@media (min-width: 901px) {
  .mobile-dock { display: none !important; }
}
