/* ต้นแบบแอปสถานีวิทยุ อสมท จังหวัดพิษณุโลก • ออกแบบและพัฒนาโดย สุรพันธุ์ อินโอภาส • ต.ค. 2569 */
:root {
  --ink: #15194f;
  --muted: #6a6f88;
  --line: #e7e9f2;
  --surface: #ffffff;
  --soft: #f5f6fb;
  --orange: #f36b14;
  --red: #eb1d27;
  --blue: #263c96;
  --violet: #4c2c91;
  --green: #16895d;
  font-family: "Sarabun", "Segoe UI", Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 10%, rgba(243, 107, 20, 0.16), transparent 28%),
    linear-gradient(135deg, #f7f8fc 0%, #eef2f8 100%);
}

button {
  font: inherit;
}

.workspace {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
}

.phone-shell {
  width: min(390px, 100%);
  height: min(844px, calc(100vh - 56px));
  min-height: 720px;
  padding: 12px;
  border-radius: 34px;
  background: #12131a;
  box-shadow: 0 24px 70px rgba(17, 22, 52, 0.28);
}

.phone-screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 25px;
  background: var(--soft);
}

.status-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 38px;
  padding: 0 20px;
  color: #11142c;
  background: rgba(255, 255, 255, 0.96);
  font-size: 13px;
  font-weight: 700;
}

.status-icons {
  color: var(--orange);
}

.app-view {
  display: none;
  height: calc(100% - 38px);
  overflow-y: auto;
  padding: 16px 14px 150px;
}

.app-view.is-active {
  display: block;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.brand-lockup {
  display: grid;
  place-items: center;
  flex: 0 0 58px;
  width: 58px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.brand-lockup img {
  display: block;
  width: 50px;
  height: 42px;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
  flex: 1;
}

.topbar.compact {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
}

.topbar h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.18;
  color: var(--ink);
}

.topbar.compact h1 {
  flex: 1;
  text-align: center;
  font-size: 23px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow.light {
  color: rgba(255, 255, 255, 0.82);
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--surface);
  font-weight: 800;
}

.back-button {
  font-size: 20px;
}

.live-card,
.event-hero {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  padding: 20px;
  border-radius: 18px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(38, 60, 150, 0.96), rgba(76, 44, 145, 0.88) 54%, rgba(235, 29, 39, 0.92)),
    linear-gradient(0deg, #263c96, #eb1d27);
  box-shadow: 0 14px 34px rgba(38, 60, 150, 0.28);
}

.live-card h2,
.event-hero h2 {
  position: relative;
  z-index: 1;
  margin: 6px 0 2px;
  font-size: 32px;
  line-height: 1.05;
}

.live-card p,
.event-hero p {
  position: relative;
  z-index: 1;
  margin: 0 0 18px;
}

.waveform {
  position: absolute;
  inset: 22px 16px auto;
  display: flex;
  height: 88px;
  align-items: center;
  gap: 8px;
  opacity: 0.22;
}

.waveform span {
  width: 8px;
  border-radius: 999px;
  background: #ffffff;
}

.waveform span:nth-child(1),
.waveform span:nth-child(10) { height: 26px; }
.waveform span:nth-child(2),
.waveform span:nth-child(9) { height: 54px; }
.waveform span:nth-child(3),
.waveform span:nth-child(8) { height: 78px; }
.waveform span:nth-child(4),
.waveform span:nth-child(7) { height: 42px; }
.waveform span:nth-child(5),
.waveform span:nth-child(6) { height: 88px; }

.primary-button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 178px;
  height: 52px;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--red), var(--orange));
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(235, 29, 39, 0.34);
}

.play-mark {
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 15px solid #ffffff;
}

.content-section {
  margin-top: 20px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
}

.section-heading button,
.event-card button {
  border: 0;
  color: var(--orange);
  background: transparent;
  font-weight: 800;
}

.feature-news,
.audio-row,
.story-row,
.event-card,
.profile-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(18, 22, 48, 0.06);
}

.feature-news {
  overflow: hidden;
}

.feature-news > div:last-child {
  padding: 12px 14px 14px;
}

.feature-news h3,
.clip-card h3,
.audio-row h2,
.story-row h2,
.event-card h2,
.profile-panel h2 {
  margin: 3px 0 4px;
  font-size: 16px;
  line-height: 1.28;
}

.feature-news p,
.clip-card p,
.audio-row p,
.story-row p,
.event-card p,
.profile-panel p,
.lead-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tag {
  display: inline-flex;
  margin: 0;
  color: var(--orange);
  font-size: 11px;
  font-weight: 800;
}

.tag.urgent {
  color: var(--red);
}

.news-photo,
.clip-photo,
.lead-image,
.thumb,
.event-thumb {
  background-size: cover;
  background-position: center;
}

.news-photo {
  height: 138px;
}

.civic {
  background:
    linear-gradient(rgba(21, 25, 79, 0.08), rgba(21, 25, 79, 0.1)),
    url("https://images.unsplash.com/photo-1517048676732-d65bc937f952?auto=format&fit=crop&w=900&q=75");
}

.clip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.clip-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.clip-card h3,
.clip-card p {
  padding: 0 10px;
}

.clip-card p {
  padding-bottom: 12px;
}

.clip-photo {
  height: 92px;
}

.studio {
  background-image: url("https://images.unsplash.com/photo-1590602847861-f357a9332bbc?auto=format&fit=crop&w=600&q=75");
}

.farm {
  background-image: url("https://images.unsplash.com/photo-1500382017468-9049fed747ef?auto=format&fit=crop&w=600&q=75");
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 16px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #ffffff;
}

.segmented-control button {
  min-height: 36px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.segmented-control button.is-selected {
  color: #ffffff;
  background: var(--orange);
}

.audio-list,
.story-list,
.event-list,
.more-menu {
  display: grid;
  gap: 10px;
}

.audio-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
}

.small-play,
.mini-player button {
  min-width: 70px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  background: var(--blue);
  font-weight: 800;
}

.lead-story {
  overflow: hidden;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(18, 22, 48, 0.08);
  margin-bottom: 14px;
}

.lead-image {
  height: 190px;
}

.emergency {
  background-image: url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=900&q=75");
}

.lead-body {
  padding: 14px;
}

.lead-body h2 {
  margin: 3px 0 5px;
  font-size: 20px;
  line-height: 1.22;
}

.story-row,
.event-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px;
  padding: 10px;
  align-items: center;
}

.thumb,
.event-thumb {
  width: 88px;
  height: 88px;
  border-radius: 11px;
}

.road {
  background-image: url("https://images.unsplash.com/photo-1449824913935-59a10b8d2000?auto=format&fit=crop&w=500&q=75");
}

.health {
  background-image: url("https://images.unsplash.com/photo-1505751172876-fa1923c5c528?auto=format&fit=crop&w=500&q=75");
}

.market {
  background-image: url("https://images.unsplash.com/photo-1488459716781-31db52582fe9?auto=format&fit=crop&w=500&q=75");
}

.event-hero {
  min-height: 168px;
  margin-bottom: 14px;
  background:
    linear-gradient(135deg, rgba(243, 107, 20, 0.96), rgba(235, 29, 39, 0.88)),
    url("https://images.unsplash.com/photo-1511578314322-379afb476865?auto=format&fit=crop&w=900&q=75");
  background-size: cover;
  background-position: center;
}

.roadshow {
  background-image: url("https://images.unsplash.com/photo-1521737604893-d14cc237f11d?auto=format&fit=crop&w=500&q=75");
}

.gallery {
  background-image: url("https://images.unsplash.com/photo-1492684223066-81342ee5ff30?auto=format&fit=crop&w=500&q=75");
}

.profile-panel {
  padding: 18px;
  margin-bottom: 14px;
  border-left: 5px solid var(--orange);
}

.profile-logo {
  display: block;
  width: 132px;
  height: 82px;
  object-fit: contain;
  margin-bottom: 8px;
}

.more-menu button {
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #ffffff;
  text-align: left;
  font-weight: 750;
}

.mini-player {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 73px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 9px 12px;
  border-radius: 16px;
  color: #ffffff;
  background: rgba(21, 25, 79, 0.95);
  box-shadow: 0 12px 28px rgba(21, 25, 79, 0.28);
}

.mini-player p,
.mini-player strong {
  display: block;
  margin: 0;
  line-height: 1.2;
}

.mini-player p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

.mini-player strong {
  font-size: 13px;
}

.mini-player button {
  color: var(--ink);
  background: #ffffff;
}

.bottom-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  min-height: 66px;
  padding: 5px 4px 8px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.bottom-nav button {
  min-width: 0;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  font-weight: 800;
}

.bottom-nav button.is-active {
  color: #ffffff;
  background: var(--red);
}

@media (max-width: 430px) {
  .workspace {
    padding: 0;
  }

  .phone-shell {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    padding: 0;
    border-radius: 0;
  }

  .phone-screen {
    border-radius: 0;
  }
}

/* ---------- Biz Talk (เชื่อมจากระบบ Biz Talk พิษณุโลก) ---------- */
:root {
  --biz-navy: #0b1f4d;
  --biz-navy-deep: #071a3d;
  --biz-red: #d71920;
  --biz-gold: #e7b83b;
}

.biz-promo {
  display: grid;
  grid-template-columns: 56px 1fr 18px;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--biz-navy-deep), var(--biz-navy) 60%, #1a2f6b);
  box-shadow: 0 10px 24px rgba(7, 26, 61, 0.28);
  cursor: pointer;
}

.biz-promo:focus-visible,
.biz-btn:focus-visible {
  outline: 3px solid var(--biz-gold);
  outline-offset: 2px;
}

.biz-promo img,
.biz-hero img {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 12px;
}

.biz-promo h3 {
  margin: 1px 0 2px;
  font-size: 15px;
  line-height: 1.25;
}

.biz-kicker {
  margin: 0;
  color: var(--biz-gold);
  font-size: 11px;
  font-weight: 800;
}

.biz-next {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.biz-arrow {
  color: var(--biz-gold);
  font-size: 26px;
  line-height: 1;
}

.biz-hero {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border-radius: 18px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--biz-navy-deep), var(--biz-navy) 55%, var(--biz-red) 140%);
  box-shadow: 0 14px 30px rgba(7, 26, 61, 0.3);
}

.biz-hero img {
  width: 72px;
  height: 72px;
}

.biz-hero h2 {
  margin: 4px 0;
  font-size: 18px;
  line-height: 1.25;
}

.biz-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  line-height: 1.5;
}

.biz-hero .biz-status {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  color: var(--biz-navy-deep);
  background: var(--biz-gold);
  font-size: 11px;
  font-weight: 800;
}

.biz-hero .biz-status.is-live {
  color: #ffffff;
  background: var(--biz-red);
  animation: biz-pulse 1.4s ease-in-out infinite;
}

@keyframes biz-pulse {
  50% { box-shadow: 0 0 0 6px rgba(215, 25, 32, 0.25); }
}

@media (prefers-reduced-motion: reduce) {
  .biz-hero .biz-status.is-live { animation: none; }
}

.biz-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0 4px;
}

.biz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--biz-navy);
  border-radius: 12px;
  color: var(--biz-navy);
  background: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.biz-btn.primary {
  border-color: var(--biz-red);
  color: #ffffff;
  background: var(--biz-red);
}

.biz-btn.wide {
  grid-column: 1 / -1;
}

.biz-embed {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.biz-embed[hidden] {
  display: none;
}

.biz-embed-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  color: #ffffff;
  background: var(--biz-navy-deep);
  font-size: 12px;
}

.biz-embed-bar span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.8;
}

.biz-embed-bar a {
  color: var(--biz-gold);
  font-weight: 800;
  text-decoration: none;
}

.biz-embed-bar button {
  border: 0;
  border-radius: 8px;
  padding: 4px 10px;
  color: var(--biz-navy-deep);
  background: #ffffff;
  font: inherit;
  font-weight: 800;
}

.biz-embed iframe {
  width: 100%;
  height: 460px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.biz-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.biz-source {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.biz-episode {
  text-decoration: none;
  color: inherit;
}

.biz-episode .thumb {
  background-color: var(--biz-navy);
  background-size: cover;
  background-position: center;
}

.biz-episode .tag {
  color: var(--biz-red);
}

.biz-episode .biz-watch {
  display: inline-block;
  margin-top: 4px;
  color: var(--biz-navy);
  font-size: 12px;
  font-weight: 800;
}

.biz-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- สมัครร่วมรายการ / แบบฟอร์ม ---------- */
.biz-hero-small h2 { font-size: 17px; }

.biz-steps {
  display: grid;
  gap: 12px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: bizstep;
}

.biz-steps > li {
  position: relative;
  padding: 14px 14px 14px 52px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  counter-increment: bizstep;
}

.biz-steps > li::before {
  content: counter(bizstep);
  position: absolute;
  left: 14px;
  top: 14px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--biz-navy);
  font-weight: 800;
  font-size: 13px;
}

.biz-steps h3 { margin: 2px 0 4px; font-size: 15px; }
.biz-steps p { margin: 0 0 8px; color: var(--muted); font-size: 13px; line-height: 1.45; }

.biz-timeline {
  display: grid;
  gap: 4px;
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

.biz-timeline b {
  display: inline-block;
  min-width: 52px;
  color: var(--biz-red);
}

.biz-details summary {
  color: var(--biz-navy);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.biz-details p { margin-top: 6px; }

.biz-dates {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.biz-date {
  display: grid;
  gap: 1px;
  padding: 7px 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.biz-date span { color: #16895d; font-size: 11px; font-weight: 700; }
.biz-date.is-busy { opacity: 0.5; cursor: not-allowed; }
.biz-date.is-busy span { color: var(--muted); }
.biz-date.is-chosen { border: 2px solid var(--biz-red); background: #fff4f4; }

.biz-link {
  color: var(--biz-navy);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.wide-btn { width: 100%; }

.biz-episode-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.biz-episode-actions .biz-watch {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.biz-episode-actions button.biz-watch { color: var(--biz-red); }

.biz-rate .biz-note { margin-bottom: 8px; }

.form-frame {
  display: block;
  width: 100%;
  height: calc(100% - 120px);
  min-height: 520px;
  margin: 8px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

[data-view="webform"].is-active {
  padding-bottom: 150px;
}

.biz-steps > li.is-primary-step {
  border: 2px solid var(--biz-red);
  box-shadow: 0 10px 24px rgba(215, 25, 32, 0.12);
}

.biz-steps > li.is-primary-step::before { background: var(--biz-red); }

.biz-why {
  display: grid;
  gap: 4px;
  margin: 0 0 10px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.45;
}

.biz-why b { color: var(--biz-navy); }

.biz-sub {
  margin: 0 0 6px !important;
  font-size: 12px !important;
}

.biz-apply-card {
  margin-top: 14px;
  padding: 16px;
  border: 2px solid var(--biz-red);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(215, 25, 32, 0.12);
}

.biz-apply-card h3 { margin: 0 0 4px; font-size: 16px; }
.biz-apply-card p { margin: 0 0 6px; color: var(--muted); font-size: 13px; }
.biz-apply-card h4 { margin: 0 0 8px; color: var(--biz-navy); font-size: 13px; }
.biz-apply-card .biz-dates { margin-bottom: 12px; }

.biz-guide {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.biz-guide h3 {
  margin: 0 0 8px;
  color: var(--biz-navy);
  font-size: 16px;
  line-height: 1.3;
}

.biz-guide p {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
}

.biz-guide ul {
  display: grid;
  gap: 4px;
  margin: 0 0 10px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.biz-guide li::marker { color: var(--biz-red); }

.biz-motto {
  padding: 10px 12px;
  border-radius: 10px;
  color: #ffffff !important;
  background: linear-gradient(135deg, var(--biz-navy-deep), var(--biz-navy));
  text-align: center;
}

.biz-motto b { display: block; margin-top: 2px; color: var(--biz-gold); font-size: 15px; }

.biz-reassure {
  margin-bottom: 0 !important;
  padding-left: 10px;
  border-left: 3px solid var(--biz-gold);
  color: var(--muted) !important;
}

/* ---------- การช่วยการเข้าถึง ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.phone-screen :focus-visible {
  outline: 3px solid #1e88e5;
  outline-offset: 2px;
}

.easy-panel { display: none; }

.easy-mode .easy-panel {
  display: grid;
  gap: 12px;
}

.easy-mode [data-view="home"] .live-card,
.easy-mode [data-view="home"] .biz-promo,
.easy-mode [data-view="home"] .horo-promo,
.easy-mode [data-view="home"] .content-section {
  display: none;
}

.easy-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 0 18px;
  border: 2px solid var(--ink);
  border-radius: 18px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-size: 22px;
  text-align: left;
  cursor: pointer;
}

.easy-btn span { font-size: 30px; }
.easy-btn small { display: block; font-size: 14px; color: var(--muted); }

.easy-btn.easy-live {
  min-height: 120px;
  border-color: var(--red);
  color: #ffffff;
  background: linear-gradient(135deg, var(--red), var(--orange));
  font-size: 28px;
}

.easy-btn.easy-live small { color: rgba(255, 255, 255, 0.85); }
.easy-live b { display: block; }
.is-playing .easy-btn.easy-live { background: var(--ink); border-color: var(--ink); }

.large-text .app-view { zoom: 1.22; }
.large-text .bottom-nav button { font-size: 14px; }
.large-text .mini-player strong { font-size: 16px; }

.high-contrast {
  --ink: #000000;
  --muted: #1a1a1a;
  --line: #000000;
  --soft: #ffffff;
  --orange: #b34700;
  --red: #b0000b;
  --biz-navy: #000a33;
}

.high-contrast .feature-news,
.high-contrast .story-row,
.high-contrast .event-card,
.high-contrast .audio-row,
.high-contrast .clip-card,
.high-contrast .contact-card,
.high-contrast .switch-row {
  border: 2px solid #000000;
}

.read-btn {
  margin-top: 6px;
  padding: 4px 10px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.a11y-intro { margin: 0 0 12px; color: var(--muted); font-size: 13px; line-height: 1.5; }

.switch-list { display: grid; gap: 10px; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.switch-row b { display: block; font-size: 16px; }
.switch-row small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }

.switch-row i {
  position: relative;
  flex: 0 0 52px;
  height: 30px;
  border-radius: 999px;
  background: #c4c8d4;
  transition: background 0.2s;
}

.switch-row i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.2s;
}

.switch-row[aria-checked="true"] i { background: #16895d; }
.switch-row[aria-checked="true"] i::after { transform: translateX(22px); }

.a11y-test {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.a11y-test p { margin: 0 0 10px; font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  .switch-row i, .switch-row i::after { transition: none; }
}

/* ---------- ดวงวันนี้ ---------- */
.horo-promo {
  display: grid;
  grid-template-columns: 48px 1fr 18px;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  color: #ffffff;
  background: linear-gradient(135deg, #3b1f6b, #6a3fa0 60%, #c06c84);
  cursor: pointer;
}

.horo-icon { font-size: 30px; text-align: center; }
.horo-promo h3 { margin: 1px 0 2px; font-size: 15px; }
.horo-promo p { margin: 0; font-size: 12px; color: rgba(255, 255, 255, 0.82); }
.horo-kicker { margin: 0; color: #ffd27a; font-size: 11px; font-weight: 800; }
.horo-promo .horo-kicker { color: #ffd27a; }

.horo-date { margin: 0 0 10px; color: var(--muted); font-size: 13px; text-align: center; }
.horo-pick h2 { margin: 0 0 10px; font-size: 20px; text-align: center; }

.horo-days {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.horo-daybtn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.horo-daybtn span {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--day);
}

.horo-daybtn:last-child { grid-column: 1 / -1; }
.horo-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.horo-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.horo-card[hidden], .horo-pick[hidden] { display: none; }
.horo-day { margin: 0 0 6px; font-size: 20px; font-weight: 800; }
.horo-text { margin: 0 0 12px; font-size: 17px; line-height: 1.6; }
.horo-color { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 14px; }

.horo-cheer {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff6e5;
}

.horo-cheer .horo-kicker { color: #b45f00; }
.horo-cheer p:last-child { margin: 4px 0 0; font-size: 16px; line-height: 1.5; }
.horo-disclaimer { margin: 12px 0 0; color: var(--muted); font-size: 11px; text-align: center; line-height: 1.5; }

/* ---------- ติดต่อสถานี ---------- */
.contact-list { display: grid; gap: 10px; }

.contact-card {
  display: block;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: var(--surface);
  text-decoration: none;
}

.contact-card h2 { margin: 0 0 4px; font-size: 16px; }
.contact-card p { margin: 0 0 4px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.contact-big { color: var(--ink) !important; font-size: 18px !important; font-weight: 800; }

.care-card {
  border-color: #b9d8c8;
  background: #f1faf5;
}

.care-card .biz-btn { margin-top: 8px; border-color: #16895d; color: #16895d; }

/* ---------- ปรับเรียบร้อย ---------- */
.logo-fallback {
  color: #1d3b8f;
  font-weight: 900;
  font-size: 15px;
  letter-spacing: 0.04em;
}

.profile-panel .logo-fallback { display: block; margin-bottom: 8px; font-size: 26px; }

.schedule-link {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 10px;
  border: 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.92);
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.segmented-control.two { grid-template-columns: 1fr 1fr; }

.rewind-search { display: block; margin-bottom: 10px; }
.rewind-search[hidden] { display: none; }

.rewind-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
}

.audio-row[hidden] { display: none; }
[data-news-pane][hidden] { display: none; }

.source-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.tna-thumb {
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #0b2a6b;
  font-weight: 900;
  font-size: 18px;
}

.tna-link {
  display: inline-block;
  margin-top: 4px;
  color: #0b2a6b;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.settings-h { margin: 18px 0 10px; font-size: 16px; }

.day-tabs {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}

.day-tabs button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.day-tabs button.is-selected { color: #ffffff; background: var(--red); border-color: var(--red); }

.schedule-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.schedule-list li {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 4px 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

.sch-time { color: var(--muted); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sch-name { font-size: 15px; font-weight: 800; }
.schedule-list li.is-onair { border: 2px solid var(--red); }
.sch-badge { grid-column: 2; color: var(--red); font-size: 12px; font-weight: 800; }

.about-card p { margin-bottom: 8px; }

.toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 140px;
  z-index: 40;
  padding: 12px 14px;
  border-radius: 12px;
  color: #ffffff;
  background: rgba(17, 20, 44, 0.94);
  font-size: 13px;
  line-height: 1.45;
}

.toast[hidden] { display: none; }

/* ---------- Facebook / TikTok ---------- */
.fb-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  padding: 12px;
  border-radius: 14px;
  color: #ffffff;
  background: #1565c0;
  text-decoration: none;
}

.fb-logo {
  display: grid;
  place-items: center;
  flex: 0 0 38px;
  height: 38px;
  border-radius: 50%;
  color: #1565c0;
  background: #ffffff;
  font-size: 24px;
  font-weight: 900;
  font-family: Arial, sans-serif;
}

.fb-banner b { display: block; font-size: 15px; }
.fb-banner small { display: block; margin-top: 2px; font-size: 11px; opacity: 0.9; }

.fb-link {
  display: inline-block;
  margin-top: 4px;
  margin-right: 8px;
  color: #1565c0;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.tiktok-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 46%;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.tiktok-card {
  display: grid;
  align-content: end;
  gap: 4px;
  min-height: 210px;
  padding: 12px;
  border: 0;
  border-radius: 14px;
  color: #ffffff;
  background: linear-gradient(180deg, #2b2b33 0%, #0d0d12 100%);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.tiktok-card span { align-self: center; justify-self: center; font-size: 34px; opacity: 0.85; }
.tiktok-card b { font-size: 13px; line-height: 1.3; }
.tiktok-card small { font-size: 11px; line-height: 1.35; opacity: 0.8; }
.tiktok-follow { color: var(--orange); font-weight: 800; text-decoration: none; }
.call-btn { margin-top: 8px; text-decoration: none; }

/* ---------- LINE OpenChat ---------- */
.line-promo {
  display: grid;
  grid-template-columns: 52px 1fr 18px;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  color: #ffffff;
  background: #06a948;
  text-decoration: none;
}

.line-logo {
  display: grid;
  place-items: center;
  height: 40px;
  border-radius: 10px;
  color: #06a948;
  background: #ffffff;
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 900;
}

.line-promo b { display: block; font-size: 15px; }
.line-promo small { display: block; margin-top: 2px; font-size: 12px; opacity: 0.9; }
.line-promo .biz-arrow { color: #ffffff; }
.easy-mode [data-view="home"] .line-promo { display: none; }
.line-btn { border-color: #06a948; color: #06a948; }

/* ---------- ผังรายการจริง ---------- */
.schedule-list li { grid-template-columns: 92px 1fr; }
.sch-name small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.sch-tags { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px; }
.sch-tags em {
  padding: 1px 8px;
  border-radius: 999px;
  color: var(--blue);
  background: #eef1fb;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}
.schedule-list li.is-short { padding-block: 6px; background: var(--soft); }
.schedule-list li.is-short .sch-name { font-size: 13px; font-weight: 600; color: var(--muted); }
.schedule-note { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.schedule-list li { grid-template-columns: 92px minmax(0, 1fr); }
.sch-name, .sch-tags { min-width: 0; overflow-wrap: anywhere; }
.schedule-list { grid-template-columns: minmax(0, 1fr); }
.schedule-list li { min-width: 0; }
/* keep the phone frame from growing with long text */
.workspace { grid-template-columns: minmax(0, 1fr); }
.phone-shell { min-width: 0; max-width: 100%; justify-self: center; }
.phone-screen, .app-view { min-width: 0; }

/* stream fallback panel (shown only when the online stream fails) */
.stream-fallback {
  position: absolute; left: 12px; right: 12px; bottom: 84px; z-index: 40;
  background: #fff; color: #1d1d1d; border: 2px solid #c62828; border-radius: 16px;
  padding: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  display: grid; gap: 8px;
}
.stream-fallback[hidden] { display: none; }
.stream-fallback p { margin: 0 0 4px; line-height: 1.5; }
.stream-fallback button {
  min-height: 48px; border-radius: 12px; border: 1px solid #ccc; background: #f5f5f5;
  font: inherit; font-weight: 600; padding: 8px 12px; cursor: pointer;
}
.stream-fallback button.primary-button { background: #c62828; color: #fff; border-color: #c62828; display: grid; gap: 2px; width: 100%; }
.stream-fallback button small { font-weight: 400; opacity: .9; }
.high-contrast .stream-fallback { border-width: 3px; border-color: #000; }

/* หน้าแรก: การ์ดเพจ Facebook อสมท พิษณุโลก (เรียงบนสุด) */
.fb-promo { background: #1565c0; }
.fb-promo-logo { color: #1565c0; font-family: Arial, sans-serif; font-size: 26px; font-weight: 900; border-radius: 50%; width: 40px; justify-self: center; }
.easy-mode [data-view="home"] .fb-promo { display: none; }
.home-tna .story-list { margin-top: 4px; }

/* หน้าแรก: Shop Mania / กิจกรรมสถานี / ผู้สนับสนุน (แถวละอัน) */
.promo-strip {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) 18px; gap: 12px; align-items: center;
  margin-top: 12px; padding: 12px; border-radius: 16px; text-decoration: none; cursor: pointer;
  color: #1d1d1d; background: #ffffff; border: 1px solid #e3e3ea;
}
.promo-strip b { display: block; font-size: 15px; line-height: 1.35; }
.promo-strip small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted, #666); }
.promo-strip .biz-arrow { color: #888; }
.promo-icon { display: grid; place-items: center; height: 44px; border-radius: 12px; font-size: 26px; background: #f3f3f7; }
.promo-label {
  display: inline-block; margin-bottom: 3px; padding: 2px 9px; border-radius: 999px;
  font-style: normal; font-size: 11px; font-weight: 800; color: #ffffff; background: #444;
}
.promo-shop { background: #fff8ef; border-color: #ffcc80; }
.promo-shop .promo-label { background: #ef6c00; }
.promo-shop .promo-icon { background: #ffe0b2; }
.promo-event .promo-label { background: #c62828; }
.promo-sponsor .promo-label { background: #6d4c41; }
.easy-mode [data-view="home"] .promo-strip { display: none; }
.high-contrast .promo-strip { border: 2px solid #000; }

/* ---------- หน้าแรก: Shop Mania / กิจกรรมสถานี / ผู้สนับสนุน ---------- */
.home-block { margin-top: 18px; }
.home-block .section-heading h2 { display: flex; align-items: center; gap: 8px; }
.home-block .section-heading .promo-label { margin: 0; font-size: 13px; padding: 4px 12px; }
.promo-label.shop { background: #ef6c00; }
.promo-label.event { background: #c62828; }
.promo-label.sponsor { background: #6d4c41; }
.heading-link { color: var(--accent, #e85d04); font-weight: 800; text-decoration: none; font-size: 14px; }
.easy-mode [data-view="home"] .home-block { display: none; }

.shop-carousel { position: relative; }
.shop-track {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: calc(50% - 6px);
  gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 2px 0 4px;
}
.shop-track::-webkit-scrollbar { display: none; }
.shop-slide { scroll-snap-align: start; min-width: 0; }
.shop-slide a {
  display: grid; gap: 4px; height: 100%; box-sizing: border-box; padding: 8px; border-radius: 14px;
  background: #ffffff; border: 1px solid #ececf2; color: #1d1d1d; text-decoration: none;
}
.shop-slide img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; border-radius: 10px; background: #fafafa; }
.shop-name {
  font-size: 13px; font-weight: 700; line-height: 1.35; min-height: 2.7em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.shop-price { color: #7b1fa2; font-size: 16px; font-weight: 900; }
.shop-regular { color: #888; font-size: 12px; }
.shop-controls { display: grid; grid-template-columns: 44px 1fr 44px; gap: 8px; margin-top: 8px; }
.shop-controls button {
  min-height: 44px; border-radius: 12px; border: 1px solid #ddd; background: #ffffff;
  font: inherit; font-weight: 800; font-size: 14px; cursor: pointer; color: #333;
}
.shop-controls [data-shop-prev], .shop-controls [data-shop-next] { font-size: 24px; line-height: 1; }

.promo-list { display: grid; gap: 12px; }
.promo-card-big {
  display: grid; width: 100%; padding: 0; overflow: hidden; text-align: left; cursor: pointer;
  border-radius: 16px; border: 1px solid #ececf2; background: #ffffff; font: inherit; color: #1d1d1d;
}
.promo-cover { display: block; aspect-ratio: 16 / 9; background: #ddd; }
.promo-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.promo-text { display: grid; gap: 3px; padding: 10px 12px 12px; }
.promo-text b { font-size: 15px; line-height: 1.4; }
.promo-text small { color: var(--muted, #666); font-size: 12px; }
.promo-card-big .promo-cta { margin-top: 2px; font-size: 13px; font-weight: 800; color: #c62828; }
.promo-card-big.sponsor .promo-cta { color: #6d4c41; }

/* หน้ารายละเอียดกิจกรรม / ผู้สนับสนุน */
.promo-detail { display: grid; gap: 8px; padding-bottom: 150px; }
.promo-detail .detail-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 16px; background: #ddd; }
.promo-detail .promo-label { justify-self: start; margin: 4px 0 0; }
.promo-detail h2 { margin: 0; font-size: 20px; line-height: 1.4; }
.promo-detail h3 { margin: 8px 0 0; font-size: 16px; }
.promo-detail p { margin: 0; line-height: 1.65; }
.detail-meta { font-weight: 700; color: #333; }
.detail-gallery { display: grid; gap: 8px; }
.detail-gallery img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 12px; background: #ddd; }
.detail-action { display: block; text-align: center; text-decoration: none; margin-top: 8px; }
.detail-back { min-height: 44px; border-radius: 12px; border: 1px solid #ddd; background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.promo-detail .read-btn { justify-self: start; }

/* ข่าวพิษณุโลกจากประชาสัมพันธ์จังหวัด (มีรูปจริง) */
.lead-photo { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #dfe3ea; }
.photo-thumb { overflow: hidden; background: #dfe3ea; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-fb { margin-top: 12px; }
img.img-missing { visibility: hidden; }
.high-contrast .promo-card-big, .high-contrast .shop-slide a, .high-contrast .shop-controls button { border: 2px solid #000; }

/* หน้าแรก: ข่าวพิษณุโลกล่าสุด (แทนการ์ดเพจ Facebook) */
.latest-news {
  margin-top: 12px; padding: 14px; border-radius: 16px; cursor: pointer;
  color: #ffffff; background: #1565c0;
}
.latest-kicker { margin: 0 0 6px; font-weight: 800; font-size: 14px; }
.latest-news ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.latest-news li {
  font-size: 14px; line-height: 1.45; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.latest-date { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,.2); font-size: 11px; font-weight: 800; }
.latest-more { display: block; margin-top: 8px; font-size: 13px; font-weight: 800; text-align: right; }
.easy-mode [data-view="home"] .latest-news { display: none; }

/* แท็บรายการ */
[data-view="schedule"] .biz-promo { margin-top: 4px; }
.replay-link {
  display: grid; grid-template-columns: 40px minmax(0,1fr) 16px; gap: 10px; align-items: center;
  margin-top: 10px; padding: 12px; border-radius: 14px; text-decoration: none;
  color: #1d1d1d; background: #ffffff; border: 1px solid #e3e3ea;
}
.replay-link > span:first-child { display: grid; place-items: center; height: 40px; border-radius: 50%; color: #fff; background: #c62828; }
.replay-link b { display: block; }
.replay-link small { display: block; color: var(--muted, #666); font-size: 12px; }
.schedule-heading { margin: 18px 0 8px; font-size: 18px; }
.more-menu .more-link { display: flex; align-items: center; min-height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: #ffffff; font-weight: 750; text-decoration: none; }

/* หน้าแรก: Facebook + TikTok ของสถานี */
.social-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.social-card {
  display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; align-items: center;
  min-height: 60px; padding: 10px 12px; border-radius: 16px; color: #ffffff; text-decoration: none;
}
.social-card.fb { background: #1565c0; }
.social-card.tiktok { background: #111111; }
.social-logo {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: #ffffff; font-family: Arial, sans-serif; font-weight: 900; font-size: 22px;
}
.social-card.fb .social-logo { color: #1565c0; }
.social-card.tiktok .social-logo { color: #111111; box-shadow: -2px 0 0 #25f4ee, 2px 0 0 #fe2c55; }
.social-card b { display: block; font-size: 15px; }
.social-card small { display: block; font-size: 11px; opacity: .9; overflow-wrap: anywhere; }
.easy-mode [data-view="home"] .social-row { display: none; }

/* ฟอนต์ Sarabun ทั้งแอป (รวมปุ่มและช่องกรอก ซึ่งปกติเบราว์เซอร์ไม่สืบทอดฟอนต์ให้) */
body, button, input, select, textarea { font-family: "Sarabun", "Segoe UI", Tahoma, sans-serif; }
body { line-height: 1.5; }

/* ปรับขนาดให้เข้ากับ Sarabun: หน้าข่าว และ หน้าเพิ่มเติม (เดิมดูใหญ่และหนาเกิน) */
.lead-body h2 { font-size: 17px; line-height: 1.4; font-weight: 700; }
.story-row h2 { font-size: 15px; line-height: 1.4; font-weight: 600; }
[data-view="news"] .tag { font-size: 12px; }
[data-view="news"] .source-note { font-size: 12px; }
.more-menu button, .more-menu .more-link {
  min-height: 48px; padding: 8px 14px; font-size: 15px; font-weight: 600; line-height: 1.35;
}
.profile-panel h2 { font-size: 16px; font-weight: 700; }

/* เกี่ยวกับสถานี: แผนที่ */
.map-card { margin-top: 12px; display: grid; gap: 8px; }
.map-card h2 { margin: 0; font-size: 17px; }
.map-address { margin: 0; font-size: 14px; line-height: 1.5; }
.map-frame { overflow: hidden; border-radius: 12px; border: 1px solid var(--line); aspect-ratio: 4 / 3; background: #e8eaf0; }
.map-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.map-btn { display: block; text-align: center; text-decoration: none; min-height: 48px; line-height: 48px; padding: 0 12px; }
[data-view="about"] { padding-bottom: 150px; }

/* แถบ "ต้นแบบ" และหน้าวิธีทดสอบ */
.proto-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  height: 34px; padding: 0 10px 0 14px; color: #5d3a00; background: #ffe8b3;
  border-bottom: 1px solid #f3c96b; font-size: 12px; font-weight: 700;
}
.proto-banner span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proto-banner button {
  flex: 0 0 auto; min-height: 26px; padding: 0 10px; border: 0; border-radius: 999px;
  color: #ffffff; background: #8a5a00; font-size: 12px; font-weight: 700; cursor: pointer;
}
.phone-screen.has-proto .app-view { height: calc(100% - 72px); }
.test-guide { display: grid; gap: 10px; }
.test-guide p { margin: 0; line-height: 1.6; }
.test-guide h2 { margin: 8px 0 0; font-size: 17px; }
.test-lead { font-weight: 700; font-size: 16px; }
.test-tasks, .test-notes { margin: 0; padding-left: 22px; display: grid; gap: 8px; line-height: 1.55; }
.test-tasks li { font-size: 15px; font-weight: 600; }
.test-guide .read-btn { justify-self: start; }
.test-send { width: 100%; }

/* กล่องเตือนก่อนออกจากแอป */
.exit-sheet {
  position: absolute; inset: 0; z-index: 60; display: grid; align-items: end;
  padding: 12px; background: rgba(10, 12, 30, 0.45);
}
.exit-sheet[hidden] { display: none; }
.exit-box {
  display: grid; gap: 10px; margin-bottom: 74px; padding: 18px 16px;
  border-radius: 18px; background: #ffffff; color: #1d1d1d; box-shadow: 0 12px 30px rgba(0,0,0,.25);
}
.exit-box h2 { margin: 0; font-size: 18px; }
.exit-box p { margin: 0; font-size: 15px; line-height: 1.6; }
.exit-skip { display: flex; align-items: center; gap: 8px; min-height: 40px; font-size: 14px; }
.exit-skip input { width: 22px; height: 22px; }
.exit-box .primary-button { width: 100%; }
.line-browser-note {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5;
  color: #1b5e20; background: #e8f5e9; border: 1px solid #a5d6a7;
}

/* หน้าแรก: แนะนำติดตั้งแอปบนหน้าจอมือถือ */
.install-card {
  display: grid; gap: 6px; margin-top: 12px; padding: 14px; border-radius: 16px;
  background: #eef2ff; border: 1px solid #c5cae9; color: #1d1d1d;
}
.install-card h2 { margin: 0; font-size: 16px; }
.install-card p { margin: 0; font-size: 14px; line-height: 1.55; }
.install-steps { font-weight: 600; }
.install-actions { display: grid; gap: 8px; margin-top: 4px; }
.install-actions .primary-button { width: 100%; }
.install-actions [hidden] { display: none !important; }

/* ---------- มือถือจริง (รวมแอปที่ติดตั้งบนหน้าจอ): เมนูล่างและแถบเล่นต้องอยู่กับที่ ----------
   เดิมใช้ 100vh ซึ่งบนมือถือสูงกว่าจอจริง ทั้งหน้าจึงเลื่อนได้ เมนูล่างเลยเลื่อนหายไปด้วย
   ตอนนี้: ล็อกทั้งหน้าให้พอดีจอ ให้เลื่อนได้เฉพาะเนื้อหาข้างใน และไม่ส่งการดึงต่อไปที่ทั้งหน้า */
@media (max-width: 430px), (pointer: coarse), (display-mode: standalone), (max-height: 600px) {
  .workspace { padding: 0; }
  .phone-shell { width: 100%; padding: 0; border-radius: 0; box-shadow: none; }
  .phone-screen { border-radius: 0; }
  html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
  body { min-height: 0; }
  .workspace { display: block; min-height: 0; height: 100%; height: 100dvh; padding: 0; }
  .phone-shell { height: 100%; height: 100dvh; min-height: 0; }
  .status-bar { display: none; } /* มือถือจริงมีแถบสถานะของเครื่องอยู่แล้ว */
  .app-view { height: 100%; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; }
  .phone-screen.has-proto .app-view { height: calc(100% - 34px); }
  .bottom-nav { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  .mini-player { bottom: calc(73px + env(safe-area-inset-bottom)); }
}

/* ---------- แท็บเล็ต / มือถือแนวนอน: ใช้เต็มจอ แต่เนื้อหาอยู่ตรงกลาง กว้างไม่เกิน 640px อ่านง่าย ---------- */
@media (min-width: 641px) and (pointer: coarse), (min-width: 641px) and (display-mode: standalone), (min-width: 641px) and (max-height: 600px) {
  .app-view { padding-left: max(14px, calc((100% - 640px) / 2)); padding-right: max(14px, calc((100% - 640px) / 2)); }
  .mini-player { left: max(12px, calc((100% - 640px) / 2)); right: max(12px, calc((100% - 640px) / 2)); }
  .bottom-nav { padding-left: max(4px, calc((100% - 640px) / 2)); padding-right: max(4px, calc((100% - 640px) / 2)); }
  .exit-box, .stream-fallback { max-width: 616px; margin-left: auto; margin-right: auto; }
  .stream-fallback { left: 0; right: 0; }
}

/* ---------- จอเตี้ย (มือถือแนวนอน): ลดความสูงเมนูล่างและแถบเล่น ให้เหลือพื้นที่เนื้อหามากขึ้น ---------- */
@media (max-height: 500px) {
  .bottom-nav { min-height: 50px; padding-top: 3px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .mini-player { min-height: 44px; padding: 5px 10px; bottom: calc(56px + env(safe-area-inset-bottom)); }
  .mini-player p { display: none; }
  .proto-banner { height: 30px; }
  .phone-screen.has-proto .app-view { height: calc(100% - 30px); }
  .app-view { padding-bottom: 120px; }
}
@media (max-height: 500px) {
  /* มือถือแนวนอน: แถบเล่นย่อเป็นปุ่มเล็กมุมขวา ไม่บังเนื้อหาทั้งแถว */
  .mini-player { left: auto !important; right: 12px !important; width: auto; max-width: 320px; gap: 10px; }
  .mini-player strong { font-size: 13px; }
  .mini-player button { min-height: 34px; }
  .proto-banner span { font-size: 11px; }
}
.news-updated { margin: 0 0 8px; font-size: 12px; color: var(--muted, #666); }

/* เครดิตผู้พัฒนา */
.credit-card { margin-top: 12px; }
.credit-card h2 { margin: 0 0 4px; font-size: 15px; color: var(--muted, #666); font-weight: 600; }
.credit-name { margin: 0; font-size: 18px; font-weight: 800; color: var(--ink, #1d1d1d); }
.credit-note { font-size: 12px; }
.credit-line { margin: 16px 0 0; text-align: center; font-size: 12px; color: var(--muted, #666); }
.contact-card.credit-card p.credit-name { font-size: 18px; font-weight: 800; color: var(--ink, #15194f); }

/* แท็บข่าวทั่วประเทศ: เปิดเว็บสำนักข่าวไทย */
.tna-card { margin-bottom: 8px;
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 14px; align-items: center;
  margin-top: 4px; padding: 16px; border-radius: 16px; text-decoration: none;
  color: #ffffff; background: linear-gradient(135deg, #0b2a6b, #1d4fb3);
}
.tna-card-logo {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 14px;
  background: #ffffff; color: #0b2a6b; font-weight: 900; font-size: 18px;
}
.tna-card-text { display: grid; gap: 4px; }
.tna-card-text b { font-size: 16px; line-height: 1.4; }
.tna-card-text small { font-size: 13px; line-height: 1.5; opacity: .9; }
.tna-card-cta { margin-top: 4px; font-weight: 800; font-size: 14px; }
.high-contrast .tna-card { margin-bottom: 8px; border: 3px solid #000; }

/* ---------- ข่าวสาร 3 แท็บ ---------- */
.segmented-control.three { grid-template-columns: repeat(3, 1fr); }

/* ---------- วาไรตี้: นิตยสาร ---------- */
.magazine { display: grid; gap: 14px; }
.tone-news { --tone: #37474f; --tone-soft: #eceff1; }
.tone-alert { --tone: #c62828; --tone-soft: #ffebee; }
.tone-health { --tone: #2e7d32; --tone-soft: #e8f5e9; }
.tone-elder { --tone: #6d4c41; --tone-soft: #efebe9; }
.tone-tech { --tone: #1565c0; --tone-soft: #e3f2fd; }
.tone-local { --tone: #ad1457; --tone-soft: #fce4ec; }
.tone-farm { --tone: #558b2f; --tone-soft: #f1f8e9; }
.tone-tips { --tone: #ef6c00; --tone-soft: #fff3e0; }

.mag-masthead { padding: 16px; border-radius: 18px; color: #fff; background: linear-gradient(135deg, #15194f, #4c2c91 60%, #c62828); }
.mag-masthead .mag-kicker { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: .5px; opacity: .85; }
.mag-masthead h2 { margin: 4px 0; font-size: 20px; line-height: 1.35; }
.mag-masthead p { margin: 0; font-size: 13px; opacity: .9; }

.mag-toc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; scroll-margin-top: 12px; }
.mag-toc button {
  display: flex; align-items: center; gap: 6px; width: 100%; min-height: 44px; padding: 6px 12px; border-radius: 14px;
  border: 1px solid var(--line, #ddd); background: #fff; font: inherit; font-size: 13px; font-weight: 700; line-height: 1.3;
  color: var(--ink, #15194f); text-align: left; cursor: pointer;
}
.mag-toc button span { flex: 0 0 auto; }
.mag-toc-title { grid-column: 1 / -1; margin: 2px 2px 0; font-size: 13px; font-weight: 800; color: var(--muted, #666); }
.magazine { container-type: inline-size; }
@container (min-width: 620px) { .mag-toc { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.mag-cover {
  display: grid; width: 100%; padding: 0; overflow: hidden; text-align: left; cursor: pointer; font: inherit;
  border: 0; border-radius: 18px; background: var(--tone, #15194f); color: #fff;
}
.mag-cover-img { display: block; aspect-ratio: 16 / 9; }
.mag-cover-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mag-cover-text { display: grid; gap: 6px; padding: 14px 16px 16px; }
.mag-cover-text b { font-size: 20px; line-height: 1.35; }
.mag-cover-text small { font-size: 14px; line-height: 1.5; opacity: .92; }
.mag-cta { font-weight: 800; font-size: 14px; }
.mag-badge {
  justify-self: start; display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800; color: var(--tone, #15194f); background: #fff;
}
.mag-noimg { display: grid; place-items: center; font-size: 46px; background: var(--tone-soft, #eee); }
.mag-cover .mag-noimg { background: rgba(255,255,255,.14); font-size: 56px; aspect-ratio: 3 / 1; }

.mag-section { scroll-margin-top: 12px; transition: box-shadow .3s; padding: 12px; border-radius: 16px; background: #fff; border: 1px solid var(--line, #e3e3ea); border-top: 5px solid var(--tone); }
.mag-section-head { display: grid; grid-template-columns: 40px minmax(0,1fr); gap: 10px; align-items: center; margin-bottom: 8px; }
.mag-section-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--tone-soft); font-size: 22px; }
.mag-section-head h3 { margin: 0; font-size: 17px; color: var(--tone); }
.mag-section-head small { display: block; font-size: 12px; color: var(--muted, #666); }
.mag-item {
  display: grid; grid-template-columns: 84px minmax(0,1fr); gap: 12px; align-items: center; width: 100%;
  padding: 8px 0; border: 0; border-top: 1px solid #f0f0f4; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.mag-item:first-of-type { border-top: 0; }
.mag-item-img { display: block; width: 84px; height: 64px; border-radius: 10px; overflow: hidden; }
.mag-item-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mag-item .mag-noimg { font-size: 30px; }
.mag-item-text b { display: block; font-size: 15px; line-height: 1.4; font-weight: 700; }
.mag-item-text small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; font-size: 13px; color: var(--muted, #666); line-height: 1.45; }

/* บทความ */
.article-reader { display: grid; gap: 10px; }
.article-reader .mag-badge { color: #fff; background: var(--tone); }
.article-reader h2 { margin: 0; font-size: 22px; line-height: 1.4; }
.article-lead { margin: 0; font-size: 16px; line-height: 1.6; font-weight: 600; color: var(--tone); }
.article-meta { margin: 0; font-size: 12px; color: var(--muted, #666); }
.article-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; background: #ddd; }
.article-reader .read-btn { justify-self: start; }
.article-body p { margin: 0 0 12px; font-size: 16px; line-height: 1.75; }
.article-sources { padding: 12px; border-radius: 12px; background: var(--tone-soft, #f4f4f8); }
.article-sources h3 { margin: 0 0 6px; font-size: 14px; }
.article-sources ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; }
.article-sources a { color: var(--tone); overflow-wrap: anywhere; }
.large-text .article-body p { font-size: 18px; }
.high-contrast .mag-section, .high-contrast .mag-cover, .high-contrast .mag-toc button { border: 2px solid #000; }

/* แจ้งสตรีมขัดข้อง (จากระบบเฝ้าสตรีม) */
.stream-status { margin: 6px 0 10px; padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; font-weight: 700; color: #3e2723; background: #ffe082; }

.mag-cover { scroll-margin-top: 12px; }
.mag-flash { box-shadow: 0 0 0 4px var(--tone, #15194f); }
.mag-top {
  display: block; width: 100%; min-height: 44px; margin-top: 8px; border: 0; border-top: 1px dashed var(--line, #ddd);
  background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--tone, #15194f); cursor: pointer;
}
@media (prefers-reduced-motion: reduce) { .mag-section { transition: none; } }

/* ---- accessibility additions (a11y.js) ---- */
.skip-link {
  position: absolute; left: 8px; right: 8px; top: 6px; z-index: 50; transform: translateY(-160%);
  min-height: 48px; padding: 10px 14px; border: 0; border-radius: 12px; background: #15194f; color: #fff;
  font: inherit; font-size: 15px; font-weight: 800; text-align: left;
}
.skip-link:focus, .skip-link:focus-visible { transform: none; outline: 3px solid #ffb703; }
.app-view h1:focus, [data-sleep-status]:focus, [data-sleep-heading]:focus, .mag-section h3:focus { outline: none; }
.read-btn.is-reading, .is-reading { background: #b3261e !important; color: #fff !important; border-color: #b3261e !important; }
.sleep-box { display: grid; gap: 10px; margin: 0 0 16px; }
.sleep-status { margin: 0; padding: 10px 12px; border-radius: 12px; background: #eef1fb; font-weight: 700; line-height: 1.5; }
.sleep-choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sleep-choices button {
  min-height: 48px; border-radius: 12px; border: 1px solid var(--line, #d7d9e6); background: #fff;
  font: inherit; font-size: 14px; font-weight: 800; color: var(--ink, #15194f); cursor: pointer;
}
.a11y-guide-link { margin: 0 0 14px; }
.settings-h small { font-size: 12px; font-weight: 600; color: var(--muted, #666); }
.a11y-guide h2 { margin-top: 18px; }
.high-contrast .sleep-choices button, .high-contrast .sleep-status { border: 2px solid #000; }
.inline-link { display: inline; padding: 0; border: 0; background: none; font: inherit; font-weight: 800; color: var(--blue, #1f3ea8); text-decoration: underline; cursor: pointer; }
.sleep-choices button[aria-pressed="true"] { background: #15194f; color: #fff; border-color: #15194f; }
