/* A double pendulum swinging in 3D: the demo window inside the site frame.
   Colors: the site's teal and rust, lightened for the space grey canvas, and sand. */

:root {
  --bg-page: #ffffff;
  --text-page: #000000;
  --link-blue: #0000ee;
  
  --chrome-border: #7a7a7a;
  --chrome-border-light: #c4c4c4;
  --chrome-bg-title: linear-gradient(#fafafa, #d2d2d2);
  --chrome-bg-bar: linear-gradient(#f6f6f6, #dedede);
  --chrome-bg-btn: linear-gradient(#ffffff, #dcdcdc);
  --chrome-bg-btn-active: linear-gradient(#cfd8e6, #eef2f8);
  --chrome-sidebar-bg: #ececec;
  --chrome-pane-bg: #ffffff;
  --chrome-field-bg: #f5f5f5;

  /* Presentation Surface (Space Grey Canvas Wrapper) */
  --space-grey-bg: radial-gradient(circle at 50% 35%, #3b4048 0%, #25282e 48%, #121417 100%);

  /* The three pendulums */
  --lead: #6cc3b5;
  --twin1: #e8894f;
  --twin2: #efe6d2;

  --font-mono: "CaskaydiaCove Nerd Font Mono", "Cascadia Mono", Consolas, "Courier New", monospace;
  --font-prose: var(--sans, "Lexend Deca", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}

* {
  box-sizing: border-box;
}

.ws-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin: 24px 0 0;
  height: clamp(560px, 82vh, 880px);
  border-radius: 6px;
  border: 1px solid var(--chrome-border);
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.15);
  min-height: 0;
  overflow: hidden;
}

.ws-titlebar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 25px;
  padding: 0 10px;
  background: var(--chrome-bg-title);
  border-bottom: 1px solid #8c8c8c;
  font-size: 12px;
  font-weight: 700;
  color: #2a2a2a;
  letter-spacing: .02em;
  user-select: none;
}

.ws-titlebar .ws-title-text {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: #2a2a2a;
  text-align: center;
}

.ws-titlebar button#maximize {
  position: absolute;
  right: 4px;
  top: 3px;
  width: 18px;
  height: 17px;
  padding: 0;
  line-height: 13px;
  font-size: 12px;
  background: linear-gradient(#fff, #dcdcdc);
  border: 1px solid #7a7a7a;
  border-radius: 2px;
  color: #2a2a2a;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ws-titlebar button#maximize:hover {
  background: #fff;
  color: #000;
}

/* Fullscreen / Maximized Mode matching integerc.dev/examples/ */
.ws-window.ws-max {
  position: fixed;
  inset: 0;
  z-index: 10000;
  width: 100vw;
  height: 100vh;
  margin: 0;
  border-radius: 0;
  border: none;
  max-width: none;
}

body.ws-maxed {
  overflow: hidden;
}

/* Main Container Layout */
.demo-container {
  display: flex;
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
  background: var(--chrome-sidebar-bg);
}

@media (max-width: 1024px) {
  .ws-window {
    flex: none;
    height: auto;
    overflow: visible;
  }

  .demo-container {
    flex-direction: column;
    overflow: visible;
    height: auto;
  }

  .viewport-panel {
    flex: none;
    height: 380px;
    min-height: 320px;
    width: 100%;
  }

  .canvas-wrapper {
    height: 100%;
    min-height: 300px;
  }

  .sidebar-panel {
    width: 100%;
    min-width: 100%;
    height: auto;
    overflow: visible;
  }
}

/* Left / Center Viewport */
.viewport-panel {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  height: 100%;
}

/* Space Grey Presentation Canvas Wrapper */
.canvas-wrapper {
  flex: 1;
  position: relative;
  background: var(--space-grey-bg);
  border: 1px solid var(--chrome-border);
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, 0.5);
  cursor: grab;
  touch-action: none;
  min-height: 240px;
  overflow: hidden;
}

.canvas-wrapper.grabbing {
  cursor: grabbing;
}

.canvas-wrapper.aiming-impulse {
  cursor: crosshair;
}

canvas#renderCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* Overlays Inside the Space Grey Viewport */
.overlay-legend {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(18, 20, 24, 0.88);
  border: 1px solid #334155;
  border-radius: 3px;
  padding: 8px 12px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: #cbd5e1;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.legend-item:last-child {
  margin-bottom: 0;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 4px currentColor;
}

.overlay-interaction-hint {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(18, 20, 24, 0.88);
  border: 1px solid #334155;
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 11px;
  font-family: var(--font-prose);
  color: #94a3b8;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.overlay-interaction-hint kbd {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 2px;
  padding: 1px 4px;
  color: #f1f5f9;
}

.camera-controls-floating {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  z-index: 10;
}

.btn-icon {
  background: rgba(18, 20, 24, 0.9);
  border: 1px solid #334155;
  color: #cbd5e1;
  width: 28px;
  height: 28px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s ease;
  font-size: 13px;
}

.btn-icon:hover {
  background: #1e293b;
  color: var(--lead);
  border-color: var(--lead);
}

/* Timeline Playback Dock (Fedora Core 1 Style) */
.timeline-dock {
  background: var(--chrome-bg-bar);
  border-top: 1px solid var(--chrome-border);
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 6px 12px;
  flex-wrap: wrap;
  z-index: 20;
}

.playback-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timeline-slider-wrap {
  flex: 1 1 160px;
  min-width: 160px;
  display: flex;
  align-items: center;
  position: relative;
}

.timeline-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 7px;
  border-radius: 2px;
  background: #c8c8c8;
  border: 1px solid #8c8c8c;
  outline: none;
  cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 2px;
  background: var(--chrome-bg-btn);
  border: 1px solid #444;
  box-shadow: 1px 1px 0 #fff;
  cursor: pointer;
}

.timeline-slider::-webkit-slider-thumb:hover {
  background: #ffffff;
  border-color: #000;
}

.timeline-scrubber-info {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #222222;
  white-space: nowrap;
  min-width: 160px;
  text-align: right;
}

/* Right Control & Telemetry Sidebar (Fedora ced Panel Style) */
.sidebar-panel {
  width: 460px;
  min-width: 460px;
  height: 100%;
  min-height: 0;
  background: var(--chrome-sidebar-bg);
  border-left: 1px solid var(--chrome-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--chrome-border-light) transparent;
}

@media (max-width: 1024px) {
  .sidebar-panel {
    width: 100%;
    min-width: auto;
    border-left: none;
    border-top: 1px solid var(--chrome-border);
  }
}

/* Fedora Document Tabs */
.tab-nav {
  display: flex;
  background: var(--chrome-bg-bar);
  border-bottom: 1px solid var(--chrome-border);
  padding: 4px 6px 0;
  gap: 3px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.tab-btn {
  flex: none;
  background: linear-gradient(#f6f6f6, #dedede);
  border: 1px solid #9a9a9a;
  border-bottom: none;
  border-radius: 3px 3px 0 0;
  padding: 4px 9px;
  font-family: var(--font-prose);
  font-size: 11.5px;
  color: #444444;
  cursor: pointer;
  margin-bottom: -1px;
}

.tab-btn:hover {
  background: #ffffff;
  color: #000000;
}

.tab-btn.active {
  background: #ffffff;
  border-color: var(--chrome-border);
  color: #000000;
  font-weight: 700;
  z-index: 2;
}

.tab-content {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--chrome-sidebar-bg);
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.tab-pane.active {
  display: flex;
}

/* Scientific Sunken Section Cards */
.card-section {
  background: var(--chrome-pane-bg);
  border: 1px solid;
  border-color: #7a7a7a #ffffff #ffffff #7a7a7a;
  box-shadow: inset 1px 1px 0 #c4c4c4;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-title {
  font-size: 12px;
  font-weight: 700;
  color: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
}

/* Status / Parity Receipt Box */
.parity-badge-box {
  background: #ffffff;
  border: 1px solid #7a7a7a;
  border-left: 4px solid #1d4e4a;
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #1d4e4a;
}

/* Classic Fedora Buttons */
.btn {
  background: var(--chrome-bg-btn);
  border: 1px solid #7a7a7a;
  border-radius: 2px;
  color: #000000;
  font-family: var(--font-prose);
  font-size: 12px;
  padding: 3px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  user-select: none;
  text-decoration: none;
}

.btn:hover {
  background: #ffffff;
  border-color: #000000;
  color: #000000;
}

.btn:active, .btn.btn-active {
  background: var(--chrome-bg-btn-active);
  border-color: #4a6ea9;
  color: #1d3c6e;
}

.btn-primary {
  font-weight: 700;
}

.btn-sm {
  padding: 2px 8px;
  font-size: 11.5px;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* Segmented Controls */
.segmented-control {
  display: inline-flex;
  border: 1px solid #8c8c8c;
  background: #dedede;
  border-radius: 2px;
  padding: 1px;
  gap: 1px;
}

.segmented-option {
  padding: 2px 8px;
  font-size: 11px;
  font-family: var(--font-prose);
  color: #333333;
  cursor: pointer;
  border-radius: 1px;
}

.segmented-option:hover {
  background: #f0f0f0;
  color: #000;
}

.segmented-option.active {
  background: #ffffff;
  color: #000000;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.speed-select {
  background: var(--chrome-bg-btn);
  border: 1px solid #7a7a7a;
  border-radius: 2px;
  font-family: var(--font-prose);
  font-size: 12px;
  padding: 2px 4px;
  color: #000000;
  cursor: pointer;
}

/* Telemetry Grid and Field Blocks */
.telemetry-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.telemetry-block {
  background: var(--chrome-field-bg);
  border: 1px solid #d2d2d2;
  border-radius: 2px;
  padding: 5px 8px;
}

.telemetry-block.full-width {
  grid-column: 1 / -1;
}

.telemetry-label {
  font-size: 10.5px;
  color: #555555;
  margin-bottom: 2px;
}

.telemetry-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #000000;
}

/* Divergence Meter Bar */
.divergence-bar-wrap {
  width: 100%;
  height: 7px;
  background: #e0e0e0;
  border: 1px solid #999999;
  border-radius: 1px;
  overflow: hidden;
  margin-top: 4px;
}

.divergence-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6cc3b5 0%, #e8894f 60%, #b0521f 100%);
  transition: width 0.1s ease;
}

/* Parity Receipt Table */
.parity-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11px;
  background: #ffffff;
  border: 1px solid #7a7a7a;
  margin-bottom: 12px;
}

.parity-table th {
  background: #e8e8e8;
  border-bottom: 1px solid #7a7a7a;
  padding: 5px 6px;
  text-align: left;
  font-weight: 700;
  color: #222222;
  font-size: 11px;
}

.parity-table td {
  padding: 5px 6px;
  border-bottom: 1px solid #e0e0e0;
  color: #000000;
  font-size: 11px;
}

.legend-swatch-sm {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.rec-receipt-box {
  background: #2e3440;
  border: 1px solid;
  border-color: #7a7a7a #fff #fff #7a7a7a;
  box-shadow: inset 1px 1px 0 #c4c4c4;
  padding: 10px 14px;
  font: 13.5px/1.45 var(--font-mono);
  color: #d8dee9;
  white-space: pre-wrap;
  word-break: break-all;
  border-radius: 4px;
}

.rec-receipt-box a {
  color: #88c0d0;
  text-decoration: underline;
}

.parity-table td.receipt-live {
  color: #1d4e4a;
  font-weight: 700;
}

.parity-table td.receipt-miss {
  color: #b0521f;
}

.receipt-engine {
  font-size: 12.5px;
  line-height: 1.5;
  color: #333333;
  margin: 0 0 10px;
}

.card-subtitle {
  font-size: 11.5px;
  font-weight: 700;
  color: #2a2a2a;
  margin: 0 0 4px;
}

.receipt-stdout {
  background: #2e3440;
  border: 1px solid;
  border-color: #7a7a7a #fff #fff #7a7a7a;
  box-shadow: inset 1px 1px 0 #c4c4c4;
  padding: 10px 14px;
  margin: 0 0 12px;
  font: 13.5px/1.45 var(--font-mono);
  color: #d8dee9;
  white-space: pre-wrap;
  word-break: break-all;
  border-radius: 4px;
}

.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 6px;
}

.theme-swatch {
  appearance: none;
  display: flex;
  gap: 0;
  height: 28px;
  padding: 3px;
  margin: 0;
  border: 1px solid #7a7a7a;
  border-radius: 3px;
  background: #25282e;
  cursor: pointer;
}

.theme-swatch span {
  flex: 1;
  height: 100%;
}

.theme-swatch:hover { border-color: #222222; }
.theme-swatch[aria-pressed="true"] { outline: 2px solid #1d4e4a; outline-offset: 1px; border-color: #1d4e4a; }
.theme-swatch:focus-visible { outline: 2px solid #b0521f; outline-offset: 1px; }

.code-pre {
  background: #ffffff;
  border: 1px solid;
  border-color: #7a7a7a #fff #fff #7a7a7a;
  box-shadow: inset 1px 1px 0 #c4c4c4;
  border-radius: 4px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.45;
  max-height: 480px;
  overflow: auto;
  color: #000000;
  white-space: pre;
}

/* Site Footer */
footer.site {
  margin: 14px 24px 24px;
  font: 12.5px/1.55 var(--font-prose);
  color: #555555;
  border-top: 1px solid #000000;
  padding-top: 14px;
}

footer.site p {
  margin: 0 0 2px;
}

footer.site a {
  color: var(--link-blue);
  text-decoration: underline;
}

footer.site .foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 32px;
}

/* --- Priority Feature: Consensus Tether --- */
.consensus-card {
  background: #ffffff;
  border: 1px solid #7a7a7a;
  border-top: 3px solid #1d4e4a;
  padding: 10px 12px;
}

.tether-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid #c8c8c8;
  background: #f4f2ee;
  color: #1d4e4a;
  white-space: nowrap;
}

.tether-control-box {
  margin: 6px 0;
}

.tether-extremes-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  margin-bottom: 3px;
}

.extreme-chaos {
  color: #b0521f;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.extreme-midpoint {
  color: #555555;
  font-size: 10px;
}

.extreme-order {
  color: #1d4e4a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.consensus-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 9px;
  border-radius: 2px;
  background: linear-gradient(90deg, #b0521f 0%, #cbd5e1 50%, #1d4e4a 100%);
  border: 1px solid #7a7a7a;
  outline: none;
  cursor: pointer;
  margin: 3px 0;
}

.consensus-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 22px;
  border-radius: 2px;
  background: linear-gradient(#ffffff, #dcdcdc);
  border: 1px solid #333333;
  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  cursor: grab;
}

.consensus-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  background: #ffffff;
}

.tether-sub-row {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: #64748b;
  margin-top: 2px;
}

.tether-divergence-block {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #e2e8f0;
}

.mobile-only {
  display: none;
}

/* --- Responsive Mobile & Touch Optimizations (max-width: 768px) --- */
@media (max-width: 768px) {
  /* Cut non-essential verbose academic telemetry on mobile */
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: inline !important;
  }

  body.demo-body {
    overflow-x: hidden;
  }

  /* Compact Site Header */
  header.site {
    padding: 8px 10px;
    gap: 6px;
    flex-direction: column;
    align-items: flex-start;
  }

  header.site nav.nav {
    width: 100%;
    gap: 6px 12px;
    font-size: 12px;
    flex-wrap: wrap;
  }

  /* Compact Demo Subhead */
  .demo-subhead {
    padding: 6px 10px;
    gap: 6px;
  }

  .demo-subhead h1 {
    font-size: 14.5px;
  }

  .subhead-meta {
    font-size: 10.5px;
    gap: 6px 10px;
    flex-wrap: wrap;
  }

  /* Window Container */
  .ws-window {
    margin: 16px 0 12px;
    box-shadow: none;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .ws-titlebar {
    height: 24px;
    padding: 0 8px;
  }

  .ws-titlebar .ws-title-text {
    font-size: 11.5px;
  }

  /* 3D Viewport on Mobile: Dedicated touch-friendly height */
  .viewport-panel {
    height: 360px;
    min-height: 320px;
  }

  .canvas-wrapper {
    min-height: 280px;
  }

  /* Viewport Overlays */
  .overlay-legend {
    top: 6px;
    left: 6px;
    padding: 4px 8px;
    font-size: 10px;
  }

  .legend-item {
    gap: 5px;
    margin-bottom: 2px;
  }

  .camera-controls-floating {
    top: 6px;
    bottom: auto;
    right: 6px;
    gap: 4px;
  }

  .btn-icon {
    width: 28px;
    height: 28px;
    font-size: 13px;
  }

  .overlay-interaction-hint {
    top: auto;
    bottom: 6px;
    left: 6px;
    right: 6px;
    height: auto;
    padding: 3px;
    transform: none;
    align-items: stretch;
  }

  .overlay-interaction-hint > span {
    display: none; /* Hide physical keyboard shortcuts on mobile touch */
  }

  .overlay-interaction-hint .segmented-control {
    width: 100%;
    display: flex;
    height: auto;
  }

  .overlay-interaction-hint .segmented-option {
    flex: 1;
    text-align: center;
    padding: 4px 2px;
    font-size: 10px;
    line-height: 1.2;
  }

  /* Timeline Playback Dock on Mobile */
  .timeline-dock {
    flex-direction: column;
    align-items: stretch;
    padding: 6px 10px;
    gap: 6px;
  }

  .playback-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 4px;
  }

  .playback-controls #stepPrevBtn,
  .playback-controls #stepNextBtn {
    display: none; /* Cut micro-step buttons on mobile; slider is easier */
  }

  .playback-controls .btn {
    padding: 4px 8px;
    font-size: 11px;
    flex: 1;
  }

  .playback-controls .speed-select {
    font-size: 11px;
    padding: 3px 2px;
  }

  .timeline-slider-wrap {
    width: 100%;
    flex: none;
    min-width: 0;
  }

  .timeline-scrubber-info {
    text-align: center;
    font-size: 10.5px;
    min-width: 0;
  }

  /* Sidebar on Mobile */
  .sidebar-panel {
    width: 100%;
    min-width: 100%;
    border-left: none;
    border-top: 1px solid var(--chrome-border);
  }

  .tab-nav {
    padding: 3px 4px 0;
    gap: 2px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tab-nav::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    padding: 4px 6px;
    font-size: 11px;
    flex: 1;
    text-align: center;
    white-space: nowrap;
  }

  .tab-content {
    padding: 8px 6px;
    gap: 8px;
  }

  .card-section {
    padding: 8px 10px;
    gap: 8px;
  }

  /* Parity Table Mobile Safety */
  .parity-table {
    font-size: 10px;
  }

  .parity-table th,
  .parity-table td {
    padding: 4px;
  }

  .rec-receipt-box {
    font-size: 10px;
    padding: 6px;
  }
}

/* Site frame: the front page's type and colors */
.demo-container, .ws-titlebar { font-family: var(--sans); }
.btn { font-family: var(--sans); border-radius: 4px; }
.btn-primary { background: #1d4e4a; border-color: #1d4e4a; color: #fff; }
.btn-primary:hover { background: #fff; color: #1d4e4a; }
.card-title { font-family: var(--sans); font-weight: 700; }
.overlay-legend { font-family: var(--sans); }
/* The mode toolbar sits at the bottom left, clear of the legend at the top left */
@media (min-width: 769px) {
  .overlay-interaction-hint { top: auto; right: auto; bottom: 12px; left: 12px; flex-wrap: wrap; max-width: calc(100% - 80px); }
}
.accent-lead { color: #1d4e4a; }
.accent-twin { color: #b0521f; }
.demo-page .ws-window { background: #fff; }
.tether-table { border-collapse: collapse; margin: 16px 0 0; font-variant-numeric: tabular-nums; }
.tether-table caption { text-align: left; font-size: 15px; margin-bottom: 6px; }
.tether-table th, .tether-table td { border: 1px solid #c8c8c8; padding: 4px 12px; text-align: right; }
.tether-table thead th { background: #f4f2ee; }
.table-scroll { max-width: 100%; overflow-x: auto; }
/* Panel headings keep the panel's size; the front page's heading bar is for page sections */
.home2 .ws-window h2.card-title { font-size: 12.5px; margin: 0; padding: 0; border: 0; }
.home2 .ws-window h2.card-title::after { display: none; }
.overlay-interaction-hint .segmented-option { color: #e2e8f0; }
.overlay-interaction-hint .segmented-option:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.overlay-interaction-hint .segmented-option.active { background: #efe6d2; color: #121417; }
.demo-page .receipt { grid-template-columns: minmax(0, 1fr); }

/* Tablets and phones: the canvas takes most of the screen width, and full screen fills the screen */
@media (max-width: 1024px) {
  .viewport-panel { height: auto; min-height: 0; }
  .canvas-wrapper { flex: none; height: max(360px, min(72vw, 64svh)); }
  .ws-window.ws-max { height: 100dvh; overflow: hidden; }
  .ws-window.ws-max .demo-container { flex: 1; flex-direction: column; overflow: hidden; min-height: 0; }
  .ws-window.ws-max .viewport-panel { flex: 1 1 auto; min-height: 0; }
  .ws-window.ws-max .canvas-wrapper { flex: 1 1 auto; height: auto; min-height: 0; }
  .ws-window.ws-max .sidebar-panel { flex: none; max-height: 36dvh; overflow-y: auto; }
}
@media (max-width: 768px) {
  .canvas-wrapper { height: max(320px, min(100vw, 66svh)); }
  .btn-icon { width: 40px; height: 40px; font-size: 18px; }
  .overlay-interaction-hint .segmented-option { padding: 9px 2px; font-size: 12px; }
  .legend-item span:last-child { white-space: nowrap; }
  .ws-titlebar button#maximize { width: 30px; height: 20px; }
}

/* The mode buttons are buttons: no native face, a visible keyboard focus */
button.segmented-option { appearance: none; border: 0; background: transparent; margin: 0; line-height: inherit; }
button.segmented-option:focus-visible { outline: 2px solid #efe6d2; outline-offset: -2px; }

/* Phones: the legend is three dots with their letters, and in full screen the tether stays on top of the panel */
@media (max-width: 768px) {
  .overlay-legend { display: flex; gap: 12px; padding: 4px 8px; }
  .legend-item { margin: 0; }
  .legend-item span:last-child { display: none; }
  .legend-item::after { content: attr(data-short); font-weight: 700; }
  .ws-window.ws-max .consensus-card { position: sticky; top: 0; z-index: 2; }
}

#copyLinkBtn {
  white-space: nowrap;
}
