/* TinyFingers — shared foundation, public site + private admin.
   Edit tokens and primitives here. Page styles own composition, not theme values.
   No remote fonts, JavaScript dependency, or compilation required. */
:root {
  color-scheme: dark;
  --tf-color-scheme: dark;
  --tf-bg: #080f17;
  --tf-surface: #111d27;
  --tf-surface-raised: #192833;
  --tf-text: #f5e7d6;
  --tf-muted: #b7c3c9;
  --tf-subtle: #91a3ad;
  --tf-border: #30414d;
  --tf-control-border: #647987;
  --tf-accent: #ffb64f;
  --tf-accent-text: var(--tf-accent);
  --tf-accent-border: var(--tf-accent);
  --tf-accent-soft: rgb(255 182 79 / 12%);
  --tf-accent-hover: #ffc773;
  --tf-on-accent: #17212a;
  --tf-link: #a9d9ee;
  --tf-danger: #ffa7a0;
  --tf-success: #a5d7b3;
  --tf-font: 'Avenir Next', ui-rounded, 'Trebuchet MS', sans-serif;
  --tf-font-mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  --tf-text-xs: .75rem;
  --tf-text-sm: .875rem;
  --tf-text-base: 1rem;
  --tf-text-lg: 1.125rem;
  --tf-heading: clamp(2rem, 4vw, 3.75rem);
  --tf-leading: 1.65;
  --tf-weight-medium: 600;
  --tf-weight-bold: 700;
  --tf-space-1: .25rem;
  --tf-space-2: .5rem;
  --tf-space-3: .75rem;
  --tf-space-4: 1rem;
  --tf-space-6: 1.5rem;
  --tf-space-8: 2rem;
  --tf-space-12: 3rem;
  --tf-space-16: 4rem;
  --tf-radius-sm: 8px;
  --tf-radius: 12px;
  --tf-radius-lg: 20px;
  --tf-radius-round: 999px;
  --tf-control-height: 44px;
  --tf-control-height-compact: 32px;
  --tf-table-font-size: .8125rem;
  --tf-table-cell-padding: .5rem .625rem;
  --tf-table-line-height: 1.35;
  --tf-button-padding: .7rem 1.25rem;
  --tf-select-icon-inset: var(--tf-space-4);
  --tf-select-icon-half: .375rem;
  --tf-shell: 1152px;
  --tf-gutter: clamp(1rem, 4vw, 3rem);
  --tf-reading-width: 68ch;
  --tf-shadow: 0 16px 48px rgb(2 8 14 / 24%);
  --tf-header-bg: rgb(8 15 23 / 96%);
  --tf-backdrop: rgb(2 8 14 / 72%);
  --tf-focus-ring: 3px solid var(--tf-link);
  --tf-motion: 160ms;
  --tf-ease: cubic-bezier(.2, .7, .3, 1);
}

/* Appearance belongs to the adult interface. The game canvas has its own palette.
   Missing or invalid preferences deliberately retain the original night theme. */
:root[data-tf-appearance="light"] {
  color-scheme: light;
  --tf-color-scheme: light;
  --tf-bg: #fbf8f1;
  --tf-surface: #ffffff;
  --tf-surface-raised: #f1eee7;
  --tf-text: #172b3a;
  --tf-muted: #526472;
  --tf-subtle: #5d6c77;
  --tf-border: #d9d9d0;
  --tf-control-border: #7b837f;
  --tf-accent-text: #895314;
  --tf-accent-border: #895314;
  --tf-accent-soft: #fff0d7;
  --tf-link: #236179;
  --tf-danger: #a8423b;
  --tf-success: #2f6b4d;
  --tf-shadow: 0 16px 48px rgb(23 43 58 / 10%);
  --tf-header-bg: rgb(251 248 241 / 96%);
  --tf-backdrop: rgb(23 43 58 / 46%);
}

[hidden] { display: none !important; }

/* Public header geometry: shared by the welcome screen and every resource page. */
:root {
  --tf-header-height: 84px;
  --tf-header-gutter: 32px;
  --tf-shell-width: min(var(--tf-shell), calc(100% - 2 * max(var(--tf-header-gutter), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px))));
  --tf-page-start: 32px;
  --tf-page-end: 64px;
}
.tf-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--tf-header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--tf-border);
  color: var(--tf-text);
  -webkit-font-smoothing: antialiased;
}
.tf-header-inner {
  width: var(--tf-shell-width);
  max-width: none;
  height: var(--tf-header-height);
  min-height: var(--tf-header-height);
  margin-inline: auto;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}
.tf-header .tf-brand {
  justify-self: start;
  min-height: var(--tf-control-height);
  gap: .45rem;
  font: var(--tf-weight-bold) 1.4rem / 1 var(--tf-font);
  letter-spacing: -.05em;
  white-space: nowrap;
}
.tf-header .tf-brand img { display: block; width: 32px; height: 32px; flex: 0 0 32px; }
.tf-header-nav { display: flex; align-items: center; justify-self: center; gap: 12px; }
.tf-header-actions { display: flex; align-items: center; justify-content: flex-end; justify-self: end; gap: 12px; }
/* Quiet, stable targets: the icon announces the next appearance in its name.
   Visible text in the mobile drawer also states the current appearance. */
.tf-appearance-toggle {
  box-sizing: border-box;
  display: inline-flex;
  flex: 0 0 var(--tf-control-height);
  align-items: center;
  justify-content: center;
  gap: var(--tf-space-3);
  min-width: var(--tf-control-height);
  width: var(--tf-control-height);
  min-height: var(--tf-control-height);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--tf-radius-sm);
  background: transparent;
  color: var(--tf-muted);
  font: 500 var(--tf-text-sm) / 1.4 var(--tf-font);
  cursor: pointer;
  touch-action: manipulation;
  transition: color var(--tf-motion) var(--tf-ease), background-color var(--tf-motion) var(--tf-ease);
}
.tf-appearance-toggle svg, [data-tf-appearance-icon] { display: block; width: 20px; height: 20px; flex: 0 0 20px; }
.tf-appearance-toggle--label { width: 100%; flex-basis: auto; justify-content: flex-start; padding: var(--tf-space-3) var(--tf-space-4); text-align: start; }
.tf-appearance-toggle--label [data-tf-appearance-label] { min-width: 0; overflow-wrap: anywhere; }
.tf-appearance-toggle:focus-visible { outline: var(--tf-focus-ring); outline-offset: 3px; }
@media (hover: hover) {
  .tf-appearance-toggle:hover { color: var(--tf-accent-text); background: var(--tf-surface-raised); }
}
.drawer-footer .tf-appearance-toggle--label, #home-navigation .tf-appearance-toggle--label { display: none; }
.tf-appearance-drawer-language { width: 100%; }
.tf-appearance-drawer-language .locale-menu-trigger { width: 100%; justify-content: flex-start; }
.tf-appearance-drawer-language .locale-menu-trigger-code { display: inline; }
.tf-appearance-drawer-language .locale-menu-panel {
  inset-inline: 0;
  top: auto;
  bottom: calc(100% + var(--tf-space-2));
  min-width: 0;
  width: 100%;
  max-width: 100%;
  max-height: min(360px, calc(100vh - var(--tf-header-height) - 160px));
  max-height: min(360px, calc(100dvh - var(--tf-header-height) - 160px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (max-width: 379px) {
  /* Keep the drawer itself reachable on short screens. The language list opens
     into the space above its trigger, inside this scrolling boundary. */
  .mobile-drawer {
    max-height: calc(100vh - var(--tf-header-height) - env(safe-area-inset-top, 0px) - 20px);
    max-height: calc(100dvh - var(--tf-header-height) - env(safe-area-inset-top, 0px) - 20px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
.tf-header-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--tf-control-height);
  height: var(--tf-control-height);
  padding: 0;
  border: 1px solid var(--tf-control-border);
  border-radius: var(--tf-radius-sm);
  background: var(--tf-surface);
  color: var(--tf-text);
  cursor: pointer;
}
.tf-header-menu-toggle svg { width: 20px; height: 20px; }
.tf-header-menu-toggle:focus-visible { outline: var(--tf-focus-ring); outline-offset: 3px; }
@media (max-width: 1120px) {
  :root { --tf-header-height: 72px; }
  .tf-header-inner { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; }
  .tf-header-nav, .tf-header-desktop-only { display: none; }
  .tf-header-menu-toggle { display: inline-flex; }
  .tf-header-actions { gap: 8px; }
  .drawer-footer .tf-appearance-toggle--label, #home-navigation .tf-appearance-toggle--label { display: inline-flex; }
}
@media (max-width: 780px) { :root { --tf-header-gutter: 20px; --tf-page-start: 24px; --tf-page-end: 44px; } }
@media (max-width: 600px) {
  /* The brand is a fixed logo; enlarged reading text must not push the global
     appearance/menu targets out of the narrow header. Keep this unlayered with
     the canonical brand rule, above page-adapter layer precedence. */
  .tf-header .tf-brand { font-size: clamp(20px, 5.75vw, 22.4px); gap: 7.2px; }
}
@media (max-width: 480px) { :root { --tf-header-gutter: 16px; } }

.tf-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--tf-space-2);
  min-height: var(--tf-control-height);
  padding: 0 var(--tf-space-1);
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--tf-muted);
  font: 500 var(--tf-text-sm) / 1.4 var(--tf-font);
  text-decoration: none;
  box-shadow: none;
  transform: none;
  transition: color var(--tf-motion) var(--tf-ease);
}
.tf-nav-link[aria-current='page'] { color: var(--tf-accent-text); background: transparent; }
.tf-nav-link[aria-current='page']::after {
  content: '';
  position: absolute;
  inset-inline: var(--tf-space-1);
  bottom: 2px;
  height: 2px;
  background: var(--tf-accent-text);
}
.tf-nav-link--drawer { justify-content: space-between; width: 100%; padding: var(--tf-space-3) var(--tf-space-4); border-radius: var(--tf-radius-sm); }
.tf-nav-link--drawer[aria-current='page']::after { inset-inline: var(--tf-space-4); }
@media (hover: hover) {
  .tf-nav-link:hover { color: var(--tf-accent-text); background: transparent; border-color: transparent; box-shadow: none; transform: none; }
}
.tf-nav-link:focus-visible { outline: var(--tf-focus-ring); outline-offset: 4px; }

.tf-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--tf-space-2);
  min-height: var(--tf-control-height);
  max-width: 100%;
  padding: var(--tf-button-padding);
  border: 1px solid var(--tf-control-border);
  border-radius: var(--tf-radius-sm);
  background: var(--tf-surface);
  color: var(--tf-text);
  font: var(--tf-weight-medium) var(--tf-text-sm) / 1.35 var(--tf-font);
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color var(--tf-motion) var(--tf-ease),
    border-color var(--tf-motion) var(--tf-ease), transform var(--tf-motion) var(--tf-ease);
}

.tf-button--primary {
  background: var(--tf-accent);
  border-color: var(--tf-accent);
  color: var(--tf-on-accent);
}

.tf-button--quiet {
  background: transparent;
  border-color: transparent;
}

.tf-button--link { color: var(--tf-link); }

.tf-button--danger {
  color: var(--tf-danger);
}

.tf-button--large {
  min-height: 58px;
  padding: .9rem 2rem;
  font-size: var(--tf-text-lg);
}

.tf-button--pill { border-radius: var(--tf-radius-round); }

.tf-button:is([aria-pressed='true'], [aria-selected='true'], [aria-current='page']) {
  background: var(--tf-accent);
  border-color: var(--tf-accent);
  color: var(--tf-on-accent);
}

@media (hover: hover) {
  .tf-button:hover { background: var(--tf-surface-raised); border-color: var(--tf-subtle); }
  .tf-button--primary:hover,
  .tf-button:is([aria-pressed='true'], [aria-selected='true'], [aria-current='page']):hover { background: var(--tf-accent-hover); border-color: var(--tf-accent-hover); color: var(--tf-on-accent); }
}

.tf-button:active { transform: translateY(1px); }
.tf-button:disabled, .tf-button[aria-disabled='true'] { opacity: .5; cursor: not-allowed; transform: none; }

.tf-field {
  display: grid;
  gap: var(--tf-space-2);
  color: var(--tf-text);
  font: var(--tf-weight-medium) var(--tf-text-sm) / var(--tf-leading) var(--tf-font);
}

.tf-input {
  color-scheme: var(--tf-color-scheme);
  min-width: 0;
  width: 100%;
  min-height: var(--tf-control-height);
  padding: .7rem .875rem;
  border: 1px solid var(--tf-control-border);
  border-radius: var(--tf-radius-sm);
  background: var(--tf-bg);
  color: var(--tf-text);
  font: 400 1rem / 1.45 var(--tf-font);
}

.tf-input::placeholder { color: var(--tf-subtle); opacity: 1; }
select.tf-input { appearance: auto; }
select.tf-input:not([multiple]):is(:not([size]), [size='1']) {
  -webkit-appearance: none;
  appearance: none;
  padding-inline-end: calc(var(--tf-select-icon-inset) + 2 * var(--tf-select-icon-half) + var(--tf-space-3));
  background-image:
    linear-gradient(45deg, transparent 42%, var(--tf-muted) 42% 58%, transparent 58%),
    linear-gradient(135deg, transparent 42%, var(--tf-muted) 42% 58%, transparent 58%);
  background-position: right calc(var(--tf-select-icon-inset) + var(--tf-select-icon-half)) center, right var(--tf-select-icon-inset) center;
  background-size: var(--tf-select-icon-half) var(--tf-select-icon-half);
  background-repeat: no-repeat;
  cursor: pointer;
}
select.tf-input:not([multiple]):is(:not([size]), [size='1']):dir(rtl) {
  background-position: left var(--tf-select-icon-inset) center, left calc(var(--tf-select-icon-inset) + var(--tf-select-icon-half)) center;
}
.tf-input[aria-invalid='true'] { border-color: var(--tf-danger); }
.tf-table { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; font-size: var(--tf-table-font-size); line-height: var(--tf-table-line-height); }
.tf-table th, .tf-table td { padding: var(--tf-table-cell-padding); vertical-align: middle; }
.tf-table th { text-align: start; }
.tf-table.tf-table--reading { table-layout: auto; font-size: var(--tf-text-sm); line-height: var(--tf-leading); }
@media (min-width: 901px) and (pointer: fine) {
  .tf-button.tf-button--compact { min-height: var(--tf-control-height-compact); padding: .35rem .625rem; font-size: var(--tf-text-xs); }
  .tf-button.icon-button.tf-button--compact, .tf-button.lead-action-button.tf-button--compact { width: var(--tf-control-height-compact); min-width: var(--tf-control-height-compact); height: var(--tf-control-height-compact); min-height: var(--tf-control-height-compact); padding: 0; }
  .tf-input.tf-input--compact { min-height: var(--tf-control-height-compact); padding-block: .3rem; font-size: var(--tf-table-font-size); }
}
.tf-reading { max-width: var(--tf-reading-width); color: var(--tf-muted); font-size: var(--tf-text-base); line-height: var(--tf-leading); text-wrap: pretty; }
.tf-reading p { margin: 0; }
.tf-reading p + p { margin-top: var(--tf-space-4); }
.tf-reading .tf-reading-lead { color: var(--tf-text); }
.tf-resource-links { display: grid; gap: var(--tf-space-2); margin: var(--tf-space-4) 0 0; padding: 0; list-style: none; }
.tf-resource-links a { display: flex; align-items: center; justify-content: space-between; gap: var(--tf-space-4); min-height: var(--tf-control-height); padding-block: var(--tf-space-2); color: var(--tf-link); font: 500 var(--tf-text-sm) / 1.5 var(--tf-font); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; transition: color var(--tf-motion) var(--tf-ease); }
.tf-resource-links a:focus-visible { outline: var(--tf-focus-ring); outline-offset: 4px; border-radius: var(--tf-radius-sm); }
@media (hover: hover) {
  .tf-resource-links a:hover { color: var(--tf-accent-text); }
}

.tf-help { color: var(--tf-muted); font-size: var(--tf-text-sm); font-weight: 400; }
.tf-help-box {
  display: grid;
  gap: var(--tf-space-3);
  padding: var(--tf-space-6);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius-sm);
  background: var(--tf-surface-raised);
  color: var(--tf-muted);
  font-size: var(--tf-text-sm);
  line-height: var(--tf-leading);
}
.tf-help-box > p { margin: 0; }
.tf-disclosure-trigger { gap: var(--tf-space-2); padding-inline: var(--tf-space-3); color: var(--tf-link); white-space: nowrap; list-style: none; }
.tf-disclosure-trigger::-webkit-details-marker { display: none; }
.tf-info-trigger { width: var(--tf-control-height); min-width: var(--tf-control-height); height: var(--tf-control-height); padding: 0; border-radius: 50%; color: var(--tf-link); font-size: 1.125rem; font-weight: 700; }
.tf-info-trigger[aria-expanded="true"], details[open] > .tf-info-trigger { background: var(--tf-surface-raised); border-color: var(--tf-control-border); }
.tf-disclosure-chevron { width: 16px; height: 16px; flex-shrink: 0; transition: transform var(--tf-motion) var(--tf-ease); }
.tf-disclosure-trigger[aria-expanded="true"] .tf-disclosure-chevron,
details[open] > .tf-disclosure-trigger .tf-disclosure-chevron { transform: rotate(180deg); }
.tf-disclosure-content { margin-top: var(--tf-space-4); padding-top: var(--tf-space-4); border-top: 1px solid var(--tf-border); color: var(--tf-muted); font-size: var(--tf-text-sm); line-height: var(--tf-leading); }
.tf-disclosure-content > p { margin: 0; }
@media (prefers-reduced-motion: reduce) {
  .tf-disclosure-chevron { transition: none; }
}
.tf-error { color: var(--tf-danger); font-size: var(--tf-text-sm); }
.tf-surface { background: var(--tf-surface); border: 1px solid var(--tf-border); border-radius: var(--tf-radius); }

/* Reports retain a distinct slate/sage surface in each appearance. Local tokens
   keep their fields, text, links and statuses consistent with the report. */
.tf-report {
  color-scheme: var(--tf-color-scheme);
  --tf-bg: #132329;
  --tf-surface: #1a2c32;
  --tf-surface-raised: #243940;
  --tf-muted: #d0dce1;
  --tf-subtle: #b8cbd3;
  --tf-link: #c0e4f4;
  --tf-success: #b9e8c6;
  --tf-border: #435a62;
  --tf-control-border: #78919b;
  color: var(--tf-text);
  background: var(--tf-surface);
  border: 1px solid var(--tf-border);
  border-radius: var(--tf-radius-lg);
}
:root[data-tf-appearance="light"] .tf-report {
  --tf-bg: #e8f0e9;
  --tf-surface: #eff5ef;
  --tf-surface-raised: #ffffff;
  --tf-text: #172b3a;
  --tf-muted: #4b6054;
  --tf-subtle: #52665b;
  --tf-link: #236179;
  --tf-success: #2f6b4d;
  --tf-border: #a9bdb0;
  --tf-control-border: #718779;
}
.tf-eyebrow { color: var(--tf-accent-text); font-size: var(--tf-text-xs); font-weight: var(--tf-weight-medium); letter-spacing: .15em; text-transform: uppercase; }
.tf-brand { display: inline-flex; align-items: center; gap: .45rem; color: var(--tf-text); font: var(--tf-weight-bold) 1.4rem / 1 var(--tf-font); letter-spacing: -.05em; text-decoration: none; }
.tf-brand img { width: 32px; height: 32px; }
.tf-dialog-home { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--tf-space-2) var(--tf-space-3); min-height: var(--tf-control-height); color: var(--tf-link); text-decoration: none; border-radius: var(--tf-radius-sm); }
.tf-dialog-home .tf-brand { font-size: 1.125rem; }
.tf-dialog-home .tf-brand img { width: 24px; height: 24px; }
.tf-dialog-home-label { font: var(--tf-weight-medium) var(--tf-text-xs) / 1.4 var(--tf-font); white-space: nowrap; }
.tf-dialog-home:hover .tf-dialog-home-label { text-decoration: underline; text-underline-offset: .2em; }
.tf-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .6rem; border: 1px solid var(--tf-border); border-radius: var(--tf-radius-sm); color: var(--tf-muted); font-size: var(--tf-text-xs); }
.tf-badge--success { color: var(--tf-success); }
.tf-badge--danger { color: var(--tf-danger); }
.tf-inline-stats { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--tf-space-2) var(--tf-space-6); margin: 0; color: var(--tf-muted); font-size: var(--tf-text-sm); line-height: 1.5; }
.tf-inline-stats > span { display: inline-flex; align-items: flex-start; gap: var(--tf-space-2); }
.tf-inline-stats > span > span:last-child { text-align: start; text-wrap: balance; }
.tf-inline-stats .tf-status-dot { margin-block-start: .5em; }
.tf-inline-stats strong { color: var(--tf-text); font-weight: var(--tf-weight-medium); font-variant-numeric: tabular-nums; }
.tf-status-dot { display: inline-block; width: 7px; height: 7px; flex-shrink: 0; border-radius: 50%; background: var(--tf-success); }
.tf-inline-stats-icon { width: 18px; height: 18px; flex-shrink: 0; color: var(--tf-accent-text); }
.tf-skip-link { position: fixed; inset-block-start: .5rem; inset-inline-start: 1rem; z-index: 200; padding: .75rem 1rem; background: var(--tf-accent); color: var(--tf-on-accent); border-radius: var(--tf-radius-sm); transform: translateY(-200%); font: 600 1rem var(--tf-font); }
.tf-skip-link:focus { transform: translateY(0); }
/* A static dialog heading can receive initial reading focus without looking
   actionable. Keyboard focus indicators on dialog controls remain visible. */
:where([role="dialog"], dialog) :is(h1, h2, h3)[tabindex="-1"]:focus { outline: none; }
.tf-button:focus-visible, .tf-input:focus-visible, .tf-brand:focus-visible, .tf-dialog-home:focus-visible, .tf-skip-link:focus-visible { outline: var(--tf-focus-ring); outline-offset: 4px; }
[role="dialog"] [data-tf-keyboard-focus]:focus { outline: var(--tf-focus-ring); outline-offset: 4px; }

/* Browser preferences are part of the component contract. */
@media (prefers-reduced-motion: reduce) {
  :root { --tf-motion: 0ms; }
  .tf-button:active { transform: none; }
}
@media (forced-colors: active) {
  .tf-button, .tf-input, .tf-surface, .tf-badge, .tf-appearance-toggle { border-color: ButtonText; }
  .tf-button:focus-visible, .tf-input:focus-visible, [role="dialog"] [data-tf-keyboard-focus]:focus { outline-color: Highlight; }
  select.tf-input:not([multiple]):is(:not([size]), [size='1']) { -webkit-appearance: auto; appearance: auto; background-image: none; padding-inline-end: var(--tf-space-4); }
}

/* Visibility must also outrank the generic navigation-link display. */
.tf-header-mobile-only { display: none; }
@media (max-width: 1120px) {
  .tf-header-mobile-only { display: inline-flex; }
  .tf-header-desktop-only { display: none; }
}

/* Key representations share their visual states across tools and help content.
   Row geometry belongs to the consuming layout, not this primitive. */
.tf-keycap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tf-control-height);
  min-width: var(--tf-control-height);
  padding: var(--tf-space-2);
  border: 1px solid var(--tf-control-border);
  border-radius: var(--tf-radius-sm);
  background: var(--tf-surface-raised);
  color: var(--tf-muted);
  font: var(--tf-weight-medium) var(--tf-text-xs) / 1.2 var(--tf-font);
  transition: background var(--tf-motion) var(--tf-ease), color var(--tf-motion) var(--tf-ease), border-color var(--tf-motion) var(--tf-ease);
}
.tf-keycap.is-tested { color: var(--tf-success); border-color: var(--tf-success); }
.tf-keycap.is-tested::after,
.tf-keycap.is-active::after {
  content: '✓';
  position: absolute;
  top: 1px;
  right: 3px;
  font-size: .6rem;
  line-height: 1;
}
.tf-keycap.is-active {
  color: var(--tf-on-accent);
  background: var(--tf-accent);
  border-color: var(--tf-accent-border);
}
.tf-keycap.is-active::after { content: '↓'; }
.tf-keycap.is-excluded { color: var(--tf-subtle); border-style: dashed; }
.tf-keycap.is-excluded::after { content: '−'; position: absolute; top: 1px; right: 3px; }
@media (forced-colors: active) {
  .tf-keycap { border-color: ButtonText; }
  .tf-keycap.is-tested { border-style: double; border-color: ButtonText; }
  .tf-keycap.is-active { background: Highlight; color: HighlightText; }
}

/* Native disclosures can sit beside a workspace without inheriting a card. */
.tf-disclosure { padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }

/* Bounded sections keep adjacent, independently expanded tools panels clear. */
.tf-disclosure--section { min-width: 0; border: 1px solid var(--tf-border); border-radius: var(--tf-radius-sm); }
.tf-disclosure--section[open] { border-color: var(--tf-control-border); }
.tf-disclosure--section > .tf-disclosure-trigger {
  display: flex; justify-content: space-between; align-items: center; gap: var(--tf-space-4);
  width: 100%; min-height: 52px; padding: var(--tf-space-4);
  /* An explicit inner radius also works through the native summary slot. */
  border: 0; border-radius: max(0px, calc(var(--tf-radius-sm) - 1px)); color: var(--tf-text); background: transparent;
  text-align: start; white-space: normal; font-size: var(--tf-text-base); font-weight: var(--tf-weight-bold); line-height: 1.4; transform: none;
}
.tf-disclosure--section[open] > .tf-disclosure-trigger { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.tf-disclosure--section > .tf-disclosure-trigger > span { min-width: 0; overflow-wrap: anywhere; }
.tf-disclosure--section > .tf-disclosure-trigger .tf-disclosure-chevron { margin-inline-start: auto; color: var(--tf-link); }
.tf-disclosure--section > .tf-disclosure-trigger:focus-visible { outline: var(--tf-focus-ring); outline-offset: -4px; }
.tf-disclosure--section > .tf-disclosure-content {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--tf-space-4);
  margin: 0; padding: 0 var(--tf-space-4) var(--tf-space-6); border: 0;
}
.tf-disclosure--section > .tf-disclosure-content > * { min-width: 0; margin-block: 0; }
.tf-disclosure--section > .tf-disclosure-content > :is(ul, ol):empty { display: none; }
@media (hover: hover) {
  .tf-disclosure--section > .tf-disclosure-trigger:hover { background: var(--tf-surface-raised); }
}
@media (forced-colors: active) {
  .tf-disclosure--section, .tf-disclosure--section[open] { border-color: CanvasText; }
}
@media print {
  .tf-disclosure--section { border: 0; }
  .tf-disclosure--section > .tf-disclosure-trigger { padding-inline: 0; }
  .tf-disclosure--section > .tf-disclosure-content { padding-inline: 0; }
}

/* A whole resource row is one clear destination, with the shared link states. */
.tf-tool-link { color: var(--tf-text); text-decoration: none; border-radius: var(--tf-radius-sm); transition: color var(--tf-motion) var(--tf-ease), background var(--tf-motion) var(--tf-ease); }
.tf-tool-link:focus-visible { outline: var(--tf-focus-ring); outline-offset: 4px; }
@media (hover: hover) { .tf-tool-link:hover { color: var(--tf-accent-text); background: var(--tf-surface); } }

/* Input diagrams share the same palette and states as physical keycaps. */
.tf-input-mark { fill: var(--tf-surface-raised); stroke: var(--tf-control-border); stroke-width: 1.5; transition: fill var(--tf-motion) var(--tf-ease), stroke var(--tf-motion) var(--tf-ease); }
.tf-input-mark.is-tested { stroke: var(--tf-success); }
.tf-input-mark.is-active { fill: var(--tf-accent); stroke: var(--tf-accent-border); }
@media (forced-colors: active) {
  .tf-input-mark { fill: Canvas; stroke: CanvasText; }
  .tf-input-mark.is-tested { stroke: CanvasText; stroke-width: 3; }
  .tf-input-mark.is-active { fill: Highlight; stroke: Highlight; }
}


/* Public page frame: the header participates in flow, so every page starts
   from one gutter and one gap instead of fixed-header offset arithmetic. */
.tf-header.site-header, #welcome-overlay .tf-header { position: sticky; top: 0; inset-inline: auto; padding: env(safe-area-inset-top, 0px) 0 0; }
.tf-header .tf-header-inner { width: var(--tf-shell-width); max-width: none; height: var(--tf-header-height); min-height: var(--tf-header-height); padding: 0; }
.tf-header .tf-header-nav { gap: 12px; }
.tf-header .tf-nav-link { font: 500 var(--tf-text-sm)/1.4 var(--tf-font); letter-spacing: normal; }
.tf-header .site-nav-icon { display: none; }
.tf-header .tf-header-actions { gap: 12px; }
.tf-header .tf-header-cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 160px; min-width: 160px; min-height: 44px; padding: 10px 12px; white-space: nowrap; font: 500 var(--tf-text-sm)/1.4 var(--tf-font); }
.tf-header .locale-menu-placeholder { display: none; }
.tf-header .locale-menu-trigger { width: 88px; min-width: 88px; height: 44px; justify-content: center; }
.tf-header .cta-icon, .drawer-footer .cta-icon { display: inline-flex; width: 18px; height: 18px; flex: 0 0 18px; }
.tf-header .cta-icon svg, .drawer-footer .cta-icon svg { display: block; width: 18px; height: 18px; }
.tf-page-shell { display: flow-root; width: var(--tf-shell-width); max-width: none; padding: 0; margin: var(--tf-page-start) auto var(--tf-page-end); }
.tf-page-shell > main { min-width: 0; }
.tf-home-shell { width: var(--tf-shell-width); margin-inline: auto; }
#welcome-overlay { padding-inline: 0; }
.tf-page-shell .tf-page-intro { padding-top: 0; margin-top: 0; }
.tf-page-intro :is(.tf-eyebrow, .section-kicker, .secondary-hero-kicker) { display: block; margin: 0 0 10px; color: var(--tf-accent-text); font: 650 .75rem/1.5 var(--tf-font); letter-spacing: .11em; text-transform: uppercase; }
.tf-page-intro h1 { margin: 0 0 18px; max-width: 24ch; font: 600 clamp(2.25rem, 3.8vw, 3.2rem)/1.08 var(--tf-font); letter-spacing: -.045em; text-wrap: balance; }
.tf-page-intro :is(.tool-lead, .secondary-hero-lead, .catalog-lead) { margin-top: 0; max-width: 65ch; font-size: 1.06rem; line-height: 1.6; }
.tf-page-shell > .tf-ad--editorial-top { margin: 0 auto 32px; }
.tf-page-shell > .tf-ad--editorial-top + main .tf-page-intro { margin-top: 0; }
/* The same drawer surface is used by resource, tools and game navigation. */
body .drawer-backdrop { position: fixed; inset: 0; z-index: 44; background: var(--tf-backdrop); }
body .drawer-backdrop[hidden], body .mobile-drawer[hidden] { display: none; }
body .mobile-drawer { position: fixed; z-index: 45; top: calc(env(safe-area-inset-top, 0px) + var(--tf-header-height) + 1px); inset-inline: var(--tf-header-gutter); width: auto; max-height: calc(100dvh - var(--tf-header-height) - env(safe-area-inset-top, 0px) - 20px); padding: 16px; border: 1px solid var(--tf-border); border-radius: var(--tf-radius); background: var(--tf-surface); box-shadow: 0 20px 60px #0006; overflow: auto; overscroll-behavior: contain; }
body .mobile-drawer nav { display: grid; gap: 8px; }
body .mobile-drawer .drawer-link { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: var(--tf-radius-sm); color: var(--tf-muted); background: transparent; font: 500 var(--tf-text-sm)/1.4 var(--tf-font); text-decoration: none; }
body .mobile-drawer .site-nav-icon { display: none; }
body .mobile-drawer .drawer-link[aria-current] { color: var(--tf-accent-text); background: var(--tf-accent-soft); }
body .drawer-footer { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--tf-border); }
body .drawer-footer .site-cta { display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px; min-height: 44px; }
@media (max-width: 1120px) {
  .tf-header .tf-header-nav, .tf-header .tf-header-cta { display: none; }
  .tf-header .tf-header-actions { gap: 8px; }
  #welcome-overlay .tf-header[data-menu-open] #home-navigation { display: grid; position: fixed; top: calc(env(safe-area-inset-top, 0px) + var(--tf-header-height) + 1px); inset-inline: var(--tf-header-gutter); padding: 16px; gap: 8px; width: auto; border: 1px solid var(--tf-border); border-radius: var(--tf-radius); background: var(--tf-surface); box-shadow: 0 20px 60px #0006; max-height: calc(100dvh - var(--tf-header-height) - 20px); overflow: auto; }
  #home-navigation > .tf-nav-link { justify-content: flex-start; width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--tf-radius-sm); }
  #home-navigation > .tf-nav-link[aria-current] { color: var(--tf-accent-text); background: var(--tf-accent-soft); }
  #home-navigation > .tf-nav-link[aria-current]::after { display: none; }
}
@media (max-width: 780px) {
  .tf-page-intro h1 { font-size: clamp(1.9rem, 6vw, 2.35rem); }
  .tf-page-shell > .tf-ad--editorial-top { margin-bottom: 24px; }
}

.tf-header, .tf-header *, .mobile-drawer, .mobile-drawer * { box-sizing: border-box; }
.tf-home-shell { margin-block: 0; }
#welcome-overlay { padding-top: 0; }
.home-site-note { padding-block: 32px; }

@media (max-width: 480px) {
  .tf-header .locale-menu-trigger { width: 44px; min-width: 44px; padding-inline: 0; }
  .tf-header .locale-menu-trigger-code, .tf-header .locale-menu-trigger-caret { display: none; }
}
