/* =========================================================
   RunCoach — ธีมลู่วิ่ง: ยางมะตอยเข้ม · เส้นลู่ขาว · น้ำเงินโคบอลต์ · ส้มชิปจับเวลา
   ========================================================= */
:root {
  --asphalt: #1B2230;
  --asphalt-2: #262F42;
  --asphalt-3: #36415A;
  --paper: #F3F4F7;
  --card: #FFFFFF;
  --ink: #161A22;
  --ink-2: #394150;
  --muted: #5E6878;
  --line: #DFE3EA;
  --line-2: #EBEEF3;
  --lane: #2446F0;
  --lane-ink: #1733C2;
  --lane-soft: #E8ECFE;
  --chip: #FF5A1F;
  --chip-soft: #FFEDE5;
  --go: #0E9F68;
  --go-soft: #E3F6EE;
  --warn: #C98500;
  --warn-soft: #FFF4DC;
  --stop: #D23B3B;
  --stop-soft: #FDE8E8;
  --info: #2A7DE1;
  --info-soft: #E6F0FC;

  --t-easy: #16A37A;
  --t-long: #2446F0;
  --t-tempo: #E08A00;
  --t-interval: #F0452B;
  --t-race: #7B3FE4;
  --t-cross: #5F6F86;
  --t-rest: #A3ACBA;

  --f-display: "Prompt", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;
  --f-body: "IBM Plex Sans Thai", "Noto Sans Thai", "Leelawadee UI", Tahoma, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --topbar-h: 60px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: var(--lane-ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: var(--f-display); line-height: 1.25; margin: 0 0 .5em; color: var(--ink); font-weight: 600; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.num { font-family: var(--f-display); font-variant-numeric: tabular-nums; }
.skip { position: absolute; left: -999px; top: 0; background: var(--lane); color: #fff; padding: 8px 12px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--chip); outline-offset: 2px; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Icons ---------- */
.ico { width: 20px; height: 20px; flex: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 8px 18px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  font: 600 .95rem/1.2 var(--f-display);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--lane); color: #fff; }
.btn-primary:hover { background: var(--lane-ink); }
.btn-accent { background: var(--chip); color: #fff; }
.btn-accent:hover { background: #E4480F; }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-2); }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.btn-ghost-light:hover { border-color: #fff; }
.btn-danger { background: var(--card); color: var(--stop); border-color: #F2C4C4; }
.btn-danger:hover { background: var(--stop-soft); }
.btn-go { background: var(--go); color: #fff; }
.btn-sm { min-height: 34px; padding: 4px 12px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-install { background: var(--chip); color: #fff; min-height: 36px; padding: 4px 14px; font-size: .88rem; }
.btn-install .ico { width: 18px; height: 18px; }
.icon-btn { background: none; border: 0; color: inherit; padding: 8px; cursor: pointer; display: inline-flex; border-radius: var(--r-sm); }
.link-btn { background: none; border: 0; padding: 0; color: var(--lane-ink); cursor: pointer; font: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--asphalt); color: #fff;
  padding-top: var(--safe-t);
  border-bottom: 3px solid var(--chip);
}
.topbar-in { height: var(--topbar-h); max-width: 1320px; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; margin-right: auto; min-width: 0; }
.brand-name { font: italic 800 1.25rem/1.6 var(--f-display); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 2px .18em 2px 0; margin: -6px 0; }
.brand-mark { display: inline-flex; flex-direction: column; gap: 3px; transform: skewX(-18deg); }
.brand-mark i { display: block; height: 3px; border-radius: 2px; background: #fff; }
.brand-mark i:nth-child(1) { width: 22px; }
.brand-mark i:nth-child(2) { width: 16px; background: var(--chip); }
.brand-mark i:nth-child(3) { width: 10px; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav > a { color: rgba(255,255,255,.78); text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm); font-weight: 500; position: relative; }
.topnav > a:hover { color: #fff; background: rgba(255,255,255,.07); }
.topnav > a.is-active { color: #fff; box-shadow: inset 0 -3px 0 var(--chip); border-radius: 0; }
.usermenu { position: relative; margin-left: 6px; }
.avatar-btn { background: none; border: 0; padding: 0; cursor: pointer; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--lane); color: #fff; font: 700 1rem var(--f-display);
  border: 2px solid rgba(255,255,255,.3);
}
.avatar-lg { width: 52px; height: 52px; font-size: 1.3rem; border-color: var(--line); }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 220px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(22,26,34,.18); padding: 6px; z-index: 50;
}
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line-2); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-head small { color: var(--muted); }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; color: var(--ink); text-decoration: none; font: inherit; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--paper); }
.menu form { margin: 0; }
.dot-badge { position: absolute; top: 6px; right: 4px; width: 9px; height: 9px; background: var(--chip); border-radius: 50%; border: 2px solid var(--asphalt); }
.count-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--chip); color: #fff; font: 700 .75rem/22px var(--f-display); text-align: center; }

/* ---------- Staff shell ---------- */
.shell { display: flex; max-width: 1320px; margin: 0 auto; min-height: calc(100vh - var(--topbar-h)); }
.side {
  width: 236px; flex: none; padding: 18px 12px;
  border-right: 1px solid var(--line); background: var(--card);
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto;
  display: flex; flex-direction: column;
}
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-weight: 500; }
.side a:hover { background: var(--paper); color: var(--ink); }
.side a.is-active { background: var(--asphalt); color: #fff; }
.side a.is-active .ico { color: var(--chip); }
.side-foot { margin-top: auto; color: var(--muted); font-size: .8rem; padding: 0 12px; }
.side-scrim { display: none; }
.shell .main { flex: 1; min-width: 0; }

/* ---------- Main ---------- */
.main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 48px; }
.area-runner .main { max-width: 980px; }
.area-public .main { max-width: none; padding: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-head .sub { margin: 4px 0 0; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; }
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.stack > * + * { margin-top: 16px; }

/* ตัวเลขสถิติ: สไตล์บอร์ดจับเวลา */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; position: relative; overflow: hidden; }
.stat-label { color: var(--muted); font-size: .88rem; }
.stat-value { font: italic 800 2rem/1.1 var(--f-display); font-variant-numeric: tabular-nums; margin-top: 4px; color: var(--ink); }
.stat-value small { font: 500 .9rem var(--f-body); font-style: normal; color: var(--muted); margin-left: 4px; }
.stat-foot { font-size: .82rem; margin-top: 4px; color: var(--muted); }
.stat::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line); }
.stat.s-lane::after { background: var(--lane); }
.stat.s-chip::after { background: var(--chip); }
.stat.s-go::after { background: var(--go); }
.stat.s-warn::after { background: var(--warn); }
.up { color: var(--go); font-weight: 600; }
.down { color: var(--stop); font-weight: 600; }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--ink-2); }
.badge-go { background: var(--go-soft); color: #08744B; }
.badge-warn { background: var(--warn-soft); color: #8A5B00; }
.badge-stop { background: var(--stop-soft); color: #A42727; }
.badge-info { background: var(--info-soft); color: #1B5DAE; }
.badge-lane { background: var(--lane-soft); color: var(--lane-ink); }
.badge-chip { background: var(--chip-soft); color: #B63A08; }
.badge-muted { background: var(--line-2); color: var(--muted); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: .94rem; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: .84rem; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #FAFBFC; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #FAFBFD; }
.tbl .r { text-align: right; }
.tbl .actions { white-space: nowrap; text-align: right; }
.tbl .actions form { display: inline; }
.who { display: flex; align-items: center; gap: 10px; }
.who .avatar { width: 34px; height: 34px; font-size: .9rem; border-color: var(--line); }
.who small { display: block; color: var(--muted); line-height: 1.3; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.field .hint { font-size: .82rem; color: var(--muted); }
.req::after { content: " *"; color: var(--stop); }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff;
  font: 16px/1.4 var(--f-body); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--lane); box-shadow: 0 0 0 3px var(--lane-soft); }
.input.num { font-family: var(--f-display); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--lane); }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; padding-top: 4px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.filters .input, .filters .select { min-height: 40px; width: auto; min-width: 160px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; background: var(--card); flex-wrap: wrap; }
.seg a { padding: 8px 14px; text-decoration: none; color: var(--ink-2); font-size: .9rem; border-right: 1px solid var(--line); }
.seg a:last-child { border-right: 0; }
.seg a.is-active { background: var(--asphalt); color: #fff; }
.scale { display: flex; gap: 4px; flex-wrap: wrap; }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale label { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--r-sm); cursor: pointer; font: 600 .95rem var(--f-display); background: #fff; }
.scale input:checked + label { background: var(--lane); border-color: var(--lane); color: #fff; }
.scale input:focus-visible + label { outline: 3px solid var(--chip); outline-offset: 1px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; top: calc(var(--topbar-h) + var(--safe-t) + 12px); right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--asphalt); color: #fff; box-shadow: 0 10px 28px rgba(22,26,34,.25); border-left: 5px solid var(--info); animation: toastIn .25s ease-out; }
.toast-success { border-left-color: var(--go); }
.toast-error { border-left-color: var(--stop); }
.toast-warn { border-left-color: var(--warn); }
.toast-x { margin-left: auto; background: none; border: 0; color: rgba(255,255,255,.7); font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0 2px; }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Alerts ---------- */
.alert { padding: 12px 16px; border-radius: var(--r-md); border: 1px solid; margin-bottom: 16px; }
.alert-info { background: var(--info-soft); border-color: #C5DAF6; color: #174C8E; }
.alert-warn { background: var(--warn-soft); border-color: #F1D89C; color: #7A5000; }
.alert-error { background: var(--stop-soft); border-color: #F2C4C4; color: #8E1F1F; }
.alert-go { background: var(--go-soft); border-color: #B7E6D2; color: #07623F; }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 36px 20px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto 16px; }
.empty-lanes { width: 120px; height: 46px; margin: 0 auto 14px; border-radius: 6px; background: repeating-linear-gradient(180deg, var(--line) 0 2px, transparent 2px 15px), var(--paper); transform: skewX(-18deg); }

/* ---------- Pager ---------- */
.pager { display: flex; gap: 4px; justify-content: center; padding: 16px; flex-wrap: wrap; }
.pager a, .pager-gap { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2); border: 1px solid var(--line); background: #fff; }
.pager a.is-current { background: var(--asphalt); color: #fff; border-color: var(--asphalt); }
.pager-gap { border: 0; background: none; }

/* =========================================================
   ลายเซ็นของธีม: ลู่วิ่ง
   ========================================================= */
.lanes {
  background:
    repeating-linear-gradient(180deg, transparent 0 58px, rgba(255,255,255,.13) 58px 60px),
    var(--asphalt);
  color: #fff;
}
.hero {
  position: relative; overflow: hidden;
  padding: 72px 20px 84px;
}
.hero-in { max-width: 1120px; margin: 0 auto; position: relative; z-index: 1; }
.hero h1 {
  color: #fff;
  font: italic 800 clamp(2.4rem, 7vw, 5rem)/1.02 var(--f-display);
  letter-spacing: -.01em;
  margin: 0 0 20px;
  max-width: 13ch;
}
.hero p.lead { font-size: 1.15rem; color: rgba(255,255,255,.82); max-width: 46ch; margin-bottom: 28px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-cta .btn { min-height: 50px; padding: 10px 26px; font-size: 1.05rem; }
.hero-finish {
  position: absolute; right: -40px; top: 0; bottom: 0; width: 180px;
  background: repeating-conic-gradient(#fff 0 25%, var(--asphalt) 0 50%) 0 0 / 30px 30px;
  opacity: .08; transform: skewX(-12deg);
}
.hero-lane-no { position: absolute; left: 20px; bottom: 16px; display: flex; gap: 0; font: italic 800 1.1rem var(--f-display); color: rgba(255,255,255,.35); }
.lane-strip { display: flex; flex-direction: column; gap: 0; }

.section { padding: 64px 20px; }
.section-in { max-width: 1120px; margin: 0 auto; }
.section h2 { font: italic 800 clamp(1.7rem, 4vw, 2.5rem)/1.1 var(--f-display); margin-bottom: 10px; }
.section .intro { color: var(--muted); max-width: 60ch; margin-bottom: 32px; }

.track-tabs { display: flex; gap: 0; margin-bottom: 24px; border-bottom: 2px solid var(--line); }
.track-tabs a { padding: 12px 20px; text-decoration: none; color: var(--muted); font: 600 1.05rem var(--f-display); margin-bottom: -2px; border-bottom: 3px solid transparent; }
.track-tabs a.is-active { color: var(--ink); border-bottom-color: var(--chip); }

/* บัตรแพ็กเกจแบบ "ป้ายเบอร์วิ่ง" */
.bibs { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.bib {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  display: flex; flex-direction: column; position: relative; overflow: hidden;
}
.bib::before, .bib::after {
  content: ""; position: absolute; top: 14px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--line);
}
.bib::before { left: 14px; }
.bib::after { right: 14px; }
.bib-top { padding: 30px 24px 18px; border-bottom: 2px dashed var(--line); }
.bib-cat { font-size: .85rem; color: var(--muted); font-weight: 500; }
.bib-name { font: italic 800 1.55rem/1.15 var(--f-display); margin: 4px 0 6px; }
.bib-tag { color: var(--ink-2); margin: 0; font-size: .95rem; }
.bib-price { padding: 18px 24px 4px; display: flex; align-items: baseline; gap: 8px; }
.bib-price .num { font: italic 800 2.4rem/1 var(--f-display); color: var(--ink); }
.bib-price small { color: var(--muted); }
.bib ul { list-style: none; padding: 12px 24px 8px; margin: 0; flex: 1; }
.bib li { padding: 6px 0 6px 26px; position: relative; font-size: .95rem; }
.bib li::before { content: ""; position: absolute; left: 2px; top: 13px; width: 14px; height: 3px; background: var(--lane); transform: skewX(-18deg); border-radius: 2px; }
.bib-foot { padding: 16px 24px 22px; }
.bib-ribbon { position: absolute; right: 36px; top: 10px; background: var(--chip); color: #fff; font: 600 .78rem var(--f-display); padding: 3px 10px; border-radius: 999px; }
.bib.c-excellence .bib-top { background: var(--asphalt); color: #fff; }
.bib.c-excellence .bib-name { color: #fff; }
.bib.c-excellence .bib-cat, .bib.c-excellence .bib-tag { color: rgba(255,255,255,.75); }
.bib.c-excellence li::before { background: var(--chip); }
.bib.c-excellence::before, .bib.c-excellence::after { background: var(--asphalt-3); border-color: var(--asphalt-3); }

.how { display: grid; gap: 0; grid-template-columns: repeat(4, 1fr); counter-reset: step; border-top: 2px solid var(--ink); }
.how li { list-style: none; padding: 18px 18px 18px 0; counter-increment: step; }
.how li::before { content: "ช่วงที่ " counter(step); display: block; font: italic 800 .95rem var(--f-display); color: var(--chip); margin-bottom: 8px; }
.how h3 { margin-bottom: 4px; }
.how p { color: var(--muted); margin: 0; font-size: .95rem; }
.how { padding: 0; margin: 0; }

.foot { background: var(--asphalt); color: rgba(255,255,255,.7); padding: 28px 20px calc(28px + var(--safe-b)); font-size: .9rem; }
.foot-in { max-width: 1120px; margin: 0 auto; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.foot a { color: #fff; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: calc(100vh - var(--topbar-h)); display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { padding: 56px 48px; display: flex; flex-direction: column; justify-content: flex-end; }
.auth-side h2 { color: #fff; font: italic 800 clamp(2rem, 4vw, 3.2rem)/1.05 var(--f-display); max-width: 12ch; }
.auth-side p { color: rgba(255,255,255,.75); max-width: 40ch; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font: italic 800 2rem var(--f-display); }

/* ---------- Runner dashboard ---------- */
.today {
  border-radius: var(--r-lg); padding: 22px 24px; position: relative; overflow: hidden;
}
.today .today-date { color: rgba(255,255,255,.7); font-size: .92rem; }
.today h2 { color: #fff; font: italic 800 clamp(1.6rem, 5vw, 2.3rem)/1.1 var(--f-display); margin: 6px 0 10px; }
.today .metrics { display: flex; gap: 22px; flex-wrap: wrap; margin: 10px 0 18px; }
.today .metrics div { display: flex; flex-direction: column; }
.today .metrics b { font: italic 800 1.6rem/1 var(--f-display); color: #fff; }
.today .metrics span { font-size: .82rem; color: rgba(255,255,255,.65); margin-top: 4px; }
.today .notes { color: rgba(255,255,255,.85); background: rgba(255,255,255,.07); padding: 10px 12px; border-radius: var(--r-sm); margin-bottom: 16px; }

/* แถบความคืบหน้าแบบลู่ 400 ม. (เส้นตรง) */
.trackbar { position: relative; height: 34px; border-radius: 6px; background: var(--asphalt); overflow: hidden; }
.trackbar::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(255,255,255,.18) calc(10% - 2px) 10%); }
.trackbar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--lane), #4A68FF); }
.trackbar-runner { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--chip); border: 3px solid #fff; }
.trackbar-label { display: flex; justify-content: space-between; font-size: .82rem; color: var(--muted); margin-top: 6px; }

/* ---------- Plan / sessions ---------- */
.week { margin-bottom: 14px; }
.week summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-md); }
.week summary::-webkit-details-marker { display: none; }
.week[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.week-no { font: italic 800 1.35rem/1 var(--f-display); min-width: 74px; }
.week-meta { color: var(--muted); font-size: .9rem; }
.week-prog { margin-left: auto; display: flex; gap: 3px; }
.week-prog i { width: 10px; height: 18px; border-radius: 2px; background: var(--line); transform: skewX(-14deg); }
.week-prog i.done { background: var(--go); }
.week-prog i.missed { background: var(--stop); }
.week-prog i.today { background: var(--chip); }
.week-body { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r-md) var(--r-md); background: var(--card); }
.sess { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line-2); position: relative; }
.sess:first-child { border-top: 0; }
.sess::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 3px 3px 0; background: var(--t-easy); }
.sess.t-long::before { background: var(--t-long); }
.sess.t-tempo::before { background: var(--t-tempo); }
.sess.t-interval::before { background: var(--t-interval); }
.sess.t-race::before { background: var(--t-race); }
.sess.t-cross::before { background: var(--t-cross); }
.sess.t-rest::before { background: var(--t-rest); }
.sess-day { text-align: center; line-height: 1.2; }
.sess-day b { display: block; font: italic 800 1.4rem var(--f-display); }
.sess-day small { color: var(--muted); }
.sess-title { font-weight: 600; }
.sess-detail { color: var(--muted); font-size: .9rem; display: flex; gap: 14px; flex-wrap: wrap; }
.sess-notes { font-size: .9rem; color: var(--ink-2); margin-top: 4px; white-space: pre-line; }
.sess.is-today { background: #FFF8F4; }
.sess.st-rest .sess-title { color: var(--muted); }
.tchip { display: inline-block; font-size: .78rem; font-weight: 600; padding: 1px 8px; border-radius: 4px; color: #fff; background: var(--t-easy); margin-right: 6px; vertical-align: 1px; }
.tchip.t-long { background: var(--t-long); }
.tchip.t-tempo { background: var(--t-tempo); }
.tchip.t-interval { background: var(--t-interval); }
.tchip.t-race { background: var(--t-race); }
.tchip.t-cross { background: var(--t-cross); }
.tchip.t-rest { background: var(--t-rest); }

/* ---------- Course designer ---------- */
.designer { display: grid; gap: 12px; }
.dz-week { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); overflow: hidden; }
.dz-week-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #FAFBFC; border-bottom: 1px solid var(--line); gap: 8px; flex-wrap: wrap; }
.dz-week-head b { font: italic 800 1.1rem var(--f-display); }
.dz-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dz-day { border-right: 1px solid var(--line-2); min-height: 110px; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.dz-day:last-child { border-right: 0; }
.dz-day-h { font-size: .78rem; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.dz-add { background: none; border: 1px dashed var(--line); color: var(--muted); border-radius: var(--r-sm); font-size: .8rem; cursor: pointer; padding: 4px; margin-top: auto; }
.dz-add:hover { border-color: var(--lane); color: var(--lane); }
.dz-item { display: block; width: 100%; text-align: left; background: var(--paper); border: 0; border-left: 3px solid var(--t-easy); border-radius: 4px; padding: 6px 7px; font: inherit; font-size: .8rem; line-height: 1.3; cursor: pointer; color: var(--ink); }
.dz-item:hover { background: var(--lane-soft); }
.dz-item b { display: block; font-size: .8rem; }
.dz-item.t-long { border-left-color: var(--t-long); }
.dz-item.t-tempo { border-left-color: var(--t-tempo); }
.dz-item.t-interval { border-left-color: var(--t-interval); }
.dz-item.t-race { border-left-color: var(--t-race); }
.dz-item.t-cross { border-left-color: var(--t-cross); }
.dz-item.t-rest { border-left-color: var(--t-rest); color: var(--muted); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 70; background: rgba(22,26,34,.55); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.modal-card { background: var(--card); border-radius: var(--r-lg); padding: 22px; width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow-y: auto; margin-bottom: var(--safe-b); animation: sheetIn .22s ease-out; }
.modal-card h2 { margin-bottom: 14px; }
@keyframes sheetIn { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.steps { padding-left: 20px; margin: 0 0 18px; }
.steps li { padding: 4px 0; }
.kbd { display: inline-block; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; font-size: .85rem; }

/* ---------- Charts ---------- */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line-2); stroke-width: 1; fill: none; }
.chart .axis { fill: var(--muted); font: 12px var(--f-body); }
.chart .axis-lg { font-size: 13px; fill: var(--ink-2); font-weight: 600; }
.chart .bar { fill: #B8C4FA; }
.chart .bar-hi { fill: var(--lane); }
.chart .line { fill: none; stroke: var(--chip); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: #fff; stroke: var(--chip); stroke-width: 2.5; }
.chart-radar { max-width: 340px; margin: 0 auto; overflow: visible; }
.chart-radar .area { fill: rgba(36,70,240,.22); stroke: var(--lane); stroke-width: 2.5; }
.chart-radar .area-prev { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.ring { width: 110px; height: 110px; }
.ring-bg { fill: none; stroke: var(--line-2); stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--go); stroke-width: 10; stroke-linecap: round; }
.ring-txt { font: italic 800 20px var(--f-display); fill: var(--ink); }
.legend { display: flex; gap: 16px; font-size: .85rem; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; background: var(--lane); }
.legend i.prev { background: none; border-top: 2px dashed var(--muted); height: 0; }

.predict { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.predict div { padding: 14px; text-align: center; border-right: 1px solid var(--line-2); }
.predict div:last-child { border-right: 0; }
.predict small { color: var(--muted); display: block; }
.predict b { font: italic 800 1.3rem var(--f-display); }

/* ---------- Chat ---------- */
.chat-layout { display: grid; grid-template-columns: 300px 1fr; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); overflow: hidden; height: calc(100vh - var(--topbar-h) - 120px); min-height: 440px; }
.chat-threads { border-right: 1px solid var(--line); overflow-y: auto; }
.chat-threads a { display: flex; gap: 10px; padding: 12px 14px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line-2); align-items: center; }
.chat-threads a:hover { background: var(--paper); }
.chat-threads a.is-active { background: var(--lane-soft); }
.chat-threads .t-body { flex: 1; min-width: 0; }
.chat-threads .t-name { font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.chat-threads .t-name small { color: var(--muted); font-weight: 400; white-space: nowrap; }
.chat-threads .t-last { color: var(--muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-threads .count-badge { margin-left: 0; }
.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.chat-head .back { display: none; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: var(--paper); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); align-self: flex-start; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.me { align-self: flex-end; background: var(--lane); color: #fff; border-color: var(--lane); border-bottom-right-radius: 4px; }
.msg:not(.me) { border-bottom-left-radius: 4px; }
.msg img { display: block; max-width: 240px; max-height: 280px; border-radius: 8px; margin: 2px 0; cursor: zoom-in; }
.msg-meta { font-size: .72rem; color: var(--muted); align-self: flex-start; margin: -2px 4px 4px; }
.msg-meta.me { align-self: flex-end; }
.msg-day { align-self: center; font-size: .78rem; color: var(--muted); background: var(--line-2); padding: 2px 10px; border-radius: 999px; margin: 8px 0; }
.chat-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); align-items: flex-end; background: var(--card); padding-bottom: calc(10px + var(--safe-b)); }
.chat-form textarea { flex: 1; min-height: 44px; max-height: 140px; resize: none; }
.chat-form .icon-btn { width: 44px; height: 44px; justify-content: center; align-items: center; border: 1px solid var(--line); }
.chat-form .send { background: var(--lane); color: #fff; border-color: var(--lane); }
.chat-preview { padding: 6px 12px; font-size: .85rem; color: var(--muted); display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line-2); }
.chat-empty { margin: auto; text-align: center; color: var(--muted); padding: 20px; }
.area-runner .chat-layout { grid-template-columns: 1fr; }

/* ---------- Detail lists ---------- */
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.slip { max-width: 100%; max-height: 520px; border-radius: var(--r-md); border: 1px solid var(--line); }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px; border: 2px solid var(--asphalt); border-radius: var(--r-md); background: #fff; }
.qr-box svg { width: 240px; height: 240px; }
.qr-head { background: #113566; color: #fff; width: 100%; text-align: center; padding: 8px; border-radius: 6px; font: 700 1rem var(--f-display); }

.feel { display: flex; gap: 6px; flex-wrap: wrap; }
.feel input { position: absolute; opacity: 0; pointer-events: none; }
.feel label { padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; background: #fff; font-size: .92rem; }
.feel input:checked + label { background: var(--asphalt); color: #fff; border-color: var(--asphalt); }
.feel input:focus-visible + label { outline: 3px solid var(--chip); }

.runlist { list-style: none; margin: 0; padding: 0; }
.runlist li { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.runlist li:last-child { border-bottom: 0; }
.run-date { text-align: center; line-height: 1.1; }
.run-date b { display: block; font: italic 800 1.35rem var(--f-display); }
.run-date small { color: var(--muted); }
.run-main { min-width: 0; }
.run-main .run-km { font: italic 800 1.15rem var(--f-display); }
.run-main .run-sub { color: var(--muted); font-size: .88rem; }
.coach-note { background: var(--lane-soft); border-radius: var(--r-sm); padding: 8px 10px; font-size: .88rem; margin-top: 6px; color: var(--lane-ink); }

/* ---------- Error page ---------- */
.error-body { min-height: 100vh; display: grid; place-items: center; background: var(--paper); padding: 24px; }
.error-wrap { text-align: center; max-width: 520px; }
.error-bib { position: relative; display: inline-block; background: #fff; border: 2px solid var(--ink); border-radius: 10px; padding: 26px 40px 18px; margin-bottom: 24px; transform: rotate(-3deg); }
.error-bib-no { font: italic 800 5rem/1 var(--f-display); color: var(--ink); }
.error-bib-holes i { position: absolute; width: 10px; height: 10px; border: 2px solid var(--ink); border-radius: 50%; }
.error-bib-holes i:nth-child(1) { left: 10px; top: 10px; }
.error-bib-holes i:nth-child(2) { right: 10px; top: 10px; }
.error-bib-holes i:nth-child(3) { left: 10px; bottom: 10px; }
.error-bib-holes i:nth-child(4) { right: 10px; bottom: 10px; }
.error-title { font: italic 800 2rem var(--f-display); }
.error-msg { color: var(--ink-2); font-size: 1.05rem; }
.error-ref { color: var(--muted); font-size: .9rem; }
.error-actions { display: flex; gap: 10px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.error-debug { text-align: left; background: var(--asphalt); color: #E6E9F0; padding: 14px; border-radius: 8px; overflow-x: auto; font-size: .78rem; margin-top: 24px; white-space: pre-wrap; }

/* ---------- Tabbar (mobile runner) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: var(--card); border-top: 1px solid var(--line);
  display: flex; padding-bottom: var(--safe-b);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; color: var(--muted); text-decoration: none; font-size: .72rem; position: relative; }
.tabbar a.is-active { color: var(--lane); }
.tabbar a.is-active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; background: var(--chip); border-radius: 0 0 3px 3px; }
.tabbar .ico { width: 24px; height: 24px; }
.tabbar .dot-badge { top: 4px; right: calc(50% - 18px); border-color: var(--card); }

.only-m { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3, .g-main { grid-template-columns: 1fr; }
  .how { grid-template-columns: 1fr 1fr; }
  .dz-days { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dz-day { border-bottom: 1px solid var(--line-2); }
}
@media (max-width: 820px) {
  .only-m { display: flex !important; }
  .only-d { display: none !important; }
  .side {
    position: fixed; left: 0; top: calc(var(--topbar-h) + var(--safe-t) + 3px); bottom: 0; z-index: 44; height: auto;
    transform: translateX(-100%); transition: transform .22s ease; box-shadow: 8px 0 24px rgba(0,0,0,.12);
  }
  body.side-open .side { transform: none; }
  body.side-open .side-scrim { display: block; position: fixed; inset: 0; background: rgba(22,26,34,.4); z-index: 43; }
  .area-runner .main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 24px); }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { padding: 36px 20px; min-height: 200px; }
  .chat-layout { grid-template-columns: 1fr; height: calc(100dvh - var(--topbar-h) - var(--safe-t) - 110px); }
  .area-runner .chat-layout { height: calc(100dvh - var(--topbar-h) - var(--safe-t) - var(--tabbar-h) - var(--safe-b) - 80px); }
  .chat-layout.has-thread .chat-threads { display: none; }
  .chat-layout:not(.has-thread) .chat-pane { display: none; }
  .area-runner .chat-layout .chat-pane { display: flex; }
  .chat-head .back { display: inline-flex; }
  .predict { grid-template-columns: 1fr 1fr; }
  .predict div:nth-child(2) { border-right: 0; }
  .predict div:nth-child(-n+2) { border-bottom: 1px solid var(--line-2); }
}
@media (max-width: 600px) {
  h1 { font-size: 1.35rem; }
  .main { padding: 16px 14px 40px; }
  .card { padding: 16px; }
  .g-2 { grid-template-columns: 1fr; }
  .g-4 { gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 1.55rem; }
  .how { grid-template-columns: 1fr; }
  .hero { padding: 48px 18px 60px; }
  .section { padding: 44px 16px; }
  .dz-days { grid-template-columns: 1fr 1fr; }
  .sess { grid-template-columns: 50px 1fr; }
  .sess > :last-child { grid-column: 1 / -1; justify-self: start; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .btn-install span { display: none; }
  .btn-install { padding: 4px 10px; }
  .modal { align-items: flex-end; padding: 0; }
  .modal-card { border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92vh; padding-bottom: calc(22px + var(--safe-b)); }
  .tbl-cards thead { display: none; }
  .tbl-cards tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .tbl-cards td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; }
  .tbl-cards td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: .85rem; }
  .tbl-cards td.actions { justify-content: flex-end; padding-top: 8px; }
  .toasts { left: 12px; right: 12px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Print (รายงานพัฒนาการ) ---------- */
@media print {
  .topbar, .side, .tabbar, .page-actions, .toasts, .no-print, .btn { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; max-width: none; }
  .card, .stat { break-inside: avoid; border-color: #ccc; }
  .shell { display: block; }
}

/* ---------- เพิ่มเติม: หลังบ้าน ---------- */
.runlist.compact li { grid-template-columns: 1fr auto; }
.inline-form { display: inline; }
.pkg-row-off { opacity: .55; }
.designer-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dz-item small { display: block; color: var(--muted); font-size: .74rem; }
.dz-week-head .page-actions { gap: 6px; }
.eval-scale { display: grid; grid-template-columns: 110px 1fr 36px; align-items: center; gap: 10px; }
.eval-scale input[type=range] { width: 100%; accent-color: var(--lane); }
.eval-scale output { font: italic 800 1.2rem var(--f-display); text-align: right; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.tabs-inline { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
@media (max-width: 640px) { .eval-scale { grid-template-columns: 90px 1fr 30px; } }

/* ---------- การแจ้งเตือน (v1.1) ---------- */
.nt-test { margin-top: 18px; padding: 16px; border: 1px dashed var(--line); border-radius: var(--r-sm); background: var(--paper); }
.nt-test .nt-row { display: flex; gap: 8px; flex-wrap: wrap; }
.nt-test .nt-row .input { flex: 1; min-width: 200px; }
.nt-result { margin-top: 12px; }
.nt-result[hidden] { display: none; }
.nt-result pre { margin: 8px 0 0; max-height: 260px; overflow: auto; background: #111722; color: #D6DEEB; padding: 12px; border-radius: 8px; font-size: .78rem; white-space: pre-wrap; word-break: break-all; }
.nt-status { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; }
.nt-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.nt-dot.on { background: var(--go); box-shadow: 0 0 0 3px var(--go-soft); }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; }
.ev-table td.c, .ev-table th.c { text-align: center; }
.ev-table input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--lane); }
.secret-hint { font-size: .8rem; color: var(--go); }

/* ---------- แชท “คุยกับเรา” หน้าแรก (v1.2) ---------- */
.gc-fab { position: fixed; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 70;
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px 12px 14px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--chip); color: #fff; font: 600 1rem var(--f-body, inherit); text-decoration: none; box-shadow: 0 10px 28px rgba(255, 90, 31, .38), 0 2px 6px rgba(0,0,0,.2);
  transition: transform .15s ease, box-shadow .15s ease; -webkit-tap-highlight-color: transparent; }
.gc-fab svg { width: 22px; height: 22px; }
.gc-fab:hover { transform: translateY(-2px); }
.gc-fab:focus-visible { outline: 3px solid var(--lane); outline-offset: 3px; }
.gc-fab.is-open { background: var(--asphalt, #1B2230); box-shadow: 0 8px 20px rgba(0,0,0,.3); }
.gc-fab[hidden] { display: none; }
.gc-badge { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--lane); color: #fff; font-size: .75rem; line-height: 22px; text-align: center; border: 2px solid #fff; }
.gc-badge[hidden] { display: none; }
.gc-panel { position: fixed; z-index: 71; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  width: 370px; max-width: calc(100vw - 32px); height: min(600px, calc(100vh - 120px)); display: flex; flex-direction: column;
  background: var(--card, #fff); border-radius: 18px; overflow: hidden; box-shadow: 0 24px 60px rgba(16, 24, 40, .28); border: 1px solid var(--line); animation: gcIn .18s ease-out; }
.gc-panel[hidden] { display: none; }
@keyframes gcIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.gc-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px; color: #fff; border-bottom: 4px solid var(--chip);
  background: var(--asphalt, #1B2230) repeating-linear-gradient(90deg, transparent 0 46px, rgba(255,255,255,.07) 46px 48px); }
.gc-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--chip); display: grid; place-items: center; font-weight: 700; flex: none; }
.gc-title { flex: 1; min-width: 0; line-height: 1.3; }
.gc-title strong { display: block; font-style: italic; }
.gc-title small { display: block; opacity: .75; font-size: .78rem; }
.gc-x { background: rgba(255,255,255,.12); border: 0; color: #fff; width: 36px; height: 36px; border-radius: 50%; font-size: 1.4rem; line-height: 1; cursor: pointer; flex: none; }
.gc-body { flex: 1; min-height: 0; overflow-y: auto; background: var(--paper); -webkit-overflow-scrolling: touch; overscroll-behavior: contain; display: flex; flex-direction: column; }
.gc-log { padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.gc-msg { align-self: flex-start; max-width: 85%; background: #fff; border: 1px solid var(--line); padding: 9px 12px; border-radius: 14px 14px 14px 4px; font-size: .95rem; line-height: 1.5; word-wrap: break-word; overflow-wrap: anywhere; }
.gc-msg small { display: block; margin-top: 3px; font-size: .7rem; color: var(--muted); }
.gc-msg.me { align-self: flex-end; background: var(--lane); color: #fff; border-color: var(--lane); border-radius: 14px 14px 4px 14px; }
.gc-msg.me small { color: rgba(255,255,255,.75); text-align: right; }
.gc-welcome { border-left: 3px solid var(--chip); }
.gc-day { align-self: center; font-size: .72rem; color: var(--muted); background: rgba(0,0,0,.05); padding: 2px 10px; border-radius: 10px; }
.gc-start { padding: 4px 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.gc-start[hidden], .gc-form[hidden] { display: none; }
.gc-row label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 4px; }
.gc-row label b { color: var(--chip); }
.gc-row label small { font-weight: 400; color: var(--muted); }
.gc-panel .input, .gc-panel .textarea { font-size: 16px; } /* ป้องกัน iOS ซูมเมื่อแตะช่องพิมพ์ */
.gc-privacy { margin: 0; font-size: .75rem; color: var(--muted); text-align: center; }
.gc-form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); background: var(--card, #fff); align-items: flex-end; }
.gc-form textarea { flex: 1; min-height: 44px; max-height: 120px; resize: none; }
.gc-form .send { width: 44px; height: 44px; border-radius: 50%; background: var(--lane); color: #fff; display: grid; place-items: center; border: 0; flex: none; }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.avatar-guest { background: var(--chip) !important; color: #fff !important; }
.guest-note { display: flex; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line-2); background: var(--warn-soft, #FFF7E6); }
.guest-note .input { flex: 1; min-height: 34px; padding: 6px 10px; font-size: .88rem; }
@media (max-width: 560px) {
  .gc-fab span { display: none; }
  .gc-fab { padding: 14px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
  .gc-panel { inset: 0; width: 100%; max-width: none; height: 100%; height: 100dvh; border-radius: 0; border: 0;
    padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--asphalt, #1B2230); }
  .gc-panel .gc-body { background: var(--paper); }
  .gc-lock body { overflow: hidden; }
  .gc-lock .gc-fab { display: none; }
}
@media (prefers-reduced-motion: reduce) { .gc-panel { animation: none; } .gc-fab { transition: none; } }
@media print { .gc-fab, .gc-panel { display: none !important; } }

/* ---------- สถิติการเข้าชม (v1.3) ---------- */
.range-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.range-form .input { width: auto; min-width: 150px; }
.chart-wrap { width: 100%; overflow-x: auto; }
.chart-traffic { width: 100%; min-width: 520px; height: auto; display: block; }
.chart-traffic .bar { fill: var(--lane); opacity: .82; }
.chart-traffic .hit { fill: transparent; cursor: pointer; }
.chart-traffic .tt.is-on .hit { fill: rgba(36, 70, 240, .07); }
.chart-traffic .tt.is-on .bar { opacity: 1; }
.chart-traffic .line-views { fill: none; stroke: var(--chip); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .axis-r { fill: var(--chip); }
.chart-tip { margin-top: 6px; font-size: .88rem; color: var(--ink-2); min-height: 1.4em; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: .88rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend li b { margin-left: auto; font-variant-numeric: tabular-nums; }
.legend i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend-inline { flex-direction: row; gap: 14px; font-size: .8rem; color: var(--muted); }
.legend .k-bar { background: var(--lane); }
.legend .k-line { background: var(--chip); height: 3px; border-radius: 2px; }
.legend .s0, .donut .s0 { background: var(--lane); stroke: var(--lane); }
.legend .s1, .donut .s1 { background: var(--chip); stroke: var(--chip); }
.legend .s2, .donut .s2 { background: var(--go); stroke: var(--go); }
.legend .s3, .donut .s3 { background: #8B5CF6; stroke: #8B5CF6; }
.legend .s4, .donut .s4 { background: #EAB308; stroke: #EAB308; }
.legend .s5, .donut .s5 { background: #64748B; stroke: #64748B; }
.donut-box { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.donut { width: 130px; height: 130px; flex: none; }
.donut circle { fill: none; stroke-width: 14; }
.donut .donut-bg { stroke: var(--line-2); }
.donut .donut-seg { background: none; }
.donut-txt { font: italic 800 15px var(--f-display); fill: var(--ink); }
.donut-box .legend { flex: 1; min-width: 0; }
.hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hb-top { display: flex; justify-content: space-between; gap: 8px; font-size: .88rem; margin-bottom: 4px; }
.hb-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-top b { white-space: nowrap; font-weight: 600; }
.hb-top small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.hb-track { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.hb-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--lane), #5B78FF); border-radius: 4px; }
.sub-h { margin: 18px 0 10px; font-size: .95rem; color: var(--ink-2); }
.live-dot, .vs-live { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--go); margin-right: 8px; vertical-align: middle; animation: livePulse 1.8s infinite; }
@keyframes livePulse { 0% { box-shadow: 0 0 0 0 rgba(14, 159, 104, .55); } 70% { box-shadow: 0 0 0 9px rgba(14, 159, 104, 0); } 100% { box-shadow: 0 0 0 0 rgba(14, 159, 104, 0); } }
/* ตัวนับหน้าแรก: สไตล์นาฬิกาจับเวลาข้างสนาม */
.visit-strip { background: #11161F; color: #fff; padding: 22px 20px; border-top: 3px solid var(--chip); }
.visit-in { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.vs-item { text-align: center; padding: 8px 4px; border-right: 1px solid rgba(255,255,255,.08); }
.vs-item:last-child { border-right: 0; }
.vs-item b { display: block; font: italic 800 1.7rem/1.1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: .5px; color: #fff; }
.vs-item:first-child b { display: inline-block; color: #6EE7B7; }
.vs-item small { display: block; margin-top: 4px; font-size: .78rem; color: rgba(255,255,255,.6); }
@media (max-width: 760px) {
  .visit-in { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .vs-item { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.08); }
  .vs-item:first-child { grid-column: 1 / -1; }
  .donut-box { flex-direction: column; align-items: stretch; }
  .donut { margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) { .live-dot, .vs-live { animation: none; } }

/* ---------- ความยินยอมคุกกี้ / PDPA (v1.4) ---------- */
.cc-banner { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 80; }
.cc-banner[hidden] { display: none; }
.cc-in { max-width: 980px; margin: 0 auto; background: var(--asphalt); color: #fff; border-radius: 14px; padding: 16px 18px; display: flex; gap: 16px; align-items: center;
  box-shadow: 0 18px 48px rgba(0,0,0,.35); border-left: 5px solid var(--chip); }
.cc-in p { margin: 0; flex: 1; font-size: .9rem; line-height: 1.55; color: rgba(255,255,255,.85); }
.cc-in p a { color: #fff; margin-left: 4px; }
.cc-actions { display: flex; gap: 8px; flex-wrap: wrap; flex: none; }
.cc-banner .btn-ghost { color: #fff; border-color: rgba(255,255,255,.3); background: transparent; }
.cc-open .gc-fab { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
.area-runner .cc-banner { bottom: calc(var(--tabbar-h, 64px) + 12px + env(safe-area-inset-bottom, 0px)); }
.cc-opt { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.cc-opt p { margin: 4px 0 0; font-size: .85rem; color: var(--muted); }
.cc-sw { appearance: none; -webkit-appearance: none; width: 46px; height: 26px; border-radius: 13px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background .15s; margin-top: 2px; }
.cc-sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.cc-sw:checked { background: var(--go); }
.cc-sw:checked::after { transform: translateX(20px); }
.cc-sw:focus-visible { outline: 3px solid var(--lane); outline-offset: 2px; }
.consent-check { align-items: flex-start; font-size: .85rem; line-height: 1.5; color: var(--ink-2); }
.consent-check input { margin-top: 3px; flex: none; }
.gc-consent { display: flex; gap: 8px; align-items: flex-start; font-size: .78rem; line-height: 1.45; color: var(--ink-2); }
.gc-consent input { margin-top: 2px; flex: none; }
.gc-privacy a { color: inherit; }
.policy-links { text-align: center; font-size: .82rem; color: var(--muted); margin: 14px 0 0; }
.policy-links a { color: var(--muted); }
.policy { max-width: 820px; margin: 0 auto; line-height: 1.75; }
.policy h1 { margin: 0 0 4px; }
.policy h2 { font-size: 1.1rem; margin: 26px 0 8px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.policy ul { padding-left: 20px; }
.policy-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 24px; }
.privacy-grid h4 { margin: 0 0 8px; }
@media (max-width: 700px) {
  .cc-in { flex-direction: column; align-items: stretch; }
  .cc-actions { justify-content: stretch; }
  .cc-actions .btn { flex: 1; }
  .cc-open .gc-fab { bottom: calc(210px + env(safe-area-inset-bottom, 0px)); }
}
@media print { .cc-banner { display: none !important; } }

/* ---------- PAR-Q / ระบบ / ใบเสร็จ (v1.5) ---------- */
.parq-list { margin: 16px 0; padding-left: 22px; display: flex; flex-direction: column; gap: 4px; }
.parq-list li { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.parq-list li > span { display: block; margin-bottom: 8px; line-height: 1.55; }
.yn { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.yn input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.yn label { padding: 8px 22px; cursor: pointer; font-weight: 600; color: var(--ink-2); min-width: 84px; text-align: center; user-select: none; }
.yn label + input + label { border-left: 1px solid var(--line); }
.yn input:checked + label { background: var(--go); color: #fff; }
.yn input:checked + label.y { background: var(--chip); }
.yn input:focus-visible + label { outline: 3px solid var(--lane); outline-offset: -3px; }
.parq-yes[hidden] { display: none; }
.parq-yes-list { margin: 0; padding-left: 18px; }
.parq-card .dl { grid-template-columns: 120px 1fr; }
.steps-sm { margin: 0 0 10px; padding-left: 20px; line-height: 1.7; font-size: .92rem; }
.steps-sm li { margin-bottom: 6px; }

/* ================= v2.0: เพิ่มยอดขาย + ประสบการณ์นักวิ่ง ================= */
/* เมนูหลังบ้านแบบกลุ่ม */
.side-group { margin: 14px 12px 4px; font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.side-group:first-child { margin-top: 2px; }
/* แถบประกาศ */
.announce { background: var(--chip); color: #fff; text-align: center; padding: 8px 16px; font-weight: 600; font-size: .92rem; }
.announce a { color: #fff; text-decoration: none; }
.announce a:hover { text-decoration: underline; }
.hero.has-img { background-image: linear-gradient(100deg, rgba(27,34,48,.94) 30%, rgba(27,34,48,.55)), var(--hero-img); background-size: cover; background-position: center; }
/* คูปอง */
.coupon-box summary { cursor: pointer; font-size: .88rem; color: var(--lane); font-weight: 600; margin-bottom: 6px; }
.coupon-box .input { text-transform: uppercase; letter-spacing: .06em; }
.coupon-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.coupon-ticket { position: relative; border: 2px dashed var(--chip); border-radius: 12px; padding: 12px 14px; background: #FFF6F2; display: flex; flex-direction: column; gap: 2px; }
.coupon-ticket b { font-size: 1.15rem; letter-spacing: .08em; color: var(--chip); }
.coupon-ticket span { font-size: .85rem; }
.coupon-ticket small { color: var(--muted); font-size: .75rem; }
.coupon-ticket.is-used { opacity: .5; border-color: var(--line); background: var(--paper); }
.coupon-ticket.is-used b { color: var(--muted); text-decoration: line-through; }
.chip-checks { display: flex; flex-wrap: wrap; gap: 4px 18px; }
/* ชวนเพื่อน */
.ref-hero { background: linear-gradient(135deg, #1B2230, #2A3550); color: #fff; }
.ref-hero .label { color: rgba(255,255,255,.8); display: block; margin: 14px 0 6px; }
.ref-offer { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ref-offer div { background: rgba(255,255,255,.08); border-radius: 12px; padding: 14px; text-align: center; }
.ref-offer b { display: block; font: italic 800 2rem/1.1 var(--f-display); color: #FFB199; }
.ref-offer span { font-size: .85rem; color: rgba(255,255,255,.8); }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-line { background: #06C755; color: #fff; border-color: #06C755; }
.btn-fb { background: #1877F2; color: #fff; border-color: #1877F2; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.renew-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-left: 5px solid var(--chip); }
.renew-card h3 { margin: 2px 0; }
.renew-card p { margin: 4px 0 0; }
.renew-card small { color: var(--muted); }
/* รีวิว */
.stars { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label { font-size: 2rem; color: var(--line); cursor: pointer; line-height: 1; transition: color .1s; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: #F5A524; }
.stars input:focus-visible + label { outline: 2px solid var(--lane); border-radius: 4px; }
.stars-view { color: #F5A524; letter-spacing: 2px; }
.quote { margin: 8px 0; padding: 10px 14px; border-left: 3px solid var(--line); color: var(--ink-2); }
.review-del { margin: -8px 0 8px; text-align: right; }
.testi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-top: 18px; }
.testi { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 4px 14px rgba(16,24,40,.05); }
.testi blockquote { margin: 0; line-height: 1.65; color: var(--ink-2); flex: 1; }
.testi-hl { align-self: flex-start; background: var(--go-soft); color: #065F46; font-weight: 700; padding: 4px 10px; border-radius: 999px; font-size: .85rem; }
.testi figcaption { display: flex; align-items: center; gap: 10px; }
.testi figcaption small { display: block; color: var(--muted); font-size: .78rem; }
.about-text { max-width: 760px; margin: 12px auto 0; line-height: 1.8; text-align: center; color: var(--ink-2); }
.faq { max-width: 820px; }
.faq details { border-bottom: 1px solid var(--line); padding: 14px 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.3rem; color: var(--lane); line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details div { margin-top: 8px; color: var(--ink-2); line-height: 1.7; }
.faq-edit { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.faq-edit .btn { justify-self: end; }
.og-preview { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; max-width: 420px; }
.og-img { aspect-ratio: 1.91/1; background: var(--paper) center/cover no-repeat; display: grid; place-items: center; color: var(--muted); }
.og-img svg { width: 40px; height: 40px; }
.og-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; background: #F0F2F5; }
.og-body small { text-transform: uppercase; color: var(--muted); font-size: .72rem; }
.og-body span { font-size: .85rem; color: var(--muted); }
/* วิดีโอ */
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.video-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.video-card.is-off { opacity: .6; }
.video-thumb { aspect-ratio: 16/9; border: 0; cursor: pointer; background: var(--asphalt) center/cover no-repeat; display: grid; place-items: center; position: relative; }
.video-thumb span { width: 54px; height: 54px; border-radius: 50%; background: rgba(255,90,31,.92); color: #fff; font-size: 1.3rem; display: grid; place-items: center; padding-left: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.35); transition: transform .15s; }
.video-thumb:hover span { transform: scale(1.08); }
.video-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.video-body small { color: var(--muted); font-size: .78rem; }
.video-body p { margin: 4px 0 0; }
.modal-video { max-width: 860px; width: 100%; padding: 16px; }
.modal-video .card-head { margin-bottom: 10px; }
.modal-video h2 { font-size: 1.05rem; margin: 0; }
.video-frame { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 10px; overflow: hidden; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* กิจกรรม */
.event-list, .event-mini { display: grid; gap: 14px; }
.event-mini { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 16px; }
.event-card { display: flex; gap: 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; color: inherit; text-decoration: none; scroll-margin-top: 90px; }
a.event-card:hover { border-color: var(--lane); }
.event-card:target { box-shadow: 0 0 0 3px var(--lane); }
.event-date { flex: none; width: 64px; text-align: center; background: var(--asphalt); color: #fff; border-radius: 10px; padding: 8px 4px; border-bottom: 4px solid var(--chip); align-self: flex-start; }
.event-date b { display: block; font: italic 800 1.7rem/1 var(--f-display); }
.event-date span { display: block; font-size: .8rem; }
.event-date small { display: block; font-size: .72rem; opacity: .7; margin-top: 2px; }
.event-body { flex: 1; min-width: 0; }
.event-body h3 { margin: 2px 0 4px; font-size: 1.05rem; }
.event-body p { margin: 4px 0; }
.event-type { color: var(--chip); font-weight: 600; font-size: .78rem; }
/* GPX / เส้นทาง */
.gpx-box { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px; border: 1px dashed var(--lane); border-radius: 12px; background: #F3F5FF; margin-bottom: 8px; }
.gpx-result { flex-basis: 100%; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.gpx-result[hidden] { display: none; }
.gpx-result .route { width: 140px; flex: none; }
.gpx-sum { flex: 1; min-width: 200px; }
.route { width: 100%; max-width: 420px; height: auto; display: block; margin: 0 auto; }
.route-bg { fill: #EEF2F7; }
.route-shadow { fill: none; stroke: rgba(36,70,240,.18); stroke-width: 9; stroke-linecap: round; stroke-linejoin: round; }
.route-line { fill: none; stroke: var(--lane); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.route-start { fill: var(--go); stroke: #fff; stroke-width: 2.5; }
.route-end { fill: var(--chip); stroke: #fff; stroke-width: 2.5; }
.push-state { font-size: .9rem; margin: 6px 0 10px; }
@media (max-width: 600px) {
  .ref-offer b { font-size: 1.5rem; }
  .event-card { padding: 12px; gap: 12px; }
  .renew-card .btn { width: 100%; }
}

/* ---------- v2.1: บัญชี / เงื่อนไข / พักคอร์ส ---------- */
.social-login { display: flex; flex-direction: column; gap: 8px; }
.social-login .or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; margin: 4px 0; }
.social-login .or::before, .social-login .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-social { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; }
.btn-social svg { width: 20px; height: 20px; flex: none; }
.btn-line { background: #06C755; color: #fff; border-color: #06C755; }
.btn-line:hover { background: #05B34C; color: #fff; }
.btn-google { background: #fff; color: #1F1F1F; border: 1px solid #DADCE0; }
.btn-google:hover { background: #F8F9FA; color: #1F1F1F; }
.oauth-set { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px 14px; margin: 0 0 12px; }
.oauth-set legend { font-weight: 700; padding: 0 6px; }
code.copyable { user-select: all; background: var(--paper); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
.otp { font-size: 1.6rem; letter-spacing: .5em; text-align: center; }
.req-star { color: var(--chip); }
.pause-req { margin-bottom: 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; }
.pause-req summary { cursor: pointer; color: var(--ink-2); font-size: .92rem; }
.pause-req form { margin-top: 10px; }

/* ---------- v2.2: ชำระเงินอัตโนมัติ / ประกาศ / เทมเพลต ---------- */
.instant-pay { border: 2px solid var(--go); }
.instant-qr { display: grid; place-items: center; padding: 10px; background: #fff; }
.instant-qr img { width: 260px; max-width: 100%; height: auto; image-rendering: pixelated; }
.pay-wait { text-align: center; color: var(--ink-2); font-size: .92rem; }
.tpl-pick { background: var(--paper); border-radius: var(--r-sm); padding: 10px; }

/* ---------- v2.3: ความสำเร็จ / ชาเลนจ์ / Strava ---------- */
.race-card { display: flex; align-items: center; gap: 18px; background: linear-gradient(120deg, #1B2230, #2A3550); color: #fff; }
.race-card .muted { color: rgba(255,255,255,.7) !important; }
.race-card .btn-ghost { color: #fff; border-color: rgba(255,255,255,.3); margin-left: auto; align-self: flex-start; }
.race-count { flex: none; width: 92px; text-align: center; border-right: 1px solid rgba(255,255,255,.15); padding-right: 14px; }
.race-count b { display: block; font: italic 800 2.6rem/1 var(--f-display); color: #FFB199; }
.race-count span { font-size: .8rem; opacity: .8; }
.race-info h3 { margin: 2px 0; } .race-info p { margin: 4px 0; } .race-info small { opacity: .75; }
.race-empty { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-left: 5px solid var(--chip); }
.race-empty p { margin: 4px 0 0; }
.pr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pr-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; background: #fff; }
.pr-card small { color: var(--muted); font-size: .78rem; }
.pr-card b { font: italic 800 1.5rem/1.15 var(--f-display); color: var(--ink); }
.pr-card span { font-size: .78rem; color: var(--muted); }
.pr-card.is-empty b { color: var(--line); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.badge-tile { border: 1px dashed var(--line); border-radius: 14px; padding: 12px; text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; filter: grayscale(1); opacity: .55; }
.badge-tile.is-earned { filter: none; opacity: 1; border-style: solid; border-color: #F5C26B; background: #FFFBEF; }
.badge-tile .badge-ico { font-size: 2rem; line-height: 1; }
.badge-tile strong { font-size: .9rem; } .badge-tile small { font-size: .72rem; color: var(--muted); }
.badge-tile .hb-track { width: 100%; margin-top: 4px; }
.motiv { display: flex; flex-direction: column; gap: 10px; }
.motiv-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.motiv-badges a { margin-left: auto; }
.mini-badge { width: 40px; height: 40px; border-radius: 50%; background: #FFFBEF; border: 1px solid #F5C26B; display: grid; place-items: center; font-size: 1.3rem; }
.motiv-ch { color: inherit; text-decoration: none; }
.challenge .ch-track { height: 12px; }
.leader { list-style: none; margin: 8px 0 0; padding: 0; }
.leader li { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid var(--line-2); }
.leader li.is-me { background: var(--lane-soft, #EEF1FF); border-radius: 8px; font-weight: 600; }
.leader .rk { width: 28px; text-align: center; font-weight: 700; } .leader .nm { flex: 1; } .leader .vl { white-space: nowrap; }
.ch-board summary { cursor: pointer; font-weight: 600; color: var(--lane); margin-top: 10px; }
.btn-strava { background: #FC4C02; color: #fff; border-color: #FC4C02; font-weight: 700; }
.btn-strava:hover { background: #E34402; color: #fff; }
@media (max-width: 600px) { .race-card { flex-wrap: wrap; } .race-card .btn-ghost { margin-left: 0; } }

/* ---------- v2.4 SEO: หน้าแพ็กเกจ บทความ และตัวตรวจ SEO ---------- */
.bib-name a { color: inherit; text-decoration: none; }
.bib-name a:hover { text-decoration: underline; text-underline-offset: 4px; }
.bib-more { display: block; text-align: center; margin-top: 10px; font-size: .88rem; color: var(--muted); }
.bib.c-excellence .bib-more { color: var(--muted); }
.foot-pk { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px 16px; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.12); }
.foot-pk a { color: rgba(255,255,255,.85); text-decoration: none; }
.foot-pk a:hover { color: #fff; text-decoration: underline; }
.seo-article article { max-width: 78ch; }
.seo-article-body { line-height: 1.8; color: var(--ink-2); }
.seo-article-body h3 { margin: 22px 0 6px; font-size: 1.15rem; color: var(--ink); }
.seo-article-body ul { padding-left: 20px; }
.crumbs { max-width: 1120px; margin: 0 auto; padding: 18px 20px 0; font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.pkg-page { padding-top: 20px; }
.pkg-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.pkg-main h1 { font: italic 800 clamp(1.9rem, 5vw, 2.8rem)/1.1 var(--f-display); margin: 6px 0 10px; }
.pkg-main h2 { font-size: 1.35rem; margin: 28px 0 10px; font-style: normal; }
.pkg-main .lead { font-size: 1.1rem; color: var(--ink-2); }
.pkg-desc { line-height: 1.8; }
.pkg-feat, .pkg-steps { line-height: 1.7; padding-left: 22px; }
.pkg-feat li::marker { color: var(--go); }
.pkg-side { position: sticky; top: 84px; display: grid; gap: 16px; }
.pkg-others ul { list-style: none; padding: 0; margin: 8px 0 0; }
.pkg-others li { padding: 8px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; }
.pkg-others small { color: var(--muted); }
@media (max-width: 860px) { .pkg-grid { grid-template-columns: 1fr; } .pkg-side { position: static; } }

.seo-score { display: flex; align-items: center; gap: 16px; }
.seo-ring { --v: 0; width: 86px; height: 86px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--c, var(--go)) calc(var(--v) * 1%), var(--line) 0); }
.seo-ring b { width: 68px; height: 68px; border-radius: 50%; background: #fff; display: grid; place-items: center; font: 800 1.5rem var(--f-display); }
.seo-checks { list-style: none; padding: 0; margin: 12px 0 0; }
.seo-checks li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .93rem; }
.seo-checks li small { grid-column: 2; color: var(--muted); word-break: break-word; }
.seo-dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 4px; }
.seo-dot.s2 { background: var(--go); } .seo-dot.s1 { background: #F59E0B; } .seo-dot.s0 { background: #DC2626; }
.kw-tbl td.c, .kw-tbl th.c { text-align: center; }
.kw-yes { color: var(--go); font-weight: 700; } .kw-no { color: #C2410C; }
.kw-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.kw-chips span { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .85rem; }
.kw-chips span.primary { background: var(--go-soft); border-color: transparent; color: #065F46; font-weight: 600; }
.serp { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; font-family: Arial, sans-serif; }
.serp small { color: #202124; font-size: .82rem; display: block; }
.serp strong { color: #1a0dab; font-size: 1.15rem; font-weight: 400; display: block; margin: 4px 0; line-height: 1.3; }
.serp span { color: #4d5156; font-size: .9rem; line-height: 1.5; }
.seo-page { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.seo-page summary { cursor: pointer; }
.seo-page[open] summary { margin-bottom: 8px; }
.pkg-quick { display: none; align-items: center; gap: 10px; flex-wrap: wrap; }
.pkg-quick b { font: italic 800 1.5rem var(--f-display); }
@media (max-width: 860px) { .pkg-quick { display: flex; } }
.seo-auto { margin-bottom: 16px; border-left: 4px solid var(--go); }
.seo-auto-in { display: flex; gap: 16px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.seo-auto-in > div { flex: 1 1 320px; }
.seo-auto-form { display: grid; gap: 8px; }
.seo-auto-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.ip-search { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.ip-search .input { width: 180px; padding: 6px 10px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88rem; }

/* ---------- v2.7 2FA / ความปลอดภัย ---------- */
.otp-input { font: 600 1.25rem/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .25em; text-align: center; }
.tfa-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tfa-row .otp-input { width: 180px; }
.tfa-steps { padding-left: 20px; line-height: 1.7; }
.tfa-steps li { margin-bottom: 10px; }
.tfa-qr { width: 200px; height: 200px; margin: 10px 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.tfa-qr svg { width: 100%; height: 100%; }
.backup-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin: 10px 0; }
.backup-codes code { background: #fff; border: 1px dashed var(--line); border-radius: 6px; padding: 6px; text-align: center; font-size: .95rem; }

/* ---------- v2.7 บทความ ---------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.post-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 4px 14px rgba(16,24,40,.05); }
.post-card-img { display: block; aspect-ratio: 16 / 9; background: var(--paper); }
.post-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-card-img.no-img { display: grid; place-items: center; color: var(--muted); background: linear-gradient(135deg, var(--go-soft), var(--paper)); }
.post-card-img.no-img svg { width: 40px; height: 40px; }
.post-card-body { padding: 14px 16px 18px; }
.post-card-body h3 { font-size: 1.08rem; margin: 6px 0; line-height: 1.4; font-style: normal; }
.post-card-body h3 a { color: var(--ink); text-decoration: none; }
.post-card-body h3 a:hover { text-decoration: underline; }
.post-card-body p { color: var(--ink-2); font-size: .93rem; margin: 0; line-height: 1.6; }
.blog-head h1 { font: italic 800 clamp(1.9rem, 5vw, 2.8rem)/1.1 var(--f-display); margin: 0 0 8px; }
.blog-search { display: flex; gap: 8px; max-width: 480px; margin: 0 0 22px; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 22px; }
.pager a { min-width: 38px; text-align: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-decoration: none; color: var(--ink); }
.pager a.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.post { padding-top: 16px; }
.post-in { max-width: 760px; margin: 0 auto; }
.post-head h1 { font: italic 800 clamp(1.7rem, 4.6vw, 2.5rem)/1.2 var(--f-display); margin: 0 0 8px; }
.post-cover { width: 100%; height: auto; border-radius: 14px; margin: 14px 0; aspect-ratio: 1200 / 630; object-fit: cover; background: var(--paper); }
.post-in .lead { font-size: 1.12rem; color: var(--ink-2); }
.post-body { font-size: 1.04rem; line-height: 1.9; color: var(--ink); }
.post-body h2 { font-size: 1.45rem; margin: 30px 0 10px; font-style: normal; }
.post-body h3 { font-size: 1.18rem; margin: 22px 0 8px; }
.post-body ul, .post-body ol { padding-left: 22px; }
.post-body li { margin-bottom: 6px; }
.post-body blockquote { margin: 18px 0; padding: 14px 18px; border-left: 4px solid var(--chip); background: var(--paper); border-radius: 0 10px 10px 0; }
.post-body figure { margin: 18px 0; }
.post-body figure img { width: 100%; height: auto; border-radius: 10px; }
.post-body figcaption { color: var(--muted); font-size: .88rem; text-align: center; margin-top: 6px; }
.post-share { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 26px 0; padding-top: 16px; border-top: 1px solid var(--line); }
.post-cta { margin-top: 10px; border-left: 4px solid var(--chip); }
.post-cta h2 { font-size: 1.25rem; margin: 0 0 6px; font-style: normal; }
.post-pkgs { padding-left: 18px; }
.md-help { font-size: .85rem; color: var(--muted); line-height: 1.7; }
.md-help code { background: var(--paper); padding: 1px 6px; border-radius: 4px; }

/* ---------- v2.7 ส่งข้อความ ---------- */
.check-row { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.bc-count { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 6px 0 12px; }
.bc-msg { background: var(--paper); border-radius: 10px; padding: 12px; line-height: 1.7; }
.progress { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.progress i { display: block; height: 100%; background: var(--go); transition: width .4s; }
.field > .label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
/* v2.7.1 ปรับ SEO บทความอัตโนมัติ */
.auto-seo-box { display: grid; gap: 8px; padding: 12px; background: var(--go-soft); border-radius: 12px; margin-bottom: 12px; }
.auto-seo-box .hint { margin: 0; }
.post-check { position: relative; }
.post-score { float: right; font-size: .9rem; color: var(--muted); }
.post-score b { font: italic 800 1.6rem var(--f-display); color: #C2410C; }
.post-score.full b { color: var(--go); }
.auto-filled { box-shadow: 0 0 0 3px rgba(14,159,104,.35) !important; transition: box-shadow .3s; }
.grid > * { min-width: 0; }
.form input[type="datetime-local"] { max-width: 100%; min-width: 0; }
#postForm > div > .card { min-width: 0; }
#postForm .form-actions { flex-wrap: wrap; }
.auto-seo-box .btn { white-space: normal; line-height: 1.35; height: auto; padding-top: 10px; padding-bottom: 10px; }
/* v2.8.2 แจ้งเตือนอัปเดตแอป */
.update-bar { position: fixed; left: 50%; transform: translateX(-50%); top: calc(72px + env(safe-area-inset-top, 0px)); z-index: 1200; display: flex; align-items: center; gap: 10px;
  background: var(--asphalt); color: #fff; padding: 10px 10px 10px 16px; border-radius: 14px; box-shadow: 0 12px 30px rgba(0,0,0,.3); border-left: 4px solid var(--go);
  width: max-content; max-width: calc(100vw - 24px); font-size: .93rem; }
.update-bar span { flex: 1; }
.update-x { background: transparent; border: 0; color: rgba(255,255,255,.7); font-size: 1.3rem; cursor: pointer; padding: 0 6px; }
.btn-install.is-update { background: var(--go); animation: rcPulse 1.6s ease-in-out 3; }
@keyframes rcPulse { 50% { box-shadow: 0 0 0 6px rgba(14,159,104,.35); } }
/* v2.8.3 ป๊อปอัปอัปเดตแอป */
.upd-modal { z-index: 100000; align-items: center; }
.upd-card { text-align: center; max-width: 400px; }
.upd-card h2 { margin: 6px 0 8px; }
.upd-card .btn + .btn { margin-top: 8px; }
.upd-icon { width: 64px; height: 64px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-size: 1.8rem; color: #fff; background: var(--go); box-shadow: 0 0 0 8px var(--go-soft); }
.seo-dot.s3 { background: #98A2B3; }
/* v2.8.5 */
.auth-main { flex-direction: column; }
.remember-check { margin: 2px 0 4px; font-size: .93rem; }

/* ---------- v2.8.7 ช่องทางติดต่อเด่นชัด ---------- */
.contact-strip { background: #FF5A1F; color: #fff; }
.contact-strip-in { max-width: 1120px; margin: 0 auto; padding: 6px 12px; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.cs-label { font-size: .85rem; font-weight: 600; opacity: .95; }
.cs-pill { display: inline-flex; align-items: center; gap: 6px; color: #fff; text-decoration: none; background: rgba(0,0,0,.18); border-radius: 999px; padding: 4px 12px 4px 8px; font-size: .95rem; line-height: 1.4; }
.cs-pill svg { width: 17px; height: 17px; }
.cs-pill b { font-weight: 700; letter-spacing: .02em; }
.cs-line { background: #06C755; }
.cs-pill:hover { filter: brightness(1.08); }
@media (max-width: 520px) { .cs-label { display: none; } .contact-strip-in { gap: 6px; } .cs-pill { font-size: .9rem; } }
.contact-band { background: linear-gradient(135deg, #1B2230, #2A3446); color: #fff; padding: 34px 20px; border-top: 4px solid #FF5A1F; }
.contact-band-in { max-width: 1120px; margin: 0 auto; display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cb-text h2 { color: #fff; font: italic 800 clamp(1.35rem, 3.6vw, 1.9rem)/1.3 var(--f-display); margin: 0 0 4px; }
.cb-text p { margin: 0; color: rgba(255,255,255,.8); }
.cb-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.cb-btn { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; border-radius: 16px; padding: 12px 20px 12px 14px; min-width: 230px; box-shadow: 0 8px 20px rgba(0,0,0,.25); transition: transform .15s; }
.cb-btn:hover { transform: translateY(-2px); }
.cb-btn svg { width: 34px; height: 34px; flex: none; background: rgba(255,255,255,.18); border-radius: 50%; padding: 6px; }
.cb-btn span { display: flex; flex-direction: column; line-height: 1.3; }
.cb-btn small { font-size: .82rem; opacity: .9; }
.cb-btn b { font-size: 1.35rem; letter-spacing: .02em; }
.cb-tel { background: #FF5A1F; }
.cb-line { background: #06C755; }
@media (max-width: 600px) { .cb-btns { width: 100%; } .cb-btn { flex: 1 1 100%; min-width: 0; } }
.foot-contact { display: flex; gap: 14px; flex-wrap: wrap; }
.foot-contact a { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: #fff; text-decoration: none; }
.foot-contact svg { width: 16px; height: 16px; }

/* ---------- v2.8.8 ความเร็ว + การเข้าถึง (สีตัดกันผ่าน WCAG AA) ---------- */
.hero.has-img { background-image: none; }
.hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.hero.has-img::before { content: ""; position: absolute; inset: 0; z-index: 0; background: linear-gradient(100deg, rgba(27,34,48,.94) 30%, rgba(27,34,48,.55)); }
.btn-accent { background: #CF4510; }
.btn-accent:hover { background: #B83C0C; }
.contact-strip { background: #C2410C; }
.cs-line, .cb-line { background: #047F38; }
.cb-tel { background: #CF4510; }
.cb-btn small, .cs-label { opacity: 1; color: #fff; }
