@font-face {
  font-family: 'Barlow Condensed';
  src: url('fonts/BarlowCondensed-SemiBold.woff2?v=20261107-NrTeXq') format('woff2');
  font-weight: 600;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #faf8f2;
  --ink: #202622;
  --muted: #50574e;
  --green: #1d624a;
  --guide-action-green: #245143;
  --red: #a6382d;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.4 system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a, button { color: inherit; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 4px; }

#visualGuide {
  max-width: 640px;
  margin: auto;
  padding: max(10px, env(safe-area-inset-top)) clamp(16px, 4vw, 32px) max(20px, env(safe-area-inset-bottom));
}
.guide-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 650;
}

.guide-bar a { display: grid; align-items: center; min-height: 44px; text-underline-offset: 4px; }
.guide-lesson h1 {
  margin: 12px 0 clamp(16px, 4vw, 28px);
  font-size: clamp(33px, 7vw, 50px);
  line-height: 1.16;
  letter-spacing: -.04em;
}

.guide-intro { --intro-inset: clamp(18px, 4.8vw, 32px); }
.intro-format, .intro-brand {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2vw, 14px);
}
.guide-intro > .intro-format {
  flex-wrap: wrap;
  margin-bottom: clamp(14px, 2.5vw, 20px);
}
:lang(vi) .guide-intro > .intro-format { font-size: clamp(23px, 5.7vw, 50px); }
.intro-brand { white-space: nowrap; }
.intro-brand svg { flex: none; width: .78em; height: .78em; color: #926e39; }
.intro-ruleset {
  padding-inline-start: clamp(8px, 2vw, 14px);
  border-inline-start: 1px solid #b7c0b8;
  color: var(--muted);
  font-size: clamp(14px, 3.3vw, 18px);
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
}
.intro-card {
  overflow: hidden;
  border: 1px solid #deded1;
  border-radius: 16px;
  background: #fffdf7;
  box-shadow: 0 8px 24px #1f372111;
}
.intro-hero {
  position: relative;
  isolation: isolate;
  padding: var(--intro-inset);
  overflow: hidden;
  background: linear-gradient(115deg, #173b31 26%, #2c5544);
  color: #faf4e4;
}
.intro-hero::before {
  position: absolute;
  z-index: -1;
  inset: -60px -68px auto auto;
  width: clamp(185px, 49%, 276px);
  aspect-ratio: 1;
  content: '';
  background: repeating-radial-gradient(circle closest-side, transparent 0 24%, #f4dcab34 24% 25%);
}
#visualHeadline {
  font-size: clamp(21px, 4.8vw, 28px);
  font-weight: 650;
  line-height: 1.16;
}
.intro-score, .headline-zero {
  font: 600 clamp(68px, 19vw, 108px)/.95 'Barlow Condensed', sans-serif;
  letter-spacing: -.035em;
}
.intro-score { color: #f4d798; }
.headline-inline {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  align-items: center;
  justify-items: center;
  gap: 4px clamp(8px, 2.5vw, 18px);
}
.headline-inline .headline-caption { grid-column: 1; color: #f4d798; }
.headline-arrow { color: #e2c98f; font-size: clamp(24px, 7vw, 41px); }
.headline-win, .headline-caption { font-size: clamp(14px, 3.6vw, 17px); }
.headline-win { grid-column: 3; color: #f4d798; white-space: nowrap; }
.intro-copy {
  padding: var(--intro-inset);
  font-size: clamp(17px, 4vw, 21px);
  line-height: 1.55;
}
.intro-copy p { margin: 0; }
.intro-copy strong { color: var(--green); }
.intro-copy .intro-result { margin-top: 12px; padding-top: 12px; border-top: 1px solid #deded1; font-weight: 700; }

.guide-diagram { display: block; width: 100%; max-width: 450px; margin: auto; overflow: hidden; }
.guide-diagram text { fill: var(--ink); font-weight: 750; font-size: 25px; }
.guide-diagram line { stroke: var(--ink); stroke-width: 2.3; }
.bull-label circle { fill: var(--paper); stroke: var(--ink); stroke-width: 1.7; }
.bull-label text { text-anchor: middle; }
.bull-label .bull-score { font-size: 37px; }
.outer-bull { fill: var(--green); }
.inner-bull { fill: var(--red); stroke: var(--paper); stroke-width: 2; }

.ring-board { width: min(100%, clamp(248px, 51svh, 422px)); }
#visualMatchBoard .board-bed { stroke: #a2aba0; stroke-width: .0035; }
#visualMatchBoard [data-example="t20"] { stroke: #fff3d3; stroke-width: .018; }
#visualMatchBoard .board-number {
  fill: #e5e1d8;
  font: 600 .126px 'Barlow Condensed', sans-serif;
  text-anchor: middle;
  dominant-baseline: central;
}
.ring-cue {
  --cue-delay: 120ms;
  --cue-light: #8de0bf;
  --cue-ink: #265b47;
  --cue-paper: #e8f3eb;
}
.ring-cue-triple {
  --cue-delay: 970ms;
  --cue-light: #ffe09a;
  --cue-ink: #79511c;
  --cue-paper: #f9edd5;
}
.ring-outline { fill: none; stroke: var(--cue-light); stroke-width: .012; opacity: .72; }
.ring-pointer path {
  fill: none;
  stroke: var(--cue-light);
  stroke-width: .018;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ring-pointer .ring-pointer-edge { stroke: var(--cue-ink); stroke-width: .036; }
.ring-pointer circle { fill: var(--cue-light); stroke: var(--cue-ink); stroke-width: .01; }
.ring-label rect { fill: var(--cue-paper); stroke: var(--cue-ink); stroke-width: .009; }
.ring-label text {
  fill: var(--cue-ink);
  font-size: .135px;
  text-anchor: middle;
  dominant-baseline: central;
}
.ring-label tspan { font-size: .17px; font-weight: 800; }

@media (prefers-reduced-motion: no-preference) {
  .ring-outline { animation: guide-ring-breathe 2.8s ease-in-out -1.4s infinite; }
  .ring-cue-triple .ring-outline { animation-delay: 0s; }
  .ring-callout { animation: guide-ring-reveal 320ms calc(var(--cue-delay) + 220ms) ease-out both; }
}
@keyframes guide-ring-breathe {
  0%, 100% { opacity: .35; stroke-width: .01; }
  50% { opacity: 1; stroke-width: .026; }
}
@keyframes guide-ring-reveal { from { opacity: 0; } }

.equation-note {
  display: grid;
  justify-items: center;
  margin-top: 8px;
  text-align: center;
}
.equation-note span, .guide-note { color: var(--muted); font-weight: 650; font-size: clamp(19px, 3.7vw, 24px); }
.guide-note { margin: 0; text-align: center; }
.equation {
  margin: 0;
  font-size: clamp(32px, 7vw, 58px);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}
.bust-definition {
  display: grid;
  gap: clamp(12px, 3.2vw, 20px);
  padding: clamp(14px, 4.4vw, 26px);
  border: 1px solid #304a3e;
  border-radius: 12px;
  background: #1a332a;
  box-shadow: 0 10px 24px #162e2322;
  color: #faf4e4;
  font-size: clamp(19px, 4.6vw, 24px);
  line-height: 1.55;
  font-weight: 650;
}
.bust-definition p { margin: 0; }
.bust-definition strong { font-weight: 800; }
.bust-art { display: block; order: -1; width: 100%; height: auto; }
:lang(vi) .bust-art text { font-size: 35px; }
.bust-meaning strong { color: #f4d798; }
.bust-effect {
  padding-top: clamp(10px, 2.8vw, 16px);
  border-top: 1px solid #8ba59469;
  color: #e0e9e0;
}

.checkout-example {
  --checkout-inset: clamp(13px, 3.5vw, 24px);
  overflow: hidden;
  border: 1px solid #deded1;
  border-radius: 12px;
  background: #fffdf7;
}
.checkout-remaining {
  margin: 0;
  padding: 8px var(--checkout-inset);
  border-bottom: 1px solid #deded1;
  color: var(--muted);
  font-size: clamp(17px, 4vw, 22px);
  font-weight: 650;
}
.checkout-remaining strong { color: var(--ink); font-size: 1.5em; }
.checkout-comparison {
  display: grid;
  grid-template-columns: clamp(82px, 25vw, 132px) minmax(0, 1fr);
  align-items: center;
  gap: clamp(12px, 4vw, 24px);
  padding: var(--checkout-inset);
}
.checkout-target {
  margin: 0;
  border: 1px solid #536358;
  border-radius: 6px;
  background: #15211d;
}
.checkout-bed { fill: none; stroke: #b5efcb; stroke-width: .012; }
.checkout-hit { fill: #b5efcb; stroke: #171d1c; stroke-width: .01; }
.checkout-options {
  display: grid;
  gap: 4px;
  width: min(100%, clamp(168px, 42vw, 248px));
  margin: 0;
  padding: 0;
  list-style: none;
}
.checkout-options li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px clamp(8px, 2.4vw, 14px);
  border-radius: 6px;
  font-size: clamp(17px, 4.8vw, 24px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.checkout-verdict {
  flex: 0 0 1em;
  color: var(--red);
  font-size: 1.35em;
  line-height: 1;
  text-align: center;
}
.checkout-options .checkout-correct { background: #e3efe5; color: var(--green); }
.checkout-correct .checkout-verdict { color: inherit; }

.guide-action { display: flex; gap: 10px; margin-top: clamp(18px, 4vw, 28px); }
.guide-primary {
  display: grid;
  flex: 1;
  min-width: 0;
  min-height: 54px;
  place-items: center;
  padding: 10px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--guide-action-green);
  color: white;
  font-weight: 750;
  font-size: 21px;
  text-align: center;
  text-decoration: none;
}
.guide-primary:hover { background: #183f34; }
.guide-secondary {
  min-height: 54px;
  padding-inline: clamp(12px, 4vw, 20px);
  border: 1px solid var(--guide-action-green);
  border-radius: 6px;
  background: transparent;
  color: var(--guide-action-green);
  font-size: 17px;
  font-weight: 650;
}
.guide-secondary:hover { background: #eaf0e9; }
#visualGuide[data-step="1"] .guide-primary {
  position: relative;
  padding-inline: 20px 48px;
  justify-items: start;
  border-radius: 10px;
  font-size: 18px;
}
#visualGuide[data-step="1"] .guide-primary::after {
  position: absolute;
  inset-inline-end: 22px;
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  content: '';
  transform: rotate(45deg);
}

@media (max-width: 350px) {
  .guide-lesson h1 { font-size: 31px; }
}
