/* Keep the paper specimen mount distinct from the controls beneath it. */
.specimen-stage.tt-stage {
  min-width: 0;
  min-height: 0;
  align-self: start;
  overflow: hidden;
  background: #f2f1e8;
  border: 1px solid #cbd0bc;
}
.tt-paper {
  position: relative;
  isolation: isolate;
  background-color: #e6e9d8;
  background-image: radial-gradient(ellipse at 48% 40%, #f3f2e7 0%, #e7e9d9 68%, #dce1cf 100%);
}
.tt-head,
.tt-paper-foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 12px 20px;
  color: #425341;
}
.tt-head {
  padding-top: 16px;
  padding-bottom: 0;
  font-family: var(--serif);
  font-size: 1rem;
  letter-spacing: .12em;
}
.tt-reading {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  font-family: var(--sans);
  font-size: .81rem;
  letter-spacing: .03em;
  font-variant-numeric: tabular-nums;
}
.tt-reading span { width: 4ch; text-align: right; }
.tt-compass {
  display: inline-block;
  position: relative;
  width: 17px;
  height: 17px;
  border: 1px solid #6b785e;
  border-radius: 50%;
}
.tt-compass::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 1px;
  width: 1px;
  height: 13px;
  background: linear-gradient(#30472f 50%, transparent 50%);
}
.tt-compass::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 6px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #4d6349;
}
.tt-canvas {
  display: block;
  width: 100%;
  height: clamp(255px, 24vw, 365px);
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.tt-canvas.tt-dragging { cursor: grabbing; }
.tt-canvas:focus-visible {
  outline: 2px dashed #657b50;
  outline-offset: -6px;
}
.tt-paper-foot { min-height: 54px; padding-top: 2px; padding-bottom: 9px; }
#tt-instruction { font-size: .78rem; }
.tt-mode-buttons {
  display: inline-flex;
  padding: 2px;
  border: 1px solid #b3bba4;
  background: #f7f7ed90;
  border-radius: 100px;
}
.tt-mode-buttons button,
.tt-controls button {
  cursor: pointer;
  -webkit-appearance: none;
  font-family: var(--sans);
  line-height: 1.4;
}
.tt-mode-buttons button {
  min-width: 60px;
  min-height: 38px;
  padding: 4px 11px;
  border: none;
  border-radius: 100px;
  background: transparent;
  font-size: .81rem;
  color: #364d39;
}
.tt-mode-buttons button[aria-pressed=true] { background: #324836; color: #fff; }
.tt-controls {
  border-top: 1px solid #cad0bc;
  padding: 10px 20px;
  color: #2c4433;
}
.tt-rotation-row,
.tt-jog,
.tt-zoom,
.tt-actions {
  display: flex;
  align-items: center;
}
.tt-rotation-row { justify-content: space-between; flex-wrap: wrap; gap: 0 12px; }
.tt-jog { gap: 2px; }
.tt-controls button {
  position: relative;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: #2c4433;
  font-size: .875rem;
  padding: 5px 9px;
  border-radius: 2px;
}
.tt-controls button:hover:not(:disabled),
.tt-mode-buttons button:hover:not([aria-pressed=true]) { background-color: #dfe5d2; }
.tt-controls button:disabled { cursor: default; color: #737965; }
.tt-controls button[aria-pressed=true],
.tt-controls button[aria-expanded=true] { color: #314b2a; background: #dfe5d2; }
.tt-jog #tt-left,
.tt-jog #tt-right {
  min-width: 44px;
  font-size: 1.45rem;
  font-family: system-ui, sans-serif;
  line-height: 1;
}
#tt-spin { min-width: 88px; font-weight: 500; }
.tt-zoom { font-size: .81rem; gap: 8px; }
.tt-zoom output { min-width: 4.1ch; font-variant-numeric: tabular-nums; }
.tt-controls input[type=range] {
  accent-color: #556b41;
  cursor: pointer;
  min-height: 36px;
  margin: 0;
}
.tt-zoom input[type=range] { width: clamp(60px, 7vw, 110px); }
.tt-actions {
  border-top: 1px solid #ced3c3;
  margin-top: 6px;
  padding: 6px 0 0;
  gap: 2px 8px;
  flex-wrap: wrap;
}
.tt-actions button { display: flex; align-items: center; gap: 7px; }
.tt-actions #tt-reset { margin-left: auto; font-size: .79rem; text-decoration: underline; text-underline-offset: 4px; }
.tt-glyph { font-size: 1.2rem; line-height: 1; }
.tt-detail-icon {
  display: inline-block;
  width: 13px;
  height: 13px;
  position: relative;
  border: 1px solid currentColor;
  border-radius: 50%;
}
.tt-detail-icon::after {
  content: '';
  position: absolute;
  right: -4px;
  bottom: -2px;
  width: 5px;
  height: 1px;
  background: currentColor;
  transform: rotate(45deg);
}
.tt-growth-panel {
  padding: 12px 4px 4px;
  margin-top: 5px;
  border-top: 1px solid #ced3c3;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 12px;
  font-size: .82rem;
}
.tt-growth-panel output { text-align: right; color: #435c33; }
.tt-growth-panel input[type=range] { width: 100%; grid-column: 1 / -1; }
.tt-small-note { grid-column: 1 / -1; font-size: .75rem; color: #596956; }
.tt-note {
  border-left: 2px solid #758959;
  background: #e5eadb;
  margin: 10px 0 4px;
  padding: 10px 14px;
  font-size: .875rem;
  line-height: 1.8;
}

.tt-touch-hint { display: none; }
@media (any-pointer: coarse), (max-width: 750px) {
  .tt-touch-hint { display: block; }
  .tt-mouse-hint { display: none; }
}

/* A phone keeps direct manipulation on the image and leaves the rail scrollable. */
@media (max-width: 750px), (max-width: 960px) and (max-height: 500px) {
  .tt-stage { container-type: inline-size; }
  .tt-canvas { height: clamp(195px, 59vw, 315px); }
  .tt-head { padding: 8px 14px 0; font-size: .95rem; }
  .tt-paper-foot { padding: 3px 12px 9px; gap: 5px; align-items: center; }
  #tt-instruction { font-size: .75rem; line-height: 1.45; letter-spacing: .015em; }
  .tt-mode-buttons { padding: 1px; }
  .tt-mode-buttons button { min-height: 44px; min-width: 54px; font-size: .8125rem; padding: 4px 10px; }
  .tt-controls { padding: 6px 12px 7px; }
  .tt-rotation-row { gap: 2px 12px; }
  .tt-jog { gap: 0; }
  .tt-jog button { padding-inline: 5px; }
  #tt-spin { min-width: 75px; font-size: .8125rem; }
  .tt-zoom { flex: 1 1 105px; min-width: 0; gap: 5px; font-size: .8125rem; }
  .tt-zoom span,.tt-zoom output { flex-shrink: 0; }
  .tt-zoom input[type=range] { flex: 1 1 54px; min-width: 44px; max-width: 160px; width: auto; }
  .tt-controls input[type=range] { min-height: 44px; }
  .tt-actions {
    display: grid;
    grid-template-columns: minmax(0,1.35fr) minmax(0,1fr) auto;
    align-items: stretch;
    gap: 3px;
    margin-top: 3px;
    padding-top: 3px;
  }
  .tt-actions button {
    padding: 4px 3px;
    justify-content: center;
    gap: 5px;
    line-height: 1.45;
    font-size: .8125rem;
  }
  .tt-actions #tt-reset { margin: 0; font-size: .75rem; }
  .tt-detail-icon,.tt-glyph { flex-shrink: 0; }
  .tt-note { margin: 5px 0 2px; padding: 8px 12px; }
  .tt-growth-panel { margin-top: 4px; padding: 7px 2px 3px; }
}
@container (max-width: 330px) {
  .tt-controls { padding-inline: 9px; }
  .tt-head, .tt-paper-foot { padding-inline: 10px; }
  .tt-rotation-row { gap: 0 4px; }
  .tt-actions { grid-template-columns: minmax(0,1.26fr) minmax(0,1fr) auto; }
  .tt-actions button { gap: 3px; }
  .tt-actions .tt-glyph,.tt-actions .tt-detail-icon { display: none; }
}
@container (max-width: 290px) {
  .tt-zoom { flex-basis: 100%; }
  .tt-zoom input[type=range] { max-width: none; }
  .tt-jog { width: 100%; justify-content: space-between; }
  .tt-actions { grid-template-columns: 1fr 1fr; gap: 0 5px; }
  .tt-actions #tt-reset { grid-column: 1 / -1; justify-self: end; }
}
@media (orientation: landscape) and (max-height: 500px) and (max-width: 960px) {
  .tt-canvas { height: clamp(155px, 44svh, 222px); }
  .tt-head { padding-top: 4px; }
  .tt-paper-foot { min-height: 46px; padding-block: 0 2px; }
  .tt-controls { padding-block: 2px; }
}
