/* CQNOW — โทนสีเดิมของ MHz.Band ทั้งหมด ไม่ได้เพิ่มสีใหม่ */
:root{
  --bg:#050a0f; --panel:#0b1621; --panel2:#0e1c29; --line:#1d394b;
  --text:#eaf4fb; --soft:#b9d2e2; --muted:#7f9aad; --dim:#2f4d64;
  --cyan:#49d9ff; --green:#42e87b; --amber:#ffc44d; --orange:#ff8f39;
}
*{ box-sizing:border-box }
html{ -webkit-text-size-adjust:100% }
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:Inter,"Noto Sans Thai",ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  line-height:1.5;
}
a{ color:var(--cyan) }

/* ---------- topbar: 3 ตัวควบคุม ไม่ใช่ 7 ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:20px; flex-wrap:wrap;
  padding:14px clamp(16px,3vw,40px);
  border-bottom:1px solid #16293a;
}
.brand{ display:flex; align-items:center; gap:14px; text-decoration:none; color:var(--text) }
.brand-mark{ height:54px; width:auto; display:block; flex-shrink:0 }
.brand-word{ font-size:26px; font-weight:800; letter-spacing:-.4px; line-height:1 }
.brand-word span{ color:var(--cyan) }
@media (max-width:620px){
  .brand{ gap:10px }
  .brand-mark{ height:40px }
  .brand-word{ font-size:20px }
}

.tabs{ display:flex; gap:20px; font-size:14px }
.tabs a{ color:var(--muted); text-decoration:none; padding-bottom:3px }
.tabs a.is-active{ color:var(--text); font-weight:600; border-bottom:2px solid var(--cyan) }

.topbar-right{ display:flex; align-items:center; gap:18px }
.station-chip{
  background:var(--panel2); border:1px solid var(--line); color:var(--text);
  border-radius:9px; padding:8px 14px; min-height:44px;
  font:inherit; font-size:13px; font-weight:600; cursor:pointer;
}
.clock{ text-align:right; font-variant-numeric:tabular-nums; line-height:1.2 }
.clock small{ display:block; font-size:10px; color:var(--muted); letter-spacing:1.2px }
.clock strong{ font-size:17px }

main{ padding:clamp(18px,3vw,32px) clamp(16px,3vw,40px); display:flex; flex-direction:column; gap:22px; max-width:1280px; margin:0 auto }

/* ---------- ชั้น 1: คำตอบ ---------- */
.answer{
  background:var(--panel); border:1px solid var(--line); border-radius:18px;
  padding:clamp(20px,3vw,34px) clamp(18px,3vw,38px);
  display:flex; flex-direction:column; gap:clamp(16px,2vw,22px);
}
.answer-status{
  display:flex; align-items:center; justify-content:space-between;
  gap:16px; flex-wrap:wrap; font-size:13px; color:var(--muted);
}
.live{ display:inline-flex; align-items:center; gap:9px }
.live i{
  width:8px; height:8px; border-radius:50%; background:var(--green);
  flex-shrink:0; animation:pulse 2.4s ease-in-out infinite;
}
@keyframes pulse{ 0%,100%{opacity:1} 50%{opacity:.35} }
@media (prefers-reduced-motion:reduce){ .live i{ animation:none } }
.confidence{ font-size:12px; letter-spacing:.6px }

.verdict{ margin:0; font-size:15px; font-weight:700; letter-spacing:2.4px; color:var(--cyan) }
.answer[data-tone="go"]    .verdict{ color:var(--green) }
.answer[data-tone="try"]   .verdict{ color:var(--amber) }
.answer[data-tone="quiet"] .verdict,
.answer[data-tone="unknown"] .verdict{ color:var(--orange) }

.headline{ margin:0; display:flex; align-items:baseline; gap:clamp(10px,1.5vw,20px); flex-wrap:wrap; line-height:.92 }
.band{ font-size:clamp(56px,8vw,92px); font-weight:800; letter-spacing:-3px }
.target{ font-size:clamp(24px,3.4vw,46px); font-weight:700 }
.answer[data-tone="unknown"] .band,
.answer[data-tone="unknown"] .target{ color:var(--muted) }

.line{ margin:0; font-size:clamp(16px,1.7vw,21px); line-height:1.45; color:var(--soft) }

/* ---------- บันไดแบนด์ ---------- */
.ladder{ display:flex; gap:10px; align-items:flex-end }
.ladder-cell{
  flex:1 1 0; min-width:0; display:grid;
  grid-template-columns:1fr auto;
  grid-template-areas:"track track" "name count";
  align-items:baseline; column-gap:6px; row-gap:7px;
}
.ladder-track{ grid-area:track; display:block; height:6px; border-radius:3px; background:#152736; overflow:hidden }
.ladder-track i{ display:block; height:100%; border-radius:3px; background:var(--dim) }
.ladder-cell.is-best .ladder-track i{ background:var(--cyan) }
.ladder-cell strong{ grid-area:name; font-size:13px; font-weight:700; color:var(--muted) }
.ladder-cell.is-best strong{ color:var(--text) }
.ladder-cell small{ grid-area:count; font-size:12px; color:var(--muted); font-variant-numeric:tabular-nums; text-align:right }

/* ---------- หลักฐาน + CTA ---------- */
.answer-foot{
  display:flex; align-items:center; justify-content:space-between;
  gap:24px; flex-wrap:wrap;
  border-top:1px solid #16293a; padding-top:20px; margin-top:auto;
}
.answer-meta{ display:flex; flex-direction:column; gap:2px; font-size:13px; color:var(--muted); line-height:1.6 }
.cta{
  background:var(--cyan); color:#04141c; text-decoration:none;
  border-radius:11px; padding:14px 26px; min-height:44px;
  font-size:15px; font-weight:700; white-space:nowrap;
  display:inline-flex; align-items:center;
}
.cta:hover{ filter:brightness(1.08) }

/* ---------- ชั้น 2 / 3 / embed ---------- */
.panel{
  background:var(--panel); border:1px solid var(--line); border-radius:16px;
  padding:clamp(18px,2.5vw,28px); scroll-margin-top:20px;
}
.panel h2{ margin:0 0 10px; font-size:clamp(17px,2vw,21px); font-weight:700 }
.panel-note{ margin:0; font-size:14px; color:var(--muted); line-height:1.6 }

.embed-preview{ display:block; max-width:100%; height:auto; margin:18px 0 14px; border-radius:10px }
.embed-label{ display:block; font-size:12px; color:var(--muted); letter-spacing:.6px; margin-bottom:6px }
.embed-code{
  width:100%; background:#08121b; color:var(--soft);
  border:1px solid var(--line); border-radius:10px; padding:12px 14px;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace; font-size:12px; line-height:1.6;
  resize:vertical;
}

.foot{ color:var(--muted); font-size:13px; line-height:1.8; padding:6px 2px 20px }
.foot p{ margin:0 }

/* ---------- มือถือ ---------- */
@media (max-width:620px){
  .topbar{ gap:12px; padding:12px 16px }
  .tabs{ order:3; width:100%; gap:18px }
  .answer{ gap:16px; border-radius:14px }
  .headline{ flex-direction:column; align-items:flex-start; gap:4px }
  .ladder{ flex-direction:column; align-items:stretch; gap:9px }
  .ladder-cell{
    grid-template-columns:38px 1fr 34px;
    grid-template-areas:"name track count";
    align-items:center; column-gap:11px; row-gap:0;
  }
  .ladder-track{ height:7px }
  .answer-foot{ flex-direction:column; align-items:stretch }
  .cta{ width:100%; justify-content:center }
}

/* ---------- ชั้น 2 / 3: ตาราง ---------- */
.src-line{ font-size:12px; color:var(--muted); margin:14px 0 10px; line-height:1.6 }
.table-wrap{ overflow-x:auto; -webkit-overflow-scrolling:touch }
table{ width:100%; border-collapse:collapse; font-size:13px; min-width:520px }
th{
  text-align:left; font-size:11px; font-weight:600; letter-spacing:.8px;
  color:var(--muted); padding:8px 10px; border-bottom:1px solid var(--line); white-space:nowrap;
}
td{ padding:10px; border-bottom:1px solid #16293a; vertical-align:top }
tr:last-child td{ border-bottom:0 }
td.loading{ color:var(--muted); text-align:center; padding:22px }

.ev-table td:first-child{ font-weight:700 }
.ev-sub{ display:block; font-size:11px; color:var(--muted); margin-top:2px }

.pill{
  display:inline-block; padding:3px 9px; border-radius:20px;
  font-size:11px; font-weight:700; letter-spacing:.4px; white-space:nowrap;
  border:1px solid currentColor;
}
.tone-good     { color:var(--green) }
.tone-observed { color:var(--cyan) }
.tone-possible { color:var(--blue,#79a8ff) }
.tone-warn     { color:var(--amber) }
.tone-bad      { color:var(--orange) }
.tone-unknown  { color:var(--muted) }

.filters{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; margin:16px 0 4px }
.filters select{
  background:var(--panel2); color:var(--text); border:1px solid var(--line);
  border-radius:9px; padding:10px 12px; min-height:44px; font:inherit; font-size:13px;
}
.filter-count{ font-size:12px; color:var(--muted); margin-left:auto }

.raw-table td{ font-variant-numeric:tabular-nums }
.raw-table .call{ font-weight:700 }
.mode-unsure{ color:var(--muted); font-style:italic }
.src-tag{
  display:inline-block; font-size:10px; letter-spacing:.4px; color:var(--muted);
  border:1px solid var(--line); border-radius:5px; padding:1px 5px; margin-right:3px;
}

/* measurement ที่เก่าจนใช้ตัดสินไม่ได้ ต้องเห็นว่ามันผิดปกติ ไม่ใช่กลืนไปกับข้อความอื่น */
.src-line.is-stale{ color:var(--amber) }

/* ---------- สถานีของคุณ ---------- */
.station-form{
  display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px; margin-top:18px;
}
.field{ display:flex; flex-direction:column; gap:7px; min-width:0 }
.field-wide{ grid-column:1 / -1; border:0; padding:0; margin:0 }
.field label, .field legend{
  font-size:12px; color:var(--muted); letter-spacing:.6px; padding:0;
}
.field input[type="text"]{
  background:#08121b; color:var(--text); border:1px solid var(--line);
  border-radius:9px; padding:12px 14px; min-height:44px;
  font:inherit; font-size:15px; text-transform:uppercase;
}
.field input[type="text"]:focus-visible{ outline:2px solid var(--cyan); outline-offset:1px }

.chips{ display:flex; flex-wrap:wrap; gap:8px }
.chip{ position:relative; display:inline-flex }
.chip input{
  position:absolute; inset:0; opacity:0; width:100%; height:100%;
  margin:0; cursor:pointer;
}
.chip span{
  display:inline-flex; align-items:center; justify-content:center;
  min-height:44px; padding:0 15px; border-radius:9px;
  background:var(--panel2); border:1px solid var(--line);
  font-size:13px; font-weight:600; color:var(--muted);
}
.chip input:checked + span{ border-color:var(--cyan); color:var(--cyan) }
.chip input:focus-visible + span{ outline:2px solid var(--text); outline-offset:2px }

.station-actions{
  grid-column:1 / -1; display:flex; align-items:center;
  gap:16px; flex-wrap:wrap; margin-top:4px;
}
.link-btn{
  background:none; border:0; color:var(--muted); font:inherit; font-size:13px;
  text-decoration:underline; cursor:pointer; padding:10px 0; min-height:44px;
}
.link-btn:hover{ color:var(--orange) }
.station-msg{ font-size:13px; color:var(--muted) }
.station-msg.is-ok{ color:var(--green) }
.station-msg.is-err{ color:var(--orange) }

@media (max-width:620px){
  .station-form{ grid-template-columns:1fr }
  .station-actions .cta{ width:100% ; justify-content:center }
}

/* ---------- แจ้งเตือน ---------- */
.tg-state{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin:18px 0 10px; font-size:13px; color:var(--muted) }
.tg-state.is-linked #tgLabel{ color:var(--green) }
.tg-code{
  margin:0 0 16px; padding:14px 16px; border-radius:10px;
  background:#08121b; border:1px solid var(--cyan); color:var(--soft);
  font-size:13px; line-height:1.7;
}
.tg-code b{ color:var(--cyan); font-size:20px; letter-spacing:3px; font-family:ui-monospace,Menlo,monospace }

.watch-table{ min-width:640px }
.watch-table td{ padding:7px 8px }
.watch-table input[type="text"], .watch-table select{
  width:100%; background:#08121b; color:var(--text); border:1px solid var(--line);
  border-radius:8px; padding:10px; min-height:44px; font:inherit; font-size:13px;
}
.watch-table input[type="text"]{ text-transform:uppercase }
.watch-actions{ display:flex; align-items:center; gap:16px; flex-wrap:wrap; margin-top:16px }
.row-del{ background:none; border:0; color:var(--muted); cursor:pointer; font-size:18px; line-height:1; padding:10px; min-height:44px }
.row-del:hover{ color:var(--orange) }

/* อธิบายตอนแบนด์ที่เลือกไม่ใช่แบนด์ที่เลขเยอะสุด — ไม่งั้นบันไดจะดูขัดกับคำตอบ */
.why-not-busiest{
  margin:0; padding:10px 14px;
  background:rgba(73,217,255,.06);
  border-left:2px solid var(--cyan);
  border-radius:0 8px 8px 0;
  font-size:13px; color:var(--soft); line-height:1.6;
}

/* ---------- แถบสปอตสด ----------
 * หน้าที่ชื่อว่า live แต่ไม่ขยับเลย คนจะนึกว่าค้าง
 * แต่ที่วิ่งตรงนี้คือสัญญาณเรียกขานจริงจากเครือข่าย ไม่ใช่แอนิเมชันประดับ
 */
.tickerbar{
  display:flex; align-items:center; gap:14px;
  padding:9px clamp(16px,3vw,40px);
  background:#08121b; border-bottom:1px solid #16293a;
  font-size:12px; color:var(--muted);
  overflow:hidden; white-space:nowrap;
}
.ticker-tag{
  display:inline-flex; align-items:center; gap:7px; flex-shrink:0;
  color:var(--green); font-weight:700; letter-spacing:1px;
}
.ticker-tag i{
  width:7px; height:7px; border-radius:50%; background:var(--green);
  animation:pulse 2.4s ease-in-out infinite;
}
.ticker-slot{ flex-grow:1; min-width:0; overflow:hidden; text-overflow:ellipsis }
.ticker-idle{ color:var(--dim) }
.ticker-count{ flex-shrink:0; color:var(--dim); font-variant-numeric:tabular-nums }

.ticker-item{ display:inline-flex; align-items:baseline; gap:10px; animation:tickerIn .45s ease both }
.ticker-item b{ color:var(--text); font-weight:700; letter-spacing:.3px }
.ticker-item .tk-band{ color:var(--cyan) }
.ticker-item .tk-dim{ color:var(--dim) }
@keyframes tickerIn{ from{ opacity:0; transform:translateY(7px) } to{ opacity:1; transform:none } }

/* แท่งแบนด์ขยับตามค่าจริงเวลาข้อมูลอัปเดต — เห็นได้ว่าอะไรกำลังขึ้นหรือลง */
.ladder-track i{ transition:width .7s cubic-bezier(.22,.61,.36,1), background .3s ease }
.ladder-cell small{ transition:color .3s ease }
.ladder-cell.just-changed small{ color:var(--cyan) }

@media (prefers-reduced-motion:reduce){
  .ticker-item{ animation:none }
  .ladder-track i{ transition:none }
}
@media (max-width:620px){
  .tickerbar{ gap:10px; padding:8px 16px }
  .ticker-count{ display:none }
}

/* ---------- AUTO countdown ----------
 * ตัวเลขนับถอยหลังจริง ไม่ใช่แอนิเมชันหลอก
 * ตอบสองคำถามด้วยตัวเดียว: ยังทำงานอยู่ไหม และอีกนานแค่ไหนจะอัปเดต
 */
.auto-chip{
  display:inline-flex; align-items:center; gap:7px;
  background:var(--panel2); border:1px solid var(--line);
  border-radius:9px; padding:7px 11px; min-height:44px;
  font-size:11px; letter-spacing:.8px; color:var(--muted);
}
.auto-chip i{
  width:7px; height:7px; border-radius:50%; background:var(--green);
  animation:pulse 2.4s ease-in-out infinite;
}
.auto-chip.is-working i{ background:var(--cyan); animation-duration:.7s }
.auto-chip small{ color:var(--text); font-variant-numeric:tabular-nums; min-width:22px; text-align:right }

.lang-switch{
  display:inline-flex; border:1px solid var(--line); border-radius:9px; overflow:hidden;
}
.lang-switch a{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:38px; min-height:44px; padding:0 10px;
  font-size:12px; font-weight:600; color:var(--muted); text-decoration:none;
  background:var(--panel2);
}
.lang-switch a.is-on{ background:rgba(73,217,255,.14); color:var(--cyan) }

@media (prefers-reduced-motion:reduce){ .auto-chip i{ animation:none } }
@media (max-width:620px){
  .auto-chip span{ display:none }
  .auto-chip{ padding:7px 9px }
}

/* นาฬิกาสองช่อง — วินาทีเดินจริง เป็นสัญญาณว่าหน้ายังทำงาน */
.clock{ display:flex; align-items:center; gap:16px }
.clock-cell{ display:flex; flex-direction:column; align-items:flex-end; line-height:1.15 }
.clock-cell small{ font-size:9px; color:var(--muted); letter-spacing:1.2px }
.clock-cell strong{ font-size:17px; font-variant-numeric:tabular-nums; letter-spacing:.3px }
.clock-local strong{ color:var(--muted); font-weight:600 }
@media (max-width:860px){ .clock-local{ display:none } }

/* ===================== ขนาดตัวอักษร =====================
 * กลุ่มผู้ใช้วิทยุสมัครเล่นอายุเฉลี่ยค่อนข้างสูง ตัวเลือกนี้จึงไม่ใช่ของแถม
 * คูณเฉพาะข้อความที่ต้องอ่านจริง ไม่แตะเลขแบนด์ที่ใหญ่อยู่แล้ว
 */
:root{ --ts:1 }
html[data-ts="large"]{ --ts:1.15 }
html[data-ts="xl"]   { --ts:1.3 }
html[data-ts="xxl"]  { --ts:1.5 }

.line        { font-size:calc(clamp(16px,1.7vw,21px) * var(--ts)) }
.answer-meta { font-size:calc(13px * var(--ts)) }
.panel-note  { font-size:calc(14px * var(--ts)) }
.why-not-busiest { font-size:calc(13px * var(--ts)) }
table        { font-size:calc(13px * var(--ts)) }
th           { font-size:calc(11px * var(--ts)) }
.ev-sub      { font-size:calc(11px * var(--ts)) }
.ladder-cell strong { font-size:calc(13px * var(--ts)) }
.ladder-cell small  { font-size:calc(12px * var(--ts)) }
.ticker-item { font-size:calc(12px * var(--ts)) }
.src-line    { font-size:calc(12px * var(--ts)) }
.field input[type="text"] { font-size:calc(15px * var(--ts)) }
.station-msg { font-size:calc(13px * var(--ts)) }
.hint        { font-size:calc(12px * var(--ts)) }
.target      { font-size:calc(clamp(24px,3.4vw,46px) * min(var(--ts),1.15)) }

.ts-control{ position:relative }
.ts-toggle{
  display:inline-flex; align-items:center; gap:7px;
  background:var(--panel2); border:1px solid var(--line); color:var(--text);
  border-radius:9px; padding:7px 11px; min-height:44px; cursor:pointer; font:inherit;
}
.ts-toggle strong{ font-size:14px }
.ts-toggle small{ font-size:11px; color:var(--muted) }
.ts-menu{
  position:absolute; right:0; top:calc(100% + 6px); z-index:40;
  background:var(--panel2); border:1px solid var(--line); border-radius:11px;
  padding:6px; min-width:160px; box-shadow:0 18px 50px rgba(0,0,0,.45);
}
.ts-menu button{
  display:flex; align-items:center; gap:12px; width:100%;
  background:none; border:0; color:var(--text); font:inherit; font-size:13px;
  padding:11px 12px; min-height:44px; border-radius:8px; cursor:pointer; text-align:left;
}
.ts-menu button:hover{ background:rgba(73,217,255,.1) }
.ts-menu button[aria-pressed="true"]{ color:var(--cyan) }

/* ===================== คำอธิบายศัพท์ ===================== */
.hint{
  display:none;
  margin:10px 0 0; padding:10px 13px;
  background:rgba(255,196,77,.07); border-left:2px solid var(--amber);
  border-radius:0 8px 8px 0; color:var(--soft); line-height:1.7;
}
html[data-hints="on"] .hint{ display:block }
.answer-meta .hint{ margin:0 0 8px }

.hints-toggle{
  display:inline-flex; align-items:center; gap:7px;
  background:var(--panel2); border:1px solid var(--line); color:var(--text);
  border-radius:9px; padding:7px 11px; min-height:44px; cursor:pointer; font:inherit;
}
.hints-toggle strong{ font-size:14px }
.hints-toggle small{ font-size:11px; color:var(--muted); letter-spacing:.6px }
.hints-toggle[aria-pressed="true"]{ border-color:var(--amber) }
.hints-toggle[aria-pressed="true"] strong,
.hints-toggle[aria-pressed="true"] small{ color:var(--amber) }

/* ===================== มิเตอร์สัญญาณ =====================
 * ความเร็วและความสูงผูกกับความแรงของหลักฐานจริง
 * หลักฐานบาง = เตี้ยและช้า, หลักฐานแน่น = สูงและไว
 * ถ้าวิ่งเท่ากันตลอดไม่ว่าอากาศเป็นยังไง มันก็แค่ของประดับที่โกหก
 */
.signal-meter{
  display:inline-flex; align-items:flex-end; gap:3px;
  height:calc(clamp(56px,8vw,92px) * .42);
  --spd:1.1s; --amp:1;
}
.signal-meter i{
  width:4px; border-radius:2px; background:var(--dim);
  height:22%;
  animation:sigbar var(--spd) ease-in-out infinite alternate;
}
.answer[data-tone="go"]  .signal-meter i{ background:var(--green) }
.answer[data-tone="try"] .signal-meter i{ background:var(--amber) }
.answer[data-tone="quiet"] .signal-meter i,
.answer[data-tone="unknown"] .signal-meter i{ background:var(--dim) }

.signal-meter i:nth-child(1){ animation-delay:0s }
.signal-meter i:nth-child(2){ animation-delay:.09s }
.signal-meter i:nth-child(3){ animation-delay:.18s }
.signal-meter i:nth-child(4){ animation-delay:.27s }
.signal-meter i:nth-child(5){ animation-delay:.36s }
.signal-meter i:nth-child(6){ animation-delay:.45s }
.signal-meter i:nth-child(7){ animation-delay:.54s }
.signal-meter i:nth-child(8){ animation-delay:.63s }
.signal-meter i:nth-child(9){ animation-delay:.72s }

@keyframes sigbar{
  from{ height:calc(14% * var(--amp)) }
  to  { height:calc(96% * var(--amp)) }
}

@media (prefers-reduced-motion:reduce){
  .signal-meter i{ animation:none; height:calc(45% * var(--amp)) }
}
@media (max-width:620px){
  .signal-meter{ display:none }
  .ts-toggle small, .hints-toggle small{ display:none }
}

/* ---------- หัวข้อแบนเนอร์ ---------- */
.embed-why{
  display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:16px; margin:18px 0 22px;
}
.embed-why div{
  display:flex; flex-direction:column; gap:5px;
  padding-left:13px; border-left:2px solid var(--line);
}
.embed-why strong{ font-size:calc(14px * var(--ts)); color:var(--text); line-height:1.4 }
.embed-why span{ font-size:calc(13px * var(--ts)); color:var(--muted); line-height:1.6 }

.embed-controls{ display:flex; gap:14px; flex-wrap:wrap; margin-bottom:18px }
.embed-controls label{ display:flex; flex-direction:column; gap:6px; min-width:0 }
.embed-controls span{ font-size:12px; color:var(--muted); letter-spacing:.6px }
.embed-controls input, .embed-controls select{
  background:#08121b; color:var(--text); border:1px solid var(--line);
  border-radius:9px; padding:11px 13px; min-height:44px; font:inherit; font-size:14px;
}
.embed-controls input{ text-transform:uppercase; width:150px }

.embed-formats{ display:flex; gap:8px; flex-wrap:wrap; margin:18px 0 10px }
.embed-formats button{
  display:inline-flex; align-items:baseline; gap:7px;
  background:var(--panel2); border:1px solid var(--line); color:var(--muted);
  border-radius:9px; padding:10px 14px; min-height:44px;
  font:inherit; font-size:13px; font-weight:600; cursor:pointer;
}
.embed-formats button small{ font-size:11px; font-weight:400; color:var(--dim) }
.embed-formats button[aria-selected="true"]{ border-color:var(--cyan); color:var(--cyan) }
.embed-formats button[aria-selected="true"] small{ color:var(--muted) }

.embed-where{
  margin:14px 0 0; font-size:calc(13px * var(--ts));
  color:var(--muted); line-height:1.7;
}

/* ===================== แผนที่ ===================== */

.map-bar{ display:flex; align-items:center; gap:.5rem; margin:.6rem 0 .5rem }
.map-bar label{ color:var(--muted); font-size:calc(.82rem * var(--ts)) }
.map-bar select{
  background:var(--panel2); color:var(--text); border:1px solid var(--line);
  border-radius:6px; padding:.3rem .5rem; font:inherit;
  font-size:calc(.85rem * var(--ts));
}

.map-canvas{
  height:420px; border-radius:8px; border:1px solid var(--line);
  background:var(--panel2); overflow:hidden;
}
@media (max-width:640px){ .map-canvas{ height:320px } }

/* ไทล์ OSM เป็นภาพสว่าง ย้อมเฉพาะชั้นไทล์ไม่ให้โดนหมุดกับเส้นด้วย */
.osm-dark .leaflet-tile-pane{
  filter:invert(1) hue-rotate(185deg) brightness(.76) contrast(1.08) saturate(.55);
}
.map-canvas .leaflet-container{ background:var(--panel2); font:inherit }
.map-canvas .leaflet-control-attribution{
  background:rgba(5,10,15,.78); color:var(--muted); font-size:10px;
}
.map-canvas .leaflet-control-attribution a{ color:var(--cyan) }
.map-canvas .leaflet-bar a,
.map-canvas .leaflet-control-layers{
  background:var(--panel); color:var(--text); border-color:var(--line);
}
.map-canvas .leaflet-bar a:hover{ background:var(--panel2) }
.map-canvas .leaflet-control-layers-expanded{ color:var(--text) }

.cq-region-bubble{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  border-radius:50%; border:1px solid var(--cyan);
  background:rgba(12,32,46,.82); color:var(--text);
  line-height:1.05; box-shadow:0 0 0 1px rgba(73,217,255,.12);
}
.cq-region-bubble span{ font-size:10px; letter-spacing:.06em; color:var(--soft) }
.cq-region-bubble strong{ font-size:15px; font-variant-numeric:tabular-nums }
.cq-region-bubble.hot{
  border-color:var(--green); box-shadow:0 0 12px rgba(66,232,123,.22);
}
.cq-region-bubble.hot strong{ color:var(--green) }

.cq-qth-pin{
  width:30px; height:30px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:rgba(255,196,77,.16); border:2px solid var(--amber);
  color:var(--amber); font-size:9px; font-weight:700; letter-spacing:.04em;
}

.map-canvas .leaflet-popup-content-wrapper,
.map-canvas .leaflet-popup-tip{
  background:var(--panel); color:var(--text); border:1px solid var(--line);
}
.cq-pop strong{ display:block; margin-bottom:.15rem }
.cq-pop div{ color:var(--soft); font-size:calc(.85rem * var(--ts)) }
.cq-pop small{ color:var(--muted) }

/* หมุดเป็น divIcon ธรรมดา ไม่ต้องมีกรอบขาวของ Leaflet */
.cq-region-icon, .cq-qth-icon{ background:none; border:0 }

/* ===================== DXpedition ===================== */

.dx-tabs{ display:flex; gap:.4rem; margin:.7rem 0 .8rem; flex-wrap:wrap }
.dx-tab{
  background:var(--panel2); color:var(--soft); border:1px solid var(--line);
  border-radius:999px; padding:.32rem .8rem; cursor:pointer; font:inherit;
  font-size:calc(.84rem * var(--ts));
}
.dx-tab:hover{ border-color:var(--dim); color:var(--text) }
.dx-tab.is-on{ background:var(--cyan); border-color:var(--cyan); color:#04161f; font-weight:600 }

.dx-list{
  display:grid; gap:.6rem;
  grid-template-columns:repeat(auto-fill,minmax(270px,1fr));
}

.dx-card{
  border:1px solid var(--line); border-left:3px solid var(--dim);
  border-radius:8px; background:var(--panel2); padding:.65rem .75rem;
}
.dx-card.is-heard{ border-left-color:var(--green) }

.dx-top{ display:flex; align-items:center; justify-content:space-between; gap:.5rem }
.dx-call{
  font-size:calc(1.05rem * var(--ts)); letter-spacing:.02em; color:var(--text);
}
.dx-badge{
  font-size:calc(.68rem * var(--ts)); letter-spacing:.05em; white-space:nowrap;
  border:1px solid var(--dim); color:var(--muted);
  border-radius:999px; padding:.1rem .45rem;
}
.dx-badge.on{
  border-color:var(--green); color:var(--green); background:rgba(66,232,123,.08);
}

.dx-meta{ color:var(--muted); font-size:calc(.78rem * var(--ts)); margin-top:.18rem }
.dx-heard{
  color:var(--green); font-size:calc(.79rem * var(--ts)); margin-top:.3rem;
  font-variant-numeric:tabular-nums;
}
.dx-note{
  color:var(--soft); font-size:calc(.8rem * var(--ts)); margin-top:.3rem; line-height:1.4;
}
.dx-dates{
  color:var(--dim); font-size:calc(.72rem * var(--ts)); margin-top:.4rem;
  font-variant-numeric:tabular-nums;
}

.dx-toggle{
  display:inline-flex; align-items:center; gap:.35rem; margin-left:auto;
  color:var(--muted); font-size:calc(.8rem * var(--ts)); cursor:pointer;
}
.dx-toggle input{ accent-color:var(--cyan); cursor:pointer }
.dx-toggle:hover{ color:var(--soft) }
.dx-long{
  border:1px solid var(--dim); border-radius:3px; padding:0 .3rem;
  font-size:calc(.68rem * var(--ts)); color:var(--muted);
}

/* ===================== แผงพับ ===================== */

.fold > summary.fold-sum{
  list-style:none; cursor:pointer; display:flex; align-items:baseline;
  gap:.6rem; flex-wrap:wrap; padding:.1rem 0;
}
.fold > summary.fold-sum::-webkit-details-marker{ display:none }

.fold > summary.fold-sum h2{ margin:0; flex:0 0 auto }

/* ลูกศรวาดเอง จะได้คุมตำแหน่งกับสีได้ */
.fold > summary.fold-sum::before{
  content:''; flex:0 0 auto; align-self:center;
  width:0; height:0; margin-right:.1rem;
  border-left:5px solid var(--muted);
  border-top:4px solid transparent;
  border-bottom:4px solid transparent;
  transition:transform .15s ease;
}
.fold[open] > summary.fold-sum::before{ transform:rotate(90deg) }
.fold > summary.fold-sum:hover::before{ border-left-color:var(--cyan) }

.fold-head{
  color:var(--muted); font-size:calc(.84rem * var(--ts));
  font-variant-numeric:tabular-nums;
}
.fold[open] > summary.fold-sum .fold-head{ opacity:.55 }
.fold > summary.fold-sum:hover .fold-head{ color:var(--soft) }

.fold-body{ padding-top:.7rem }

.fold > summary.fold-sum:focus-visible{
  outline:2px solid var(--cyan); outline-offset:3px; border-radius:4px;
}

/* แผงย่อยในกลุ่มตั้งค่า ไม่ต้องมีกรอบซ้อนกรอบ */
.subpanel{ padding:0; margin:0 0 1.6rem; background:none; border:0 }
.subpanel:last-child{ margin-bottom:0 }
.subpanel h2{ font-size:calc(1.02rem * var(--ts)); color:var(--soft) }

@media (prefers-reduced-motion:reduce){
  .fold > summary.fold-sum::before{ transition:none }
}
