/* typogenesis — mobile-first foundry UI. Inherits vars from /styles.css. */

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
}

.tg-app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg);
  color: var(--fg);
}

/* Header */

.tg-header {
  padding: calc(env(safe-area-inset-top) + 0.6rem) 1rem 0.5rem;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.tg-title-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: lowercase;
}

.tg-back {
  color: var(--muted);
  text-decoration: none;
}

.tg-back::before {
  content: "← ";
}

.tg-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.tg-name-row h1 {
  font-size: 1.15rem;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tg-actions {
  display: flex;
  gap: 0.4rem;
  flex: none;
}

.tg-actions button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 1rem;
  width: 2.2rem;
  height: 2.2rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.tg-actions button:active {
  border-color: var(--fg);
}

/* Main / views */

.tg-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.8rem 1rem 1rem;
}

.tg-view {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.tg-view[hidden] {
  display: none;
}

.tg-hint {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  margin: 0;
}

/* Evolve */

.tg-champion {
  width: 100%;
  height: 130px;
  border: 1px solid var(--border);
  touch-action: manipulation;
}

.tg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.tg-grid canvas {
  width: 100%;
  height: 84px;
  border: 1px solid var(--border);
  cursor: pointer;
  display: block;
  transition: border-color 0.15s ease;
}

.tg-grid canvas:active {
  border-color: var(--fg);
}

.tg-slider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.tg-slider input {
  flex: 1;
  accent-color: var(--fg);
}

.tg-slider button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 0.7rem;
}

.tg-slider button.on {
  background: var(--fg);
  color: var(--bg);
}

.tg-history {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
}

.tg-history canvas {
  width: 72px;
  height: 48px;
  flex: none;
  border: 1px solid var(--border);
  cursor: pointer;
}

/* Genes */

#sliders {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.tg-gene {
  display: grid;
  grid-template-columns: 7.2rem 1fr 2.4rem;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.tg-gene label {
  color: var(--fg);
}

.tg-gene input {
  width: 100%;
  accent-color: var(--fg);
}

.tg-gene output {
  text-align: right;
  color: var(--muted);
}

.tg-charstrip {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  padding-bottom: 0.3rem;
}

.tg-charstrip button {
  flex: none;
  width: 2rem;
  height: 2rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 0.9rem;
  cursor: pointer;
}

.tg-charstrip button.active {
  background: var(--fg);
  color: var(--bg);
}

.tg-anatomy {
  width: 100%;
  height: 300px;
  border: 1px solid var(--border);
}

/* Specimen */

.tg-specimen-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.tg-primary {
  background: var(--fg);
  color: var(--bg);
  border: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
}

.tg-specimen {
  border: 1px solid var(--border);
  padding: 1rem;
  overflow-wrap: break-word;
}

.tg-specimen p {
  margin: 0 0 0.8rem;
  line-height: 1.25;
}

.tg-spec-giant {
  font-size: clamp(90px, 34vw, 200px);
  line-height: 1 !important;
}

.tg-spec-name {
  font-size: 1.8rem;
}

.tg-s48 {
  font-size: clamp(26px, 7.5vw, 48px);
}

.tg-s32 {
  font-size: clamp(19px, 5vw, 32px);
}

.tg-s24 {
  font-size: clamp(15px, 4vw, 24px);
}

.tg-spec-charset {
  font-size: clamp(15px, 4.2vw, 26px);
  line-height: 1.5 !important;
}

.tg-spec-para {
  font-size: clamp(16px, 4.4vw, 22px);
  line-height: 1.4 !important;
  outline: none;
  border-top: 1px solid var(--border);
  padding-top: 0.8rem;
}

/* About */

.tg-about {
  max-width: 56ch;
}

.tg-about p {
  font-size: 0.92rem;
  line-height: 1.55;
}

/* Tabs */

.tg-tabs {
  flex: none;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 3rem;
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg);
}

.tg-tabs button {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0.85rem 0;
  cursor: pointer;
  transition: color 0.15s ease;
}

.tg-tabs button.active {
  color: var(--fg);
  box-shadow: inset 0 2px 0 var(--fg);
}

@media (min-width: 768px) {
  .tg-grid canvas {
    height: 104px;
  }
  .tg-champion {
    height: 160px;
  }
}
