/* ============================================================
   BOX — card-box Americana components (docs/STYLE_GUIDE.md)
   ============================================================
   Plain CSS on tokens.css, shared by the public site (site.css)
   and the app (imported into the Tailwind build). Prefix: hg-.
   Red is never a button. Gold fills buttons with a navy label.
   Gold is never text on cream.
   ============================================================ */

/* ── Type ──────────────────────────────────────────────────── */
.hg-display {
  font-family: var(--font-family-display);
  font-weight: 900;
  text-transform: uppercase;
  line-height: 0.95;
  letter-spacing: 0.01em;
}
.hg-h1 {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: clamp(2.6rem, 6vw, 4rem);
  line-height: 0.95;
  text-transform: uppercase;
  color: var(--color-text-primary);
}
.hg-h2 {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: clamp(1.6rem, 3.4vw, 2rem);
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--color-text-primary);
}
.hg-h3 {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.05;
  text-transform: uppercase;
}
/* A heading with the double rule under it (score-sheet header). */
.hg-ruled {
  border-bottom: 3px double currentColor;
  padding-bottom: 8px;
}
.hg-ruled-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  border-bottom: 3px double var(--color-text-primary);
  padding-bottom: 8px;
}
.hg-kicker {
  margin: 0;
  font-family: var(--font-family-mono);
  font-size: 0.875rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-accent-text);
}
.hg-tag {
  font-family: var(--font-family-mono);
  font-size: 0.9rem;
  color: var(--color-accent-text);
}
.hg-mono { font-family: var(--font-family-mono); }
.hg-lede { margin: 10px 0 0; max-width: 46rem; color: var(--color-text-secondary); }
.hg-quiet { color: var(--color-text-muted); font-size: 0.9rem; }
.hg-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-primary);
}

/* ── Buttons ───────────────────────────────────────────────── */
.hg-btn, .hg-btn-alt, .hg-btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  line-height: 1.1;
  border-radius: 0;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}
.hg-btn {
  background: var(--hg-gold);
  color: var(--hg-navy);
  border: 2px solid var(--hg-navy);
  box-shadow: 4px 4px 0 var(--hg-navy);
}
.hg-btn:hover { background: var(--color-primary-hover); text-decoration: none; color: var(--hg-navy); }
.hg-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--hg-navy); }
.hg-btn-alt {
  background: transparent;
  color: var(--color-text-primary);
  border: 2px solid var(--color-text-primary);
  font-weight: 700;
}
.hg-btn-alt:hover { background: rgba(29, 42, 68, 0.06); text-decoration: none; color: var(--color-text-primary); }
.hg-btn-sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.875rem;
  background: var(--hg-gold);
  color: var(--hg-navy);
  border: 2px solid var(--hg-navy);
}
.hg-btn-sm:hover { background: var(--color-primary-hover); text-decoration: none; color: var(--hg-navy); }
.hg-btn-sm.is-alt { background: transparent; color: var(--color-text-primary); border-color: var(--color-text-primary); }
.hg-btn[disabled], .hg-btn-alt[disabled], .hg-btn-sm[disabled],
.hg-btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; transform: none; }
.hg-btn-block { width: 100%; }
/* On navy (and on the red band) the gold button keeps a navy label and a
   cream edge; the outline button turns cream. */
.hg-dark .hg-btn, .hg-on-navy .hg-btn { border-color: var(--hg-cream); box-shadow: none; }
.hg-dark .hg-btn-alt, .hg-on-navy .hg-btn-alt { color: var(--hg-cream); border-color: var(--hg-cream); }
.hg-dark .hg-btn-alt:hover, .hg-on-navy .hg-btn-alt:hover { background: rgba(242, 232, 208, 0.08); }
.hg-btn:focus-visible, .hg-btn-alt:focus-visible, .hg-btn-sm:focus-visible,
.hg-chip:focus-visible, .hg-input:focus-visible {
  outline: 3px solid var(--hg-gold);
  outline-offset: 2px;
}
/* A text button: looks like a link. */
.hg-link {
  background: none;
  border: 0;
  padding: 0;
  min-height: 0;
  min-width: 0;
  font: inherit;
  font-weight: 700;
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ── Boxes ─────────────────────────────────────────────────── */
/* The score sheet: card stock, navy edge, hard shadow. */
.hg-sheet {
  background: var(--hg-card);
  color: var(--hg-navy);
  border: 2px solid var(--hg-navy);
  padding: 24px;
}
.hg-sheet.is-raised { box-shadow: 8px 8px 0 var(--hg-navy); }
/* A quieter panel on paper. */
.hg-panel {
  background: var(--hg-paper);
  color: var(--hg-navy);
  border: 2px solid var(--hg-navy);
  padding: 22px;
}
.hg-dashed {
  border: 1px dashed var(--hg-navy);
  padding: 18px 20px;
}
/* The framed box with the second rule around it (empty states, hero). */
.hg-frame {
  border: 2px solid var(--hg-navy);
  outline: 1px solid var(--hg-navy);
  outline-offset: 5px;
  background: var(--hg-paper);
  padding: 28px;
  text-align: center;
}
.hg-navy {
  background-color: var(--hg-navy);
  background-image: var(--hg-weave);
  color: var(--hg-cream);
  padding: 24px;
}
.hg-band-red {
  background-color: var(--hg-red);
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.035) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.035) 0 1px, transparent 1px 18px),
    var(--hg-red-band);
  color: #FBEFEA;
  border-top: 4px double var(--hg-gold);
  border-bottom: 4px double var(--hg-gold);
}
/* A "checked" line: navy strip, typed text. */
.hg-stamp {
  margin: 14px 0 0;
  padding: 12px 14px;
  background: var(--hg-navy);
  color: var(--hg-cream);
  font-family: var(--font-family-mono);
  font-size: 0.95rem;
}
.hg-stamp b, .hg-stamp strong { color: var(--hg-gold); }
.hg-stamp.is-bad b, .hg-stamp.is-bad strong { color: var(--hg-blush); }

/* ── Lists ─────────────────────────────────────────────────── */
.hg-rows { list-style: none; margin: 0; padding: 0; }
.hg-rows > li {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px dashed var(--color-text-primary);
}
.hg-steps { list-style: none; margin: 14px 0 0; padding: 0; }
.hg-steps > li {
  display: flex;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hg-rule);
}
.hg-steps > li:last-child { border-bottom: 0; }
.hg-steps > li > strong:first-child {
  flex: 0 0 90px;
  font-family: var(--font-family-mono);
}
/* Menu line: name …… detail */
.hg-menu { list-style: none; margin: 0; padding: 0; font-family: var(--font-family-mono); font-size: 1.05rem; }
.hg-menu > li {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px dashed var(--hg-navy);
}
.hg-menu > li > a { font-weight: 700; color: var(--hg-navy); text-decoration: none; }
.hg-menu > li > a:hover { text-decoration: underline; }
.hg-menu .hg-dots { flex: 1; border-bottom: 2px dotted #8B93A6; min-width: 16px; }

/* ── Forms ─────────────────────────────────────────────────── */
.hg-field { display: flex; flex-direction: column; gap: 6px; }
.hg-input, .hg-field input:not([type="checkbox"]):not([type="radio"]), .hg-field select, .hg-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 2px solid var(--hg-navy);
  border-radius: 0;
  background: var(--hg-paper);
  color: var(--hg-navy);
  font: 400 1.0625rem var(--font-family);
  letter-spacing: 0;
  text-transform: none;
}
textarea.hg-input, .hg-field textarea {
  padding: 12px 14px;
  font-family: var(--font-family-mono);
  line-height: 1.5;
  min-height: 120px;
}
.hg-input:focus, .hg-field input:focus, .hg-field select:focus, .hg-field textarea:focus {
  outline: 3px solid var(--hg-gold);
  outline-offset: 1px;
}
.hg-check {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 0.95rem;
  color: var(--hg-ink-2);
  padding: 12px 14px;
  border: 1px dashed var(--hg-navy);
}
.hg-check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--hg-navy); flex: none; }
.hg-check strong { color: var(--hg-navy); }
.hg-chip {
  min-height: 40px;
  padding: 0 12px;
  background: var(--hg-card);
  border: 1px solid var(--hg-navy);
  color: var(--hg-navy);
  font: 400 0.95rem var(--font-family-mono);
  cursor: pointer;
}
.hg-chip:hover { background: var(--hg-paper); }
.hg-chip.is-on, .hg-chip[aria-pressed="true"] { background: var(--hg-navy); color: var(--hg-cream); }

/* ── Header and footer (navy box lid) ──────────────────────── */
.hg-head {
  position: sticky;
  top: 0;
  z-index: var(--z-header, 50);
  background-color: var(--hg-navy);
  background-image: var(--hg-weave);
  color: var(--hg-cream);
  border-bottom: 4px double var(--hg-gold);
}
.hg-head-in {
  max-width: 1160px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}
.hg-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--hg-cream);
  text-decoration: none;
}
.hg-brand:hover { text-decoration: none; color: #fff; }
.hg-mono-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 44px;
  border: 2px solid var(--hg-gold);
  border-radius: 4px;
  outline: 1px solid var(--hg-gold);
  outline-offset: 3px;
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: 19px;
  color: var(--hg-gold);
  flex: none;
}
.hg-word {
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: 26px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.hg-beta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hg-gold);
  border-top: 1px solid var(--hg-gold);
  border-bottom: 1px solid var(--hg-gold);
  padding: 1px 4px;
}
.hg-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hg-nav a, .hg-nav button.hg-navlink {
  color: var(--hg-cream);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.hg-nav button.hg-navlink {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}
.hg-nav a:hover, .hg-nav button.hg-navlink:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.hg-nav a[aria-current="page"] {
  color: var(--hg-gold);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}
.hg-nav a.hg-nav-cta {
  background: var(--hg-gold);
  color: var(--hg-navy);
  font-weight: 800;
  padding: 0 16px;
  border: 1px solid var(--hg-cream);
}
.hg-nav a.hg-nav-cta:hover { background: var(--color-primary-hover); color: var(--hg-navy); text-decoration: none; }
.hg-foot {
  background-color: var(--hg-navy);
  background-image: var(--hg-weave);
  color: var(--hg-cream-2);
  border-top: 4px double var(--hg-gold);
}
.hg-foot-in {
  max-width: 1160px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.hg-foot-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.hg-foot a { color: var(--hg-cream); }
.hg-foot a:hover { color: #fff; }

/* ── Page frame ────────────────────────────────────────────── */
.hg-main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}
.hg-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  margin-top: 28px;
  align-items: flex-start;
}
.hg-cols > .is-wide { flex: 1 1 560px; min-width: 0; }
.hg-cols > .is-narrow { flex: 1 1 320px; min-width: 0; }
.hg-stack { display: flex; flex-direction: column; gap: 24px; }

@media (max-width: 640px) {
  .hg-head-in { padding: 10px 16px; }
  .hg-word { font-size: 22px; }
  .hg-nav { gap: 0 14px; font-size: 0.8rem; }
  .hg-main { padding: 28px 16px 48px; }
  .hg-sheet, .hg-panel { padding: 18px; }
  .hg-sheet.is-raised { box-shadow: 5px 5px 0 var(--hg-navy); }
}

/* ── Notes ─────────────────────────────────────────────────── */
.hg-note {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 2px solid var(--color-text-primary);
  border-left-width: 6px;
  background: var(--hg-paper);
  color: var(--hg-navy);
}
.hg-note p { margin: 0; }
.hg-note.is-bad { border-color: var(--hg-oxblood); color: var(--hg-oxblood); background: #FBEFEA; }
.hg-note.is-ok { border-color: var(--color-success-text); }
.hg-mono-input, .hg-field input.hg-mono-input { font-family: var(--font-family-mono); }

/* ── Tabs (navy fill on the chosen one) ─────────────────────── */
.hg-tabs { display: flex; border-bottom: 3px double var(--hg-navy); }
.hg-tabs [role="tab"] {
  min-height: 48px;
  padding: 0 20px;
  background: transparent;
  border: 0;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hg-ink-3);
  cursor: pointer;
}
.hg-tabs [role="tab"][aria-selected="true"] { background: var(--hg-navy); color: var(--hg-cream); }
.hg-tabs [role="tab"]:focus-visible { outline: 3px solid var(--hg-gold); outline-offset: -3px; }

/* ── Sign-in box ───────────────────────────────────────────── */
.hg-auth {
  max-width: 1040px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  border: 3px solid var(--hg-navy);
  outline: 1px solid var(--hg-navy);
  outline-offset: 6px;
}
.hg-auth-form { flex: 1 1 460px; min-width: 0; background: var(--hg-card); padding: 36px 40px; }
.hg-auth-side {
  flex: 1 1 340px;
  min-width: 0;
  background-color: var(--hg-navy);
  background-image: var(--hg-weave);
  color: var(--hg-cream);
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  --color-accent-text: var(--hg-gold);
}
.hg-auth-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; color: var(--hg-cream-2); }
.hg-auth-steps li { display: flex; gap: 12px; }
.hg-auth-steps span { font-family: var(--font-family-display); font-weight: 900; font-size: 1.5rem; color: var(--hg-gold); line-height: 1.1; }
@media (max-width: 640px) {
  .hg-auth { outline-offset: 3px; }
  .hg-auth-form { padding: 22px 18px; }
  .hg-auth-side { padding: 26px 20px; }
}

/* ── Game builder (core_games/pages.rs) ────────────────────── */
.cg { display: flex; flex-direction: column; gap: 12px; }
.cg-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.cg-progress { margin: 0; font-family: var(--font-family-mono); font-size: 0.95rem; color: var(--hg-ink-2); }
.cg-progress:empty { display: none; }
.cg-progress.cg-bad { color: var(--hg-oxblood); font-weight: 700; }
.cg-card h2 { margin: 0; }
.cg-notes { margin: 12px 0 0; font-size: 0.95rem; color: var(--hg-ink-2); }
.cg-summary { white-space: pre-wrap; font-size: 0.95rem; color: var(--hg-navy); margin: 10px 0 0; line-height: 1.5; }
.cg-details { margin-top: 12px; }
.cg-details summary { cursor: pointer; font-weight: 700; min-height: 32px; display: flex; align-items: center; }
.cg-details pre {
  white-space: pre-wrap;
  font-family: var(--font-family-mono);
  font-size: 0.85rem;
  color: var(--hg-ink-2);
  background: var(--hg-paper);
  border: 1px solid var(--hg-rule);
  padding: 12px;
  max-height: 360px;
  overflow: auto;
  margin: 8px 0 0;
}
.cg-said {
  margin: 0;
  padding: 14px 16px;
  background: var(--hg-card);
  border: 2px solid var(--hg-navy);
  border-left-width: 6px;
  white-space: pre-wrap;
  font-size: 0.95rem;
}
.cg-list { list-style: none; margin: 10px 0 0; padding: 0; font-family: var(--font-family-mono); font-size: 1rem; }
.cg-list li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(242, 232, 208, 0.35);
}
.cg-list li:last-child { border-bottom: 0; }
.cg-list small { display: block; font-family: var(--font-family); font-size: 0.8rem; color: var(--hg-cream-2); margin-top: 2px; }
.hg-navy .hg-link, .hg-on-navy .hg-link { color: var(--hg-gold); }
.cg-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.cg-connector code {
  font-family: var(--font-family-mono);
  font-size: 0.85rem;
  background: var(--hg-paper);
  border: 1px solid var(--hg-rule);
  padding: 1px 6px;
  user-select: all;
  word-break: break-all;
}

/* ── Advanced: the first builder, by hand ──────────────────── */
.hg-advanced { margin-top: 40px; }
.hg-advanced > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hg-navy);
  text-decoration: underline;
  text-underline-offset: 4px;
}
.hg-advanced > summary::-webkit-details-marker { display: none; }
.hg-advanced > summary::after { content: "→"; text-decoration: none; }
.hg-advanced[open] > summary::after { content: "↓"; }
.hg-advanced-body { margin-top: 16px; padding-top: 20px; border-top: 3px double var(--hg-navy); }

/* Links inside running text are underlined (Tailwind's reset removes it). */
.hg-main p a:not([class]), .hg-main li a:not([class]), .hg-quiet a, .hg-lede a, .hg-note a, .hg-check a, .cg-notes a, .hg-dashed p a {
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
}
.hg-tabs [role="tab"] { white-space: nowrap; }
@media (max-width: 480px) {
  .hg-tabs [role="tab"] { flex: 1; padding: 0 10px; font-size: 0.85rem; letter-spacing: 0.05em; }
}
.hg-foot a, .hg-head a { text-decoration: none; }
.hg-foot a:hover { text-decoration: underline; }
.hg-foot .s-foot-blurb a, .hg-foot p a { text-decoration: underline; }
@media (max-width: 640px) {
  .hg-kicker { letter-spacing: 0.12em; }
  .hg-menu > li { flex-wrap: wrap; gap: 2px 10px; }
  .hg-menu .hg-dots { display: none; }
  .hg-menu > li > span:last-child { width: 100%; font-size: 0.9rem; color: var(--hg-ink-3); }
}
.cg-details summary { list-style: none; gap: 8px; }
.cg-details summary::-webkit-details-marker { display: none; }
.cg-details summary::before { content: "+"; font-family: var(--font-family-mono); width: 1ch; }
.cg-details[open] summary::before { content: "−"; }

/* ── Table looks (core_table, store::THEMES) ─────────────────────────────
   Each theme sets the felt, the rail, the pinstripe and the card backs.
   table.css paints the table from these; the swatches below use them too. */
.ct-theme--navy, .ct {
  --t-felt-hi: #1C3A57; --t-felt: #163049; --t-felt-lo: #10263B;
  --t-weave: rgba(242, 232, 208, 0.06);
  --t-rail-hi: #9E2329; --t-rail: #7E171C; --t-rail-lo: #5A0E13; --t-rail-edge: #2A0609;
  --t-pin: #C9A84C;
  --t-back: #1D2A44; --t-back-line: rgba(201, 168, 76, 0.35); --t-back-edge: #F2E8D0; --t-back-key: #C9A84C;
}
.ct-theme--green {
  --t-felt-hi: #2A6B45; --t-felt: #1F5A37; --t-felt-lo: #123A24;
  --t-weave: rgba(242, 232, 208, 0.05);
  --t-rail-hi: #7A4E2C; --t-rail: #5C3A1E; --t-rail-lo: #3A2410; --t-rail-edge: #1E1208;
  --t-pin: #C9A84C;
  --t-back: #8C1C22; --t-back-line: rgba(242, 232, 208, 0.32); --t-back-edge: #F2E8D0; --t-back-key: #F2E8D0;
}
.ct-theme--burgundy {
  --t-felt-hi: #7A2A34; --t-felt: #5E1C25; --t-felt-lo: #3E1016;
  --t-weave: rgba(242, 232, 208, 0.05);
  --t-rail-hi: #2C3A57; --t-rail: #1D2A44; --t-rail-lo: #111A2E; --t-rail-edge: #0A1022;
  --t-pin: #C9A84C;
  --t-back: #1F4A33; --t-back-line: rgba(201, 168, 76, 0.4); --t-back-edge: #F2E8D0; --t-back-key: #C9A84C;
}
.ct-theme--black {
  --t-felt-hi: #2E2E33; --t-felt: #212125; --t-felt-lo: #141416;
  --t-weave: rgba(201, 168, 76, 0.06);
  --t-rail-hi: #3A3A3F; --t-rail: #1C1C1F; --t-rail-lo: #0B0B0C; --t-rail-edge: #000;
  --t-pin: #C9A84C;
  --t-back: #141416; --t-back-line: rgba(201, 168, 76, 0.45); --t-back-edge: #C9A84C; --t-back-key: #C9A84C;
}

/* A small picture of a look: the felt in its rail, and a card back. */
.hg-swatch { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.hg-swatch__felt {
  width: 52px; height: 30px; border-radius: 999px;
  border: 5px solid transparent;
  background:
    linear-gradient(var(--t-felt), var(--t-felt-lo)) padding-box,
    linear-gradient(160deg, var(--t-rail-hi), var(--t-rail) 45%, var(--t-rail-lo)) border-box;
  box-shadow: inset 0 0 0 1px var(--t-pin);
}
.hg-swatch__back {
  width: 20px; height: 28px; border-radius: 3px;
  background-color: var(--t-back);
  background-image:
    repeating-linear-gradient(45deg, var(--t-back-line) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(-45deg, var(--t-back-line) 0 1px, transparent 1px 4px);
  border: 1.5px solid var(--t-back-edge);
}

/* The picker when opening a table: four radio cards. */
.hg-themes { border: 0; margin: 0; padding: 0; min-width: 0; }
.hg-themes__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.hg-theme {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 8px 10px;
  border: 1px solid var(--hg-navy); background: var(--hg-paper);
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.hg-theme input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hg-theme:has(input:checked) { border: 2px solid var(--hg-navy); padding: 7px 9px; background: var(--hg-card); box-shadow: 3px 3px 0 var(--hg-navy); }
.hg-theme:has(input:focus-visible) { outline: 3px solid var(--hg-gold); outline-offset: 2px; }
@media (max-width: 380px) { .hg-themes__row { grid-template-columns: 1fr; } }

/* The header stays on screen, so in-page links land below it. */
html { scroll-padding-top: calc(var(--header-height) + var(--space-6)); }
/* A phone held sideways has no height to spare: the header scrolls away. */
@media (max-height: 500px) {
  .hg-head { position: static; }
  html { scroll-padding-top: 0; }
}
/* Phones: the header tucks away on the way down, back on the way up
   (js/header.js sets html.hg-tucked). */
@media (max-width: 720px) {
  .hg-head { transition: transform 0.2s ease; }
  html.hg-tucked .hg-head { transform: translateY(-100%); }
  html { scroll-padding-top: 0; }
}
@media (prefers-reduced-motion: reduce) { .hg-head { transition: none; } }
