body.portal { line-height: 1.6; }
.tf-shell { max-width: 900px; margin: 0 auto; padding: 24px 16px 56px; }
.tf-visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tf-h1-sub { display: block; margin-top: 4px; color: var(--muted); font-size: .55em; font-weight: 700; letter-spacing: 0; }
.tf-intro h1 { margin-bottom: 12px; }
.tf-intro .lead { margin-bottom: 16px; font-size: 17px; }
.tf-tool { margin: 22px 0 36px; padding: 16px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

.tf-label { display: flex; align-items: center; gap: 8px; margin: 18px 0 10px; color: var(--text); font-size: 14px; font-weight: 750; }
.tf-label:first-of-type { margin-top: 0; }
.tf-num { display: inline-grid; place-items: center; flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; }
.tf-hint { margin: 10px 0; color: var(--muted); font-size: 14px; }
.tf-inputs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; max-width: 360px; }
.tf-input { box-sizing: border-box; width: 100%; min-height: 56px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; font-size: 26px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.tf-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.tf-input[aria-invalid="true"] { border-color: #c0392b; background: #fdecea; }
.tf-input-target { display: inline-block; width: 5em; min-height: 40px; font-size: 18px; }
.tf-target-wrap { margin-top: 6px; }
.tf-target-wrap summary { color: var(--text); font-size: 14px; font-weight: 750; cursor: pointer; }
.tf-chips, .tf-presets, .tf-edit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tf-presets-label { color: var(--muted); font-size: 14px; font-weight: 700; }
.tf-chip { min-width: 44px; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); color: var(--text); font-size: 14px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.tf-chip:hover:not(:disabled) { border-color: var(--accent); }
.tf-chip[aria-pressed="true"], .tf-chip-strong { background: var(--accent); border-color: var(--accent); color: #fff; }
.tf-chip-quiet { background: transparent; color: var(--muted); }

.tf-solve { width: 100%; font-size: 16px; }
.tf-status { min-height: 1.6em; margin: 12px 0; color: var(--text); font-size: 14px; }

.tf-result { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
.tf-result:focus { outline: none; }
.tf-result-title { margin: 0 0 8px; font-size: 22px; }
.tf-note { margin: 0 0 10px; font-size: 14px; }
.tf-answers { display: grid; gap: 6px; margin: 0 0 12px; padding-left: 1.6em; max-height: 360px; overflow: auto; }
.tf-answer { width: 100%; min-height: 40px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); font: 600 17px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: left; cursor: pointer; }
.tf-picked .tf-answer { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tf-steps-wrap { margin: 0 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-soft); }
.tf-steps-title { margin: 0 0 6px; font-weight: 750; }
.tf-steps { margin: 0; padding-left: 1.4em; font: 16px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }
.tf-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tf-copy-status { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 13px; }
.tf-copy-status:empty { display: none; }

/* Play mode: four tiles in fixed slots, so combining never moves the page. */
.tf-game h2 { margin: 0 0 8px; font-size: 22px; }
.tf-game-lead { margin: 0 0 12px; font-size: 15px; }
.tf-hand { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-width: 420px; min-height: 84px; margin: 14px 0 12px; }
.tf-tile { min-height: 84px; border: 2px solid var(--line); border-radius: 14px; background: #fffdf7; color: #1d1a26; font-size: 28px; font-weight: 850; font-variant-numeric: tabular-nums; cursor: pointer; touch-action: manipulation; }
.tf-tile[hidden] { display: block !important; visibility: hidden; }
.tf-tile[aria-pressed="true"] { border-color: var(--accent); background: #ffe9a8; }
.tf-tile.tf-win { border-color: #2f9e44; background: #d3f9d8; }
.tf-ops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-width: 420px; }
.tf-op { min-height: 52px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); color: var(--text); font-size: 26px; font-weight: 800; cursor: pointer; touch-action: manipulation; }
.tf-op[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.tf-game-status { min-height: 3.2em; }
.tf-score { margin: 10px 0 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

.tf-article h2 { margin: 30px 0 12px; font-size: 24px; }
.tf-article li { margin-bottom: 8px; color: var(--muted); }
.tf-article li strong { color: var(--text); }
.tf-faq details { padding: 12px 0; border-bottom: 1px solid var(--line); }
.tf-faq summary { color: var(--text); font-weight: 750; cursor: pointer; }
.tf-faq details p { margin: 8px 0 0; }
.tf-cta { margin-top: 32px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.tf-cta h2 { margin-top: 0; }
.tf-cta .text-link { color: var(--accent-strong); }
.tf-ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 0; }
.tf-footer { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

@media (min-width: 720px) {
  .tf-shell { padding: 36px 24px 64px; }
  .tf-tool { padding: 22px; }
}

/* Shared-hand links: the sections below the solver wait for the answers (see #tf-shared-hold). */
.tf-shared-pending #solver ~ * { display: none; }
