:root {
  font-family:
    Aptos,
    "Segoe UI",
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    sans-serif;
  color: #27211b;
  background: #f6f8ff;
  color-scheme: light;
  font-synthesis: none;
  --bg: #f6f8ff;
  --paper: #ffffff;
  --panel-2: #edf2ff;
  --line: #d7deec;
  --text: #27211b;
  --muted: #667085;
  --teal: #2f6fed;
  --blue: #4f8df7;
  --amber: #f4a62a;
  --green: #34a853;
  --violet: #8b5cf6;
  --shadow: 0 18px 45px rgba(36, 54, 89, 0.12);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.72), transparent 34rem),
    radial-gradient(
      circle at 12% 8%,
      rgba(47, 111, 237, 0.13),
      transparent 24rem
    ),
    radial-gradient(
      circle at 86% 2%,
      rgba(244, 166, 42, 0.13),
      transparent 25rem
    ),
    linear-gradient(180deg, #f6f8ff 0%, #eef4ff 54%, #f8fbff 100%);
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select,
summary {
  touch-action: manipulation;
}
a {
  color: var(--teal);
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(39, 33, 27, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease;
}
button:hover {
  transform: translateY(-1px);
  border-color: var(--teal);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  transform: none;
  border-color: rgba(39, 33, 27, 0.12);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible,
#canvas-host:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
}
button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-button {
  width: 44px;
  flex-shrink: 0;
  padding: 10px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.lab {
  display: grid;
  grid-template-columns: clamp(320px, 27vw, 370px) minmax(0, 1fr);
  height: 100svh;
  min-height: 540px;
}
.journey {
  position: relative;
  z-index: 2;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 22px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
  scrollbar-color: #c3cde0 transparent;
}
.journey-header {
  margin-bottom: 20px;
}
.back-link {
  display: inline-block;
  padding: 3px 0 8px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.back-link:hover {
  text-decoration: underline;
}
h1 {
  margin: 8px 0 7px;
  font-size: 28px;
  font-weight: 900;
  line-height: 1.05;
}
h1 span {
  color: var(--teal);
}
.journey-header p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}
.prompt-panel > label {
  display: block;
  margin-bottom: 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
#prompt-input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 50px;
  padding: 11px 14px;
  border: 1px solid rgba(87, 103, 132, 0.24);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(36, 54, 89, 0.1);
}
#prompt-input[aria-invalid="true"] {
  border-color: #e85d75;
}
.primary {
  width: 100%;
  min-height: 50px;
  margin-top: 10px;
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 16px 32px rgba(47, 111, 237, 0.2);
}
.primary span {
  font-size: 20px;
  line-height: 1;
}
.primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  border-color: var(--teal);
}
.input-hint,
.input-error {
  margin: 9px 0 0;
  font-size: 12px;
  line-height: 1.5;
}
.input-hint {
  color: var(--muted);
}
.input-error {
  color: #b42318;
}
.text-button {
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  text-decoration: underline;
}
.step-panel {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
#steps {
  display: grid;
  gap: 5px;
}
#steps button {
  justify-content: flex-start;
  gap: 10px;
  min-height: 40px;
  padding: 6px 10px;
  border-color: var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}
#steps button:hover {
  color: var(--text);
  border-color: rgba(47, 111, 237, 0.42);
}
#steps b {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #e9eef8;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}
#steps button:disabled {
  opacity: 0.55;
}
#steps button[data-visited="true"] b {
  background: rgba(52, 168, 83, 0.18);
  color: #1d6b35;
}
#steps button[aria-pressed="true"] {
  background: linear-gradient(
    180deg,
    rgba(47, 111, 237, 0.14),
    rgba(255, 255, 255, 0.96)
  );
  border-color: var(--teal);
  color: var(--text);
}
#steps button[aria-pressed="true"] b {
  background: var(--teal);
  color: #fff;
}
.guide {
  margin: 18px 0 16px;
  min-height: 126px;
}
#step-kicker {
  color: var(--teal);
  font-size: 12px;
  letter-spacing: 0.14em;
  font-weight: 900;
  text-transform: uppercase;
}
.guide h2 {
  margin: 8px 0 8px;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
}
.guide p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}
.playback {
  display: flex;
  gap: 6px;
}
#play {
  min-width: 88px;
}
#next-step {
  flex: 1;
  padding-inline: 8px;
}
.playback-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.speed-label {
  display: flex;
  align-items: center;
  gap: 5px;
}
select {
  min-height: 34px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
progress {
  display: block;
  appearance: none;
  width: 100%;
  height: 6px;
  margin: 10px 0 0;
  border: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #e9eef8;
  accent-color: var(--teal);
}
progress::-webkit-progress-bar {
  background: #e9eef8;
}
progress::-webkit-progress-value {
  background: var(--teal);
  border-radius: 4px;
}
progress::-moz-progress-bar {
  background: var(--teal);
}
.answer-panel {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(52, 168, 83, 0.28);
  border-radius: 8px;
  background: rgba(52, 168, 83, 0.07);
}
.answer-panel > span {
  color: #1d6b35;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.answer-panel p {
  margin: 8px 0 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.answer-panel[data-empty="true"] p {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.answer-new {
  padding: 2px 6px;
  border-radius: 7px;
  background: var(--green);
  color: #fff;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
#guide[data-loop="true"] {
  min-height: 0;
}
#loop-pass {
  margin: 10px 0;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.loop-words {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
}
.loop-word-card {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.loop-word-card > span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.loop-word-card strong {
  display: block;
  min-height: 28px;
  margin-top: 5px;
  font-size: 21px;
  font-weight: 900;
  line-height: 28px;
}
.loop-arrow {
  color: var(--muted);
  font-size: 20px;
  font-weight: 900;
  text-align: center;
}
#loop-result-card[data-ready="true"] {
  border-color: var(--green);
  background: rgba(52, 168, 83, 0.1);
}
#loop-result-card[data-ready="true"] strong {
  color: #1d6b35;
}
#loop-result-card[data-ready="false"] strong {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
#loop-status {
  min-height: 36px;
  margin: 9px 0 0;
  color: #344054;
  font-size: 13px;
  line-height: 1.5;
}
#loop-readout .answer-panel {
  margin-top: 10px;
  padding: 10px 12px;
}
#loop-readout .answer-panel p {
  margin-top: 6px;
}
.technical-details {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: #344054;
  font-size: 13px;
  line-height: 1.6;
}
summary {
  min-height: 38px;
  padding: 7px 0;
  color: var(--teal);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}
.technical-details p {
  margin: 12px 0;
}
.label-setting {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 9px 11px;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}
.label-setting input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--teal);
}
.technical-field {
  display: grid;
  gap: 6px;
  margin: 14px 0;
  color: var(--text);
  font-weight: 700;
}
.technical-field select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  font-size: 13px;
}
.metrics {
  display: grid;
  gap: 9px;
  padding: 12px 0;
}
.metrics > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.metrics strong {
  min-width: 62px;
  color: var(--text);
  font-size: 17px;
  font-weight: 900;
}
.metrics span {
  color: var(--muted);
  font-size: 12px;
}
.technical-actions {
  display: grid;
  gap: 8px;
}
.technical-actions button {
  font-size: 13px;
}
.extra-detail,
.source-notes {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}
.micro {
  color: var(--muted);
  font-size: 12px;
}
.temperature {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
.temperature input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  accent-color: var(--teal);
}
.prob-row {
  display: grid;
  grid-template-columns: 70px 1fr 36px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 800;
}
.prob-track {
  height: 10px;
  border: 1px solid rgba(87, 103, 132, 0.16);
  border-radius: 6px;
  overflow: hidden;
  background: #e9eef8;
}
.prob-fill {
  height: 100%;
  border-radius: 6px;
  background: var(--blue);
}
.prob-row[data-sampled="true"] {
  color: #1d6b35;
}
.prob-row[data-sampled="true"] .prob-fill {
  background: var(--green);
}
#sample-result {
  color: var(--text);
  font-weight: 800;
}
.simulation-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}
.experience,
.viewport {
  min-width: 0;
  min-height: 0;
  height: 100%;
}
.viewport {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(47, 111, 237, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 111, 237, 0.055) 1px, transparent 1px),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.96),
      rgba(244, 247, 252, 0.94)
    );
  background-size:
    38px 38px,
    38px 38px,
    auto;
}
#canvas-host {
  position: absolute;
  inset: 0;
  cursor: grab;
  touch-action: none;
}
#canvas-host:active {
  cursor: grabbing;
}
#canvas-host:focus-visible {
  outline-offset: -6px;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.scene-heading {
  position: absolute;
  top: 26px;
  left: 30px;
  max-width: min(54%, 460px);
  padding: 14px 18px;
  border: 1px solid rgba(47, 111, 237, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 30px rgba(36, 54, 89, 0.1);
  pointer-events: none;
}
.scene-heading > span {
  color: var(--teal);
  font-size: 12px;
  letter-spacing: 0.14em;
  font-weight: 900;
  text-transform: uppercase;
}
.scene-heading h2 {
  margin: 6px 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
}
.scene-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.view-actions {
  position: absolute;
  top: 26px;
  right: 24px;
  display: flex;
  gap: 8px;
}
.view-actions button {
  min-height: 40px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(36, 54, 89, 0.1);
}
#mobile-play {
  display: none;
}
#follow-step {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}
#show-model[aria-pressed="true"] {
  border-color: var(--teal);
  background: linear-gradient(
    180deg,
    rgba(47, 111, 237, 0.14),
    rgba(255, 255, 255, 0.96)
  );
}
.camera-tools {
  display: flex;
  align-items: center;
  position: absolute;
  right: 24px;
  bottom: 24px;
  padding: 4px;
  border: 1px solid rgba(87, 103, 132, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 30px rgba(36, 54, 89, 0.1);
}
.camera-tools button {
  border: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
}
.camera-tools button:hover {
  background: #eef4ff;
  transform: none;
}
.tool-divider {
  width: 1px;
  height: 16px;
  margin: 0 2px;
  background: var(--line);
}
.gesture {
  position: absolute;
  bottom: 34px;
  left: 30px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}
.flow-label {
  position: absolute;
  z-index: 2;
  max-width: min(260px, calc(100% - 24px));
  padding: 7px 10px;
  border: 1px solid rgba(52, 168, 83, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: #1d6b35;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.render-notice {
  position: absolute;
  top: 44%;
  left: 10%;
  right: 10%;
  max-width: 420px;
  margin: 0 auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  box-shadow: var(--shadow);
}
/* Controls and narration stay beside the model, never underneath it. */
@media (min-width: 801px) {
  body {
    overflow: hidden;
  }
}
@media (max-width: 1100px) and (min-width: 801px) {
  .lab {
    grid-template-columns: 310px minmax(0, 1fr);
  }
  .journey {
    padding-inline: 18px;
  }
  .scene-heading {
    top: 84px;
    left: 20px;
    max-width: calc(100% - 40px);
  }
  .scene-heading h2 {
    font-size: 22px;
  }
  .view-actions {
    top: 20px;
    right: 20px;
  }
  .gesture {
    left: 22px;
    bottom: 88px;
  }
}
@media (max-height: 800px) and (min-width: 801px) {
  .journey {
    padding-top: 14px;
  }
  .journey-header {
    margin-bottom: 14px;
  }
  .journey-header p {
    display: none;
  }
  .step-panel {
    margin-top: 14px;
    padding-top: 12px;
  }
  #steps button {
    min-height: 34px;
    padding-block: 4px;
  }
  .guide {
    margin: 14px 0;
    min-height: 0;
  }
  .guide h2 {
    font-size: 21px;
  }
  #guide[data-loop="true"] {
    margin: 8px 0;
  }
  #guide[data-loop="true"] #loop-pass {
    margin: 6px 0;
  }
  #loop-readout .answer-panel {
    padding: 8px 10px;
  }
}
@media (max-width: 800px) {
  .lab {
    height: auto;
    min-height: 100svh;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(500px, 70svh);
  }
  .journey {
    overflow: visible;
    padding: 16px 18px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }
  .journey-header {
    margin-bottom: 14px;
  }
  .journey-header h1 {
    font-size: 25px;
  }
  .journey-header p {
    display: none;
  }
  .prompt-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 94px;
    gap: 8px;
  }
  .prompt-panel > label {
    grid-column: 1 / -1;
    margin: 0;
  }
  #send {
    margin: 0;
  }
  .input-hint,
  .input-error,
  #use-example {
    grid-column: 1 / -1;
    margin-top: 0;
  }
  .step-panel {
    margin-top: 16px;
    padding-top: 16px;
  }
  #steps {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
  }
  #steps button {
    flex-direction: column;
    justify-content: flex-start;
    gap: 6px;
    min-height: 66px;
    padding: 7px 2px;
    text-align: center;
    font-size: 11px;
    line-height: 1.25;
  }
  #steps b {
    width: 22px;
    height: 22px;
  }
  .guide {
    min-height: 0;
    margin: 16px 0;
  }
  .guide h2 {
    font-size: 21px;
  }
  .guide p {
    font-size: 14px;
    line-height: 1.5;
  }
  .playback-meta {
    margin-top: 8px;
  }
  .answer-panel {
    margin-top: 14px;
  }
  .technical-details {
    margin-top: 16px;
    padding-top: 8px;
  }
  .simulation-note {
    margin-top: 5px;
  }
  .scene-heading {
    top: 76px;
    left: 16px;
    max-width: calc(100% - 32px);
    padding: 12px 14px;
  }
  .scene-heading > span {
    font-size: 10px;
  }
  .scene-heading h2 {
    font-size: 20px;
    margin: 5px 0;
  }
  .scene-heading p {
    font-size: 13px;
  }
  .view-actions {
    top: 16px;
    right: 14px;
  }
  .view-actions button {
    padding-inline: 11px;
    font-size: 12px;
  }
  #mobile-play {
    display: inline-flex;
  }
  #canvas-host {
    inset: 160px 0 84px;
  }
  .camera-tools {
    right: 14px;
    bottom: 14px;
  }
  #rotate-left,
  #rotate-right,
  .tool-divider:first-of-type {
    display: none;
  }
  .gesture {
    bottom: 79px;
    left: 16px;
    font-size: 11px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
