@font-face { font-family: "LINE Seed Sans TH"; src: url("../fonts/LINESeedSansTH-Rg.woff2") format("woff2"); font-weight: 100 549; font-display: swap; }
@font-face { font-family: "LINE Seed Sans TH"; src: url("../fonts/LINESeedSansTH-Bd.woff2") format("woff2"); font-weight: 550 900; font-display: swap; }
/* ==========================================================================
   Runner Privileges · Chiang Mai — UI tokens + components
   Concept: Lanna gold on Chiang Mai night navy. Gold is reserved for the privilege
   (the thing a runner came for) and for selection; navy carries structure and text.
   ========================================================================== */
:root {
  /* brand ramps */
  --navy-950: #070920; --navy-900: #0C0F33; --navy-800: #131643;   /* navy sampled from the event logo */ --navy-700: #1B3263; --navy-500: #3A548C; --navy-200: #C5CEE0; --navy-100: #E4E8F1;
  --gold-700: #8A6A1F; --gold-600: #A9822F; --gold-500: #C9A24B; --gold-300: #E6CC8A; --gold-100: #F7EED6;
  /* category hues: tuned to sit beside navy+gold, each passes 3:1 against white for the badge glyph ring */
  --c-cafe: #A55E33; --c-food: #B8325E; --c-spa: #1D7562; --c-sport: #2F62C6; --badge-fg: #FFFFFF;
  /* semantic */
  --ok: #1D8048; --warn: #9A5A0C; --off: #6B7488;
  /* surfaces (light) */
  --bg: #EEF1F6; --surface: #FFFFFF; --surface-2: #F4F6FA; --line: #DCE1EA; --line-2: #C9D0DD;
  --fg: #101C38; --fg-2: #46536F; --fg-3: #5A6580;
  --accent-ink: var(--gold-700); --ticket: #FBF5E6; --ticket-line: #E2CB92;
  --chrome: var(--navy-800); --chrome-fg: #F4F1E8; --scrim: rgba(8, 18, 42, .42);
  --pin-ring: #FFFFFF;
  --primary-bg: var(--navy-800); --primary-fg: #F7F2E4; --primary-ico: var(--gold-300);
  --chip-on-bg: var(--navy-800); --chip-on-fg: #F4F1E8; --chip-on-ico: var(--gold-300); --focus: var(--gold-700);
  --cluster-bg: #FFFFFF; --cluster-fg: var(--navy-800);
  /* type */
  /* Jost = open-source Futura look for Latin; Thai glyphs fall through to LINE Seed Sans TH (OFL, self-hosted) */
  --f-display: "Jost", "LINE Seed Sans TH", "Noto Sans SC", system-ui, sans-serif;
  --f-ui: "Jost", "LINE Seed Sans TH", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t-xs: .75rem; --t-sm: .8125rem; --t-md: .9375rem; --t-lg: 1.125rem; --t-xl: 1.375rem; --t-2xl: 1.75rem;
  /* shape + depth */
  --r-sm: 8px; --r-md: 14px; --r-lg: 22px; --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(8, 18, 42, .08), 0 2px 8px rgba(8, 18, 42, .06);
  --sh-2: 0 6px 24px -6px rgba(8, 18, 42, .28), 0 2px 6px rgba(8, 18, 42, .08);
  --sh-pin: 0 5px 12px -3px rgba(8, 18, 42, .5);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --pin: 46px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B1834; --surface: #111F40; --surface-2: #17284F; --line: #22365F; --line-2: #2E4473;
    --fg: #EEF1F8; --fg-2: #B5C0D8; --fg-3: #8D99B6;
    --accent-ink: var(--gold-300); --ticket: #1B2A4E; --ticket-line: #6F5A2A;
    --chrome: #0E1B3A; --chrome-fg: #F4F1E8; --scrim: rgba(3, 8, 20, .6);
    --ok: #4CC37F; --warn: #E9A13B; --off: #8D99B6;
    --pin-ring: #F4F1E8;
    --primary-bg: var(--gold-500); --primary-fg: var(--navy-950); --primary-ico: var(--navy-900);
    --c-cafe: #E09A6E; --c-food: #F07C9E; --c-spa: #5CC9A8; --c-sport: #7FA6F0; --badge-fg: var(--navy-950);
    --chip-on-bg: var(--gold-500); --chip-on-fg: var(--navy-950); --chip-on-ico: var(--navy-900); --focus: var(--gold-300);
    --cluster-bg: #17284F; --cluster-fg: #F4F1E8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B1834; --surface: #111F40; --surface-2: #17284F; --line: #22365F; --line-2: #2E4473;
  --fg: #EEF1F8; --fg-2: #B5C0D8; --fg-3: #8D99B6;
  --accent-ink: var(--gold-300); --ticket: #1B2A4E; --ticket-line: #6F5A2A;
  --chrome: #0E1B3A; --chrome-fg: #F4F1E8; --scrim: rgba(3, 8, 20, .6);
  --ok: #4CC37F; --warn: #E9A13B; --off: #8D99B6;
  --pin-ring: #F4F1E8;
  --primary-bg: var(--gold-500); --primary-fg: var(--navy-950); --primary-ico: var(--navy-900);
  --c-cafe: #E09A6E; --c-food: #F07C9E; --c-spa: #5CC9A8; --c-sport: #7FA6F0; --badge-fg: var(--navy-950);
  --chip-on-bg: var(--gold-500); --chip-on-fg: var(--navy-950); --chip-on-ico: var(--navy-900); --focus: var(--gold-300);
  --cluster-bg: #17284F; --cluster-fg: #F4F1E8;
  color-scheme: dark;
}
/* Thai running text: LINE Seed first, so digits and spaces inside a Thai sentence come from the same face as the letters.
   With Jost first, "2 แก้ว 100 บาท" mixed two fonts at two weights. Headings (--f-display) keep Jost numerals. */
:lang(th) { --f-ui: "LINE Seed Sans TH", "Jost", system-ui, -apple-system, "Segoe UI", sans-serif; }
:lang(zh) { --f-display: "Noto Serif SC", "Songti SC", "STSong", "LINE Seed Sans TH", serif; --f-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "LINE Seed Sans TH", system-ui, sans-serif; }
/* Japanese: Jost for Latin and digits, then a Japanese face. Never the SC fonts: the same kanji are drawn differently in Chinese. */
:lang(ja) { --f-display: "Jost", "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP", "LINE Seed Sans TH", sans-serif; --f-ui: "Jost", "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP", "LINE Seed Sans TH", system-ui, sans-serif; }
/* Korean: Jost for Latin and digits, then a Korean face. */
:lang(ko) { --f-display: "Jost", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "LINE Seed Sans TH", sans-serif; --f-ui: "Jost", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "LINE Seed Sans TH", system-ui, sans-serif; }
/* Korean breaks lines between words, not inside them: without this "배번표" was split as "배 / 번표" on the staff card.
   overflow-wrap still lets one over-long word wrap. Thai blocks inside a Korean page keep normal breaking. */
:lang(ko) { word-break: keep-all; overflow-wrap: break-word; }
:lang(ko) :lang(th) { word-break: normal; }
/* Vietnamese: Jost has no Vietnamese glyphs, so the whole text uses Be Vietnam Pro rather than mixing two faces inside a word. */
:lang(vi) { --f-display: "Be Vietnam Pro", "LINE Seed Sans TH", system-ui, "Segoe UI", sans-serif; --f-ui: "Be Vietnam Pro", "LINE Seed Sans TH", system-ui, "Segoe UI", sans-serif; }

.ico { width: 20px; height: 20px; flex: none; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[data-cat="cafe"] { --cat: var(--c-cafe); } [data-cat="food"] { --cat: var(--c-food); }
[data-cat="spa"] { --cat: var(--c-spa); } [data-cat="sport"] { --cat: var(--c-sport); }

/* ---------- Logo pin --------------------------------------------------- */
.pin { position: relative; width: var(--pin); height: calc(var(--pin) + 24px); border: 0; padding: 0; background: none; cursor: pointer;
  transition: transform .18s var(--ease), filter .18s; transform-origin: 50% 100%; -webkit-tap-highlight-color: transparent; }
/* tail: a short stem from the badge to the exact coordinate (the button's bottom edge) */
.pin::after { content: ""; position: absolute; left: 50%; bottom: 1px; width: 9px; height: 9px; background: var(--cat, var(--navy-800));
  transform: translateX(-50%) rotate(45deg); border-radius: 0 0 2px 0; box-shadow: 1.5px 1.5px 0 0 var(--pin-ring); }
/* buttons centre their content vertically: pin the disc to the top so the badge hangs below it, not over the logo */
.pin-disc { position: absolute; top: 0; left: 0; z-index: 1; display: block; width: var(--pin); height: var(--pin); border-radius: 50%; overflow: hidden; background: var(--logo-bg, #fff);
  box-shadow: 0 0 0 2px var(--pin-ring), 0 0 0 4px var(--cat, var(--navy-800)), var(--sh-pin); }
.pin-disc img { width: 100%; height: 100%; display: block; object-fit: cover; }
/* category badge sits under the disc: it overlaps the rings only, never the logo */
.pin-badge { position: absolute; z-index: 2; left: 50%; top: calc(var(--pin) + 1px); transform: translateX(-50%); width: 18px; height: 18px; border-radius: 50%;
  background: var(--cat); color: var(--badge-fg); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--pin-ring); }
.pin-badge .ico { width: 12px; height: 12px; stroke-width: 2.2; }
.pin:hover { transform: translateY(-2px) scale(1.06); }
.pin:focus-visible { outline: none; }
.pin:focus-visible .pin-disc { box-shadow: 0 0 0 2px var(--pin-ring), 0 0 0 5px var(--focus), var(--sh-pin); }
.pin.is-active { --pin: 60px; z-index: 5; }
.pin.is-active .pin-disc { box-shadow: 0 0 0 2.5px var(--pin-ring), 0 0 0 5.5px var(--gold-500), 0 0 0 11px rgba(201, 162, 75, .28), var(--sh-pin); }
.pin.is-active::after { background: var(--gold-500); }
.pin.is-dim { filter: grayscale(1) opacity(.35); transform: scale(.82); }
.pin-label { position: absolute; z-index: 3; left: 50%; top: calc(100% + 4px); transform: translateX(-50%); white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
  padding: 3px 10px; border-radius: var(--r-pill); background: var(--navy-800); color: var(--gold-100); font: 600 12px/1.4 var(--f-ui); box-shadow: var(--sh-1); }
/* monogram for shops without a supplied logo */
.mono { width: 100%; height: 100%; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, var(--navy-700), var(--navy-900));
  color: var(--gold-300); font: 600 calc(var(--pin) * .36)/1 var(--f-display); letter-spacing: .02em; box-shadow: inset 0 0 0 calc(var(--pin) * .06) var(--navy-900), inset 0 0 0 calc(var(--pin) * .08) rgba(201, 162, 75, .55); border-radius: 50%; }

/* ---------- Cluster ---------------------------------------------------- */
.cluster { display: inline-flex; align-items: center; gap: 0; min-height: 44px; padding: 5px 12px 5px 5px; border-radius: var(--r-pill); border: 0; cursor: pointer;
  background: var(--cluster-bg); box-shadow: 0 0 0 1.5px var(--line-2), var(--sh-pin); color: var(--cluster-fg); font: 700 15px/1 var(--f-ui);
  font-variant-numeric: tabular-nums; transition: transform .18s var(--ease); }
.cluster:hover { transform: scale(1.06); }
.cluster-face { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; background: #fff; box-shadow: 0 0 0 2px var(--cluster-bg), 0 0 0 3px var(--line-2); flex: none; }
.cluster-face + .cluster-face { margin-left: -12px; }
.cluster-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cluster-face .mono { font-size: 11px; box-shadow: none; }
.cluster b { margin-left: 8px; }

/* ---------- Controls --------------------------------------------------- */
.search { display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 6px 0 14px; border-radius: var(--r-pill); background: var(--surface);
  color: var(--fg-3); box-shadow: var(--sh-2); border: 1px solid var(--line); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--fg); font: 500 var(--t-md)/1 var(--f-ui); }
.search input::placeholder { color: var(--fg-3); font-weight: 400; }
.search:focus-within { border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(201, 162, 75, .3), var(--sh-2); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 0; background: transparent; color: var(--fg-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:focus-visible, .chip:focus-visible, .btn:focus-visible, .seg button:focus-visible, .row:focus-visible, .fab:focus-visible, .cluster:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { position: relative; flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 11px; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: 500 var(--t-sm)/1 var(--f-ui); box-shadow: var(--sh-1); white-space: nowrap; }
.chip::before { content: ""; position: absolute; inset: -3px -2px; }
.chip .ico { width: 17px; height: 17px; color: var(--cat, var(--fg-2)); }
.chip small { font-size: 11px; color: var(--fg-3); font-variant-numeric: tabular-nums; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--chip-on-bg); border-color: var(--chip-on-bg); color: var(--chip-on-fg); font-weight: 600; }
.chip[aria-pressed="true"] .ico { color: var(--chip-on-ico); }
.chip[aria-pressed="true"] small { color: inherit; opacity: .8; }

.seg { display: inline-flex; padding: 3px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px rgba(230, 204, 138, .35); }
.seg button { min-width: 44px; height: 36px; padding: 0 9px; border-radius: var(--r-pill); border: 0; background: none; color: rgba(244, 241, 232, .78);
  font: 600 12.5px/1 var(--f-ui); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--gold-500); color: var(--navy-900); }

.fab { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); display: grid; place-items: center;
  box-shadow: var(--sh-2); cursor: pointer; }
.fab.is-on { color: var(--c-sport); box-shadow: 0 0 0 2px var(--c-sport), var(--sh-2); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: var(--r-pill); cursor: pointer;
  font: 600 var(--t-md)/1 var(--f-ui); border: 1px solid var(--line-2); background: var(--surface); color: var(--fg); text-decoration: none; white-space: nowrap; }
.btn .ico { width: 19px; height: 19px; }
.btn-primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-fg); }
.btn-primary .ico { color: var(--primary-ico); }

/* ---------- Badges + status ------------------------------------------- */
.perk { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 6px; white-space: nowrap;
  background: linear-gradient(180deg, var(--gold-300), var(--gold-500)); color: var(--navy-950); font: 700 12.5px/1 var(--f-ui); font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px rgba(138, 106, 31, .35); }
.status { display: inline-flex; align-items: center; gap: 6px; font: 500 var(--t-sm)/1.25 var(--f-ui); color: var(--fg-2); white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--off); }
.status.is-open::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.status.is-soon::before { background: var(--warn); }
.status b { font-weight: 700; color: var(--fg); }
.status.is-open b { color: var(--ok); } .status.is-soon b { color: var(--warn); }
.cat-tag { white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; font: 600 var(--t-xs)/1 var(--f-ui); color: var(--cat); }
.cat-tag .ico { width: 15px; height: 15px; }

/* ---------- List row --------------------------------------------------- */
.row { display: grid; grid-template-columns: 52px minmax(0, 1fr) fit-content(46%); gap: 12px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--line);
  background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; color: inherit; cursor: pointer; }
.row:hover { background: var(--surface-2); }
.row-logo { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; background: var(--logo-bg, #fff); box-shadow: 0 0 0 1px var(--line), 0 0 0 3px var(--surface), 0 0 0 4.5px var(--cat); --pin: 52px; }
/* category marker: a filled badge on the logo (same language as the map pins) plus the category word in the second line */
.row-pic { position: relative; display: block; width: 52px; height: 52px; }
.row-pic .row-logo { display: block; }   /* spans: they were sized by the grid before, now they need their own box */
.row-badge { position: absolute; right: -5px; bottom: -5px; width: 23px; height: 23px; border-radius: 50%; background: var(--cat); color: var(--badge-fg); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface); }
.row-badge .ico { width: 14px; height: 14px; stroke-width: 2.2; }
.row-cat { font-weight: 600; color: var(--cat); }
.row-logo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.row-main { min-width: 0; display: grid; gap: 3px; }
/* the name is the shop's identity: let it take two lines before it is cut */
.row-name { font: 600 var(--t-md)/1.25 var(--f-ui); color: var(--fg); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-sub { font: 400 var(--t-sm)/1.35 var(--f-ui); color: var(--fg-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { display: flex; gap: 8px; align-items: center; min-width: 0; overflow: hidden; }
.row-meta .cat-tag { flex: none; }
.row-end { display: grid; justify-items: end; gap: 6px; }
/* a long perk wraps onto two lines instead of squeezing the shop name down to a few letters */
.row .perk { height: auto; min-height: 24px; padding-block: 3px; white-space: normal; text-align: center; line-height: 1.2; }
.row-dist { font: 500 var(--t-xs)/1 var(--f-ui); color: var(--fg-3); font-variant-numeric: tabular-nums; }
.row mark { background: rgba(201, 162, 75, .32); color: inherit; border-radius: 3px; padding: 0 1px; }

/* ---------- Privilege ticket -------------------------------------------- */
.ticket { position: relative; border-radius: var(--r-md); background: var(--ticket); border: 1px solid var(--ticket-line); padding: 14px 16px 14px 18px;
  display: grid; gap: 8px; overflow: hidden; }
.ticket::before, .ticket::after { content: ""; position: absolute; top: 50%; width: 16px; height: 16px; border-radius: 50%; background: var(--surface);
  border: 1px solid var(--ticket-line); transform: translateY(-50%); }
.ticket::before { left: -9px; } .ticket::after { right: -9px; }
.ticket-eyebrow { display: flex; align-items: center; gap: 6px; font: 600 12px/1.3 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.ticket-eyebrow .ico { width: 16px; height: 16px; }
:lang(th) .ticket-eyebrow, :lang(zh) .ticket-eyebrow, :lang(ja) .ticket-eyebrow, :lang(ko) .ticket-eyebrow, .ticket-eyebrow:lang(th) { letter-spacing: 0; text-transform: none; font-size: 13px; }
.who { margin-left: auto; padding: 2px 8px; border-radius: var(--r-pill); background: var(--navy-800); color: #F4F1E8; letter-spacing: 0; text-transform: none; font-size: 11.5px; }
.ticket-perk { font: 700 26px/1.15 var(--f-display); color: var(--fg); text-wrap: balance; }
.ticket-perk small { display: block; margin-top: 2px; font: 600 var(--t-md)/1.3 var(--f-ui); color: var(--accent-ink); }
.ticket-body { font: 500 var(--t-md)/1.55 var(--f-ui); color: var(--fg-2); white-space: pre-line; }
.ticket-foot { font: 500 var(--t-sm)/1.45 var(--f-ui); color: var(--fg-2); border-top: 1px dashed var(--ticket-line); padding-top: 8px; }
.btn-staff { width: 100%; margin-top: 2px; background: var(--gold-500); border-color: var(--gold-600); color: var(--navy-950); }
.btn-staff .ico { color: var(--navy-900); }
.lanna-rule { height: 10px; background:
  radial-gradient(circle at 5px 5px, var(--gold-500) 1.6px, transparent 2px) 0 0/20px 10px repeat-x,
  linear-gradient(var(--gold-500), var(--gold-500)) 0 50%/100% 1px no-repeat; opacity: .55; }

/* ---------- Sheet ------------------------------------------------------ */
.sheet { background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 -10px 30px -12px rgba(8, 18, 42, .35); }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 4px; }

@media (prefers-reduced-motion: reduce) { .pin, .cluster, .chip, .btn { transition: none; } html { scroll-behavior: auto; } }
/* long open/closed lines ("Đã đóng cửa · mở lúc 10:00 ngày mai") wrap instead of being cut mid-time */
.row-meta { flex-wrap: wrap; row-gap: 2px; }
/* in a row the status is plain wrapping text with its dot pinned left: as a flex box each part wrapped inside its own narrow column */
.row .status { display: block; white-space: normal; position: relative; padding-left: 13px; }
.row .status::before { position: absolute; left: 0; top: .42em; }
