.screen.turtle-soup-screen {
  width: min(1120px, calc(100% - 48px));
  height: var(--ts-available-height, calc(100dvh - var(--header-height)));
  min-height: 260px;
  padding: 20px 0 max(16px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.turtle-soup-screen *, .turtle-soup-screen *::before, .turtle-soup-screen *::after { box-sizing: border-box; }
.ts-table { display: grid; grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto; column-gap: 32px; height: 100%; min-height: 0; }
.ts-table-header { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 16px; }
.ts-table-header h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0; font-size: 1.25rem; line-height: 1.4; letter-spacing: -0.02em; }
.ts-table-header p { margin: 4px 0 0; font-size: 0.75rem; color: var(--muted); }
.ts-phase { color: var(--mint-ink); font-size: 0.75rem; font-weight: 600; letter-spacing: 0; }
.ts-button { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; padding: 9px 14px; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--background); font: inherit; font-size: 0.8125rem; font-weight: 650; line-height: 1.4; cursor: pointer; touch-action: manipulation; transition: background-color 160ms var(--ease-out), border-color 160ms var(--ease-out); }
.ts-button:not(:disabled):hover { background: var(--surface); border-color: var(--border-strong); }
.ts-button:not(:disabled):active { background: var(--surface-strong); }
.ts-button:disabled { cursor: default; color: var(--muted); background: var(--surface); }
.ts-primary { background: var(--mint-ink); border-color: var(--mint-ink); color: var(--background); }
.ts-primary:not(:disabled):hover, .ts-primary:not(:disabled):active { background: var(--ink); border-color: var(--ink); }
.ts-quiet { background: transparent; border-color: transparent; }
.ts-table-header > .ts-button { flex-shrink: 0; color: var(--muted); }
.ts-connection { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; padding: 8px 12px; background: var(--sand-soft); border-radius: var(--radius-small); color: var(--sand-ink); }
.ts-connection p { margin: 0; font-size: 0.8125rem; }
.ts-connection .ts-button { flex-shrink: 0; }
.ts-sidebar { grid-column: 1; grid-row: 3 / 5; min-height: 0; overflow-y: auto; padding-right: 4px; }
.ts-scenario { background: var(--surface); border-radius: var(--radius-medium); }
.ts-scenario summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 64px; padding: 18px; list-style: none; cursor: pointer; }
.ts-scenario summary::-webkit-details-marker { display: none; }
.ts-scenario summary strong { display: block; margin-top: 5px; font-size: 1.125rem; line-height: 1.4; overflow-wrap: anywhere; }
.ts-scenario-label { display: block; color: var(--muted); font-size: 0.75rem; }
.ts-expand { display: inline-block; flex-shrink: 0; color: var(--muted); transition: transform 160ms var(--ease-out); }
.ts-scenario[open] .ts-expand { transform: rotate(180deg); }
.ts-scenario > p { margin: 0; padding: 0 18px 20px; font-size: 0.9375rem; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.ts-players { display: flex; flex-wrap: wrap; gap: 8px 12px; padding: 16px 0; }
.ts-player { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; font-size: 0.75rem; color: var(--muted); overflow-wrap: anywhere; }
.ts-player-dot { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: var(--mint-strong); }
.ts-offline .ts-player-dot { background: var(--border-strong); }
.ts-hints { padding: 8px 0 16px; }
.ts-hints h2 { margin: 0 0 10px; font-size: 0.8125rem; font-weight: 650; }
.ts-hints ol { margin: 0; padding-left: 22px; font-size: 0.875rem; line-height: 1.7; }
.ts-hints li { padding: 3px 0 6px; overflow-wrap: anywhere; }
.ts-conversation { position: relative; grid-column: 2; grid-row: 3; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ts-discussion-heading { flex-shrink: 0; padding: 0 0 12px; border-bottom: 1px solid var(--border); }
.ts-discussion-heading h2 { margin: 0 0 4px; font-size: 0.9375rem; }
.ts-discussion-heading > p { margin: 0; color: var(--muted); font-size: 0.75rem; line-height: 1.6; }
.ts-timeline { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 6px 16px 0; overflow-wrap: anywhere; }
.ts-empty { max-width: 34ch; margin: 40px auto; text-align: center; }
.ts-empty > .ts-host-mark { display: inline-flex; width: 38px; height: 38px; font-size: 1rem; }
.ts-empty h3 { margin: 16px 0 8px; font-size: 1rem; }
.ts-empty p { margin: 0; color: var(--muted); font-size: 0.875rem; line-height: 1.8; }
.ts-chat { padding: 4px 0 16px; }
.ts-author { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 0 0 5px; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.ts-self { font-size: 0.6875rem; font-weight: 400; }
.ts-message { max-width: 72ch; margin: 0; font-size: 0.9375rem; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.ts-exchange { padding: 0 0 20px; }
.ts-question { margin-bottom: 10px; }
.ts-kind { color: var(--mint-ink); font-weight: 500; }
.ts-host-response { display: flex; align-items: start; gap: 10px; padding: 13px 14px; background: var(--mint-soft); border-radius: var(--radius-medium); }
.ts-host-response > div { min-width: 0; }
.ts-host-response .ts-author { color: var(--mint-ink); }
.ts-host-mark { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; background: var(--mint-ink); color: var(--background); font-size: 0.8125rem; font-weight: 650; }
.ts-verdict { display: inline-block; margin: 0 0 4px; color: var(--mint-ink); font-size: 0.875rem; font-weight: 750; }
.ts-response-status { margin: 0; color: var(--mint-ink); font-size: 0.875rem; line-height: 1.7; }
.ts-new-messages { position: absolute; inset-inline-end: 8px; bottom: 10px; min-height: 36px; background: var(--ink); color: var(--background); border-color: var(--ink); }
.ts-ending { flex-shrink: 0; max-height: 60%; overflow-y: auto; padding: 16px 18px; margin-bottom: 12px; background: var(--mint-soft); border-radius: var(--radius-medium); }
.ts-ending h2 { margin: 0 0 8px; font-size: 1.125rem; }
.ts-ending .ts-button { margin-top: 14px; }
.ts-ending > p:last-child { margin-bottom: 0; color: var(--mint-ink); font-size: 0.875rem; }
.ts-bottom { grid-column: 2; grid-row: 4; min-width: 0; padding-top: 10px; border-top: 1px solid var(--border); background: var(--background); }
.ts-mode-row { display: flex; gap: 4px; padding-bottom: 6px; }
.ts-mode { flex: 0 1 auto; min-height: 42px; padding: 8px 14px; border: 0; border-radius: var(--radius-small); background: transparent; color: var(--muted); font: inherit; font-size: 0.8125rem; font-weight: 650; cursor: pointer; transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out); }
.ts-mode:hover { background: var(--surface); color: var(--ink); }
.ts-mode[aria-pressed="true"] { background: var(--surface-strong); color: var(--ink); }
[data-composer-mode="ask-host"] .ts-mode[aria-pressed="true"], [data-composer-mode="solution"] .ts-mode[aria-pressed="true"] { background: var(--mint-soft); color: var(--mint-ink); }
.ts-input-row { display: flex; align-items: stretch; gap: 8px; }
.ts-input-row textarea { display: block; flex: 1; min-width: 0; min-height: 68px; max-height: 140px; padding: 12px; resize: vertical; border: 1px solid var(--border-strong); border-radius: var(--radius-small); background: var(--background); color: var(--ink); font: inherit; font-size: 1rem; line-height: 1.45; }
.ts-input-row textarea::placeholder { color: var(--muted); opacity: 1; }
.ts-input-row textarea:disabled { background: var(--surface); }
[data-composer-mode="ask-host"] textarea, [data-composer-mode="solution"] textarea { border-color: var(--mint-strong); }
.ts-input-row .ts-send { align-self: stretch; flex-shrink: 0; min-width: 68px; max-width: 88px; padding-inline: 12px; }
.ts-compose-meta { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding-top: 5px; color: var(--muted); font-size: 0.6875rem; line-height: 1.5; }
.ts-compose-meta p { margin: 0; }
.ts-compose-meta > span { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.ts-examples { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; margin: 0 0 8px; color: var(--muted); font-size: 0.75rem; }
.ts-examples button { min-height: 36px; padding: 6px 0; border: 0; background: transparent; color: var(--mint-ink); font: inherit; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.ts-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 0 4px; padding-top: 3px; }
.ts-tools > .ts-button { padding-inline: 10px; }
.ts-tools > span { margin-left: auto; color: var(--muted); font-size: 0.6875rem; }
.ts-vote { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; padding: 12px 14px; margin-bottom: 8px; background: var(--sand-soft); color: var(--sand-ink); border-radius: var(--radius-small); }
.ts-vote strong { font-size: 0.875rem; }
.ts-vote p { margin: 4px 0 0; font-size: 0.75rem; }
.ts-vote p:empty { display: none; }
.ts-vote-buttons { display: flex; gap: 8px; }
.ts-vote-buttons .ts-button { min-height: 42px; }
.ts-vote-buttons .ts-button[aria-pressed="true"] { border-color: var(--mint-ink); box-shadow: inset 0 0 0 1px var(--mint-ink); background: var(--mint-soft); color: var(--mint-ink); }
.ts-button[aria-busy="true"] { color: var(--mint-ink); border-color: var(--mint-ink); }
.ts-action-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 6px; color: var(--mint-ink); }
.ts-action-feedback p { flex: 1; min-width: 150px; margin: 0; font-size: 0.75rem; line-height: 1.5; }
.ts-action-feedback[data-error="true"] { color: var(--danger-strong); }
.ts-action-feedback .ts-button { min-height: 36px; padding: 6px 8px; }
.ts-ready, .ts-vote-result { margin: 0 0 8px; color: var(--mint-ink); font-size: 0.8125rem; line-height: 1.5; }
.ts-vote-result { color: var(--muted); }
.ts-input-error { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.ts-input-error p { margin: 0; color: var(--danger-strong); font-size: 0.8125rem; line-height: 1.5; }
.ts-input-error button { color: var(--danger-strong); }

@media (max-width: 900px) and (min-width: 701px) {
  .ts-table { grid-template-columns: 230px minmax(0, 1fr); column-gap: 20px; }
  .ts-tools > span { display: none; }
}

@media (max-width: 700px) {
  .screen.turtle-soup-screen { width: 100%; margin: 0; padding: 10px max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .ts-table { display: flex; flex-direction: column; min-width: 0; gap: 0; }
  .ts-table-header { flex-shrink: 0; padding-bottom: 7px; }
  .ts-table-header h1 { font-size: 1.0625rem; gap: 8px; }
  .ts-table-header p { font-size: 0.6875rem; margin-top: 2px; }
  .ts-table-header > .ts-button { padding: 8px; }
  .ts-phase { font-size: 0.6875rem; }
  .ts-sidebar { flex-shrink: 0; max-height: 31%; padding: 0; overflow-y: auto; }
  .ts-scenario summary { min-height: 58px; padding: 10px 12px; }
  .ts-scenario summary strong { margin-top: 2px; font-size: 0.9375rem; }
  .ts-scenario-label { font-size: 0.6875rem; }
  .ts-scenario > p { padding: 0 12px 12px; font-size: 0.875rem; line-height: 1.75; }
  .ts-players { gap: 4px 12px; padding: 8px 2px; }
  .ts-player { font-size: 0.6875rem; }
  .ts-hints { padding: 4px 2px 10px; }
  .ts-hints h2 { margin-bottom: 5px; }
  .ts-hints ol { font-size: 0.8125rem; }
  .ts-conversation { flex: 1; min-height: 70px; }
  .ts-discussion-heading { display: flex; align-items: start; gap: 12px; padding: 7px 0 8px; }
  .ts-discussion-heading h2 { flex-shrink: 0; margin: 0; font-size: 0.8125rem; }
  .ts-discussion-heading > p { font-size: 0.6875rem; line-height: 1.6; }
  .ts-timeline { padding: 12px 2px 8px; }
  .ts-chat { padding-bottom: 13px; }
  .ts-message { font-size: 0.875rem; line-height: 1.7; }
  .ts-host-response { gap: 8px; padding: 10px 11px; }
  .ts-empty { margin: 22px auto; }
  .ts-empty h3 { font-size: 0.9375rem; margin-top: 10px; }
  .ts-empty p { font-size: 0.8125rem; }
  .ts-bottom { flex-shrink: 1; min-height: 0; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding-top: 4px; }
  .ts-mode-row { gap: 2px; padding-bottom: 4px; }
  .ts-mode { min-height: 42px; padding: 8px 12px; }
  .ts-input-row textarea { min-height: 64px; max-height: 98px; padding: 10px; resize: none; }
  .ts-input-row .ts-send { min-width: 64px; max-width: 80px; padding: 9px; }
  .ts-tools { padding-top: 2px; }
  .ts-tools > .ts-button { min-height: 42px; padding: 8px; }
  .ts-tools > span { display: none; }
  .ts-examples { margin-bottom: 4px; gap: 0 8px; }
  .ts-examples button { min-height: 32px; font-size: 0.6875rem; }
  .ts-vote { padding: 10px 12px; gap: 8px; }
  .ts-vote-buttons { width: 100%; }
  .ts-vote-buttons .ts-button { flex: 1; }
  .ts-ending { padding: 12px; max-height: 75%; margin-bottom: 6px; }
  .ts-ending h2 { font-size: 1rem; }
  .ts-connection { flex-shrink: 0; margin-bottom: 8px; padding: 5px 8px; }
  .ts-connection p { font-size: 0.75rem; }
  [data-keyboard="true"] .ts-sidebar, [data-keyboard="true"] .ts-table-header, [data-keyboard="true"] .ts-examples, [data-keyboard="true"] .ts-discussion-heading, [data-keyboard="true"] .ts-ready, [data-keyboard="true"] .ts-vote-result { display: none; }
  [data-keyboard="true"] .ts-vote { padding: 6px 10px; }
  [data-keyboard="true"] .ts-vote-buttons { width: auto; }
  [data-keyboard="true"] .ts-input-row textarea { min-height: 54px; }
  [data-compact-viewport="true"] .ts-sidebar, [data-compact-viewport="true"] .ts-table-header, [data-compact-viewport="true"] .ts-examples, [data-compact-viewport="true"] .ts-discussion-heading, [data-compact-viewport="true"] .ts-ready, [data-compact-viewport="true"] .ts-vote-result { display: none; }
  [data-compact-viewport="true"] .ts-conversation { min-height: 0; overflow: hidden; }
  [data-compact-viewport="true"] .ts-vote { padding: 6px 10px; }
  [data-compact-viewport="true"] .ts-input-row textarea { min-height: 54px; }
}

@media (prefers-reduced-motion: reduce) {
  .turtle-soup-screen *, .turtle-soup-screen *::before, .turtle-soup-screen *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
