.tc-page {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  width: min(100%, 850px);
  margin-inline: auto;
}
.tc-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .5rem;
}
.tc-head h1 {
  margin: 0;
  font-size: clamp(2.1rem, 4.4vw, 3.45rem);
  line-height: 1.06;
  letter-spacing: -.06em;
}
.tc-exit, .tc-info-toggle {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  min-height: 44px;
  padding: .25rem .4rem;
  border: 0;
  border-radius: .55rem;
  background: transparent;
  color: #365648;
  font-size: .88rem;
  font-weight: 650;
  text-decoration: none;
}
.tc-exit { justify-self: start; white-space: nowrap; }
.tc-info-toggle { justify-self: end; white-space: nowrap; }
.tc-exit:hover, .tc-info-toggle:hover { background: #eaf0e3; }
.tc-thread {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  min-height: 44px;
  color: var(--sd-subtle);
  font-size: .85rem;
}
.tc-thread p {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.tc-reset {
  flex: none;
  min-height: 44px;
  padding: .25rem .4rem;
  border: 0;
  border-radius: .55rem;
  background: transparent;
  color: #365648;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 650;
}
.tc-reset:hover:not(:disabled) { background: #eaf0e3; }
.tc-reset:disabled { opacity: .68; }
.tc-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--sd-line);
  border-radius: var(--sd-card-radius);
  background: var(--sd-paper);
}
.tc-history {
  min-width: 0;
  min-height: 11rem;
  max-height: min(51dvh, 34rem);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  overflow-anchor: none;
  scrollbar-width: thin;
  padding: clamp(14px, 2.6vw, 26px);
  background: #f9faf6;
}
.tc-history:focus-visible { outline-offset: -3px; }
.tc-info {
  width: min(100%, 40rem);
  margin: 0 auto .75rem;
  padding: clamp(.85rem, 2vw, 1.4rem);
  border: 1px solid var(--sd-line);
  border-radius: .8rem;
  background: var(--sd-paper);
  overflow-wrap: anywhere;
}
.tc-info h2, .tc-empty h2 {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.25;
  letter-spacing: -.025em;
}
.tc-info p {
  margin: .5rem 0 0;
  color: var(--sd-subtle);
  font-size: .9rem;
}
.tc-info [data-tc-context-detail] {
  color: var(--sd-ink);
  font-weight: 650;
}
.tc-consent-actions, .tc-prompts {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.tc-consent-actions { margin-top: .8rem; }
.tc-empty {
  display: grid;
  justify-items: center;
  gap: .85rem;
  padding: .7rem 0;
  text-align: center;
}
.tc-prompts { justify-content: center; }
.tc-prompts [hidden] { display: none; }
.tc-secondary, .tc-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 44px;
  padding: .55rem .8rem;
  border: 1px solid #c8d6c8;
  border-radius: .65rem;
  background: var(--sd-paper);
  color: #264738;
  font-weight: 650;
  font-size: .9rem;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}
.tc-secondary:hover:not(:disabled) { background: #eaf0e3; }
.tc-earlier { margin-bottom: .65rem; }
.tc-transcript {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.tc-bubble {
  align-self: start;
  width: fit-content;
  max-width: min(90%, 40rem);
  padding: .65rem .9rem;
  border: 1px solid #dfe6da;
  border-radius: 13px 13px 13px 4px;
  background: var(--sd-paper);
  overflow-wrap: anywhere;
}
.tc-bubble strong {
  display: block;
  margin-bottom: .2rem;
  color: #476459;
  font-size: .82rem;
}
.tc-bubble p { margin: 0; white-space: pre-wrap; }
.tc-observation {
  width: min(100%, 40rem);
  max-width: 100%;
  margin-bottom: .8rem;
  border-color: #c8d6c8;
  border-radius: .8rem;
  background: #edf3e7;
}
.tc-observation h2 {
  margin: 0 0 .25rem;
  color: #264738;
  font-size: 1rem;
  line-height: 1.3;
}
.tc-user {
  align-self: end;
  border-color: #dce6c5;
  border-radius: 13px 13px 4px 13px;
  background: #ecf3dc;
}
.tc-user.tc-pending {
  border-color: #96ac7d;
  border-style: dashed;
}
.tc-composer {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: .4rem .5rem;
  padding: .65rem clamp(14px, 2.6vw, 26px) .35rem;
  border-top: 1px solid var(--sd-line);
}
.tc-composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 5.5rem;
  resize: vertical;
  padding: .55rem .7rem;
  border: 1px solid #aebfaf;
  border-radius: .65rem;
  background: #fcfdfb;
  font-size: 1rem;
}
.tc-composer [data-tc-retry] { grid-column: 1 / -1; justify-self: start; }
.tc-status {
  grid-column: 1 / -1;
  margin: 0;
  color: #476459;
  font-size: .86rem;
  line-height: 1.35;
}
.tc-status:empty { position: absolute; }
.tc-status.tc-error { color: #873e31; }
.tc-status.tc-waiting {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.tc-status.tc-waiting::before {
  content: '';
  flex: none;
  width: .86em;
  height: .86em;
  border: 2px solid #bac9b9;
  border-top-color: #37614c;
  border-radius: 50%;
  animation: tc-spin .8s linear infinite;
}
@keyframes tc-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  .tc-status.tc-waiting::before { animation: none; }
}
.tc-send {
  align-self: end;
  border-color: var(--sd-forest);
  background: var(--sd-forest);
  color: white;
}
.tc-send:hover:not(:disabled) { background: #285747; }
.tc-send:disabled, .tc-secondary:disabled { opacity: .68; }
.tc-warning {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .2rem .65rem;
  padding: .32rem 1rem .5rem;
  color: var(--sd-subtle);
  text-align: center;
  font-size: .78rem;
  line-height: 1.25;
}
.tc-warning [data-tc-quota] {
  color: #365648;
  font-weight: 650;
}
.tc-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
@media (max-width: 760px) {
  .sd-shell.sd-trainer-view {
    position: fixed;
    inset: 0;
    min-height: 0;
    overflow: hidden;
  }
  .sd-trainer-view > :is(.sd-mobile-bar, .sd-bottom-nav) { display: none; }
  .sd-trainer-view .sd-content { padding: 0; }
  .tc-page {
    position: fixed;
    inset: var(--tc-viewport-top, 0px) 0 auto;
    width: 100%;
    height: 100vh;
    height: var(--tc-viewport-height, 100dvh);
    gap: 0;
    padding: env(safe-area-inset-top) 0 0;
    background: var(--sd-paper);
  }
  .tc-head {
    grid-template-columns: max-content minmax(0,1fr) max-content;
    gap: .25rem;
    min-height: 48px;
    padding-inline: max(6px,env(safe-area-inset-left)) max(6px,env(safe-area-inset-right));
  }
  .tc-head h1 {
    text-align: center;
    font-size: clamp(1.12rem, 5vw, 1.42rem);
    letter-spacing: -.04em;
  }
  .tc-exit, .tc-info-toggle { font-size: .82rem; }
  .tc-thread {
    padding-inline: max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right));
  }
  .tc-card {
    flex: 1;
    border-width: 1px 0 0;
    border-radius: 0;
  }
  .tc-history {
    min-height: 0;
    max-height: none;
    padding: .7rem max(12px,env(safe-area-inset-right)) .7rem max(12px,env(safe-area-inset-left));
  }
  .tc-bubble { max-width: 94%; }
  .tc-observation { max-width: 100%; }
  .tc-composer {
    padding: .45rem max(10px,env(safe-area-inset-right)) .2rem max(10px,env(safe-area-inset-left));
  }
  .tc-composer textarea { resize: none; }
  .tc-warning {
    padding-bottom: max(.4rem,env(safe-area-inset-bottom));
  }
}
@media (max-width: 540px) {
  .tc-prompts, .tc-prompts button { width: 100%; }
}
