/* Scoped to .tf-root. The site already styles html and body. */
.tf-root {
  --tf-bg: #12141a;
  --tf-ink: #e7ecf5;
  --tf-muted: #9aa3b5;
  --tf-accent: #7ec8ff;
  color-scheme: dark;
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  background: var(--tf-bg);
  color: var(--tf-ink);
  font: 16px/1.45 "Segoe UI", Helvetica, sans-serif;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}

.tf-root *,
.tf-root *::before,
.tf-root *::after { box-sizing: border-box; }

.tf-stage {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.tf-root .tf-screen {
  display: block;
  background: #000;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  image-rendering: pixelated;
  touch-action: none;
}

.tf-help {
  flex: 0 0 168px;
  padding: 18px 14px;
  color: var(--tf-muted);
  font-size: 13px;
  line-height: 1.45;
}

.tf-help button {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--tf-muted);
  font: 13px/1.45 "Segoe UI", Helvetica, sans-serif;
  text-align: left;
}

.tf-build {
  margin-top: 16px;
  font: 9px/1.3 ui-monospace, "Cascadia Mono", Consolas, monospace;
  color: var(--tf-muted);
  opacity: 0.7;
  word-break: break-all;
}

.tf-root.tf-help-hidden .tf-help { display: none; }

.tf-root.tf-touch-dock {
  flex-direction: column;
}

.tf-root.tf-touch-dock .tf-stage { align-items: flex-start; }

/* Touch controls: shared SGPad (className tf-pad). Portrait dock: the pad is a 200px strip under the stage. */
.tf-root .sgpad.tf-pad { z-index: 3; font-family: "Segoe UI", Helvetica, sans-serif; }
.tf-root.tf-touch-dock .sgpad.tf-pad { position: relative; inset: auto; flex: 0 0 200px; width: 100%; }

/* Start screen (SgPopup title, className tf-start): buttons only, over the title art. */
.sgp-dock .sgp-card.tf-start { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
/* Portrait touch layout: keep the start buttons above the docked 200px pad. */
:has(> .tf-root.tf-touch-dock) .sgp-dock .sgp-card.tf-start { margin-bottom: calc(200px + 4cqh); }
