/** Public pages reuse the app shell's palette, typography and layout classes. */
:root {
  --color-bg: oklch(15% 0.012 255); --color-surface: oklch(19% 0.014 255); --color-surface-raised: oklch(23% 0.016 255);
  --color-border: oklch(29% 0.016 255); --color-border-strong: oklch(38% 0.018 255);
  --color-text: oklch(95% 0.005 255); --color-text-muted: oklch(74% 0.012 255); --color-text-subtle: oklch(62% 0.014 255);
  --color-accent: oklch(80% 0.15 165); --color-accent-hover: oklch(85% 0.14 165); --color-accent-soft: oklch(30% 0.06 165); --color-on-accent: oklch(18% 0.03 165);
  --font-sans: "Inter Variable", "Inter", ui-sans-serif, system-ui, sans-serif; --radius-button: 8px;
  --bg: var(--color-bg); --surface: var(--color-surface); --border: var(--color-border); --text: var(--color-text); --muted: var(--color-text-muted); --accent: var(--color-accent);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; margin: 0; color: var(--text); background: var(--bg); font: 16px/1.7 var(--font-sans); }
.app-container { width: 100%; max-width: 1080px; margin: 0 auto; padding-inline: 24px; }
.app-hdr { position: sticky; top: 0; z-index: 30; padding-top: env(safe-area-inset-top, 0px); background: oklch(15% 0.012 255 / .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.app-hdr-row { display: flex; align-items: center; gap: 8px; min-height: 60px; }
.wordmark { display: inline-flex; flex: none; align-items: center; gap: 8px; min-height: 44px; margin-right: auto; color: var(--text); text-decoration: none; font-size: 17px; font-weight: 600; white-space: nowrap; }
.wordmark-logo { display: block; width: auto; height: 20px; }
.app-brand-sub { font-weight: 500; color: var(--muted); }
.wordmark-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 700; color: var(--color-on-accent); background: var(--accent); }
.account-area { display: flex; align-items: center; gap: 8px; }
.app-nav { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted); text-decoration: none; white-space: nowrap; }
.app-nav[aria-current=page] { background: var(--color-surface-raised); color: var(--text); }
.policy-shell { width: 100%; max-width: 768px; min-width: 0; margin: 0 auto; padding: 32px 24px 48px; line-height: 1.7; }
main { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
h1 { margin: 0 0 24px; font-size: 28px; line-height: 1.2; }
h2 { margin: 32px 0 12px; font-size: 20px; line-height: 1.3; }
h3 { margin: 24px 0 10px; font-size: 17px; line-height: 1.4; }
p, li, td, th { color: var(--muted); }
ul, ol { padding-left: 20px; }
strong, th { color: var(--text); }
a { color: var(--color-text); text-underline-offset: 3px; overflow-wrap: anywhere; touch-action: manipulation; }
.updated { font-size: 12px; margin-bottom: 0; }
.policy-toolbar { margin-bottom: 24px; }
.back { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
button { min-height: 44px; padding: 8px 12px; color: var(--text); background: var(--color-surface-raised); border: 1px solid var(--color-border-strong); border-radius: 8px; cursor: pointer; font: inherit; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.policy-table { display: block; width: 100%; min-width: 0; max-width: 100%; overflow-x: auto; margin-block: 16px; }
/* The tier column keeps its name and badge on single lines; the wrapper scrolls instead of wrapping them. */
.tier-credit-table th[scope="row"] { white-space: nowrap; }
.tier-credit-table .inline-badge { display: block; width: max-content; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; }
th, td { min-width: 110px; padding: 10px; text-align: left; vertical-align: top; border: 1px solid var(--border); }
hr { border: 0; border-top: 1px solid var(--border); margin-block: 24px; }
.site-footer { min-width: 0; padding: 32px 24px calc(48px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.app-footer-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(0, 1fr)); gap: 24px; width: 100%; max-width: 1032px; margin: 0 auto; font-size: 13px; color: var(--muted); }
.site-footer h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text); }
.site-footer-logo { display: block; width: auto; height: 20px; margin: 0 0 12px; }
.site-footer p { margin: 0; font-size: inherit; line-height: 1.7; }
.site-footer nav { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; line-height: 1.5; color: var(--muted); text-decoration: none; }
.print-version { display: none; }

/* Pricing uses the full app width; policy prose keeps a 720px reading column. */
.pricing-shell { max-width: 1080px; }
.pricing-shell h1 { font-size: 32px; font-weight: 750; letter-spacing: -.02em; }
.pricing-tiers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 32px; }
.pricing-tier { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; padding: 20px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.pricing-tier.is-featured { border-color: oklch(80% 0.15 165 / .55); background: linear-gradient(180deg, var(--color-accent-soft), var(--surface) 45%); }
.pricing-tier h3 { margin: 0; font-size: 15px; font-weight: 600; }
.tier-price { font-size: 26px; font-weight: 750; line-height: 1.3; font-variant-numeric: tabular-nums; }
.tier-price small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
.tier-price s { display: block; font-size: 12px; font-weight: 500; color: var(--color-text-subtle); }
.pricing-tier ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.pricing-tier li { display: flex; gap: 8px; }
.pricing-tier li svg { flex: none; width: 16px; height: 16px; margin-top: 3px; color: var(--accent); }
.button-primary, .button-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: var(--radius-button); border: 1px solid var(--color-border-strong); font: 600 14px/1.4 var(--font-sans); text-align: center; text-decoration: none; }
.button-primary { color: var(--color-on-accent); background: var(--accent); border-color: transparent; }
.button-secondary { color: var(--text); background: var(--color-surface-raised); }
.pricing-tier > a { width: 100%; margin-top: auto; }
.pricing-tier > .is-disabled { color: var(--color-text-subtle); background: var(--surface); border-color: var(--border); cursor: default; }
.offer-badge { position: absolute; top: -10px; left: 16px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 20px; color: var(--color-on-accent); background: var(--accent); }
.inline-badge { display: inline-flex; align-items: center; margin-top: 6px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: var(--color-on-accent); background: var(--accent); }
.packs-table { font-size: 14px; font-variant-numeric: tabular-nums; }
.packs-table th, .packs-table td { border: 0; border-bottom: 1px solid var(--border); padding: 12px; min-width: 0; }
.packs-table th { font-size: 12px; font-weight: 600; color: var(--muted); }
.packs-table td:first-child { font-weight: 700; }
.packs-table a { display: flex; margin-top: 8px; }
.packs-table small, .pack-split { display: block; font-size: 12px; font-weight: 400; color: var(--color-text-subtle); }
.pack-base { display: block; font-size: 11.5px; font-weight: 400; color: var(--color-text-subtle); text-decoration: line-through; }
.pricing-faq { display: grid; gap: 8px; margin-top: 16px; }
.pricing-faq details { padding: 0 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.pricing-faq summary { min-height: 44px; padding-block: 10px; font-weight: 600; cursor: pointer; }
.pricing-faq p { margin: 8px 0 16px; font-size: 14px; }
.launch-frame { margin: 16px 0 24px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--color-accent-soft); color: var(--color-text, inherit); }
.launch-frame[hidden] { display: none; }
.offer-countdown { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 0 0 24px; padding: 12px 16px; border-radius: 12px;
  border: 1px solid oklch(80% 0.15 165 / .35); background: linear-gradient(90deg, oklch(80% 0.15 165 / .14), oklch(80% 0.15 165 / .04)); }
.offer-countdown > svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.offer-countdown b { font-size: 14px; color: var(--text); }
.offer-countdown .oc-time { margin-left: auto; font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 700; letter-spacing: .01em; color: var(--text); }
.offer-countdown .oc-time small { margin-right: 6px; color: var(--muted); font-size: 12px; font-weight: 500; }
.offer-countdown .oc-until { flex-basis: 100%; color: var(--muted); font-size: 12px; }
.offer-countdown.is-final { border-color: oklch(84% 0.13 75 / .45); background: linear-gradient(90deg, oklch(84% 0.13 75 / .16), oklch(84% 0.13 75 / .04)); }
.offer-countdown.is-final .oc-time { color: oklch(84% 0.13 75); }
@media (hover: hover) and (pointer: fine) {
  .app-nav:hover, .site-footer a:hover { color: var(--text); }
  .button-primary:hover { background: var(--color-accent-hover); }
  .button-secondary:hover { border-color: var(--color-text-subtle); }
}
@media (max-width: 1023px) { .pricing-tiers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; } }
/* Below desktop the affiliate program keeps its header slot; the API guide stays reachable from the footer. */
@media (max-width: 1023px) { .public-nav .app-nav-wide { display: none; } }
@media (max-width: 639px) {
  .app-container { padding-inline: 16px; }
  .app-hdr-row { min-height: 56px; gap: 4px; }
  .app-brand-sub { display: none; }
  .account-area { gap: 0; }
  .app-nav { padding-inline: 8px; font-size: 13px; }
  .policy-shell { max-width: 752px; padding: 24px 16px 40px; }
  .site-footer { padding-inline: 16px; }
  .app-footer-grid, .pricing-tiers { grid-template-columns: minmax(0, 1fr); }
  .packs-table th, .packs-table td { padding: 10px 6px; }
}
@media screen and (max-width: 639px) {
  .public-header { position: fixed; inset: 0 0 auto; }
  body:has(> .public-header) { padding-top: calc(56px + env(safe-area-inset-top, 0px)); }
  .public-header .app-hdr-row { flex-wrap: wrap; }
  .public-nav { flex-wrap: wrap; justify-content: flex-end; min-width: 0; }
  .public-nav .app-nav { padding-inline: 6px; font-size: 12px; }
  .public-home { display: none; } /* The logo keeps the home link reachable. */
}

@page {
  margin: 18mm 12mm 22mm;
  @bottom-center { content: "Phiên bản 2.0 · " counter(page); }
}
@media print {
  body { min-height: 0; padding: 0; color: #000; background: #fff; }
  .policy-shell { width: 100%; padding: 0; border: 0; background: #fff; }
  .app-hdr, .policy-toolbar, nav, .site-footer, button { display: none !important; }
  p, li, td, th, strong, a { color: #000; }
  h1, h2, h3 { break-after: avoid; }
  .policy-table { overflow: visible; }
  table { table-layout: fixed; }
  td, th { min-width: 0; padding: 5px; overflow-wrap: anywhere; border-color: #777; }
  .print-version { display: block; font-size: 10pt; margin-top: 24px; }
}

/* Shared press and accessibility states; footer navigation retains its own style. */
:is(.btn, .button-primary, .button-secondary, .button-ghost, button, .back-btn, .related a) { transition: transform 120ms ease-out; }
:is(.btn, .button-primary, .button-secondary, .button-ghost, button, .back-btn, .related a):active:not(:disabled):not([aria-disabled="true"]) { transform: scale(.97); }
.pricing-tier > .is-disabled, :is(.button-primary, .button-secondary):is(:disabled, [aria-disabled="true"]) {
  color: var(--color-text-subtle); background: var(--color-surface); border: 1px dashed var(--color-border-strong); box-shadow: none; cursor: not-allowed;
}
.back-btn { min-height: 44px; }
.policy-body .prose-link { display: inline; min-height: 0; }
@media (max-width: 899px) { .related { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  :is(.btn, .button-primary, .button-secondary, .button-ghost, button, .back-btn, .related a) { transition: none; }
  :is(.btn, .button-primary, .button-secondary, .button-ghost, button, .back-btn, .related a):active { transform: none; }
}

/* Approved purchase and button system. */
:is(.btn, .button-primary, .button-secondary, .button-ghost, .pay-btn) { min-height: 44px; padding: 0 18px; border-radius: 10px; font: 600 14px/1 var(--font-sans); letter-spacing: .005em;
  transition: transform 120ms ease-out; }
.btn-lg { min-height: 50px; font-size: 15px; }
:is(.btn-primary, .button-primary, .pay-btn-primary) { color: var(--color-on-accent); background: linear-gradient(180deg, oklch(84% 0.15 165), var(--color-accent));
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / .28), 0 1px 2px oklch(5% 0 0 / .5), 0 6px 18px -8px oklch(80% 0.15 165 / .55); }
@media (hover: hover) and (pointer: fine) { :is(.btn-primary, .button-primary, .pay-btn-primary):hover { background: linear-gradient(180deg, oklch(88% 0.14 165), var(--color-accent-hover)); } }
:is(.btn-secondary, .button-secondary, .pay-btn-secondary) { color: var(--color-text); background: linear-gradient(180deg, oklch(26% 0.016 255), var(--color-surface-raised));
  border: 1px solid var(--color-border-strong); box-shadow: inset 0 1px 0 oklch(100% 0 0 / .06), 0 1px 2px oklch(5% 0 0 / .4); }
@media (hover: hover) and (pointer: fine) { :is(.btn-secondary, .button-secondary, .pay-btn-secondary):hover { border-color: oklch(50% 0.02 255); } }
:is(.btn-quiet, .button-ghost, .pay-btn-ghost) { color: var(--color-text-muted); background: transparent; border: 1px solid var(--color-border); }
:is(.btn, .button-primary, .button-secondary, .button-ghost, .pay-btn)[aria-disabled="true"], :is(.btn, .button-primary, .button-secondary, .button-ghost, .pay-btn):disabled { color: var(--color-text-subtle); background: var(--color-surface); border: 1px dashed var(--color-border-strong); box-shadow: none; cursor: not-allowed; }
:is(.btn, .button-primary, .button-secondary, .button-ghost, .pay-btn) svg { width: 16px; height: 16px; }

.back-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px 0 8px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--color-text-muted); background: var(--color-surface); border: 1px solid var(--color-border); text-decoration: none; }
@media (hover: hover) and (pointer: fine) { .back-btn:hover { color: var(--color-text); border-color: var(--color-border-strong); } }
.back-btn svg { width: 16px; height: 16px; }
.prose-link { color: var(--color-text); text-decoration: underline; text-decoration-color: oklch(60% 0.02 255 / .6); text-underline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .prose-link:hover { text-decoration-color: var(--color-accent); } }
.related { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.related a { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; padding: 12px 14px; border-radius: 12px;
  color: var(--color-text); text-decoration: none; background: var(--color-surface); border: 1px solid var(--color-border); font-size: 14px; font-weight: 600; }
.related a small { display: block; margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--color-text-muted); }
.related a svg { flex: none; width: 16px; height: 16px; color: var(--color-text-subtle); }
@media (hover: hover) and (pointer: fine) { .related a:hover { border-color: var(--color-border-strong); } }

/* These states follow the shared button definitions so reduced motion wins the cascade. */
.back-btn { min-height: 44px; }
@media (max-width: 899px) { .related { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  :is(.btn, .button-primary, .button-secondary, .button-ghost, button, .back-btn, .related a) { transition: none; }
  :is(.btn, .button-primary, .button-secondary, .button-ghost, button, .back-btn, .related a):active:not(:disabled):not([aria-disabled="true"]) { transform: none; }
}

/* Policy navigation matches the approved single-row secondary toolbar. */
.policy-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: nowrap; }
.policy-toolbar :is(.back-btn, .btn-sm) { display: inline-flex; align-items: center; justify-content: center; flex: none; gap: 6px; height: 40px; min-height: 40px; padding: 0 14px; border-radius: 10px; font: 600 13px/1 var(--font-sans); white-space: nowrap; position: relative; color: var(--color-text); background: linear-gradient(180deg, oklch(26% 0.016 255), var(--color-surface-raised)); border: 1px solid var(--color-border-strong); box-shadow: inset 0 1px 0 oklch(100% 0 0 / .06), 0 1px 2px oklch(5% 0 0 / .4); }
.policy-toolbar .has-lead { padding-left: 10px; }
.policy-toolbar :is(.back-btn, .btn-sm)::after { content: ""; position: absolute; inset: -2px 0; }
.policy-toolbar svg { width: 16px; height: 16px; flex: none; }
main .prose-link { display: inline; min-height: 0; font-weight: 600; text-decoration-thickness: 1px; }
@media (hover: hover) and (pointer: fine) { .policy-toolbar :is(.back-btn, .btn-sm):hover { border-color: oklch(50% 0.02 255); } }
@media print { main .prose-link { color: #000; text-decoration-color: #777; } }
