/* ===========================================================
   Rally - public court finder

   Shape system (one rule, applied everywhere):
     999px  anything you tap that is a pill: buttons, chips, tags
     20px   cards and panels
     12px   inputs, selects, the sheet body

   Colour system: one accent (#C8462B, lifted to #FF8A66 on dark)
   plus one semantic pair for the two listing kinds, because the
   difference between "vãng lai" and "pass sân" is information, not
   decoration. Nothing else is coloured.
   =========================================================== */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --paper: #F2F6F1;
  --paper-2: #E7EFE6;
  --card: #FFFFFF;
  --card-2: #FAFCF9;

  --ink: #17211B;
  --ink-2: #4B5A50;
  --ink-3: #74857A;

  --line: #DCE6DA;
  --line-2: #C6D5C4;

  --accent: #C8462B;
  --accent-deep: #A83A22;
  --accent-on: #FFFFFF;
  --accent-soft: #FBE7E1;
  --accent-line: #EFC5B8;

  --grass: #146B47;
  --grass-soft: #DDF0E5;
  --grass-line: #B6DEC7;

  --shade: 23 33 27;

  --nav-h: 68px;
  --gap: 1.25rem;

  --r-pill: 999px;
  --r-card: 20px;
  --r-field: 12px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

:root[data-theme="dark"],
html:not([data-theme="light"]) {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121714;
    --paper-2: #171F1B;
    --card: #1B2320;
    --card-2: #202924;

    --ink: #E8F0E9;
    --ink-2: #A7B7AC;
    --ink-3: #7E8F84;

    --line: #2A3630;
    --line-2: #384740;

    --accent: #FF8A66;
    --accent-deep: #FFA184;
    --accent-on: #1A0E09;
    --accent-soft: #35201A;
    --accent-line: #4E2E23;

    --grass: #6DCB9C;
    --grass-soft: #16291F;
    --grass-line: #274534;

    --shade: 0 0 0;

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #121714;
  --paper-2: #171F1B;
  --card: #1B2320;
  --card-2: #202924;

  --ink: #E8F0E9;
  --ink-2: #A7B7AC;
  --ink-3: #7E8F84;

  --line: #2A3630;
  --line-2: #384740;

  --accent: #FF8A66;
  --accent-deep: #FFA184;
  --accent-on: #1A0E09;
  --accent-soft: #35201A;
  --accent-line: #4E2E23;

  --grass: #6DCB9C;
  --grass-soft: #16291F;
  --grass-line: #274534;

  --shade: 0 0 0;

  color-scheme: dark;
}

/* ── Base ───────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

/* `hidden` has to outrank the flex and grid rules below, otherwise the
   detail sheet and the toast render on first paint. */
[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3 {
  font-family: "Baloo 2", "Be Vietnam Pro", system-ui, sans-serif;
  margin: 0;
  letter-spacing: -0.015em;
  line-height: 1.12;
}

p {
  margin: 0;
}

a {
  color: var(--accent-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.shell {
  width: min(100% - 2.5rem, 1240px);
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 90;
  background: var(--accent);
  color: var(--accent-on);
  padding: 0.7rem 1.1rem;
  border-radius: var(--r-pill);
}

.skip:focus {
  left: 1rem;
  top: 1rem;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  padding: 0.72rem 1.35rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.16s var(--ease), background-color 0.2s, border-color 0.2s, color 0.2s;
}

.btn:active {
  transform: translateY(1px) scale(0.985);
}

.btn--solid {
  background: var(--accent);
  color: var(--accent-on);
}

.btn--solid:hover {
  background: var(--accent-deep);
}

.btn--ghost {
  background: var(--card);
  border-color: var(--line-2);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
}

.btn--quiet {
  background: transparent;
  color: var(--ink-2);
  padding-inline: 0.6rem;
}

.btn--quiet:hover {
  color: var(--accent-deep);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: default;
}

/* ── Brand ──────────────────────────────────────────────── */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--ink);
}

.brand__mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-on);
  border-radius: 13px;
  font-size: 1.35rem;
  transform: rotate(-6deg);
  transition: transform 0.3s var(--ease);
}

.brand:hover .brand__mark {
  transform: rotate(6deg) scale(1.06);
}

.brand__word {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 1.4rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* ── Navigation ─────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--nav-h);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s, background-color 0.25s;
}

.nav.is-stuck {
  border-bottom-color: var(--line);
}

.nav__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav__links {
  margin-left: auto;
  display: flex;
  gap: 1.6rem;
}

.nav__links a {
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding-block: 0.2rem;
}

.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease);
}

.nav__links a:hover {
  color: var(--ink);
}

.nav__links a:hover::after {
  transform: scaleX(1);
}

.theme {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line-2);
  background: var(--card);
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--ink-2);
  transition: color 0.2s, border-color 0.2s, transform 0.2s var(--ease);
}

.theme:hover {
  color: var(--accent-deep);
  border-color: var(--accent);
  transform: rotate(-15deg);
}

/* ── Quick search strip ─────────────────────────────────── */
/* Replaces the old marketing hero: no headline, no photo, just a way
   to search and a live pulse, so the card list is the next thing on
   screen after the nav - no scrolling required to see a kèo. */
.quick {
  background: var(--paper-2);
  border-bottom: 1px solid var(--line);
  padding-block: 1.1rem;
}

.quick__row {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  flex-wrap: wrap;
}

.qseek {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--card);
  border: 1.5px solid var(--line-2);
  border-radius: var(--r-pill);
  padding: 0.3rem 0.3rem 0.3rem 1rem;
  flex: 1 1 340px;
  max-width: 480px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.qseek:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.qseek__icon {
  color: var(--ink-3);
  font-size: 1.1rem;
  display: grid;
  place-items: center;
}

.qseek__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding-block: 0.62rem;
  outline: none;
}

.qseek__input::placeholder {
  color: var(--ink-3);
}

.qseek__go {
  flex: 0 0 auto;
  padding-block: 0.6rem;
}

.quick__pulse {
  margin-left: auto;
  color: var(--ink-3);
  font-size: 0.83rem;
}

/* ── Board head and bar ─────────────────────────────────── */
.board {
  padding-block: clamp(1.4rem, 3vw, 2rem) clamp(2.2rem, 5vw, 3.4rem);
}

.board__head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}

.board__title {
  font-size: clamp(1.7rem, 3.4vw, 2.3rem);
  font-weight: 700;
}

.board__note {
  color: var(--ink-3);
  font-size: 0.92rem;
}

/* ── Filter bar ─────────────────────────────────────────── */
/* One row of compact dropdown triggers replaces what used to be a
   permanent sidebar plus two separate rows of always-visible pills
   (kind segments, day pills). Every filter is still one tap away; none
   of them cost vertical space - or fight for it against the card grid -
   until the visitor actually opens one. */
.fbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
  position: relative;
  z-index: 20;
}

.fitem {
  position: relative;
}

.ftrig {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line-2);
  background: var(--card);
  color: var(--ink-2);
  padding: 0.5rem 0.85rem;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s var(--ease);
}

.ftrig:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.ftrig i:first-child {
  color: var(--ink-3);
  font-size: 1rem;
}

.ftrig__caret {
  font-size: 0.7rem !important;
  color: var(--ink-3) !important;
  transition: transform 0.2s var(--ease);
}

.fitem.is-open .ftrig,
.ftrig.is-active {
  border-color: var(--accent);
}

.fitem.is-open .ftrig__caret {
  transform: rotate(180deg);
}

.ftrig.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.ftrig.is-active i:first-child {
  color: var(--accent-deep);
}

.fbar__reset {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 0.86rem;
  font-weight: 600;
  padding: 0.5rem 0.4rem;
  cursor: pointer;
}

.fbar__reset:hover {
  color: var(--accent-deep);
}

.fbar__sort {
  margin-left: auto;
}

.pick {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pick__cap {
  font-size: 0.85rem;
  color: var(--ink-3);
  font-weight: 500;
}

.pick__sel {
  border-radius: var(--r-field);
  border: 1.5px solid var(--line-2);
  background: var(--card);
  padding: 0.5rem 0.7rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

/* ── Filter popovers ────────────────────────────────────── */
.fpop {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 1rem;
  box-shadow: 0 24px 48px -24px rgb(var(--shade) / 0.4);
  z-index: 30;
}

@media (min-width: 901px) {
  .fpop {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    width: max-content;
    min-width: 240px;
    max-width: 320px;
  }
}

@media (max-width: 900px) {
  /* No room to anchor a popover under a specific button once the bar has
     wrapped to several lines, so on narrow screens every popover docks
     to the same place: a small panel near the bottom of the screen. */
  .fpop {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
    max-height: 70dvh;
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .fpop {
    animation: pop-in 0.16s var(--ease);
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.fcheck {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.92rem;
  color: var(--ink);
  cursor: pointer;
  padding: 0.3rem 0.1rem;
}

.fcheck input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
}

.fcheck i {
  color: var(--ink-3);
  font-size: 1.05rem;
}

.fcheck__n {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.rail__cap {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink-2);
}

.rail__out {
  font-family: "Baloo 2", sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.rail__empty {
  color: var(--ink-3);
  font-size: 0.87rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line-2);
  background: var(--card-2);
  color: var(--ink-2);
  padding: 0.34rem 0.75rem;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}

.chip:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.chip:active {
  transform: scale(0.96);
}

.chip.is-on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 600;
}

.chip__n {
  font-size: 0.74rem;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.pair {
  display: grid;
  /* minmax(0, 1fr), not 1fr: a bare 1fr track still refuses to shrink
     below the intrinsic min-content width of a native time input, which
     is what caused the rail to overflow its 268px column. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.55rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.field__cap {
  font-size: 0.78rem;
  color: var(--ink-3);
  font-weight: 500;
}

.field__in {
  border-radius: var(--r-field);
  border: 1.5px solid var(--line-2);
  background: var(--card-2);
  padding: 0.5rem 0.6rem;
  font-size: 0.9rem;
  width: 100%;
}

.field__in:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--line);
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--accent);
  border: 3px solid var(--card);
  box-shadow: 0 2px 6px rgb(var(--shade) / 0.28);
  cursor: grab;
}

.slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--accent);
  border: 3px solid var(--card);
  cursor: grab;
}

.slider__ends {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--ink-3);
}

/* ── Card grid ──────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--gap);
  transition: opacity 0.18s ease;
}

.grid.is-refreshing {
  opacity: 0.62;
  pointer-events: none;
}

.kard {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 1.05rem 1.1rem 0.9rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  position: relative;
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.22s;
}

.kard:hover {
  transform: translateY(-3px);
  border-color: var(--line-2);
  box-shadow: 0 18px 38px -22px rgb(var(--shade) / 0.42);
}

.kard:active {
  transform: translateY(0) scale(0.993);
}

.kard__top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  border-radius: var(--r-pill);
  padding: 0.26rem 0.66rem;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.tag--vang_lai {
  background: var(--grass-soft);
  color: var(--grass);
  border-color: var(--grass-line);
}

.tag--pass_san {
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-color: var(--accent-line);
}

.tag--cho_thue,
.tag--tim_keo {
  background: var(--paper-2);
  color: var(--ink-2);
  border-color: var(--line-2);
}

.kard__when {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  /* Some posts resolve a "Hôm nay ·" date prefix and some don't (the
     parser could not pin a date), which makes this badge's text length
     vary card to card. Without nowrap, a longer badge would word-wrap
     internally on some cards but not others, shifting the title below
     it up and down as you scan the grid - it must move as one unit or
     not at all. */
  white-space: nowrap;
  flex-shrink: 0;
}

.kard__when i {
  color: var(--ink-3);
  font-size: 1rem;
}

.kard__title {
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kard__place {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  color: var(--ink-2);
  font-size: 0.89rem;
}

.kard__place i {
  color: var(--accent);
  font-size: 1.05rem;
  flex: 0 0 auto;
  margin-top: 1px;
}

.kard__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.kard__chips li {
  border-radius: var(--r-pill);
  background: var(--paper-2);
  color: var(--ink-2);
  padding: 0.16rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 500;
}

.kard__facts {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
  padding-top: 0.7rem;
  border-top: 1px solid var(--line);
  margin-top: auto;
}

.kard__fee {
  font-family: "Baloo 2", sans-serif;
  font-weight: 800;
  font-size: 1.32rem;
  color: var(--ink);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.kard__fee small {
  font-family: "Be Vietnam Pro", sans-serif;
  white-space: nowrap;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--ink-3);
  margin-left: 0.15rem;
}

.kard__fee--free {
  color: var(--grass);
}

.kard__meta {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-size: 0.82rem;
  color: var(--ink-2);
}

.kard__meta i {
  font-size: 1rem;
  color: var(--ink-3);
}

.kard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--ink-3);
}

.kard__src {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kard__go {
  color: var(--accent-deep);
  font-weight: 600;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

/* Skeletons mirror the real card so the layout never jumps */
.bone {
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  background: var(--card);
  padding: 1.05rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 218px;
}

.bone span {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--paper-2) 25%, var(--line) 37%, var(--paper-2) 63%);
  background-size: 400% 100%;
}

@media (prefers-reduced-motion: no-preference) {
  .bone span {
    animation: sweep 1.5s ease-in-out infinite;
  }
}

@keyframes sweep {
  0% {
    background-position: 100% 0;
  }

  100% {
    background-position: 0 0;
  }
}

.bone span:nth-child(1) {
  width: 38%;
  height: 22px;
  border-radius: var(--r-pill);
}

.bone span:nth-child(2) {
  width: 92%;
  height: 16px;
}

.bone span:nth-child(3) {
  width: 66%;
}

.bone span:nth-child(4) {
  width: 44%;
  height: 24px;
  margin-top: auto;
}

/* ── Empty and error states ─────────────────────────────── */
.state {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-card);
  padding: 2.6rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.state__ico {
  font-size: 2.4rem;
  color: var(--ink-3);
  line-height: 1;
}

.state__title {
  font-family: "Baloo 2", sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.state__text {
  color: var(--ink-2);
  max-width: 46ch;
  font-size: 0.94rem;
}

.state .btn {
  margin-top: 0.6rem;
}

.more {
  display: flex;
  justify-content: center;
  margin-top: 1.6rem;
}

/* ── How it works ───────────────────────────────────────── */
.howto {
  padding-block: clamp(2.6rem, 6vw, 4.6rem);
  background: var(--paper-2);
  border-block: 1px solid var(--line);
}

.howto__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.1fr);
  gap: clamp(1.6rem, 4vw, 3.4rem);
  align-items: center;
}

.howto__shot {
  margin: 0;
  border-radius: var(--r-card);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  transform: rotate(-1.2deg);
  box-shadow: 0 22px 50px -30px rgb(var(--shade) / 0.5);
}

.howto__shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.howto__title {
  font-size: clamp(1.6rem, 3.2vw, 2.35rem);
  font-weight: 700;
  max-width: 20ch;
  margin-bottom: 1.7rem;
}

.moves {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.move {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
}

.move__ico {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--accent);
  font-size: 1.25rem;
}

.move__body h3 {
  font-family: "Be Vietnam Pro", sans-serif;
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.move__body p {
  color: var(--ink-2);
  font-size: 0.93rem;
}

/* ── FAQ ────────────────────────────────────────────────── */
.faq {
  padding-block: clamp(2.6rem, 6vw, 4.6rem);
}

.faq__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.8fr);
  gap: clamp(1.6rem, 4vw, 3.4rem);
  align-items: start;
}

.faq__title {
  font-size: clamp(1.6rem, 3.2vw, 2.35rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.asks {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.ask {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 0.85rem 1.1rem;
  transition: border-color 0.2s;
}

.ask[open] {
  border-color: var(--accent-line);
}

.ask summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.ask summary::-webkit-details-marker {
  display: none;
}

.ask summary::after {
  content: "+";
  font-family: "Baloo 2", sans-serif;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent);
  transition: transform 0.24s var(--ease);
}

.ask[open] summary::after {
  transform: rotate(45deg);
}

.ask p {
  color: var(--ink-2);
  font-size: 0.94rem;
  margin-top: 0.6rem;
  max-width: 62ch;
}

.faq__shot {
  margin: 0;
  border-radius: var(--r-card);
  overflow: hidden;
  aspect-ratio: 3 / 2;
  transform: rotate(1.6deg);
  box-shadow: 0 20px 46px -30px rgb(var(--shade) / 0.5);
}

.faq__shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Footer ─────────────────────────────────────────────── */
.foot {
  background: var(--paper-2);
  border-top: 1px solid var(--line);
  padding-block: 2.2rem;
}

.foot__grid {
  display: flex;
  gap: 1.6rem;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
}

.foot__line {
  color: var(--ink-3);
  font-size: 0.88rem;
  max-width: 46ch;
  margin-top: 0.6rem;
}

.foot__nav {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.foot__nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.9rem;
}

.foot__nav a:hover {
  color: var(--accent-deep);
}

/* ── Detail sheet ───────────────────────────────────────── */
.veil {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgb(var(--shade) / 0.42);
  backdrop-filter: blur(3px);
}

.sheet {
  position: fixed;
  z-index: 61;
  top: 0;
  right: 0;
  height: 100dvh;
  width: min(560px, 100vw);
  background: var(--card);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

@media (prefers-reduced-motion: no-preference) {
  .sheet {
    animation: slide-in 0.32s var(--ease);
  }

  .veil {
    animation: fade-in 0.25s ease;
  }
}

@keyframes slide-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--line);
}

.sheet__title {
  font-size: 1.2rem;
  font-weight: 700;
}

.sheet__close {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  color: var(--ink-2);
  cursor: pointer;
  font-size: 1.1rem;
}

.sheet__close:hover {
  color: var(--accent-deep);
}

.sheet__body {
  padding: 1.3rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.detail__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail__facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.7rem;
}

.fact {
  background: var(--paper-2);
  border-radius: var(--r-field);
  padding: 0.7rem 0.85rem;
}

.fact__cap {
  display: block;
  font-size: 0.75rem;
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.fact__val {
  font-weight: 600;
  font-size: 0.96rem;
}

/* A fact that differs by gender (price, level) gets its own full-width
   row with Nam/Nữ broken out separately, instead of one run-on string
   like "Nam: X · Nữ: Y" that wraps awkwardly in a 130px-wide cell. */
.fact--split {
  grid-column: 1 / -1;
}

.gsplit {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.gsplit__row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex: 1 1 180px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-field);
  padding: 0.5rem 0.7rem;
}

.gsplit__row i {
  align-self: center;
  color: var(--ink-3);
  font-size: 1rem;
}

.gsplit__label {
  flex: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-3);
}

.gsplit__val {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--ink);
  word-break: break-word;
}

.detail__raw {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--paper-2);
  border-radius: var(--r-field);
  padding: 1rem;
  font-size: 0.93rem;
  color: var(--ink-2);
  line-height: 1.7;
  max-height: 340px;
  overflow-y: auto;
}

.detail__acts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.detail__note {
  font-size: 0.84rem;
  color: var(--ink-3);
}

/* ── Toast ──────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  z-index: 80;
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 1.2rem;
  border-radius: var(--r-pill);
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: 0 12px 30px -12px rgb(var(--shade) / 0.6);
}

/* ── Scroll reveal, driven by IntersectionObserver ──────── */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  }

  .reveal.is-in {
    opacity: 1;
    transform: none;
  }
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 900px) {
  .shell {
    width: min(100% - 2rem, 1240px);
  }

  .howto__grid,
  .faq__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .howto__shot,
  .faq__shot {
    transform: none;
  }

  .nav__links {
    gap: 1.1rem;
  }

  .nav__links a {
    font-size: 0.88rem;
  }

  .quick__pulse {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 640px) {
  /* Below this width the nav cannot hold links on one line, and a
     two-line nav is broken. The links were only filter shortcuts, and
     the segmented control sits a few hundred pixels below anyway. */
  .nav__links {
    display: none;
  }

  .theme {
    margin-left: auto;
  }

  .qseek {
    flex: 1 1 100%;
    max-width: none;
    flex-wrap: wrap;
    border-radius: var(--r-card);
    padding: 0.6rem;
  }

  .qseek__icon {
    display: none;
  }

  .qseek__input {
    flex: 1 1 100%;
    padding-inline: 0.6rem;
  }

  .qseek__go {
    flex: 1 1 100%;
  }

  .fbar__sort {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  .grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sheet {
    width: 100vw;
    top: auto;
    bottom: 0;
    height: 92dvh;
    border-radius: var(--r-card) var(--r-card) 0 0;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .foot__grid {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}
