/* หน้าแปลงค่าเงิน — สไตล์ชีตครบในตัว (ไม่พึ่ง styles.css กลาง เพราะถูกออกแบบใหม่บ่อยจนโครง/ชื่อคลาสเปลี่ยนตลอด)
   โทเค็นสีเป็นของหน้านี้เอง; โหมดกลางคืนผูกกับ html[data-theme="night"] และคีย์ localStorage "web-th-theme" เดียวกับหน้าอื่น */
.currency-page {
  --c-paper: #f4f2e9;
  --c-emerald: #0a6b4f;
  --c-emerald-bright: #15926b;
  --c-deep: #071f1a;
  --c-gold: #f2bd62;
  --c-orange: #ef7945;
  --c-mint: #dceee4;
  --c-ink: #102e27;
  --c-ink-soft: #395b52;
  --c-muted: #71867f;
  --c-line: rgba(28, 74, 61, .13);
  --c-surface: rgba(255, 254, 249, .86);
  --c-surface-solid: #fffef9;
  --c-shadow: 0 24px 70px rgba(21, 53, 45, .10);
  --c-shadow-soft: 0 12px 34px rgba(21, 53, 45, .07);
  --c-up: #128a5e;
  --c-down: #d8553a;
  --c-accent-text: #0a6b4f;
  color-scheme: light;
}
:root[data-theme="night"] .currency-page {
  --c-paper: #071712;
  --c-mint: #143d31;
  --c-ink: #eef8f3;
  --c-ink-soft: #bfd3ca;
  --c-muted: #8ea69d;
  --c-line: rgba(196, 231, 216, .12);
  --c-surface: rgba(14, 42, 34, .78);
  --c-surface-solid: #0d2a22;
  --c-shadow: 0 24px 80px rgba(0, 0, 0, .28);
  --c-shadow-soft: 0 12px 34px rgba(0, 0, 0, .2);
  --c-up: #5fd39f;
  --c-down: #ff8f73;
  --c-accent-text: #73d2ad;
  color-scheme: dark;
}

/* ---- ฐาน ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.currency-page {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 14% 3%, rgba(242, 189, 98, .12), transparent 27rem),
    radial-gradient(circle at 91% 16%, rgba(21, 146, 107, .10), transparent 32rem),
    var(--c-paper);
  color: var(--c-ink);
  font-family: "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
}
.currency-page button, .currency-page input { font: inherit; }
.currency-page button, .currency-page a { -webkit-tap-highlight-color: transparent; }
.currency-page button:focus-visible, .currency-page a:focus-visible { outline: 3px solid var(--c-gold); outline-offset: 3px; }
.currency-page svg { display: block; }
.currency-page h1, .currency-page h2, .currency-page h3, .currency-page p { margin-top: 0; }
.currency-page [hidden] { display: none !important; } /* กัน display:flex/grid ของคลาสไปทับ [hidden] */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.cx-shell, .cx-topbar-inner, .cx-footer { width: min(1220px, calc(100% - 48px)); margin-inline: auto; }

/* ---- แถบบน ---- */
.cx-topbar { position: relative; }
.cx-topbar-inner { height: 92px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.cx-brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; color: var(--c-ink); font-size: 19px; font-weight: 900; letter-spacing: -.025em; text-decoration: none; }
.cx-brand-mark { position: relative; display: grid; place-items: center; width: 40px; height: 40px; overflow: hidden; border-radius: 13px; background: var(--c-emerald); color: #fff; font-size: 12px; letter-spacing: -.08em; box-shadow: inset 0 -3px 0 rgba(0,0,0,.14), 0 7px 18px rgba(10,107,79,.18); }
.cx-brand-mark::before { content: ""; position: absolute; width: 45px; height: 12px; top: -5px; left: -9px; background: rgba(255,255,255,.22); transform: rotate(-18deg); }
.cx-brand-name span { color: var(--c-orange); }
.cx-nav { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--c-line); border-radius: 999px; background: var(--c-surface); box-shadow: var(--c-shadow-soft); }
.cx-nav a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 15px; border-radius: 999px; color: var(--c-ink-soft); font-size: 12.5px; font-weight: 800; text-decoration: none; transition: .18s ease; }
.cx-nav a:hover { background: var(--c-mint); color: var(--c-accent-text); }
.cx-actions { justify-self: end; display: flex; align-items: center; gap: 14px; }
.cx-time { display: flex; align-items: center; gap: 9px; color: var(--c-muted); font-size: 13px; white-space: nowrap; }
.cx-time i { width: 7px; height: 7px; border-radius: 50%; background: #4eb781; box-shadow: 0 0 0 5px rgba(78,183,129,.12); animation: cx-pulse 2.2s ease-in-out infinite; }
@keyframes cx-pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.75); opacity: .65; } }
.cx-theme { width: 43px; height: 43px; display: grid; place-items: center; border: 1px solid var(--c-line); border-radius: 50%; background: var(--c-surface); color: var(--c-ink); cursor: pointer; box-shadow: var(--c-shadow-soft); transition: transform .2s ease, background .2s ease; }
.cx-theme:hover { transform: rotate(9deg) scale(1.05); background: var(--c-mint); }
.cx-theme svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.cx-theme .moon-icon { display: none; }
[data-theme="night"] .cx-theme .sun-icon { display: none; }
[data-theme="night"] .cx-theme .moon-icon { display: block; }

/* ---- หัวข้อ/โครงส่วนต่าง ๆ ---- */
.cx-eyebrow { display: flex; align-items: center; gap: 12px; color: var(--c-emerald); font-size: 12px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
[data-theme="night"] .cx-eyebrow { color: var(--c-accent-text); }
.cx-eyebrow::before { content: ""; width: 35px; height: 2px; background: var(--c-orange); }
.cx-eyebrow i { width: 5px; height: 5px; border-radius: 50%; background: var(--c-gold); box-shadow: 12px 0 0 rgba(242,189,98,.4); }
.cx-section-heading { display: flex; justify-content: space-between; align-items: end; gap: 40px; margin-bottom: 30px; }
.cx-section-heading h2, .cx-about h2 { margin: 9px 0 8px; font-size: clamp(38px, 4.6vw, 60px); line-height: 1.05; letter-spacing: -.05em; }
.cx-about { display: grid; grid-template-columns: .8fr 1.2fr; gap: 105px; padding: 100px 0; border-top: 1px solid var(--c-line); }
.cx-footer { min-height: 112px; display: grid; grid-template-columns: 1fr auto auto; gap: 42px; align-items: center; border-top: 1px solid var(--c-line); color: var(--c-muted); font-size: 11px; }
.cx-footer p { margin: 0; }
.cx-footer .cx-brand { font-size: 15px; }
.cx-footer .cx-brand-mark { width: 31px; height: 31px; border-radius: 10px; font-size: 10px; }

/* ---- Hero ---- */
.cx-hero { display: grid; grid-template-columns: .9fr 1.1fr; gap: 56px; align-items: center; padding: 44px 0 70px; }
.cx-hero h1 { margin: 22px 0 22px; font-size: clamp(50px, 6.4vw, 92px); line-height: 1.02; letter-spacing: -.055em; font-weight: 950; }
.cx-hero h1 em { color: var(--c-emerald); font-style: normal; background: linear-gradient(100deg, var(--c-emerald), #1a9970 58%, var(--c-emerald)); background-size: 180% auto; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: cx-glow 7s linear infinite; }
@keyframes cx-glow { to { background-position: -180% center; } }
.cx-intro { max-width: 560px; color: var(--c-ink-soft); font-size: 17px; line-height: 1.8; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.hero-badges span { padding: 7px 12px; border: 1px solid var(--c-line); border-radius: 999px; background: var(--c-surface); color: var(--c-muted); font-size: 12px; font-weight: 700; }
.recent-pairs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.recent-pairs::before { content: "ล่าสุด"; align-self: center; color: var(--c-muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

/* ---- ชิป ---- */
.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 40px; padding: 0 13px; border: 1px solid var(--c-line); border-radius: 999px; background: var(--c-surface); color: var(--c-ink); font-size: 12.5px; font-weight: 800; cursor: pointer; transition: .18s ease; }
.chip:hover { border-color: var(--c-emerald); transform: translateY(-1px); }
.chip.is-active { background: var(--c-emerald); border-color: var(--c-emerald); color: #fff; }
.pair-chip span { color: var(--c-muted); }
.pair-chip.is-active span { color: rgba(255,255,255,.7); }

/* ---- กล่องแปลง ---- */
.converter-card { position: relative; isolation: isolate; padding: 30px 32px 30px; border: 1px solid rgba(255,255,255,.1); border-radius: 36px; background: radial-gradient(circle at 76% 12%, rgba(242,189,98,.14), transparent 26%), linear-gradient(145deg, #0b4938 0%, #06241d 74%); color: #fff; box-shadow: 0 35px 90px rgba(7,31,26,.3); }
/* วงกลมตกแต่งอยู่ในชั้นที่ตัดขอบเอง (การ์ดตัดขอบไม่ได้ เพราะแผงเลือกสกุลต้องล้นออกมาได้) */
.converter-deco { position: absolute; inset: 0; z-index: -1; overflow: hidden; border-radius: inherit; pointer-events: none; }
.converter-deco::after { content: ""; position: absolute; inset: auto -120px -170px auto; width: 380px; height: 380px; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); box-shadow: 0 0 0 45px rgba(255,255,255,.035), 0 0 0 90px rgba(255,255,255,.025); }
.converter-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.converter-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid rgba(255,255,255,.17); border-radius: 999px; background: rgba(255,255,255,.05); color: rgba(229,247,239,.8); font-size: 12px; letter-spacing: .02em; }
.converter-pill i { width: 6px; height: 6px; border-radius: 50%; background: #64d39e; box-shadow: 0 0 0 4px rgba(100,211,158,.12); }
.refresh-button, .mini-button, .ghost-button { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 15px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: rgba(255,255,255,.08); color: #fff; font-size: 12.5px; font-weight: 800; cursor: pointer; transition: transform .2s ease, background .2s ease; }
.refresh-button:hover, .ghost-button:hover { background: rgba(255,255,255,.16); transform: translateY(-1px); }
.refresh-button:disabled { opacity: .6; cursor: progress; transform: none; }
.refresh-button svg { width: 15px; height: 15px; }
.refresh-button.is-loading svg { animation: cur-spin 1s linear infinite; }
.mini-button { min-height: 40px; padding: 0 12px; font-size: 11.5px; }
.mini-button:hover { background: rgba(255,255,255,.18); }
.ghost-button .fav-icon { color: rgba(255,255,255,.55); font-size: 15px; transition: .2s; }
.ghost-button.is-on { border-color: var(--c-gold); background: rgba(242,189,98,.16); }
.ghost-button.is-on .fav-icon { color: var(--c-gold); }
@keyframes cur-spin { to { transform: rotate(360deg); } }

.field-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 4px 8px; }
.field-label { color: rgba(229,247,239,.72); font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.field-hint { color: var(--c-gold); font-size: 12px; font-weight: 800; }
.field { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, 44%); border-radius: 18px; background: #fffef9; color: #102e27; box-shadow: inset 0 0 0 1px rgba(16,46,39,.08); }
.field:focus-within { box-shadow: 0 0 0 3px rgba(242,189,98,.8); }
.field input, .field .result-value { min-width: 0; height: 68px; padding: 0 20px; border: 0; border-radius: 18px 0 0 18px; background: transparent; color: #102e27; font-size: clamp(24px, 3vw, 30px); font-weight: 900; letter-spacing: -.03em; outline: none; font-variant-numeric: tabular-nums; }
.field input::placeholder { color: #a9b5af; font-weight: 700; }
.field .result-value { display: flex; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #0a6b4f; }
.field .result-value.is-empty { color: #a9b5af; }
.quick-amounts { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 2px 0; }
.quick-amounts .chip { min-height: 40px; padding: 0 11px; border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: rgba(229,247,239,.85); font-size: 11.5px; }
.quick-amounts .chip:hover { border-color: rgba(255,255,255,.4); }
.quick-amounts .chip.is-active { background: var(--c-gold); border-color: var(--c-gold); color: var(--c-deep); }

/* ---- ตัวเลือกสกุลเงิน ---- */
.picker { position: relative; min-width: 0; }
.picker-button { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; width: 100%; height: 68px; padding: 0 16px 0 16px; border: 0; border-left: 1px solid rgba(16,46,39,.1); border-radius: 0 18px 18px 0; background: #dceee4; color: #0b4936; text-align: left; cursor: pointer; transition: background .2s ease; }
.picker-button:hover, .picker-button[aria-expanded="true"] { background: #cfe5d5; }
.picker-button-code { font-size: 16px; font-weight: 900; letter-spacing: -.01em; }
.picker-button-name { overflow: hidden; color: #2f6a58; font-size: 12.5px; font-weight: 700; white-space: nowrap; text-overflow: ellipsis; }
.picker-caret { width: 16px; height: 16px; fill: none; stroke: #0a6b4f; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s ease; }
.picker-button[aria-expanded="true"] .picker-caret { transform: rotate(180deg); }
.picker-panel[hidden] { display: none; }
.picker-panel { position: absolute; z-index: 60; top: calc(100% + 8px); right: 0; width: min(380px, 92vw); max-height: 420px; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--c-line); border-radius: 20px; background: var(--c-surface-solid); color: var(--c-ink); box-shadow: 0 30px 80px rgba(4,24,19,.28); animation: picker-in .16s ease; }
@keyframes picker-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.picker-head { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--c-line); }
.picker-search { flex: 1; min-width: 0; height: 44px; padding: 0 14px; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-surface); color: var(--c-ink); font: inherit; font-size: 14px; outline: none; }
.picker-search:focus { border-color: var(--c-emerald); box-shadow: 0 0 0 3px rgba(10,107,79,.15); }
.picker-close { width: 44px; height: 44px; border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-surface); color: var(--c-muted); font-size: 15px; cursor: pointer; }
.picker-list { flex: 1; margin: 0; padding: 6px; overflow-y: auto; list-style: none; overscroll-behavior: contain; scrollbar-width: thin; }
.picker-group { padding: 12px 12px 6px; color: var(--c-muted); font-size: 10.5px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.picker-option { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; cursor: pointer; }
.picker-option.is-active { background: var(--c-mint); }
.picker-option[aria-selected="true"] .picker-code { color: var(--c-emerald); }
.picker-code { font-size: 14px; font-weight: 900; letter-spacing: -.01em; }
.picker-text { display: grid; min-width: 0; }
.picker-text b { overflow: hidden; font-size: 13.5px; white-space: nowrap; text-overflow: ellipsis; }
.picker-text small { overflow: hidden; color: var(--c-muted); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.picker-symbol { color: var(--c-muted); font-size: 12px; font-weight: 700; }
.picker-empty { padding: 26px 12px; color: var(--c-muted); text-align: center; font-size: 13px; }

.swap-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 12px 0; }
.swap-row::before, .swap-row::after { content: ""; flex: 1; height: 1px; background: rgba(255,255,255,.14); }
.swap-button { display: grid; place-items: center; width: 50px; height: 50px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; transition: .25s ease; }
.swap-button:hover { background: var(--c-gold); border-color: var(--c-gold); color: var(--c-deep); transform: rotate(180deg); }
.swap-button svg { width: 22px; height: 22px; }

.baht-words { margin: 10px 4px 0; color: rgba(229,247,239,.7); font-size: 12px; line-height: 1.5; }
.rate-lines { display: grid; gap: 5px; margin-top: 20px; font-size: 15px; font-weight: 800; }
.rate-lines span:first-child { color: var(--c-gold); }
.rate-lines span:nth-child(2) { color: rgba(229,247,239,.75); font-weight: 600; font-size: 13.5px; }
.rate-change { font-size: 12.5px; font-weight: 800; }
.rate-change.up { color: #7fe3b4; }
.rate-change.down { color: #ffa48c; }
.rate-status { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: rgba(255,255,255,.07); color: rgba(229,247,239,.78); font-size: 12px; line-height: 1.6; }
.rate-status.is-warning { background: rgba(242,189,98,.16); color: #ffe6b8; }
.converter-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.share-button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: #fff; color: #0b4936; font-size: 13px; font-weight: 800; cursor: pointer; transition: .2s ease; }
.share-button:hover { background: var(--c-gold); transform: translateY(-1px); }
.share-button svg { width: 15px; height: 15px; }
.share-feedback { color: rgba(229,247,239,.75); font-size: 12px; word-break: break-all; }

/* ---- กราฟ ---- */
.chart-section { padding: 0 0 40px; }
.chart-card { padding: 30px 32px 24px; border: 1px solid var(--c-line); border-radius: 30px; background: var(--c-surface); box-shadow: var(--c-shadow); backdrop-filter: blur(16px); }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.chart-head h2 { margin: 10px 0 4px; font-size: clamp(30px, 3.4vw, 42px); letter-spacing: -.045em; line-height: 1; }
.chart-subtitle { margin: 0; color: var(--c-muted); font-size: 13px; }
.chart-current { text-align: right; }
.chart-current strong { display: block; font-size: clamp(30px, 3.4vw, 42px); letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; transition: color .15s; }
.chart-current strong.is-hover { color: var(--c-emerald); }
[data-theme="night"] .chart-current strong.is-hover { color: #73d2ad; }
.chart-change { display: inline-block; margin-top: 8px; padding: 5px 10px; border-radius: 999px; background: var(--c-mint); color: var(--c-muted); font-size: 12px; font-weight: 800; }
.chart-change:empty { display: none; }
.chart-change.up { background: rgba(18,138,94,.14); color: var(--c-up); }
.chart-change.down { background: rgba(216,85,58,.13); color: var(--c-down); }
.chart-range { display: flex; gap: 6px; margin: 22px 0 6px; }
.chart-range button { min-height: 40px; padding: 0 14px; border: 1px solid var(--c-line); border-radius: 999px; background: transparent; color: var(--c-ink-soft); font-size: 12.5px; font-weight: 800; cursor: pointer; transition: .18s ease; }
.chart-range button:hover { border-color: var(--c-emerald); }
.chart-range button.is-active { background: var(--c-emerald); border-color: var(--c-emerald); color: #fff; }
.chart-body { position: relative; }
.chart-svg { display: block; width: 100%; height: 280px; touch-action: pan-y; }
.chart-grid { stroke: var(--c-line); stroke-dasharray: 3 5; }
.chart-line { fill: none; stroke: var(--c-emerald); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.down { stroke: var(--c-down); }
.chart-stop-a { stop-color: var(--c-emerald); stop-opacity: .28; }
.chart-stop-b { stop-color: var(--c-emerald); stop-opacity: 0; }
.chart-stop-a.down { stop-color: var(--c-down); }
.chart-stop-b.down { stop-color: var(--c-down); }
.chart-dot { fill: var(--c-surface-solid); stroke: var(--c-muted); stroke-width: 1.5; }
.chart-dot.max { stroke: var(--c-up); }
.chart-dot.min { stroke: var(--c-down); }
.chart-last { fill: var(--c-emerald); stroke: var(--c-surface-solid); stroke-width: 2.5; }
.chart-last.down { fill: var(--c-down); }
.chart-label { fill: var(--c-muted); font-size: 11px; font-weight: 800; }
.chart-label.max { fill: var(--c-up); }
.chart-label.min { fill: var(--c-down); }
.chart-axis { fill: var(--c-muted); font-size: 11px; }
.chart-cursor { stroke: var(--c-ink); stroke-opacity: .35; stroke-dasharray: 2 4; }
.chart-cursor-dot { fill: var(--c-gold); stroke: var(--c-deep); stroke-width: 2; }
.chart-empty-text { fill: var(--c-muted); font-size: 13px; }
.chart-tooltip { position: absolute; top: 4px; padding: 6px 10px; border-radius: 9px; background: var(--c-deep); color: #fff; font-size: 12px; font-weight: 800; white-space: nowrap; pointer-events: none; box-shadow: 0 8px 20px rgba(0,0,0,.2); }
.chart-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.chart-stats div { padding: 12px 14px; border: 1px solid var(--c-line); border-radius: 14px; background: var(--c-surface-solid); }
.chart-stats span { display: block; color: var(--c-muted); font-size: 11px; font-weight: 800; }
.chart-stats strong { display: block; margin-top: 3px; font-size: 16px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.chart-note { margin: 12px 0 0; color: var(--c-muted); font-size: 11.5px; }

/* ---- ตารางอัตรายอดนิยม ---- */
.rates-section { padding: 70px 0; border-top: 1px solid var(--c-line); }
.rates-section .cx-section-heading p { max-width: 560px; margin: 10px 0 0; color: var(--c-muted); font-size: 14px; line-height: 1.7; }
.rates-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.rate-card { display: grid; gap: 4px; padding: 18px 18px 16px; border: 1px solid var(--c-line); border-radius: 20px; background: var(--c-surface); color: var(--c-ink); text-align: left; cursor: pointer; box-shadow: var(--c-shadow-soft); transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.rate-card:hover, .rate-card:focus-visible { transform: translateY(-3px); border-color: rgba(10,107,79,.35); outline: none; }
.rate-card:focus-visible { box-shadow: 0 0 0 3px rgba(242,189,98,.7); }
.rate-card.is-active { border-color: var(--c-emerald); background: var(--c-mint); }
.rate-card-top { display: flex; align-items: center; justify-content: space-between; }
.rate-code { display: flex; align-items: baseline; gap: 8px; }
.rate-code b { font-size: 17px; letter-spacing: -.02em; }
.rate-code small { color: var(--c-muted); font-size: 12px; font-weight: 700; }
.fav-star { width: 40px; height: 40px; margin: -10px -12px -10px 0; border: 0; border-radius: 50%; background: transparent; color: var(--c-muted); font-size: 17px; line-height: 1; cursor: pointer; transition: .18s; }
.fav-star:hover { background: rgba(242,189,98,.2); color: var(--c-gold); transform: scale(1.1); }
.fav-star.is-on { color: var(--c-gold); }
.rate-name { color: var(--c-muted); font-size: 12.5px; }
.rate-card-body { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 10px; }
.rate-value { display: block; font-size: 13px; color: var(--c-muted); }
.rate-value strong { margin-right: 3px; color: var(--c-emerald); font-size: 23px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
[data-theme="night"] .rate-value strong { color: #73d2ad; }
.rate-sub { display: block; margin-top: 2px; color: var(--c-muted); opacity: .85; font-size: 11px; }
.rate-trend { display: grid; justify-items: end; gap: 2px; }
.rate-delta { min-height: 14px; font-size: 11.5px; font-weight: 900; color: var(--c-muted); }
.rate-delta.up { color: var(--c-up); }
.rate-delta.down { color: var(--c-down); }
.sparkline .sparkline-line { fill: none; stroke: var(--c-up); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sparkline .sparkline-area { fill: var(--c-up); opacity: .12; }
.sparkline .sparkline-dot { fill: var(--c-up); }
.sparkline.down .sparkline-line, .sparkline.down .sparkline-dot { stroke: var(--c-down); fill: var(--c-down); }
.sparkline.down .sparkline-line { fill: none; }
.sparkline.down .sparkline-area { fill: var(--c-down); }

/* ---- ได้จริงเท่าไร ---- */
.real-section { padding: 0 0 70px; }
.real-card { display: grid; grid-template-columns: .95fr 1.05fr; gap: 50px; padding: 50px 56px; border-radius: 32px; background: var(--c-deep); color: #fff; box-shadow: 0 28px 80px rgba(7,31,26,.22); position: relative; overflow: hidden; isolation: isolate; }
.real-card::before { content: ""; position: absolute; z-index: -1; width: 460px; height: 460px; right: -200px; bottom: -330px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; box-shadow: 0 0 0 55px rgba(255,255,255,.022), 0 0 0 110px rgba(255,255,255,.018); }
.real-intro .eyebrow { color: #79c6a8; }
.real-intro h2 { margin: 12px 0 14px; font-size: clamp(36px, 4.4vw, 54px); line-height: 1.05; letter-spacing: -.045em; }
.real-intro p { max-width: 460px; margin: 0; color: #a9c1b7; font-size: 14px; line-height: 1.8; }
.channel-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.channel-presets .chip { border-color: rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #e6f6ef; }
.channel-presets .chip.is-active { background: var(--c-gold); border-color: var(--c-gold); color: var(--c-deep); }
.channel-note { min-height: 20px; margin: 14px 0 0; color: #8da99e; font-size: 12px; line-height: 1.6; }
.real-form { align-self: center; }
.real-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.real-inputs label { display: grid; gap: 7px; color: #a9c1b7; font-size: 12px; font-weight: 800; }
.input-wrap { display: flex; align-items: center; height: 50px; padding: 0 14px; border: 1px solid rgba(255,255,255,.16); border-radius: 14px; background: rgba(255,255,255,.06); }
.input-wrap:focus-within { border-color: var(--c-gold); }
.input-wrap input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: #fff; font: inherit; font-size: 18px; font-weight: 900; outline: none; }
.input-wrap b { color: #8da99e; font-size: 12px; }
.real-results { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin: 16px 0 0; }
.real-results div { padding: 14px 16px; border: 1px solid rgba(255,255,255,.1); border-radius: 16px; background: rgba(255,255,255,.05); }
.real-results div.highlight { background: rgba(242,189,98,.14); border-color: rgba(242,189,98,.4); }
.real-results dt { color: #8da99e; font-size: 11px; font-weight: 800; }
.real-results dd { margin: 5px 0 0; font-size: 16px; font-weight: 900; letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.real-results .highlight dd { color: var(--c-gold); font-size: 20px; }
.real-summary { margin: 16px 0 0; color: #cfe5da; font-size: 13px; line-height: 1.7; }

/* ---- ตารางแปลง ---- */
.tables-section { padding: 0 0 100px; }
.tables-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 30px; }
.table-card { overflow: hidden; border: 1px solid var(--c-line); border-radius: 24px; background: var(--c-surface); box-shadow: var(--c-shadow); backdrop-filter: blur(16px); }
.table-card h3 { margin: 0; padding: 20px 24px; border-bottom: 1px solid var(--c-line); font-size: 16px; }
.table-card table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table-card td { padding: 12px 24px; border-bottom: 1px solid var(--c-line); font-variant-numeric: tabular-nums; }
.table-card td:last-child { text-align: right; font-weight: 800; color: var(--c-emerald); }
[data-theme="night"] .table-card td:last-child { color: #73d2ad; }
.table-card tr:last-child td { border-bottom: 0; }
.table-card tr:nth-child(even) td { background: rgba(220,238,228,.28); }
[data-theme="night"] .table-card tr:nth-child(even) td { background: rgba(255,255,255,.03); }

/* ---- จุดเด่น 3 ใบ ---- */
.cur-facts { display: grid; grid-template-columns: 1.35fr .82fr .82fr; gap: 16px; padding-bottom: 108px; }
.cur-fact { min-height: 240px; padding: 30px; border: 1px solid var(--c-line); border-radius: 24px; background: var(--c-surface); box-shadow: var(--c-shadow-soft); }
.cur-fact-main { display: flex; gap: 32px; align-items: end; border: 0; background: var(--c-emerald); color: #fff; }
.cur-giant { color: var(--c-gold); font-size: 92px; font-weight: 950; line-height: .8; letter-spacing: -.05em; }
.cur-fact h2 { margin: 38px 0 10px; font-size: 20px; }
.cur-fact-main h2 { margin: 8px 0 9px; }
.cur-fact p { margin: 0; color: var(--c-muted); font-size: 12.5px; line-height: 1.7; }
.cur-fact-main p { color: rgba(230,246,239,.75); }
.cur-fact-icon { width: 51px; height: 51px; display: grid; place-items: center; border-radius: 15px; background: var(--c-mint); color: var(--c-emerald); font-weight: 900; }
[data-theme="night"] .cur-fact-icon { color: #73d2ad; }

/* ---- เกร็ดความรู้ ---- */
.faq-list { display: grid; gap: 14px; }
.faq-list details { border: 1px solid var(--c-line); border-radius: 18px; background: var(--c-surface); }
.faq-list summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; font-weight: 800; cursor: pointer; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; color: var(--c-orange); font-size: 22px; font-weight: 800; line-height: 1; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list details p { margin: 0; padding: 0 22px 20px; color: var(--c-muted); font-size: 14.5px; line-height: 1.75; }
.faq-list kbd, .faq-list code { padding: 2px 7px; border: 1px solid var(--c-line); border-radius: 6px; background: var(--c-surface-solid); color: var(--c-ink); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.about-copy .cur-note { margin-top: 27px; padding: 19px 21px; border-left: 3px solid var(--c-orange); border-radius: 0 14px 14px 0; background: rgba(239,121,69,.07); color: var(--c-muted); font-size: 12px; line-height: 1.7; }

.tool-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.tool-links a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--c-line); border-radius: 999px; background: var(--c-surface); color: var(--c-emerald); font-size: 13.5px; font-weight: 800; text-decoration: none; transition: .2s ease; }
.tool-links a:hover { background: var(--c-emerald); border-color: var(--c-emerald); color: #fff; }
[data-theme="night"] .tool-links a { color: #73d2ad; }
[data-theme="night"] .tool-links a:hover { color: #fff; }

@media (max-width: 1000px) {
  .cx-hero { grid-template-columns: 1fr; gap: 34px; padding-top: 32px; }
  .cx-hero h1 { font-size: clamp(50px, 11vw, 84px); }
  .cx-topbar-inner { grid-template-columns: auto 1fr; }
  .cx-nav { display: none; }
  .cx-about { grid-template-columns: 1fr; gap: 35px; padding: 76px 0; }
  .tables-grid { grid-template-columns: 1fr; }
  .cur-facts { grid-template-columns: repeat(2, 1fr); }
  .cur-fact-main { grid-column: 1 / -1; }
  .real-card { grid-template-columns: 1fr; gap: 30px; padding: 40px 34px; }
  .chart-stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .cx-shell, .cx-topbar-inner, .cx-footer { width: min(100% - 24px, 1220px); }
  .cx-topbar-inner { height: 76px; }
  .cx-brand { font-size: 16px; }
  .cx-time { font-size: 10px; }
  .cx-hero { gap: 24px; padding: 22px 0 50px; }
  .cx-hero h1 { margin-bottom: 14px; font-size: clamp(46px, 14vw, 66px); }
  .cx-intro { font-size: 14.5px; line-height: 1.7; }
  .cx-section-heading { display: block; }
  .cx-section-heading h2 { font-size: 40px; }
  .cx-footer { grid-template-columns: 1fr; gap: 14px; padding: 32px 0; }
  .hero-badges { display: none; } /* มือถือ: ให้กล่องแปลงขึ้นมาอยู่ในจอแรก */
  .recent-pairs { margin-top: 14px; }
  .converter-card { padding: 22px 18px 24px; border-radius: 26px; }
  .converter-top { flex-direction: column; align-items: flex-start; margin-bottom: 18px; }
  .field { grid-template-columns: minmax(0, 1fr) 46%; }
  .field input, .field .result-value { height: 60px; padding: 0 14px; font-size: 22px; }
  .picker-button { height: 60px; padding: 0 12px; gap: 6px; }
  .picker-button-code { font-size: 14px; }
  .picker-button-name { font-size: 11.5px; }
  /* มือถือ: ตัวเลือกกลายเป็น bottom sheet */
  .picker { position: static; }
  .picker-panel { position: fixed; z-index: 90; inset: auto 0 0 0; width: auto; max-height: 78vh; overflow: visible; border-radius: 22px 22px 0 0; animation: sheet-in .22s ease; }
  .picker-panel > * { position: relative; z-index: 1; }
  .picker-panel .picker-list { border-radius: 0; }
  /* ม่านมืดวาดจากในแผงเอง (z-index -1 ของแผง) — วางไว้ที่ body ไม่ได้ เพราะการ์ดแปลงเป็น stacking context ม่านจะทับแผงด้วย */
  .picker-panel::before { content: ""; position: fixed; inset: 0; z-index: -1; background: rgba(3,18,14,.5); backdrop-filter: blur(3px); }
  .picker-panel::after { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; background: var(--c-surface-solid); }
  @keyframes sheet-in { from { opacity: 0; } to { opacity: 1; } }
  .picker-list { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .rate-lines { font-size: 14px; }
  .chart-card { padding: 22px 16px 18px; border-radius: 22px; }
  .chart-head { flex-direction: column; gap: 10px; }
  .chart-current { text-align: left; }
  .chart-svg { height: 220px; }
  .chart-range { flex-wrap: wrap; }
  .chart-range button { flex: 1; min-width: 70px; }
  .rates-section { padding: 56px 0; }
  .rates-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .rate-card { padding: 13px 12px; border-radius: 16px; }
  .rate-code b { font-size: 15px; }
  .rate-value strong { font-size: 18px; }
  .rate-name { overflow: hidden; font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; }
  .rate-sub { font-size: 10px; }
  .rate-card-body { flex-direction: column; align-items: flex-start; gap: 6px; }
  .rate-trend { justify-items: start; grid-auto-flow: column; align-items: center; gap: 8px; }
  .real-card { padding: 32px 22px; border-radius: 24px; }
  .real-inputs, .real-results { grid-template-columns: 1fr; }
  .real-results { grid-template-columns: 1fr 1fr; }
  .real-results div.highlight { grid-column: 1 / -1; }
  .tables-section { padding-bottom: 70px; }
  .table-card td { padding: 11px 16px; font-size: 13.5px; }
  .table-card h3 { padding: 16px; font-size: 15px; }
  .cur-facts { grid-template-columns: 1fr; padding-bottom: 78px; }
  .cur-fact { min-height: 0; }
  .cur-fact-main { grid-column: auto; gap: 20px; }
  .cur-giant { font-size: 70px; }
}
