    :root {
      --surface-0: #0d0d0c;
      --surface-1: #171715;
      --surface-2: #20201d;
      --surface-3: #2a2a25;
      --line: #3a3832;
      --line-soft: #2c2b27;
      --text: #ece9df;
      --text-muted: #b8b2a5;
      --text-dim: #8d877c;
      --accent: #667f69;
      --accent-strong: #93ad8f;
      --accent-deep: #263327;
      --warning: #c89b4a;
      --danger: #c95f56;
      --success: #6fa878;
      --shadow-soft: 0 12px 28px rgba(0,0,0,0.34);
    }
    * {
      box-sizing: border-box;
      font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    }
    html, body {
      margin: 0;
      padding: 0;
      height: 100%;
      background: var(--surface-0);
      color: var(--text);
      overflow: hidden;
    }
    body {
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .sim-root {
      display: flex;
      flex-direction: column;
      gap: 10px;
      width: 100%;
      max-width: 1680px;
      padding: 0 4px;
    }
    .app {
      display: flex;
      gap: 12px;
      padding: 0;
      background: transparent;
      border-radius: 0;
      box-shadow: none;
      max-width: 1680px;
      width: 100%;
      max-height: 96vh;
      height: 96vh;
      border: none;
    }
    .app.is-hidden {
      display: none;
    }
    .mode-switcher {
      display: none;
      align-items: center;
      gap: 8px;
      background: var(--surface-1);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 6px;
      box-shadow: var(--shadow-soft);
      align-self: flex-start;
    }
    .mode-btn {
      border: none;
      background: transparent;
      color: var(--text-muted);
      font-size: 13px;
      font-weight: 600;
      letter-spacing: 0.03em;
      padding: 10px 18px;
      border-radius: 6px;
      cursor: pointer;
      transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    }
    .mode-btn:not(.active):hover {
      color: var(--text);
    }
    .mode-btn.active {
      background: var(--accent);
      color: #07100d;
      box-shadow: none;
    }
    .general-mode-panel {
      display: none;
      width: 100%;
      max-width: 1680px;
      height: 96vh;
      border-radius: 8px;
      border: 1px dashed var(--line);
      background: var(--surface-1);
      align-items: center;
      justify-content: center;
      text-align: left;
      box-shadow: var(--shadow-soft);
      padding: 40px;
    }
    .general-mode-panel.is-active {
      display: flex;
    }
    .general-mode-card {
      max-width: 460px;
      display: flex;
      flex-direction: column;
      gap: 14px;
    }
    .general-mode-card h2 {
      margin: 0;
      font-size: 24px;
      letter-spacing: 0.04em;
    }
    .general-mode-card p {
      margin: 0;
      font-size: 13px;
      color: var(--text-muted);
      line-height: 1.6;
    }
    .general-mode-card ul {
      margin: 0;
      padding-left: 18px;
      color: var(--text-dim);
      font-size: 13px;
      line-height: 1.5;
    }
    .general-mode-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 12px;
      border-radius: 6px;
      background: var(--surface-2);
      border: 1px solid var(--line);
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--warning);
      width: fit-content;
    }
    .controls {
      --surface-1: #f3f0e8;
      --surface-2: #fffdf7;
      --surface-3: #e5dfd2;
      --line: #d4cab8;
      --line-soft: #ddd6ca;
      --text: #25231f;
      --text-muted: #585145;
      --text-dim: #766f63;
      --shadow-soft: 0 12px 24px rgba(55, 48, 38, 0.16);
      width: 320px;
      padding: 10px 14px;
      border-radius: 8px;
      background: linear-gradient(180deg, #f8f5ee 0%, var(--surface-1) 100%);
      border: 1px solid var(--line);
      color: var(--text);
      display: flex;
      flex-direction: column;
      gap: 8px;
      overflow: visible;
      height: 100%;
    }
    .controls h1 {
      font-size: 18px;
      margin: 4px 0;
      padding: 4px 0 4px;
      display: inline-flex;
      align-items: center;
      gap: 8px;
      line-height: 1.1;
      font-weight: 700;
    }
    .controls-scroll {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 8px;
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-width: thin;
      padding-right: 4px;
      min-height: 0;
    }
    .app-title-icon {
      width: 22px;
      height: 22px;
      border-radius: 4px;
      display: inline-block;
      flex-shrink: 0;
      transform: translateY(1px);
    }
    .app-title-text {
      color: var(--text);
      text-transform: uppercase;
      letter-spacing: 0.08em;
    }
    .controls h2 {
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-muted);
      margin: 6px 0 4px;
    }
    .controls p {
      font-size: 11px;
      color: var(--text-dim);
      margin: 0;
      line-height: 1.3;
    }
    .controls-section {
      border-top: 1px solid var(--line-soft);
      padding-top: 10px;
      margin-top: 8px;
    }
    .eye-toggle {
      display: flex;
      gap: 6px;
      margin-top: 2px;
    }
    .pill-btn {
      flex: 1;
      padding: 5px 10px;
      font-size: 11px;
      line-height: 1.2;
      border-radius: 6px;
      border: 1px solid var(--line);
      background: var(--surface-2);
      color: var(--text);
      cursor: pointer;
      text-transform: none;
      letter-spacing: 0.02em;
      transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    }
    .pill-btn:hover {
      border-color: var(--accent-strong);
      box-shadow: none;
    }
    .controls .pill-btn:not(.active):hover,
    .slit-panel .pill-btn:not(.active):hover {
      background: #f7f3ea;
      color: var(--text);
    }
    .pill-btn.active {
      background: var(--accent);
      border-color: var(--accent-strong);
      color: #07100d;
      font-weight: 600;
      box-shadow: none;
    }
    .pill-shortcut {
      display: inline-flex;
      align-items: center;
      margin-left: 6px;
      padding: 2px 7px;
      border-radius: 4px;
      background: rgba(37,35,31,0.07);
      border: 1px solid var(--line);
      font-size: 10px;
      color: var(--text-muted);
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }
    .info-row {
      display: flex;
      align-items: center;
      gap: 6px;
    }
    .fullscreen-tip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 10px;
      border-radius: 6px;
      background: var(--surface-1);
      border: 1px solid var(--line);
      color: var(--text-muted);
      font-size: 11px;
      line-height: 1.3;
      box-shadow: var(--shadow-soft);
      position: relative;
      z-index: 25000;
      pointer-events: auto;
    }
    .fullscreen-tip-text {
      white-space: nowrap;
    }
    .fullscreen-tip-close {
      border: none;
      background: transparent;
      color: var(--text-dim);
      cursor: pointer;
      font-size: 13px;
      line-height: 1;
      padding: 2px 4px;
      border-radius: 6px;
      transition: color 0.2s ease, background 0.2s ease;
      pointer-events: auto;
    }
    .fullscreen-tip-close:hover {
      color: var(--text);
      background: rgba(255,255,255,0.06);
    }
    .info-trigger {
      position: relative;
      display: inline-flex;
      align-items: center;
      cursor: pointer;
      user-select: none;
    }
    .info-pill {
      width: 16px;
      height: 16px;
      border-radius: 50%;
      border: 1px solid var(--accent-strong);
      color: var(--accent-strong);
      font-size: 10px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      pointer-events: none;
      background: color-mix(in srgb, var(--accent) 16%, transparent);
      user-select: none;
    }
    .info-popover.is-visible {
      opacity: 1;
      pointer-events: auto;
      transform: translateY(0);
    }
    .info-popover {
      position: fixed;
      top: 0;
      left: 0;
      width: 220px;
      background: var(--surface-2);
      border: 1px solid var(--accent);
      border-radius: 6px;
      padding: 10px;
      font-size: 10px;
      color: var(--text-muted);
      line-height: 1.5;
      box-shadow: var(--shadow-soft);
      opacity: 0;
      pointer-events: none;
      transform: translateY(6px);
      transition: opacity 0.18s ease, transform 0.18s ease;
      z-index: 20000;
    }
    .info-popover::after {
      content: '';
      position: absolute;
      left: -6px;
      top: 50%;
      transform: translateY(-50%);
      width: 8px;
      height: 12px;
      background: var(--surface-2);
      border-left: 1px solid var(--accent);
      border-top: 1px solid var(--accent);
      border-bottom: 1px solid var(--accent);
      border-top-left-radius: 6px;
      border-bottom-left-radius: 6px;
    }
    .select-control {
      width: 100%;
      padding: 8px 10px;
      font-size: 11px;
      border-radius: 6px;
      border: 1px solid var(--line);
      background: var(--surface-2);
      color: var(--text);
      outline: none;
      appearance: none;
      cursor: pointer;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
      box-shadow: none;
      padding-right: 28px;
      background-image:
        linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
        linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
      background-position:
        calc(100% - 18px) center,
        calc(100% - 12px) center;
      background-size: 6px 6px;
      background-repeat: no-repeat;
    }
    .select-control:focus {
      border-color: var(--accent-strong);
      box-shadow: 0 0 0 2px rgba(95,143,122,0.2);
    }
    .slider-row input[type="range"],
    .slit-controls input[type="range"] {
      -webkit-appearance: none;
      appearance: none;
      width: 100%;
      height: 5px;
      background: var(--surface-3);
      border-radius: 5px;
      outline: none;
      cursor: pointer;
    }
    .slider-row input[type="range"]::-webkit-slider-thumb,
    .slit-controls input[type="range"]::-webkit-slider-thumb {
      -webkit-appearance: none;
      appearance: none;
      width: 14px;
      height: 14px;
      background: var(--accent-strong);
      border: 2px solid var(--accent-deep);
      border-radius: 50%;
      cursor: pointer;
      box-shadow: none;
      transition: all 0.15s;
    }
    .slider-row input[type="range"]::-webkit-slider-thumb:hover,
    .slit-controls input[type="range"]::-webkit-slider-thumb:hover {
      background: var(--warning);
      box-shadow: none;
    }
    .slider-row input[type="range"]::-moz-range-thumb,
    .slit-controls input[type="range"]::-moz-range-thumb {
      width: 14px;
      height: 14px;
      background: var(--accent-strong);
      border: 2px solid var(--accent-deep);
      border-radius: 50%;
      cursor: pointer;
      box-shadow: none;
      transition: all 0.15s;
    }
    .slider-row input[type="range"]::-moz-range-thumb:hover,
    .slit-controls input[type="range"]::-moz-range-thumb:hover {
      background: var(--warning);
      box-shadow: none;
    }
    .slider-row input[type="range"]::-moz-range-track,
    .slit-controls input[type="range"]::-moz-range-track {
      background: transparent;
      border: none;
    }
    .small-text {
      font-size: 10px;
      color: var(--text-dim);
      line-height: 1.25;
    }
    .loading-note {
      margin: 6px 0 0;
      color: var(--text-muted);
    }
    .startup-recommendation {
      margin-top: 8px;
      color: var(--text-muted);
    }
    .fullscreen-tip-intro {
      margin: 0 0 6px;
    }
    .fullscreen-tip-list {
      margin: 0 0 6px 16px;
      padding: 0;
      color: var(--text-muted);
      font-size: 10px;
      line-height: 1.45;
    }
    .fullscreen-tip-footer {
      margin: 0;
      color: var(--text-dim);
    }
    .slider-row.is-centered {
      align-items: center;
    }
    .file-input {
      margin-top: 2px;
    }
    .file-input input {
      width: 100%;
      font-size: 11px;
      color: var(--text-muted);
      border: 1px dashed var(--line);
      background: var(--surface-2);
      padding: 3px 6px;
      border-radius: 6px;
    }
    .controls-scroll,
    .slit-panel > .slit-controls.right-card {
      scrollbar-color: #bdb3a2 transparent;
    }
    .btn-secondary {
      padding: 5px 9px;
      font-size: 11px;
      border-radius: 6px;
      border: 1px solid var(--line);
      background: transparent;
      color: var(--text);
      cursor: pointer;
      margin-top: 4px;
      align-self: flex-start;
    }
    .btn-secondary:hover {
      border-color: var(--accent-strong);
    }
    .hint-list {
      margin-top: 2px;
      padding-left: 16px;
    }
    .hint-list li {
      font-size: 10px;
      color: var(--text-dim);
      margin-bottom: 3px;
      line-height: 1.35;
    }

    .canvas-wrapper {
      flex: 1 1 auto;
      width: auto;
      max-width: none;
      min-width: 0;
      border-radius: 8px;
      border: 0;
      position: relative;
      overflow: hidden;
      background: #030405;
      height: 100%;
      display: flex;
    }
    .sim-view {
      position: relative;
      flex: 1 1 auto;
      min-width: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      gap: 18px;
      padding: 40px 16px 16px 16px;
    }
    .sim-view.eye-transitioning {
      pointer-events: none;
      user-select: none;
    }
    canvas {
      border-radius: 6px;
      background: #000;
      border: 1px solid #15191d;
    }
    .orientation-label {
      position: absolute;
      font-size: 10px;
      color: var(--text);
      text-shadow: 0 0 6px rgba(0,0,0,0.85);
      pointer-events: none;
      background: rgba(16, 21, 26, 0.88);
      padding: 3px 10px;
      border-radius: 4px;
      border: 1px solid rgba(95, 143, 122, 0.5);
      letter-spacing: 0.05em;
      text-transform: uppercase;
      transform: translate(-50%, -50%);
      white-space: nowrap;
      z-index: 8;
    }
    #overviewCanvas {
      width: 360px;
      height: 230px;
      border-radius: 6px;
      border: 1px solid var(--line);
      background: var(--surface-0);
    }
    .overview-shell {
      position: relative;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
    }
    .overview-cluster {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 12px;
      z-index: 5;
      align-self: center;
      margin-top: 6px;
    }
    .overview-label {
      font-size: 11px;
      color: var(--text-dim);
      text-align: center;
      pointer-events: none;
    }
    .orientation-caption {
      position: absolute;
      bottom: 260px;
      right: 18px;
      font-size: 10px;
      color: var(--text-dim);
      text-align: right;
      pointer-events: none;
    }
    .focus-indicator {
      width: 240px;
      min-height: 190px;
      background: var(--surface-1);
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 12px 10px;
      font-size: 11px;
      color: var(--text);
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      backdrop-filter: none;
    }
    .focus-floating {
      position: absolute;
      right: calc(100% + 30px);
      top: 50%;
      transform: translateY(-50%);
      z-index: 10;
    }
    .focus-indicator.is-hidden {
      display: none;
    }
    .focus-indicator-label {
      color: var(--text-muted);
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      font-weight: 600;
    }
    .focus-joystick {
      --focus-knob-size: 52px;
      width: 58px;
      height: 122px;
      background:
        linear-gradient(90deg, rgba(255,255,255,0.08), transparent 18%, transparent 82%, rgba(0,0,0,0.26)),
        linear-gradient(to bottom, var(--danger) 0%, var(--warning) 30%, var(--success) 66%, var(--warning) 82%, var(--danger) 100%);
      border-radius: 10px;
      position: relative;
      border: 1px solid #47515a;
      box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.18),
        inset 0 -8px 14px rgba(0,0,0,0.3),
        0 8px 16px rgba(0,0,0,0.34);
      overflow: visible;
    }
    .focus-joystick::before {
      content: none;
    }
    .focus-joystick::after {
      content: "";
      position: absolute;
      left: 50%;
      top: 8px;
      bottom: 8px;
      width: 2px;
      transform: translateX(-50%);
      background: rgba(255,255,255,0.28);
      box-shadow: 13px 0 0 rgba(0,0,0,0.16), -13px 0 0 rgba(0,0,0,0.16);
      opacity: 0.65;
    }
    .focus-joystick-travel {
      position: absolute;
      inset: calc(var(--focus-knob-size) / 2) 0;
      z-index: 1;
    }
    .focus-joystick-thumb {
      position: absolute;
      width: var(--focus-knob-size);
      height: var(--focus-knob-size);
      border-radius: 50%;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      box-shadow: 0 4px 7px rgb(0 0 0 / 40%);
      pointer-events: none;
    }
    .focus-joystick-cap {
      --grip-turn: 0deg;
      position: absolute;
      inset: 0;
      /* Looking down the Y axis reverses CSS rotateY's screen-space sign. */
      transform: rotate(calc(-1 * var(--grip-turn)));
    }
    .focus-indicator-text {
      text-align: center;
      font-weight: 600;
      font-size: 11px;
      color: var(--text);
      height: 16px;
    }

    .challenge-badge {
      position: absolute;
      top: 10px;
      right: 14px;
      background: rgba(239, 68, 68, 0.12);
      border: 1px solid rgba(239, 68, 68, 0.45);
      color: rgba(239, 68, 68, 0.9);
      font-size: 10px;
      font-weight: 700;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      padding: 4px 12px;
      border-radius: 4px;
      pointer-events: none;
      opacity: 0;
      transition: opacity 0.4s ease;
      z-index: 20;
    }
    .challenge-mode .challenge-badge {
      opacity: 1;
    }
    .focus-indicator.is-sharp .focus-joystick {
      box-shadow:
        0 0 0 2px rgba(111,168,120,0.35),
        inset 0 1px 0 rgba(255,255,255,0.18),
        inset 0 -10px 18px rgba(0,0,0,0.38),
        0 12px 22px rgba(0,0,0,0.42);
      border-color: var(--success);
    }
    .focus-indicator-text.is-sharp {
      color: var(--success);
    }

    .tutorial-btn:disabled {
      opacity: 0.55;
      cursor: not-allowed;
      box-shadow: none;
      filter: grayscale(0.3);
    }

    /* Side-on instrument: matte fluted grip, satin shaft, fixed mounting collar. */
    .joystick-indicator {
      --joystick-scale: 1;
      width: 240px;
      min-height: 190px;
      background: var(--surface-1);
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 12px 10px;
      font-size: 11px;
      color: var(--text);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      gap: 4px;
      backdrop-filter: none;
      overflow: hidden;
      position: relative;
    }
    .joystick-assembly {
      position: relative;
      width: 154px;
      height: 145px;
      flex: 0 0 145px;
      margin-bottom: calc(145px * (var(--joystick-scale) - 1));
      transform: scale(var(--joystick-scale));
      transform-origin: 50% 0;
      pointer-events: none;
      isolation: isolate;
    }
    .joystick-assembly::before {
      content: "";
      position: absolute;
      left: 50%;
      bottom: 0;
      width: 112px;
      height: 16px;
      transform: translateX(-45%);
      border-radius: 50%;
      background: radial-gradient(ellipse, rgb(0 0 0 / 45%), transparent 70%);
    }
    .joystick-assembly::after {
      content: "";
      position: absolute;
      left: 50%;
      bottom: 7px;
      width: 90px;
      height: 19px;
      transform: translateX(-50%);
      border-radius: 50%;
      background:
        radial-gradient(ellipse 23px 7px at 50% 35%, #111312 0 72%, #444641 77%, transparent 85%),
        linear-gradient(180deg, #a3a69f 0%, #858980 40%, #63675f 65%, #454940 69%, #50544c 100%);
      border: 1px solid #454840;
      box-shadow:
        inset 0 1px 1px rgb(224 227 218 / 25%),
        1px 3px 3px rgb(0 0 0 / 35%);
      pointer-events: none;
      z-index: 0;
    }
    .joystick-indicator.is-hidden {
      display: none;
    }
    .joystick-floating {
      position: absolute;
      left: calc(100% + 30px);
      top: 50%;
      transform: translateY(-50%);
      z-index: 10;
    }
    .joystick-label {
      color: var(--text-muted);
      font-size: 12px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      font-weight: 600;
    }
    .joystick-stick {
      --joystick-lean: 0deg;
      width: 27px;
      height: 118px;
      position: absolute;
      left: 50%;
      bottom: 18px;
      margin-left: -13.5px;
      transform-origin: 50% 100%;
      transform: rotate(var(--joystick-lean));
      transition: transform 0.12s ease;
      z-index: 1;
    }
    .joystick-stick::before {
      /* Only draw the exposed shaft below the grip, never behind its cap. */
      content: '';
      position: absolute;
      left: 0;
      bottom: 0;
      width: 100%;
      height: 43px;
      background:
        linear-gradient(180deg, rgb(0 0 0 / 24%), transparent 45%, rgb(0 0 0 / 18%) 100%),
        repeating-linear-gradient(0deg, transparent 0 1px, rgb(255 255 255 / 3%) 1px 2px),
        linear-gradient(90deg, #555b56 0%, #979d95 13%, #bfc3b9 29%, #adb2a8 44%, #868d83 68%, #555c53 90%, #3d443c 100%);
      border-radius: 0 0 7px 7px;
      border: 1px solid #4a5047;
      box-shadow:
        inset 1px 0 1px rgb(255 255 255 / 12%),
        3px 3px 5px rgb(0 0 0 / 16%);
    }
    .joystick-stick::after {
      content: "";
      position: absolute;
      left: 50%;
      bottom: -5px;
      width: 37px;
      height: 13px;
      transform: translateX(-50%);
      border-radius: 50% 50% 35% 35%;
      background: linear-gradient(90deg, #1e211c, #3a3e35 30%, #252920 70%, #141711);
      border: 1px solid #171a14;
      box-shadow: inset 0 1px 1px rgb(190 198 176 / 15%);
      z-index: 2;
    }
    .joystick-grip-view {
      position: absolute;
      left: 50%;
      top: 8px;
      width: 56px;
      height: 82px;
      margin-left: -28px;
      perspective: 420px;
      perspective-origin: 50% 40%;
      z-index: 3;
    }
    .joystick-grip {
      --grip-turn: 0deg;
      position: absolute;
      left: 50%;
      top: 0;
      width: 0;
      height: 72px;
      transform-style: preserve-3d;
      transform: rotateX(-18deg) rotateY(var(--grip-turn));
      transform-origin: 0 36px;
    }
    .joystick-grip-face {
      position: absolute;
      top: 0;
      left: 0;
      height: 72px;
      backface-visibility: hidden;
      background-image:
        linear-gradient(180deg, rgb(0 0 0 / 28%), transparent 7%, transparent 80%, rgb(0 0 0 / 35%) 100%),
        linear-gradient(90deg, rgb(0 0 0 / 30%), rgb(211 217 202 / 12%) 25%, transparent 48%, rgb(0 0 0 / 24%) 100%);
      border-top: 1px solid rgb(174 182 159 / 12%);
      border-bottom: 2px solid rgb(0 0 0 / 25%);
    }
    .joystick-grip-cap,
    .joystick-grip-bottom {
      position: absolute;
      left: -26px;
      top: -26px;
      width: 52px;
      height: 52px;
      border-radius: 50%;
      backface-visibility: hidden;
    }
    .joystick-grip-cap {
      transform: rotateX(90deg);
    }
    .joystick-cap-surface {
      border-radius: 50%;
      background: #50554a;
      border: 1px solid #696e61;
      box-shadow: inset 0 0 0 2px #3f4439, inset 0 0 5px rgb(0 0 0 / 22%);
    }
    .joystick-cap-surface::after {
      content: '';
      position: absolute;
      top: 10%;
      left: calc(50% - 1.5px);
      width: 3px;
      height: 22%;
      border-radius: 1px;
      background: #c4c5b5;
      box-shadow: 0 1px 1px rgb(0 0 0 / 40%);
    }
    .joystick-grip-bottom {
      transform: translateY(72px) rotateX(-90deg);
      background: #23271f;
    }
    /* positioning handled in overview-shell; keep canvas static here */

    .slit-panel {
      --surface-1: #f3f0e8;
      --surface-2: #fffdf7;
      --surface-3: #e5dfd2;
      --line: #d4cab8;
      --line-soft: #ddd6ca;
      --text: #25231f;
      --text-muted: #585145;
      --text-dim: #766f63;
      --shadow-soft: 0 12px 24px rgba(55, 48, 38, 0.16);
      flex: 0 0 320px;
      width: 320px;
      margin-left: 0;
      padding: 8px;
      border-radius: 8px;
      background: linear-gradient(180deg, #f8f5ee 0%, var(--surface-1) 100%);
      border: 1px solid var(--line);
      color: var(--text);
      display: flex;
      flex-direction: column;
      gap: 0;
      align-items: stretch;
      height: 100%;
      overflow: hidden;
      box-shadow: var(--shadow-soft);
    }
    .slit-controls {
      width: 100%;
      background: var(--surface-1);
      border: 1px solid var(--line);
      border-radius: 6px;
      padding: 10px;
      color: var(--text);
      font-size: 11px;
      box-shadow: none;
      backdrop-filter: none;
    }
    .slit-panel > .slit-controls.right-card {
      background: transparent;
      border: none;
      border-radius: 0;
      padding: 0;
      box-shadow: none;
      backdrop-filter: none;
      height: 100%;
      overflow-y: auto;
      padding-right: 6px;
    }
    .right-card {
      display: flex;
      flex-direction: column;
      gap: 8px;
      transition: gap 0.25s ease;
    }
    .right-section + .right-section {
      border-top: 1px solid var(--line-soft);
      padding-top: 8px;
      margin-top: 2px;
    }
    .right-section {
      transition: opacity 0.25s ease, transform 0.25s ease, max-height 0.35s ease, padding 0.25s ease, margin 0.25s ease, border-color 0.25s ease;
      max-height: 800px;
      overflow: visible;
    }
    .quiz-hideable.quiz-hidden {
      opacity: 0;
      transform: translateY(-18px);
      max-height: 0;
      height: 0;
      padding-top: 0;
      padding-bottom: 0;
      margin-top: 0;
      margin-bottom: 0;
      border-color: transparent;
      pointer-events: none;
      visibility: hidden;
    }
    .right-section h2,
    .right-section h3 {
      margin: 4px 0 2px;
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-muted);
    }
    .slit-controls h3 {
      margin: 4px 0 2px;
      font-size: 11px;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-muted);
    }
    .slit-controls .row {
      display: flex;
      flex-direction: column;
      gap: 7px;
      margin-bottom: 13px;
    }
    .slit-controls label {
      color: #716b60;
      font-size: 11px;
      font-weight: 650;
      letter-spacing: 0.015em;
      display: flex;
      justify-content: space-between;
      gap: 6px;
    }
    .slit-controls label span {
      color: #4e4a43;
      font-variant-numeric: tabular-nums;
      font-weight: 750;
    }
    .slit-controls input[type="range"] {
      width: 100%;
      height: 9px;
      border: 1px solid #4a4b46;
      border-radius: 999px;
      background:
        linear-gradient(180deg, #555750 0%, #252724 30%, #111210 58%, #383a35 100%);
      box-shadow:
        inset 0 2px 3px rgba(0,0,0,0.8),
        inset 0 -1px 1px rgba(255,255,255,0.2),
        0 1px 1px rgba(255,255,255,0.62),
        0 0 0 1px rgba(43,42,38,0.08);
    }
    .slit-controls input[type="range"]::-webkit-slider-thumb {
      width: 29px;
      height: 29px;
      border: 1px solid #53554f;
      border-radius: 50%;
      background:
        radial-gradient(circle at 39% 32%, rgba(255,255,255,0.9) 0 5%, rgba(255,255,255,0) 17%),
        radial-gradient(circle, #d8d5ca 0 13%, #8b8d86 15% 24%, #4f514d 26% 31%, transparent 33%),
        repeating-conic-gradient(from -2deg, #e1ded3 0deg 5deg, #777970 5deg 9deg, #b7b4a9 9deg 13deg);
      box-shadow:
        inset 0 0 0 2px rgba(235,232,221,0.28),
        inset 0 -3px 4px rgba(0,0,0,0.32),
        0 1px 0 rgba(255,255,255,0.72),
        0 3px 5px rgba(0,0,0,0.4);
    }
    .slit-controls input[type="range"]::-webkit-slider-thumb:hover {
      background:
        radial-gradient(circle at 39% 32%, #ffffff 0 5%, rgba(255,255,255,0) 17%),
        radial-gradient(circle, #eeeade 0 13%, #9b9d95 15% 24%, #565852 26% 31%, transparent 33%),
        repeating-conic-gradient(from -2deg, #f1eee3 0deg 5deg, #83857c 5deg 9deg, #c7c4b8 9deg 13deg);
      box-shadow:
        inset 0 0 0 2px rgba(255,255,255,0.32),
        inset 0 -3px 4px rgba(0,0,0,0.28),
        0 1px 0 rgba(255,255,255,0.8),
        0 4px 8px rgba(0,0,0,0.46);
    }
    .slit-controls input[type="range"]::-moz-range-track {
      height: 7px;
      border: 1px solid #4a4b46;
      border-radius: 999px;
      background:
        linear-gradient(180deg, #555750 0%, #252724 30%, #111210 58%, #383a35 100%);
      box-shadow:
        inset 0 2px 3px rgba(0,0,0,0.8),
        inset 0 -1px 1px rgba(255,255,255,0.2);
    }
    .slit-controls input[type="range"]::-moz-range-thumb {
      width: 29px;
      height: 29px;
      border: 1px solid #53554f;
      border-radius: 50%;
      background:
        radial-gradient(circle at 39% 32%, rgba(255,255,255,0.9) 0 5%, rgba(255,255,255,0) 17%),
        radial-gradient(circle, #d8d5ca 0 13%, #8b8d86 15% 24%, #4f514d 26% 31%, transparent 33%),
        repeating-conic-gradient(from -2deg, #e1ded3 0deg 5deg, #777970 5deg 9deg, #b7b4a9 9deg 13deg);
      box-shadow:
        inset 0 0 0 2px rgba(235,232,221,0.28),
        inset 0 -3px 4px rgba(0,0,0,0.32),
        0 1px 0 rgba(255,255,255,0.72),
        0 3px 5px rgba(0,0,0,0.4);
    }
    .slit-controls input[type="range"]::-moz-range-thumb:hover {
      background:
        radial-gradient(circle at 39% 32%, #ffffff 0 5%, rgba(255,255,255,0) 17%),
        radial-gradient(circle, #eeeade 0 13%, #9b9d95 15% 24%, #565852 26% 31%, transparent 33%),
        repeating-conic-gradient(from -2deg, #f1eee3 0deg 5deg, #83857c 5deg 9deg, #c7c4b8 9deg 13deg);
    }
    .slit-controls input[type="range"]:focus-visible {
      outline: 2px solid #536b91;
      outline-offset: 3px;
    }
    .magnification-control {
      margin-top: 10px;
      padding-top: 10px;
      border-top: 1px solid var(--line-soft);
    }
    .magnification-readout {
      margin: 0 0 8px;
      color: var(--text-muted);
      font-size: 11px;
      font-weight: 700;
      display: flex;
      justify-content: space-between;
      gap: 8px;
    }
    .magnification-wheel-shell {
      position: relative;
      width: 142px;
      height: 120px;
      margin: 0 auto;
      display: flex;
      align-items: flex-end;
      justify-content: center;
      overflow: visible;
      user-select: none;
      touch-action: none;
    }
    .magnification-indicator {
      position: absolute;
      top: -4px;
      left: calc(50% + 24px);
      width: 16px;
      height: 22px;
      margin-left: -8px;
      transform: rotate(26deg);
      transform-origin: 50% 100%;
      z-index: 3;
      pointer-events: none;
    }
    .magnification-indicator::before {
      content: "";
      position: absolute;
      inset: 0;
      clip-path: polygon(0 0, 100% 0, 100% 54%, 50% 100%, 0 54%);
      background:
        linear-gradient(90deg, #020303 0%, #24282a 28%, #090a0b 54%, #303437 76%, #030404 100%);
      filter:
        drop-shadow(0 2px 2px rgba(0,0,0,0.72))
        drop-shadow(0 0 1px rgba(255,255,255,0.34));
    }
    .magnification-indicator::after {
      content: "";
      position: absolute;
      top: 3px;
      left: 50%;
      width: 6px;
      height: 6px;
      transform: translateX(-50%);
      border: 1px solid #050606;
      border-radius: 50%;
      background: radial-gradient(circle at 36% 30%, #4b5052 0 10%, #17191a 34%, #050606 76%, #000 100%);
      box-shadow: inset 0 1px 1px rgba(255,255,255,0.2), 0 1px 1px rgba(0,0,0,0.65);
    }
    .magnification-wheel {
      --magnification-wheel-rotation: 0deg;
      --magnification-label-radius: 48px;
      position: relative;
      width: 104px;
      height: 104px;
      border-radius: 50%;
      background:
        radial-gradient(circle at 38% 28%, rgba(255,255,255,0.12), transparent 18%),
        radial-gradient(circle at 50% 50%, #171717 0 42%, #111 43% 72%, #050505 73% 100%);
      border: 1px solid #050505;
      box-shadow:
        inset 0 3px 5px rgba(255,255,255,0.12),
        inset 0 -10px 16px rgba(0,0,0,0.65),
        0 0 0 4px #2f302f,
        0 0 0 7px #c8c8c2,
        0 7px 13px rgba(0,0,0,0.28);
      cursor: grab;
      transform: rotate(var(--magnification-wheel-rotation));
      transition: transform 0.18s cubic-bezier(.2,.9,.24,1.22), box-shadow 0.16s ease;
      touch-action: none;
    }
    .magnification-wheel:active,
    .magnification-wheel.is-dragging {
      cursor: grabbing;
    }
    .magnification-wheel:focus-visible {
      outline: 2px solid #3f6fd9;
      outline-offset: 4px;
    }
    .magnification-wheel.is-stepping {
      animation: magnification-detent 0.18s ease;
    }
    .magnification-wheel::before {
      content: "";
      position: absolute;
      inset: 9px;
      border-radius: 50%;
      border: 1px solid rgba(255,255,255,0.07);
      background:
        repeating-conic-gradient(from 0deg, rgba(255,255,255,0.035) 0deg 1.5deg, transparent 1.5deg 7deg),
        radial-gradient(circle, rgba(255,255,255,0.08), rgba(255,255,255,0) 58%);
      pointer-events: none;
    }
    .magnification-wheel::after {
      content: "";
      position: absolute;
      left: 50%;
      top: 50%;
      width: 64px;
      height: 24px;
      border-radius: 6px;
      background:
        radial-gradient(circle at 50% 50%, #2a2a2a 0 8px, #030303 9px 13px, transparent 14px),
        linear-gradient(180deg, #222 0%, #080808 55%, #000 100%);
      border: 1px solid rgba(0,0,0,0.92);
      transform: translate(-50%, -50%);
      box-shadow:
        inset 0 2px 3px rgba(255,255,255,0.08),
        inset 0 -3px 4px rgba(0,0,0,0.7),
        0 5px 9px rgba(0,0,0,0.45);
      pointer-events: none;
    }
    .magnification-step {
      position: absolute;
      left: 50%;
      top: 50%;
      width: 30px;
      height: 22px;
      margin: -11px 0 0 -15px;
      border: 0;
      padding: 0;
      background: transparent;
      color: #f6f6f2;
      font: 800 11px/1 system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
      text-align: center;
      text-shadow: 0 1px 2px rgba(0,0,0,0.95), 0 0 3px rgba(255,255,255,0.18);
      cursor: pointer;
      transform: rotate(var(--item-angle)) translateY(calc(-1 * var(--magnification-label-radius))) rotate(calc(-1 * var(--item-angle)));
      transform-origin: 50% 50%;
      user-select: none;
      -webkit-user-select: none;
      z-index: 2;
    }
    .magnification-step.is-active {
      color: #ffffff;
      text-shadow: 0 0 5px rgba(255,255,255,0.45), 0 1px 2px rgba(0,0,0,0.95);
    }
    .magnification-step:focus-visible {
      outline: 2px solid #3f6fd9;
      outline-offset: 1px;
      border-radius: 4px;
    }
    body.is-magnification-dragging {
      user-select: none;
      -webkit-user-select: none;
      cursor: grabbing;
    }
    @keyframes magnification-detent {
      0% { box-shadow: inset 0 3px 5px rgba(255,255,255,0.12), inset 0 -10px 16px rgba(0,0,0,0.65), 0 0 0 4px #2f302f, 0 0 0 7px #c8c8c2, 0 7px 13px rgba(0,0,0,0.28); }
      45% { box-shadow: inset 0 4px 6px rgba(255,255,255,0.17), inset 0 -12px 18px rgba(0,0,0,0.72), 0 0 0 4px #242524, 0 0 0 7px #d2d2cd, 0 9px 16px rgba(0,0,0,0.34); }
      100% { box-shadow: inset 0 3px 5px rgba(255,255,255,0.12), inset 0 -10px 16px rgba(0,0,0,0.65), 0 0 0 4px #2f302f, 0 0 0 7px #c8c8c2, 0 7px 13px rgba(0,0,0,0.28); }
    }
    .challenge-toggle {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-top: 2px;
    }
    .challenge-toggle .toggle-group {
      display: flex;
      gap: 6px;
      width: 100%;
    }
    .sim-view.challenge-mode #overviewCanvas,
    .sim-view.challenge-mode .overview-label,
    .sim-view.challenge-mode .overview-cluster {
      display: none;
    }

    /* Lessons stay in the existing learning panel; only the highlight moves. */
    .tutorial-overlay {
      position: fixed;
      inset: 0;
      display: none;
      z-index: 30;
      pointer-events: none;
    }
    .slit-panel.is-tutorial-active > .right-card,
    .slit-panel.is-tutorial-active > .panel-footer {
      display: none;
    }
    .tutorial-card {
      display: flex;
      flex-direction: column;
      flex: 1 1 auto;
      min-height: 0;
      height: 100%;
      color: var(--text);
    }
    .tutorial-card[hidden] {
      display: none;
    }
    .tutorial-card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      flex: 0 0 auto;
      padding-bottom: 14px;
      border-bottom: 1px solid var(--line-soft);
    }
    .tutorial-lesson {
      font-size: 13px;
      font-weight: 600;
      color: var(--text-muted);
    }
    .tutorial-close-btn {
      display: grid;
      place-items: center;
      width: 30px;
      height: 30px;
      flex: 0 0 auto;
      border: 0;
      border-radius: 4px;
      background: transparent;
      color: var(--text-muted);
      cursor: pointer;
      font-size: 22px;
      line-height: 1;
    }
    .tutorial-close-btn:hover {
      background: var(--surface-3);
      color: var(--text);
    }
    .tutorial-content {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-gutter: stable;
      scrollbar-color: #c3ccc3 transparent;
      padding: 20px 6px 16px 0;
      font-size: 14px;
      line-height: 1.6;
    }
    #tutorialTitle {
      margin: 0 0 14px;
      font-size: 19px;
      font-weight: 650;
      line-height: 1.3;
      letter-spacing: 0;
      color: var(--text);
    }
    #tutorialTitle:focus {
      outline: none;
    }
    #tutorialBody p {
      margin: 0 0 12px;
    }
    .tutorial-points {
      margin: 0 0 14px;
      padding-left: 18px;
    }
    .tutorial-points li {
      margin-bottom: 8px;
    }
    .tutorial-try {
      margin: 18px 0 0;
      padding-top: 14px;
      border-top: 1px solid var(--line-soft);
    }
    .tutorial-try strong,
    .tutorial-try span {
      display: block;
    }
    .tutorial-try strong {
      margin-bottom: 4px;
      font-size: 13px;
      font-weight: 650;
      color: var(--accent-deep);
    }
    .tutorial-footer {
      flex: 0 0 auto;
      border-top: 1px solid var(--line-soft);
      padding-top: 10px;
    }
    .tutorial-gate {
      min-height: 36px;
      margin: 0 0 8px;
      font-size: 12px;
      line-height: 1.5;
      color: var(--text-muted);
    }
    .tutorial-actions {
      display: flex;
      align-items: center;
      gap: 8px;
    }
    .tutorial-progress {
      margin-right: auto;
      color: var(--text-muted);
      font-size: 12px;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }
    .tutorial-btn {
      min-width: 62px;
      min-height: 36px;
      padding: 8px 12px;
      border: 0;
      border-radius: 5px;
      background: transparent;
      color: var(--text);
      font-size: 13px;
      font-weight: 550;
      cursor: pointer;
    }
    .tutorial-btn.secondary:hover:not(:disabled) {
      background: var(--surface-3);
    }
    .tutorial-btn.primary {
      background: var(--accent);
      color: #fff;
    }
    .tutorial-btn.primary:hover:not(:disabled) {
      background: var(--accent-deep);
    }
    .tutorial-card button:focus-visible,
    .tutorial-content:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 3px;
    }
    /* Reference images occupy the same main viewing area on every slide. */
    .tutorial-media {
      position: absolute;
      inset: 0;
      z-index: 32;
      display: none;
      padding: 16px;
      background: var(--surface-0);
      color: var(--text);
    }
    .tutorial-media.is-visible {
      display: flex;
    }
    .tutorial-media-panel,
    .tutorial-media-figure,
    .tutorial-media-grid {
      width: 100%;
      height: 100%;
      min-width: 0;
      min-height: 0;
    }
    .tutorial-media-figure {
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .tutorial-media img {
      display: block;
      width: 100%;
      height: 100%;
      min-height: 0;
      object-fit: contain;
    }
    .tutorial-media-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 12px;
    }
    .tutorial-media-item {
      display: flex;
      flex-direction: column;
      gap: 10px;
      min-width: 0;
      min-height: 0;
    }
    .tutorial-media-item img {
      flex: 1 1 0;
      height: 0;
    }
    .tutorial-media-caption {
      flex: 0 0 auto;
      color: var(--text);
      font-size: 13px;
      text-align: center;
    }
    .tutorial-media-error {
      padding: 18px 12px;
      color: #fecaca;
      font-size: 14px;
    }
    .tutorial-highlight {
      position: absolute;
      border: 3px solid #ffd16a;
      border-radius: 6px;
      box-shadow:
        0 0 0 1px rgba(24, 19, 9, 0.7),
        0 0 10px rgba(255, 202, 94, 0.35),
        inset 0 0 0 1px rgba(24, 19, 9, 0.45);
      pointer-events: none;
      z-index: 31;
    }
    .tutorial-highlight::after {
      content: "";
      position: absolute;
      inset: -3px;
      border: 3px solid #ffdf8a;
      border-radius: inherit;
      box-shadow:
        0 0 0 4px rgba(255, 202, 94, 0.22),
        0 0 20px rgba(255, 202, 94, 0.68),
        inset 0 0 10px rgba(255, 202, 94, 0.22);
      opacity: 0.25;
      pointer-events: none;
      animation: tutorial-highlight-pulse 1.8s ease-in-out infinite;
    }
    /* Pulse the glow while the solid outline stays visible and stationary. */
    @keyframes tutorial-highlight-pulse {
      0%, 100% { opacity: 0.25; }
      50% { opacity: 1; }
    }
    @media (prefers-reduced-motion: reduce) {
      .tutorial-highlight::after {
        animation: none;
        opacity: 0.5;
      }
    }
    .tutorial-input-demo {
      display: none;
      margin-top: 20px;
      padding-top: 14px;
      border-top: 1px solid var(--line-soft);
      --tutorial-key-size: clamp(24px, 2.1vw, 30px);
    }
    .tutorial-input-demo.is-visible {
      display: block;
    }
    .tutorial-input-demo-title {
      margin-bottom: 12px;
      color: var(--text-muted);
      font-size: 12px;
      line-height: 1.5;
    }
    .tutorial-keyboard {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 12px;
    }
    .tutorial-key-cluster {
      min-width: 0;
    }
    .tutorial-key-cluster-label {
      min-height: 48px;
      margin-bottom: 6px;
      font-size: 11px;
      line-height: 1.4;
      color: var(--text-muted);
    }
    .tutorial-key-rows {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }
    .tutorial-key-row {
      display: flex;
      gap: 3px;
    }
    .tutorial-key-row.is-wasd-top,
    .tutorial-key-row.is-arrow-top {
      padding-left: calc(var(--tutorial-key-size) + 3px);
    }
    .tutorial-key {
      display: grid;
      place-items: center;
      width: var(--tutorial-key-size);
      height: var(--tutorial-key-size);
      border: 1px solid var(--line);
      border-radius: 4px;
      background: var(--surface-2);
      color: var(--text);
      font-size: 12px;
      font-weight: 600;
    }
    .tutorial-key.is-active {
      border-color: var(--accent);
      background: var(--accent);
      color: #fff;
    }
    @media (max-width: 991px) {
      .slit-panel.is-tutorial-active {
        flex: 0 0 40vh;
        height: 40vh;
        min-height: 240px;
      }
      .tutorial-content {
        padding-top: 12px;
      }
    }
    .eye-diagram {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: 10px;
      margin-top: 4px;
    }
    .eye-icon {
      width: 28px;
      height: 16px;
      border-radius: 999px;
      border: 1px solid var(--line);
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 9px;
      color: var(--text-dim);
    }
    .eye-icon::before {
      content: "";
      position: absolute;
      width: 9px;
      height: 9px;
      border-radius: 999px;
      border: 1px solid var(--text-dim);
    }
    .eye-icon.active-eye {
      border-color: var(--accent-strong);
      box-shadow: none;
      color: var(--text);
    }
    .eye-icon.active-eye::before {
      border-color: var(--accent-strong);
      background: var(--accent-strong);
    }

    /* Eye schematic SVG styling */
    #sclera, .sclera {
      fill: #ffffff !important;
    }
    #outerRing, .outerRing, #limbus, .limbus {
      stroke: var(--accent-strong) !important;
      fill: none !important;
    }
    #pupil, .pupil {
      fill: #000000 !important;
    }
    .eye-diagram-caption {
      font-size: 9px;
      color: var(--text-dim);
      text-align: center;
      margin-top: 2px;
    }

    .fixation-toggle {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      grid-template-rows: repeat(3, auto);
      gap: 6px;
      margin-top: 2px;
      align-items: center;
      justify-items: center;
    }
    .fixation-toggle .pill-btn {
      width: 100%;
      min-height: 32px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      text-align: center;
    }
    .fixation-toggle .pill-btn,
    .tutorial-btn-group .pill-btn,
    .pathology-choice,
    .challenge-toggle .pill-btn {
      font-weight: 700;
      text-transform: uppercase;
    }
    .fixation-up { grid-column: 2; grid-row: 1; }
    .fixation-left { grid-column: 1; grid-row: 2; }
    .fixation-primary { grid-column: 2; grid-row: 2; }
    .fixation-right { grid-column: 3; grid-row: 2; }
    .fixation-down { grid-column: 2; grid-row: 3; }
    .pathology-panel {
      margin-top: 4px;
    }
    .pathology-panel .btn-secondary {
      width: 100%;
      margin-top: 6px;
    }
    .pill-btn.full-width {
      width: 100%;
      text-align: center;
      justify-content: center;
    }
    .tutorial-btn-group {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }
    .slit-controls.quiz-mode .right-card {
      gap: 8px;
    }
    /* In quiz mode, make the first visible section (Pathology) have no divider */
    .slit-controls.quiz-mode .right-section {
      border-top: none;
    }
    .slit-controls.quiz-mode .quiz-hideable {
      opacity: 0;
      transform: translateY(-18px);
      max-height: 0;
      height: 0;
      padding-top: 0;
      padding-bottom: 0;
      margin-top: 0;
      margin-bottom: 0;
      border-color: transparent;
      pointer-events: none;
      visibility: hidden;
    }
    .slit-controls.quiz-mode .pathology-section {
      order: 1;
      border-top: none !important;
      padding-top: 0;
      margin-top: 0;
    }
    .slit-controls.quiz-mode .challenge-section {
      order: 2;
      border-top: 1px solid var(--line-soft);
      padding-top: 10px;
      margin-top: 6px;
    }
    .pathology-options.active,
    .slit-controls.quiz-mode .pathology-options {
      display: flex;
    }
    .pathology-options {
      display: none;
      flex-wrap: wrap;
      gap: 8px;
      margin-top: 8px;
    }
    .pathology-options .pill-btn {
      min-width: 120px;
      padding: 6px 14px;
      font-size: 11px;
      justify-content: center;
    }
    .pathology-section {
      position: relative;
    }
    .pathology-options .pill-btn.is-wrong {
      background: var(--danger);
      border-color: #e18b82;
      color: #150706;
      box-shadow: none;
    }
    .pathology-options .pill-btn.is-correct {
      background: var(--success);
      border-color: #9fca9f;
      color: #06110a;
      box-shadow: none;
    }
    .quiz-toast {
      position: absolute;
      right: 10px;
      top: 8px;
      padding: 6px 10px;
      border-radius: 10px;
      background: rgba(248,113,113,0.14);
      border: 1px solid rgba(248,113,113,0.4);
      color: #fecaca;
      font-size: 10px;
      letter-spacing: 0.04em;
      pointer-events: none;
      opacity: 0;
      transform: translateY(-6px);
      transition: opacity 0.18s ease, transform 0.18s ease;
    }
    .quiz-toast.is-visible {
      opacity: 1;
      transform: translateY(0);
    }
    .pathology-detail {
      display: none;
      gap: 6px;
    }
    .pathology-detail.is-visible {
      display: block;
    }
    .pathology-detail-body {
      white-space: pre-line;
      max-height: 180px;
      overflow-y: auto;
      padding-right: 4px;
    }
    /* Loading overlay before assets are ready */
    .loading-overlay {
      position: fixed;
      inset: 0;
      background: var(--surface-0);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 12000;
      transition: opacity 0.3s ease;
    }
    .loading-overlay.fade-out {
      opacity: 0;
      pointer-events: none;
    }
    .loading-card {
      background: var(--surface-1);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 18px 24px;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 12px;
      box-shadow: var(--shadow-soft);
    }
    .loading-spinner {
      width: 48px;
      height: 48px;
      border-radius: 999px;
      border: 3px solid rgba(95,143,122,0.26);
      border-top-color: var(--accent-strong);
      animation: loading-spin 1s linear infinite;
      position: relative;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .loading-spinner::after {
      content: "";
      width: 30px;
      height: 30px;
      border-radius: 8px;
      background-image: url('assets/favicon.png');
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      box-shadow: 0 3px 10px rgba(0,0,0,0.35);
    }
    .loading-card p {
      margin: 0;
      font-size: 12px;
      color: var(--text);
      letter-spacing: 0.05em;
    }
    @keyframes loading-spin {
      to { transform: rotate(360deg); }
    }
    /* Phone-only notice, shown before the simulator welcome flow. */
    .phone-notice-overlay {
      position: fixed;
      inset: 0;
      z-index: 13000;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
      background: rgba(7, 9, 9, 0.97);
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.2s ease;
    }
    .phone-notice-overlay.is-active {
      opacity: 1;
      pointer-events: auto;
    }
    .phone-notice-card {
      width: min(420px, 100%);
      max-height: 100%;
      overflow-y: auto;
      padding: 30px 26px 26px;
      border: 1px solid rgb(255 255 255 / 14%);
      border-top: 3px solid var(--accent);
      border-radius: 4px;
      background: #111513;
      color: var(--text);
      box-shadow: 0 18px 60px rgb(0 0 0 / 42%);
      text-align: left;
      transform: translateY(8px);
      transition: transform 0.2s ease;
    }
    .phone-notice-overlay.is-active .phone-notice-card {
      transform: translateY(0);
    }
    .phone-notice-eyebrow {
      margin: 0 0 14px;
      color: #aeb8b2;
      font-size: 10px;
      font-weight: 650;
      letter-spacing: 0.16em;
      text-transform: uppercase;
    }
    .phone-notice-card h2 {
      margin: 0 0 10px;
      color: var(--text);
      font-size: 24px;
      font-weight: 620;
      line-height: 1.16;
      letter-spacing: -0.015em;
    }
    .phone-notice-card p {
      margin: 0;
      color: var(--text-muted);
      font-size: 14px;
      line-height: 1.55;
    }
    .phone-notice-steps {
      display: grid;
      gap: 0;
      margin-top: 22px;
      border-top: 1px solid rgb(255 255 255 / 12%);
      text-align: left;
    }
    .phone-notice-card .phone-notice-steps p {
      display: grid;
      grid-template-columns: 34px 1fr;
      column-gap: 12px;
      align-items: start;
      padding: 14px 0;
      border-bottom: 1px solid rgb(255 255 255 / 12%);
    }
    .phone-notice-steps .phone-step-number {
      padding-top: 2px;
      color: var(--accent);
      font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.06em;
    }
    .phone-notice-steps .phone-step-copy { min-width: 0; }
    .phone-notice-steps strong {
      display: block;
      margin-bottom: 2px;
      color: var(--text);
      font-weight: 650;
    }
    .phone-notice-btn {
      width: 100%;
      margin-top: 24px;
      padding: 13px 16px;
      border: 1px solid #7aa892;
      border-radius: 3px;
      background: #668f7b;
      color: #f7fbf9;
      cursor: pointer;
      font-size: 14px;
      font-weight: 650;
    }
    .phone-notice-btn:focus-visible {
      outline: 3px solid var(--accent-strong);
      outline-offset: 3px;
    }
    @media (prefers-reduced-motion: reduce) {
      .phone-notice-overlay,
      .phone-notice-card {
        transition: none;
      }
    }
    .phone-preview-footer { display: none; }
    .phone-touch-help {
      width: min(420px, calc(100vw - 32px));
      max-height: calc(100dvh - 40px);
      padding: 24px;
      border: 1px solid var(--line);
      border-radius: 12px;
      background: var(--surface-1);
      color: var(--text);
      overflow-y: auto;
    }
    .phone-touch-help::backdrop { background: rgb(0 0 0 / 78%); }
    .phone-touch-help h2 { margin: 0 0 20px; font-size: 22px; }
    .phone-touch-help p { margin: 16px 0; color: var(--text-muted); font-size: 15px; line-height: 1.5; }
    .phone-touch-help strong { display: inline-block; margin-bottom: 4px; color: var(--text); }
    .phone-gesture-coach { display: none; }
    .phone-slit-control { display: none; }

    /* --- Startup modal overlay --- */
    .startup-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(13, 13, 12, 0.9);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      padding: 18px;
      opacity: 0;
      pointer-events: none;
      transform: translateY(24px);
      transition: opacity 0.35s ease, transform 0.35s ease;
    }
    .startup-modal-overlay.is-active {
      opacity: 1;
      pointer-events: auto;
      transform: translateY(0);
    }
    .startup-modal-overlay.is-closing {
      opacity: 0;
      pointer-events: none;
      transform: translateY(-18px);
    }
    .startup-modal {
      width: min(720px, 96vw);
      max-height: 90vh;
      overflow-y: auto;
      background: var(--surface-1);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: var(--shadow-soft);
      padding: 18px 18px 14px 18px;
      color: var(--text);
      opacity: 0;
      transform: translateY(16px) scale(0.98);
      transition: opacity 0.35s ease, transform 0.35s ease;
    }
    .startup-modal-overlay.is-active .startup-modal {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
    .startup-modal-overlay.is-closing .startup-modal {
      opacity: 0;
      transform: translateY(-12px) scale(0.98);
    }
    .startup-modal h2 {
      margin: 0 0 8px 0;
      font-size: 18px;
      font-weight: 650;
      letter-spacing: 0.2px;
    }
    .startup-modal p {
      margin: 6px 0;
      font-size: 12.5px;
      line-height: 1.45;
      color: var(--text-muted);
    }
    /* Browser banner shown to non-Chrome users after startup modal */
    .browser-banner {
      position: fixed;
      top: 14px;
      left: 50%;
      transform: translateX(-50%);
      background: var(--surface-1);
      color: var(--text);
      border: 1px solid var(--line);
      padding: 10px 14px;
      border-radius: 6px;
      box-shadow: var(--shadow-soft);
      font-size: 13px;
      display: none;
      z-index: 10000;
      backdrop-filter: none;
      align-items: center;
      gap: 10px;
    }
    .browser-banner p { margin: 0; color: var(--text); }
    .browser-banner button { background: transparent; border: 1px solid var(--line); color: var(--text); padding: 6px 8px; border-radius: 6px; cursor: pointer; }
    .startup-modal ul {
      margin: 8px 0 8px 18px;
      padding: 0;
    }
    .startup-modal li {
      font-size: 12.5px;
      line-height: 1.45;
      color: var(--text-muted);
      margin-bottom: 6px;
    }
    .startup-modal .credit {
      font-size: 11px;
      color: var(--text-dim);
      margin-top: 10px;
    }
    .startup-modal-footer {
      display: flex;
      flex-direction: column;
      gap: 10px;
      margin-top: 10px;
      align-items: flex-start;
    }
    .startup-modal-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      align-items: center;
    }
    .startup-modal-btn {
      padding: 6px 12px;
      font-size: 11px;
      border-radius: 6px;
      border: 1px solid var(--line);
      background: var(--surface-2);
      color: var(--text);
      cursor: pointer;
      font-weight: 600;
      letter-spacing: 0.02em;
      transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
      box-shadow: none;
    }
    .startup-modal-btn.primary {
      background: var(--accent);
      border-color: var(--accent-strong);
      color: #07100d;
      font-weight: 700;
      box-shadow: none;
    }
    .startup-modal-btn.secondary {
      background: transparent;
      color: var(--text);
      border-color: var(--line);
    }
    .startup-modal-btn:hover {
      border-color: var(--accent-strong);
      box-shadow: none;
    }
    .browser-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.7);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 12000;
      backdrop-filter: blur(4px);
    }
    .browser-modal-overlay.is-active {
      display: flex;
    }
    .browser-modal {
      background: var(--surface-1);
      border: 1px solid var(--line);
      border-radius: 8px;
      padding: 24px;
      max-width: 520px;
      width: calc(100% - 32px);
      box-shadow: var(--shadow-soft);
      display: flex;
      flex-direction: column;
      gap: 12px;
      text-align: left;
    }
    .browser-modal h3 {
      margin: 0;
      font-size: 18px;
      letter-spacing: 0.02em;
      color: var(--text);
    }
    .browser-modal p {
      margin: 0;
      font-size: 12px;
      color: var(--text-muted);
      line-height: 1.5;
    }
    .browser-modal-actions {
      display: flex;
      justify-content: flex-end;
      gap: 8px;
      margin-top: 6px;
    }
    .browser-modal-btn {
      padding: 8px 14px;
      border-radius: 6px;
      border: 1px solid var(--accent-strong);
      background: var(--accent);
      color: #07100d;
      font-weight: 700;
      font-size: 12px;
      cursor: pointer;
      letter-spacing: 0.03em;
      transition: transform 0.15s ease, box-shadow 0.2s ease;
    }
    .browser-modal-btn.secondary {
      background: transparent;
      color: var(--text);
      border-color: var(--line);
    }
    .browser-modal-btn:hover {
      transform: translateY(-1px);
      box-shadow: none;
    }
    /* Footer credit styling (docked in left controls panel) */
    .credit-box {
      margin-top: auto;
      padding: 8px 10px;
      border-radius: 8px;
      border: 1px solid var(--line);
      background: var(--surface-2);
      color: var(--text-dim);
      font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
      font-size: 10px;
      line-height: 1.35;
      letter-spacing: 0.15px;
      text-align: left;
      width: 100%;
      user-select: none;
      cursor: pointer;
      appearance: none;
      -webkit-appearance: none;
      transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    }
    .credit-box:hover,
    .credit-box:focus-visible {
      border-color: var(--accent-strong);
      color: var(--text-muted);
      background: var(--surface-1);
      outline: none;
    }
    .credit-box-link {
      display: inline-block;
      margin-top: 5px;
      color: var(--accent-strong);
      font-weight: 700;
    }
    .terms-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(13, 13, 12, 0.86);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 12500;
      padding: 18px;
      backdrop-filter: blur(4px);
    }
    .terms-modal-overlay.is-active {
      display: flex;
    }
    .terms-modal {
      width: min(780px, 96vw);
      max-height: min(760px, 90vh);
      background: var(--surface-1);
      border: 1px solid var(--line);
      border-radius: 8px;
      box-shadow: var(--shadow-soft);
      color: var(--text);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .terms-modal-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 16px;
      padding: 18px 20px 12px;
      border-bottom: 1px solid var(--line-soft);
      flex-shrink: 0;
    }
    .terms-modal-title {
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .terms-modal h2 {
      margin: 0;
      font-size: 18px;
      line-height: 1.2;
      letter-spacing: 0.02em;
      color: var(--text);
    }
    .terms-modal .terms-updated {
      margin: 0;
      font-size: 11px;
      color: var(--text-dim);
    }
    .terms-modal-close {
      width: 32px;
      height: 32px;
      border-radius: 6px;
      border: 1px solid var(--line);
      background: var(--surface-2);
      color: var(--text);
      font-size: 21px;
      line-height: 1;
      cursor: pointer;
      flex: 0 0 auto;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .terms-modal-close:hover,
    .terms-modal-close:focus-visible {
      border-color: var(--accent-strong);
      outline: none;
    }
    .terms-modal-body {
      flex: 1 1 auto;
      min-height: 0;
      overflow-y: auto;
      overscroll-behavior: contain;
      scrollbar-width: thin;
      scrollbar-color: var(--accent) var(--surface-2);
      -webkit-overflow-scrolling: touch;
      padding: 16px 20px 20px;
    }
    .terms-modal-body::-webkit-scrollbar {
      width: 10px;
    }
    .terms-modal-body::-webkit-scrollbar-track {
      background: var(--surface-2);
      border-radius: 999px;
    }
    .terms-modal-body::-webkit-scrollbar-thumb {
      background: var(--accent);
      border: 2px solid var(--surface-2);
      border-radius: 999px;
    }
    .terms-modal-body::-webkit-scrollbar-thumb:hover {
      background: var(--accent-strong);
    }
    .terms-modal-body h3 {
      margin: 16px 0 6px;
      font-size: 13px;
      color: var(--text);
      letter-spacing: 0.04em;
      text-transform: uppercase;
    }
    .terms-modal-body h3:first-child {
      margin-top: 0;
    }
    .terms-modal-body p,
    .terms-modal-body li {
      font-size: 12.5px;
      line-height: 1.55;
      color: var(--text-muted);
    }
    .terms-modal-body p {
      margin: 0 0 9px;
    }
    .terms-modal-body ul {
      margin: 0 0 10px 18px;
      padding: 0;
    }
    .terms-modal-body li {
      margin-bottom: 6px;
    }
    .terms-modal-body strong {
      color: var(--text);
      font-weight: 700;
    }
    .terms-modal-note {
      margin-top: 16px;
      padding-top: 12px;
      border-top: 1px solid var(--line-soft);
      color: var(--text-dim);
    }

    /* Desktop feedback prompt: a quiet, non-modal card that waits for a pause. */
    .feedback-launcher,
    .feedback-prompt {
      display: none;
    }
    @media (min-width: 992px) and (pointer: fine) {
      .feedback-launcher {
        position: static;
        flex-shrink: 0;
        align-self: center;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        min-height: 38px;
        padding: 8px 13px 8px 10px;
        border: 1px solid #8da58a;
        border-radius: 999px;
        background: #263327;
        color: #eef4ec;
        box-shadow: none;
        cursor: pointer;
        font-size: 12px;
        font-weight: 750;
        letter-spacing: 0.02em;
        transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
      }
      .feedback-launcher:hover,
      .feedback-launcher:focus-visible,
      .feedback-launcher.is-highlighted {
        border-color: #c1d5bd;
        background: #344635;
        box-shadow: 0 0 0 3px rgba(147, 173, 143, 0.18);
        outline: none;
      }
      .feedback-launcher-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 21px;
        height: 21px;
        border-radius: 50%;
        background: #93ad8f;
        color: #142016;
        font-size: 11px;
        line-height: 1;
      }
      .feedback-prompt {
        display: block;
        position: absolute;
        right: -6px;
        bottom: calc(100% - 8px);
        z-index: 1;
        width: calc(100% + 12px);
        max-height: calc(100dvh - 120px);
        overflow-y: auto;
        padding: 18px;
        border: 1px solid #cdd6cf;
        border-radius: 14px;
        background: var(--surface-2);
        color: var(--text);
        /* An opaque surround masks borders of the panel behind this card. */
        box-shadow: 0 0 0 5px var(--surface-1), 0 12px 28px rgba(29, 43, 33, 0.16);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(10px) scale(0.985);
        transform-origin: bottom right;
        transition: opacity 0.2s ease, transform 0.2s ease;
      }
      .feedback-prompt.is-active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0) scale(1);
      }
      .feedback-prompt-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 8px;
      }
      .feedback-prompt-kicker {
        color: var(--accent-deep);
        font-size: 10px;
        font-weight: 800;
        letter-spacing: 0.13em;
        text-transform: uppercase;
      }
      .feedback-prompt-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        padding: 0;
        border: 1px solid transparent;
        border-radius: 8px;
        background: transparent;
        color: var(--text-muted);
        cursor: pointer;
        font-size: 21px;
        line-height: 1;
      }
      .feedback-prompt-close:hover,
      .feedback-prompt-close:focus-visible {
        border-color: var(--line);
        background: var(--surface-2);
        color: var(--text);
        outline: none;
      }
      .feedback-prompt h2 {
        margin: 0 0 8px;
        color: var(--text);
        font-size: 19px;
        line-height: 1.25;
        letter-spacing: 0.01em;
      }
      .feedback-prompt p {
        margin: 0;
        color: var(--text-muted);
        font-size: 12.5px;
        line-height: 1.55;
      }
      .feedback-prompt-actions {
        display: grid;
        grid-template-columns: 1fr 1.2fr;
        gap: 8px;
        margin-top: 16px;
      }
      .feedback-prompt-btn {
        min-width: 0;
        min-height: 40px;
        padding: 9px 10px;
        border: 1px solid var(--line);
        border-radius: 8px;
        cursor: pointer;
        font-size: 11.5px;
        font-weight: 700;
        letter-spacing: 0.02em;
      }
      .feedback-prompt-btn.secondary {
        background: transparent;
        color: var(--text-muted);
      }
      .feedback-prompt-btn.primary {
        border-color: var(--accent);
        background: var(--accent);
        color: #fff;
      }
      .feedback-prompt-btn:hover,
      .feedback-prompt-btn:focus-visible {
        border-color: #c1d5bd;
      }
      .feedback-prompt-btn:focus-visible,
      .feedback-prompt-close:focus-visible {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      .feedback-launcher,
      .feedback-prompt {
        transition: none;
      }
    }

/* ====== RESPONSIVE DESIGN ====== */

/* Large screens (14" MacBook Pro and larger) - baseline */
@media (min-width: 1441px) {
  .app {
    max-width: 1680px;
    width: 100%;
    gap: 12px;
    padding: 10px;
  }
  .canvas-wrapper {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-width: 0;
  }
  .controls {
    flex: 0 0 320px;
    width: 320px;
  }
  .sim-view {
    flex: 1 1 auto;
    min-width: 0;
    padding: 40px 16px 16px 16px;
    gap: 18px;
  }
  .controls-scroll {
    overflow-y: auto;
    padding-right: 4px;
  }
}

/* Medium-large screens (13" laptops, 1200-1440px) */
@media (min-width: 1200px) and (max-width: 1440px) {
  .app {
    max-width: 100%;
    gap: 10px;
    padding: 8px;
  }
  .canvas-wrapper {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
    min-width: 0;
  }
  .controls {
    flex: 0 0 280px;
    width: 280px;
  }
  .slit-panel {
    flex: 0 0 280px;
    width: 280px;
    margin-left: 0;
  }
  .sim-view {
    flex: 1 1 auto;
    min-width: 0;
    padding: 30px 12px 12px 12px;
    gap: 14px;
  }
  .controls h1 {
    font-size: 16px;
    margin: 6px 0;
  }
  .controls h2 {
    font-size: 11px;
  }
  canvas {
    border-radius: 12px;
  }
  .controls-scroll {
    overflow-y: auto;
    padding-right: 4px;
  }
}

/* Medium screens (11-12" laptops, iPads landscape, 992-1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
  body {
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .sim-root {
    width: 100%;
    max-width: 100%;
    padding: 0 2px;
  }
  .app {
    max-width: 100%;
    width: 100%;
    gap: 8px;
    padding: 6px;
    max-height: 100vh;
    height: 100vh;
  }
  .controls {
    flex: 0 0 240px;
    width: 240px;
    padding: 10px 12px;
    gap: 10px;
  }
  .slit-panel {
    flex: 0 0 240px;
    width: 240px;
    margin-left: 0;
  }
  .controls h1 {
    font-size: 14px;
    margin: 4px 0;
    gap: 6px;
  }
  .controls h2 {
    font-size: 10px;
    margin: 8px 0 4px;
  }
  .controls p {
    font-size: 10px;
  }
  .pill-btn {
    font-size: 10px;
    padding: 5px 10px;
  }
  .sim-view {
    padding: 24px 10px 10px 10px;
    gap: 12px;
  }
  #overviewCanvas {
    width: 280px;
    height: 180px;
    border-radius: 10px;
  }
  .overview-label {
    font-size: 10px;
  }
  .orientation-label {
    font-size: 9px;
    padding: 2px 8px;
  }
  .focus-indicator,
  .joystick-indicator {
    width: 200px;
    min-height: 178px;
    padding: 10px 8px;
    font-size: 10px;
  }
  .controls-scroll {
    overflow-y: auto;
    padding-right: 4px;
  }
}

/* Small screens (tablets, 768-991px) */
@media (min-width: 768px) and (max-width: 991px) {
  body {
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .sim-root {
    width: 100%;
    max-width: 100%;
    padding: 0;
  }
  .app {
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    height: 100vh;
    gap: 6px;
    padding: 4px;
    flex-direction: column;
  }
  .slit-panel {
    width: 100%;
    margin-left: 0;
  }
  .controls {
    width: 100%;
    max-height: 120px;
    padding: 8px 12px;
    gap: 8px;
    overflow-y: auto;
  }
  .controls-scroll {
    gap: 8px;
  }
  .controls h1 {
    font-size: 13px;
    margin: 2px 0;
  }
  .controls h2 {
    font-size: 9px;
    margin: 6px 0 3px;
  }
  .controls p {
    font-size: 9px;
  }
  .pill-btn {
    font-size: 9px;
    padding: 4px 8px;
  }
  .sim-view {
    flex: 1;
    width: 100%;
    padding: 16px 8px 8px 8px;
    gap: 10px;
  }
  .canvas-wrapper {
    flex: 1;
    width: 100%;
  }
  #overviewCanvas {
    width: 240px;
    height: 150px;
  }
  .overview-label {
    font-size: 9px;
  }
  .overview-cluster {
    gap: 8px;
  }
  .orientation-label {
    font-size: 8px;
    padding: 2px 6px;
  }
  .focus-indicator,
  .joystick-indicator {
    width: 180px;
    min-height: 158px;
    padding: 8px 6px;
    font-size: 9px;
  }
  .focus-joystick {
    --focus-knob-size: 44px;
    height: 100px;
    width: 50px;
  }
  .joystick-indicator {
    --joystick-scale: 0.82;
  }
  select, input {
    font-size: 11px;
  }
}

/* Extra small screens & mobile (< 768px) */
@media (max-width: 767px) {
  body {
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .sim-root {
    width: 100%;
    max-width: 100%;
    padding: 0;
  }
  .app {
    max-width: 100%;
    width: 100%;
    max-height: 100vh;
    height: 100vh;
    gap: 4px;
    padding: 2px;
    flex-direction: column;
  }
  .slit-panel {
    width: 100%;
    margin-left: 0;
  }
  .controls {
    width: 100%;
    max-height: 100px;
    padding: 6px 10px;
    gap: 6px;
    overflow-y: auto;
  }
  .controls-scroll {
    gap: 6px;
  }
  .controls h1 {
    font-size: 12px;
    margin: 2px 0;
  }
  .controls h2 {
    font-size: 8px;
    margin: 4px 0 2px;
  }
  .controls p {
    font-size: 8px;
  }
  .pill-btn {
    font-size: 8px;
    padding: 3px 6px;
  }
  .sim-view {
    flex: 1;
    width: 100%;
    padding: 12px 6px 6px 6px;
    gap: 8px;
  }
  .canvas-wrapper {
    flex: 1;
    width: 100%;
  }
  #overviewCanvas {
    width: 200px;
    height: 130px;
  }
  .overview-label {
    font-size: 8px;
  }
  .overview-cluster {
    gap: 6px;
  }
  .orientation-label {
    font-size: 7px;
    padding: 1px 4px;
  }
  .focus-indicator,
  .joystick-indicator {
    width: 160px;
    min-height: 138px;
    padding: 6px 4px;
    font-size: 8px;
  }
  .focus-joystick {
    --focus-knob-size: 38px;
    height: 80px;
    width: 42px;
  }
  .joystick-indicator {
    --joystick-scale: 0.68;
  }
  select, input {
    font-size: 10px;
  }
}

/* Ultra-wide screens (4K, ultra-wide monitors) */
@media (min-width: 2560px) {
  .app {
    max-width: 2400px;
  }
  .controls {
    width: 380px;
  }
  .controls h1 {
    font-size: 20px;
  }
  #overviewCanvas {
    width: 420px;
    height: 270px;
  }
}

/* Side panel refresh. Keep the simulator, indicators and magnification wheel intact. */
.controls,
.slit-panel,
.laser-header,
.laser-console,
.laser-pattern-panel,
.laser-task,
.laser-help,
.laser-mobile-firebar,
.laser-view-heading {
  --surface-1: #f5f6f4;
  --surface-2: #fcfcfb;
  --surface-3: #e2e5e1;
  --line: #d6dad5;
  --line-soft: #e0e3df;
  --text: #292e2b;
  --text-muted: #555e58;
  --text-dim: #707872;
  --accent: #536d5d;
  --accent-strong: #819b89;
  --accent-deep: #3d5546;
  --shadow-soft: 0 8px 24px rgba(29, 43, 33, 0.08);
  background: var(--surface-1);
  border-color: var(--line);
  border-radius: 6px;
  padding: 22px 20px 18px;
  box-shadow: none;
}
.controls-scroll {
  gap: 0;
  padding-right: 0;
  scrollbar-color: #c3ccc3 transparent;
}
.controls h1 {
  position: relative;
  display: flex;
  flex-shrink: 0;
  gap: 14px;
  margin: 0;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 20px;
  line-height: 1.25;
  font-weight: 720;
}
.controls .app-title-icon {
  width: 32px;
  height: 32px;
  object-fit: contain;
}
.controls .app-title-text {
  max-width: 195px;
  letter-spacing: 0.065em;
}
.controls .controls-section {
  margin: 0;
  padding: 10px 0;
  flex-shrink: 0;
}
.controls-scroll > .controls-section:nth-child(2) {
  border-top: 0;
}
.controls .info-row,
.slit-panel .info-row {
  margin-bottom: 10px;
  gap: 7px;
}
.controls h2,
.slit-panel .right-section h2,
.slit-panel .right-section h3 {
  margin: 0 0 14px;
  font-size: 11.5px;
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: 0.055em;
  color: var(--text);
}
.controls .info-row h2,
.slit-panel .info-row h2 {
  margin: 0;
}
.controls .info-pill,
.slit-panel .info-pill {
  width: 13px;
  height: 13px;
  font-size: 9px;
  border-color: #97a59b;
  color: #738b7a;
  background: transparent;
}
.controls .info-popover,
.slit-panel .info-popover {
  font-size: 12px;
  line-height: 1.55;
  width: 260px;
  padding: 14px;
}
.panel-icon {
  display: block;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.controls .pill-btn,
.slit-panel .pill-btn {
  color: var(--text);
  border-color: var(--line);
  background: transparent;
  box-shadow: none;
}
.controls .pill-btn:not(.active):not(:disabled):hover,
.slit-panel .pill-btn:not(.active):not(:disabled):hover {
  background: #eaf0e9;
  border-color: #a8b9ab;
}
.controls .pill-btn.active,
.slit-panel .pill-btn.active {
  background: var(--accent);
  border-color: var(--accent-strong);
  color: #fff;
}
.controls .pill-btn:focus-visible,
.slit-panel .pill-btn:focus-visible,
.controls .select-control:focus-visible,
.slit-panel summary:focus-visible,
.controls .info-trigger:focus-visible,
.slit-panel .info-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.controls .eye-toggle {
  gap: 8px;
  margin: 0;
  border: 0;
}
.controls .eye-toggle .pill-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 54px;
  border-width: 1px;
  border-style: solid;
  border-radius: 5px;
  margin: 0;
}
.eye-code {
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0.025em;
}
.eye-name {
  font-size: 11px;
  font-weight: 450;
  letter-spacing: 0;
}
.fixation-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.controls .fixation-toggle {
  --fixation-button-size: 36px;
  grid-template-columns: repeat(3, var(--fixation-button-size));
  grid-template-rows: repeat(3, var(--fixation-button-size));
  gap: 6px;
  margin: 0;
}
.controls .fixation-toggle .pill-btn {
  width: var(--fixation-button-size);
  height: var(--fixation-button-size);
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border-width: 1.5px;
}
.controls .fixation-toggle .pill-btn.active {
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.07);
}
.controls .fixation-primary.active .panel-icon {
  color: #d7e7dc;
}
.fixation-shortcuts {
  list-style: none;
  display: grid;
  gap: 6px;
  min-width: 70px;
  padding: 0;
  margin: 0 8px 0 0;
  color: var(--text-dim);
  font-size: 11px;
}
.fixation-shortcuts li {
  display: flex;
  align-items: center;
  gap: 9px;
}
.fixation-shortcuts kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: 0 1px 0 var(--line);
  font-size: 10px;
  font-weight: 600;
}
.controls .slit-controls {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.controls .slit-controls .row {
  position: relative;
  gap: 6px;
  margin-bottom: 12px;
  padding-bottom: 8px;
}
.controls .slit-controls .row::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 0;
  height: 3px;
  pointer-events: none;
  background: radial-gradient(circle, #c4ccc5 1px, transparent 1.5px) left center / 10% 3px repeat-x;
}
.controls .slit-controls label {
  font-size: 12px;
  font-weight: 450;
  line-height: 1.4;
  color: var(--text);
  letter-spacing: 0;
}
.controls .slit-controls label span {
  color: var(--text);
  font-weight: 700;
}
/* Keep the filled track separate from the circular thumb. */
.controls .slit-controls input[type="range"] {
  height: 6px;
  margin: 5px 0;
  border: 0;
  background: linear-gradient(to right, var(--accent) 0 var(--slit-fill, 0%), var(--surface-3) var(--slit-fill, 0%) 100%);
  box-shadow: none;
  border-radius: 4px;
}
.controls .slit-controls input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  box-shadow: none;
  transition: background 0.15s ease;
}
.controls .slit-controls input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--accent-deep);
}
.controls .slit-controls input[type="range"]::-moz-range-track {
  height: 6px;
  border: 0;
  border-radius: 4px;
  background: var(--surface-3);
  box-shadow: none;
}
.controls .slit-controls input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 4px;
  background: var(--accent);
}
.controls .slit-controls input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
  box-shadow: none;
}
.controls .slit-controls input[type="range"]::-moz-range-thumb:hover {
  background: var(--accent-deep);
}
.controls .slit-controls .row:focus-within {
  outline: 2px solid var(--accent-strong);
  outline-offset: 5px;
  border-radius: 2px;
}
.controls .slit-controls input[type="range"]:focus-visible {
  outline: none;
}
.controls .magnification-control {
  margin-top: 3px;
  padding-top: 12px;
}
.controls .magnification-readout {
  margin-bottom: 12px;
  color: var(--text);
  font-size: 11.5px;
  letter-spacing: 0.055em;
  text-transform: uppercase;
}
.controls .select-control {
  min-height: 38px;
  padding-left: 12px;
  font-size: 12px;
  background-color: transparent;
}
.controls .reset-section {
  margin-top: auto;
  padding-bottom: 0;
}
.controls #resetBtn {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  font-size: 11.5px;
  font-weight: 550;
}
.controls #resetBtn .panel-icon {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}
.slit-panel > .slit-controls.right-card {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  gap: 0;
  padding-right: 0;
  scrollbar-color: #c3ccc3 transparent;
  overscroll-behavior: contain;
}
.slit-panel .right-section {
  flex-shrink: 0;
}
.slit-panel .right-section + .right-section {
  margin: 0;
  padding: 24px 0;
}
.slit-panel .learning-section {
  padding: 4px 0 20px;
}
.slit-panel .learning-section h2 {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.slit-panel .tutorial-btn-group {
  gap: 10px;
}
.slit-panel .lesson-card {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 75px;
  padding: 12px 10px;
  border-radius: 7px;
  background: var(--surface-2);
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}
.lesson-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 39px;
  height: 39px;
  border-radius: 7px;
  color: #edf3ee;
  background: var(--accent);
}
.lesson-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 8px;
}
.lesson-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
}
.lesson-number {
  font-size: 11px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.lesson-meta {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.3;
}
.lesson-chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--text-muted);
}
.slit-panel .lesson-card:disabled {
  cursor: not-allowed;
  background: #f0f1ef;
  border-color: var(--line-soft);
}
.slit-panel .lesson-card:disabled .lesson-title {
  color: #737b74;
}
.slit-panel .lesson-card:disabled .lesson-icon {
  background: #d2d7d1;
  color: #7d877e;
}
.coming-soon {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 4px;
  color: #687269;
  background: #e4e8e2;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
}
.slit-panel .pathology-menu {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}
.slit-panel .pathology-menu > summary {
  border: 0;
}
.slit-panel .pathology-menu[open] > summary {
  border-bottom: 1px solid var(--line-soft);
  border-radius: 6px 6px 0 0;
}
.pathology-menu-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}
.slit-panel .pathology-choice {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 550;
  text-align: left;
  text-transform: none;
}
.slit-panel .pathology-choice:disabled {
  color: var(--text-dim);
  background: var(--surface-1);
  cursor: not-allowed;
}
.slit-panel .pathology-choice.quiz-hidden {
  min-height: 0;
}
.slit-panel summary {
  list-style: none;
  cursor: pointer;
}
.slit-panel summary::-webkit-details-marker {
  display: none;
}
.disclosure-chevron {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 0.18s ease;
}
.slit-panel details[open] > summary .disclosure-chevron {
  transform: rotate(90deg);
}
.slit-panel .pathology-section .small-text {
  margin: 2px 0 0;
  font-size: 11px;
}
.slit-panel .challenge-toggle {
  margin: 16px 0 12px;
}
.slit-panel .challenge-toggle .toggle-group {
  width: 146px;
  gap: 8px;
  border: 0;
}
.slit-panel .challenge-toggle .pill-btn {
  min-height: 34px;
  border-width: 1px;
  border-style: solid;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 650;
}
.slit-panel .small-text {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
}
.slit-panel .challenge-description {
  margin: 0;
}
.slit-panel .upload-card {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 10px 12px;
  margin: 0;
  border: 1px dashed #bec8be;
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.slit-panel .upload-card:hover,
.slit-panel .upload-card:focus-within {
  background: #eaf0e9;
  border-color: var(--accent);
}
.slit-panel .upload-card:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.upload-card .panel-icon {
  width: 18px;
  height: 18px;
}
.slit-panel .upload-card .upload-title {
  align-self: center;
  font-weight: 550;
}
.slit-panel .upload-card input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.slit-panel .upload-note {
  margin: 8px 0 0;
  text-align: center;
  font-size: 10.5px;
}
.panel-help {
  flex-shrink: 0;
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.help-disclosure + .help-disclosure {
  border-top: 1px solid var(--line);
}
.help-disclosure > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.help-disclosure > summary:hover {
  background: #eaf0e9;
}
.help-disclosure > summary > .panel-icon:first-child {
  color: var(--text-muted);
}
.slit-panel .hint-list {
  margin: 0;
  padding: 2px 17px 14px 28px;
}
.slit-panel .hint-list li {
  font-size: 12px;
  line-height: 1.55;
  margin-bottom: 10px;
  color: var(--text-muted);
}
.panel-credit {
  flex-shrink: 0;
  padding-top: 24px;
}
.slit-panel {
  /* Keep all feedback UI below the simulator's tutorial overlays. */
  isolation: isolate;
}
.panel-footer {
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  gap: 6px;
  padding-top: 14px;
}
.panel-footer .panel-credit {
  padding-top: 0;
}
.panel-credit > summary {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 10px 0;
  color: var(--text-dim);
  font-size: 10px;
}
.panel-credit > summary:hover {
  color: var(--text);
}
.panel-credit .credit-box {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.55;
}
.panel-credit .credit-box-link {
  color: var(--accent-deep);
}
/* Retain the original quiz hide/show states despite the new panel spacing. */
.slit-panel .quiz-hideable.quiz-hidden {
  padding: 0;
  margin: 0;
  border-width: 0;
  overflow: hidden;
}
@media (max-width: 1440px) {
  .controls,
  .slit-panel {
    padding: 18px 15px 14px;
  }
  .controls h1 {
    font-size: 18px;
    gap: 12px;
  }
  .controls .app-title-text {
    max-width: 180px;
  }
  .fixation-shortcuts {
    margin-right: 0;
  }
  .slit-panel .lesson-card {
    gap: 9px;
    padding: 12px 8px;
  }
  .lesson-icon {
    width: 34px;
    height: 36px;
  }
  .lesson-title {
    gap: 6px;
    font-size: 11.5px;
  }
}
@media (max-width: 1199px) {
  .controls,
  .slit-panel {
    padding-left: 12px;
    padding-right: 12px;
  }
  .controls h1 {
    font-size: 15px;
    gap: 10px;
  }
  .controls .app-title-text {
    max-width: 146px;
  }
  .controls .app-title-icon {
    width: 26px;
    height: 26px;
  }
  .controls .fixation-toggle {
    --fixation-button-size: 33px;
    gap: 5px;
  }
  .fixation-layout {
    gap: 10px;
  }
  .fixation-shortcuts {
    min-width: 65px;
  }
  .lesson-title {
    flex-wrap: wrap;
    gap: 2px 6px;
  }
  .lesson-icon {
    width: 30px;
    height: 34px;
  }
  .slit-panel .lesson-card {
    gap: 8px;
  }
}
@media (min-width: 992px) and (max-height: 900px) {
  .controls,
  .slit-panel {
    padding-top: 16px;
    padding-bottom: 14px;
  }
  .controls h1 {
    padding-bottom: 16px;
  }
  .controls .controls-section {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .controls .slit-controls .row {
    margin-bottom: 8px;
    gap: 4px;
  }
  .controls .eye-toggle .pill-btn {
    min-height: 44px;
  }
  .controls .magnification-control {
    padding-top: 10px;
  }
  .slit-panel .lesson-card {
    min-height: 60px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .slit-panel .right-section + .right-section {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .panel-footer {
    padding-top: 10px;
  }
  .help-disclosure > summary {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .panel-credit {
    padding-top: 12px;
  }
  .controls .fixation-toggle {
    --fixation-button-size: 32px;
  }
  .controls .info-row {
    margin-bottom: 8px;
  }
  .controls .slit-controls input[type="range"] {
    margin-top: 4px;
    margin-bottom: 4px;
  }
  .controls .magnification-readout {
    margin-bottom: 8px;
  }
  .controls .select-control {
    min-height: 34px;
  }
  .controls .reset-section {
    padding-bottom: 0;
  }
}
@media (max-width: 991px) {
  .controls .controls-scroll {
    flex: 1 0 auto;
  }
  .controls .fixation-layout {
    justify-content: flex-start;
    gap: 24px;
  }
  .panel-help {
    margin-top: 16px;
  }
  .slit-panel .lesson-title {
    flex-wrap: nowrap;
  }
}
@media (prefers-reduced-motion: reduce) {
  .disclosure-chevron,
  .slit-panel .upload-card {
    transition: none;
  }
}

/* Generic retinal laser practice. All visual assets and audio are local. */
body.laser-active .sim-root { height: 98vh; height: 98dvh; max-height: 98dvh; gap: 8px; }
.laser-active .mode-switcher { display: flex; }
.laser-launch { margin-top: 12px; }
.mode-switcher { flex: 0 0 auto; }
.mode-btn[hidden], .laser-panel[hidden] { display: none !important; }
.laser-panel {
  width: 100%; max-width: 1440px; margin: 0 auto;
  height: calc(96vh - 50px); height: calc(96dvh - 50px);
  overflow-y: auto; padding: 8px 16px 18px; scrollbar-width: thin;
}
.sim-root > .laser-panel { flex: 1 1 0; min-height: 0; }
.laser-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 12px; padding: 12px 18px; border: 1px solid var(--line); color: var(--text); }
.laser-header h1 { margin: 0; font-size: 20px; line-height: 1.25; font-weight: 720; }
.laser-beta-tag { display: inline-block; vertical-align: middle; margin-left: 7px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-2); color: var(--text-muted); font-size: 10px; font-weight: 500; letter-spacing: 0.02em; }
.laser-eyebrow { margin: 0; color: var(--text-muted); font-size: 11px; letter-spacing: 0.035em; }
.laser-header-tools { display: flex; align-items: center; gap: 14px; }
.laser-header-tools label { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 11px; }
.laser-header-tools label[hidden] { display: none; }
.laser-view-tools { display: flex; align-items: center; gap: 12px; }
.laser-zoom-label { display: flex; align-items: center; gap: 5px; font-size: 10px; }
.laser-panel .laser-view-tools select, .laser-panel .laser-view-tools button { min-height: 25px; padding: 3px 7px; font-size: 10px; }
.laser-task { padding: 12px 16px; margin-top: 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.laser-task[hidden] { display: none; }
.laser-task-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.laser-task h2 { font-size: 12px; font-weight: 600; margin: 0; }
.laser-task p { font-size: 11px; line-height: 1.5; color: var(--text-muted); margin: 7px 0 0; }
.laser-panel .laser-task-heading button { min-height: 28px; padding: 4px 9px; font-size: 11px; }
.laser-panel[data-exercise="tear"] .laser-view-field { width: min(100%, calc(100dvh - 390px)); }
.laser-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: stretch; }
.laser-examination { min-width: 0; display: flex; flex-direction: column; }
.laser-panel button, .laser-panel select {
  border: 1px solid var(--line); border-radius: 5px; background: var(--surface-2);
  color: var(--text); font-size: 12px; min-height: 36px; padding: 8px 12px; cursor: pointer;
}
.laser-panel button:hover:not(:disabled) { border-color: #a8b9ab; background: #eaf0e9; }
.laser-panel button:disabled { opacity: 0.4; cursor: not-allowed; }
.laser-panel button:focus-visible, .laser-panel input:focus-visible, .laser-panel select:focus-visible,
.laser-panel canvas:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.laser-panel button[aria-pressed="true"] { border-color: var(--accent-strong); color: #fff; background: var(--accent); }
.laser-panel button[aria-pressed="true"]:hover:not(:disabled) { background: var(--accent-deep); color: #fff; }
.laser-panel .laser-quiet-btn { border-color: transparent; background: transparent; color: var(--text-muted); padding: 6px 8px; }
.laser-view-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line-soft); border-bottom: 0; border-radius: 7px 7px 0 0; font-size: 11px; color: var(--text-muted); }
.laser-state { font-size: 10px; letter-spacing: 0.08em; color: var(--text-muted); }
.laser-state::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; background: #a39b87; border-radius: 50%; }
.laser-state.is-ready { color: var(--accent-deep); }
.laser-state.is-ready::before { background: var(--accent); }
.laser-view-wrap { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); flex: 1; align-items: center; justify-items: center; background: #080907; border: 1px solid var(--line-soft); border-radius: 0 0 7px 7px; overflow: hidden; }
.laser-danger-warning { position: absolute; z-index: 2; top: 14px; left: 14px; right: 14px; padding: 11px 14px; border: 1px solid #b79a63; border-radius: 5px; background: #faf1dc; color: #62471f; box-shadow: 0 3px 12px #0003; font-size: 12px; line-height: 1.5; pointer-events: none; }
.laser-danger-warning[hidden] { display: none; }
.laser-view-field { position: relative; width: min(100%, calc(100dvh - 315px)); aspect-ratio: 1; }
#laserCanvas { display: block; width: 100%; height: 100%; aspect-ratio: 1; border: 0; border-radius: 50%; touch-action: none; cursor: ns-resize; }
.laser-activity { position: absolute; top: clamp(30px, 5%, 44px); right: clamp(30px, 4%, 44px); width: clamp(42px, 4vw, 54px); color: #f2d64b; pointer-events: none; }
.laser-activity[hidden] { display: none; }
.laser-activity::before {
  content: ''; position: absolute; top: 50%; left: 50%; width: 185%; aspect-ratio: 1;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle closest-side, rgb(96 255 104) 0%, rgb(96 255 104) 28%, rgb(96 255 104 / 0.85) 40%, rgb(96 255 104 / 0.42) 58%, rgb(96 255 104 / 0.12) 77%, rgb(96 255 104 / 0) 100%);
}
.laser-activity svg { position: relative; display: block; width: 100%; height: auto; }
.laser-view-note { position: absolute; bottom: 9px; left: 0; width: calc(100% - 138px); text-align: center; pointer-events: none; color: #888b7e; font-size: 10px; }
.laser-pattern-panel { width: 100%; display: flex; flex-direction: column; gap: 7px; border: 0; border-radius: 0; padding: 0 0 12px; margin-bottom: 4px; color: var(--text); box-shadow: none; }
.laser-pattern-panel h3 { margin: 0; font-size: 11px; font-weight: 600; color: var(--text); }
.laser-pattern-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.laser-panel .laser-pattern-grid button { display: flex; align-items: center; flex-direction: column; gap: 1px; min-height: 48px; padding: 4px 2px; font-size: 9px; }
.laser-pattern-grid svg { display: block; width: 100%; height: 29px; fill: #b95044; }
.laser-pattern-grid button[aria-pressed="true"] svg { fill: #fff1df; }
.laser-pattern-panel label { display: flex; align-items: center; justify-content: space-between; gap: 3px; font-size: 10px; color: var(--text-muted); }
.laser-panel .laser-pattern-panel select { min-height: 26px; width: 66px; font-size: 10px; padding: 3px; }
.laser-pattern-panel select:disabled { opacity: 0.45; }
.laser-pattern-panel p { margin: 0; color: var(--text-dim); font-size: 9px; line-height: 1.5; }
.laser-focus-control { padding: 10px 14px 0; }
.laser-focus-heading { display: flex; align-items: center; justify-content: space-between; font-size: 12px; gap: 10px; }
.laser-focus-control output { color: #c8b28b; font-size: 11px; }
.laser-focus-control output.is-sharp { color: #bdd0ae; }
.laser-focus-control p { margin: 6px 0 0; color: var(--text-dim); font-size: 10px; line-height: 1.5; }
.laser-focus-cues { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 7px; font-size: 10px; color: #b6ad99; }
.laser-focus-cues span::before { content: ''; display: inline-block; width: 5px; height: 5px; border-radius: 50%; border: 1px solid currentColor; margin-right: 6px; }
.laser-focus-cues .is-sharp { color: #bdd0ae; }
.laser-focus-cues .is-sharp::before { background: currentColor; }
.laser-input-hint { margin: 9px 0 0; text-align: center; font-size: 10px; color: var(--text-dim); line-height: 1.6; }
.laser-console { min-width: 0; align-self: stretch; padding: 18px; border: 0; color: var(--text); box-shadow: none; }
.laser-map-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.laser-map-heading h2 { font-size: 13px; margin: 0; font-weight: 500; }
.laser-eye-toggle { display: flex; gap: 5px; }
.laser-eye-toggle button { min-height: 30px; font-size: 11px; padding: 5px 9px; }
#laserMap { display: block; width: 100%; height: auto; border-radius: 6px; background: #030303; border: 1px solid var(--line); }
.laser-map-hint { font-size: 10px; line-height: 1.5; margin: 7px 0 8px; color: var(--text-dim); }
.laser-map-caption { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.laser-map-caption .laser-map-hint { flex: 1; margin: 0; }
.laser-panel #laserHint { flex: none; min-height: 32px; padding: 4px 12px; color: var(--text); }
.laser-panel #laserHint.is-active { border-color: #b69c57; background: #eee3c3; color: #624c1e; }
.laser-panel #laserHint[hidden] { display: none; }
.laser-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.laser-field-controls { display: flex; gap: 4px; align-items: center; margin-top: 6px; }
.laser-field-controls span { flex: 1; font-size: 11px; color: var(--text-muted); }
.laser-field-controls button { min-width: 29px; min-height: 30px; padding: 4px 7px; }
.laser-settings { padding: 0; }
.laser-settings > label, .laser-settings > p { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 11px; margin: 0 0 10px; }
.laser-settings p { color: var(--text-muted); }
.laser-settings p output { color: var(--text); }
.laser-settings select { min-height: 30px; padding: 4px 8px; }
.laser-settings input { width: 120px; accent-color: var(--accent); }
.laser-panel #laserAimToggle { min-height: 28px; padding: 4px 9px; font-size: 11px; }
.laser-ready-controls { display: flex; gap: 7px; }
.laser-ready-controls button { width: 50%; font-size: 11px; letter-spacing: 0.05em; }
.laser-status { min-height: 17px; margin: 10px 0; color: var(--text-muted); font-size: 11px; line-height: 1.5; }
.laser-panel .laser-fire { width: 100%; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 16px; background: var(--accent); border-color: var(--accent-strong); color: #fff; font-weight: 600; font-size: 14px; }
.laser-panel .laser-fire:hover:not(:disabled) { background: var(--accent-deep); color: #fff; }
.laser-panel .laser-fire.is-firing { background: var(--accent-deep); }
.laser-fire kbd { color: inherit; border: 1px solid var(--accent-strong); background: transparent; font-size: 10px; box-shadow: none; }
.laser-session-row { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 4px; color: var(--text-muted); font-size: 12px; }
.laser-session-row strong { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }
.laser-session-actions { display: flex; gap: 8px; }
.laser-session-actions button { flex: 1; min-height: 30px; font-size: 11px; padding: 6px 10px; }
.laser-model-note { margin: 12px 0 0; color: var(--text-dim); font-size: 10px; line-height: 1.5; }
.laser-help { max-width: 510px; width: calc(100% - 32px); max-height: 85dvh; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; color: var(--text); padding: 28px; }
.laser-help::backdrop { background: rgba(0,0,0,0.78); }
.laser-help h2 { margin: 0 0 12px; font-size: 20px; }
.laser-help p, .laser-help li { font-size: 13px; color: var(--text-muted); line-height: 1.65; }
.laser-help ol { padding-left: 21px; margin: 18px 0; }
.laser-help li { padding-left: 6px; margin-bottom: 12px; }
.laser-help strong { color: var(--text); font-weight: 600; }
.laser-panel .laser-help-start { display: block; width: 100%; margin-top: 20px; background: var(--accent); color: #fff; border-color: var(--accent-strong); font-size: 13px; }
.laser-panel .laser-help-start:hover { background: var(--accent-deep); color: #fff; }
.laser-mobile-firebar { display: none; }
.laser-active .fullscreen-tip, .laser-active #layoutBanner { display: none !important; }
.phone-preview #retinaModeContent.is-hidden { display: none; }
.phone-preview.laser-active .phone-preview-actions, .phone-preview.laser-active .phone-preview-footer > p { display: none; }
/* A single instrument console with three clear groups. */
.laser-header, .laser-task, .laser-view-heading { border: 0; box-shadow: none; }
.laser-beta-tag { border: 0; background: var(--surface-3); }
.laser-view-caption { font-size: 10px; color: var(--text-dim); }
.laser-console-section + .laser-console-section { border-top: 1px solid var(--line-soft); margin-top: 16px; padding-top: 16px; }
.laser-console-section > h2, .laser-section-heading h2 { margin: 0 0 12px; font-size: 13px; font-weight: 600; }
.laser-map-heading h2 { font-weight: 600; }
.laser-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.laser-key-hint { color: var(--text-dim); font-size: 10px; font-weight: 400; }
.laser-viewing .laser-view-tools { justify-content: space-between; margin-bottom: 10px; }
.laser-viewing .laser-zoom-label { font-size: 11px; }
.laser-console #laserMap { border: 0; }
.laser-panel .laser-console select { border-color: transparent; border-bottom-color: var(--line); border-radius: 0; background: transparent; }
.laser-panel .laser-pattern-grid button { background: var(--surface-3); border-color: transparent; }
.laser-panel .laser-pattern-grid button[aria-pressed="true"] { background: var(--accent); }
.laser-pattern-options { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; }
.laser-pattern-options label { flex: 1; gap: 5px; margin: 0; white-space: nowrap; }
.laser-pattern-panel p { margin: 0; }
.laser-eye-toggle, .laser-ready-controls { padding: 3px; gap: 3px; background: var(--surface-3); border-radius: 5px; }
.laser-panel .laser-eye-toggle button, .laser-panel .laser-ready-controls button { border-color: transparent; background: transparent; }
.laser-panel .laser-eye-toggle button[aria-pressed="true"], .laser-panel .laser-ready-controls button[aria-pressed="true"] { background: var(--accent); }
.laser-panel #laserHint, .laser-panel .laser-session-actions button, .laser-panel .laser-task-heading button { border-color: transparent; background: transparent; }
.laser-panel #laserHint:hover:not(:disabled), .laser-panel .laser-session-actions button:hover:not(:disabled), .laser-panel .laser-task-heading button:hover:not(:disabled) { background: var(--surface-3); }
.laser-panel .laser-console button:focus-visible { outline-offset: 1px; }
@media (min-width: 901px) and (max-height: 850px) {
  #laserMap { width: 240px; max-width: 100%; margin: 0 auto; }
  .laser-settings { padding: 0; }
  .laser-settings > label, .laser-settings > p { margin-bottom: 6px; }
  .laser-status { margin: 6px 0; }
}
@media (max-width: 900px) {
  .laser-layout { grid-template-columns: minmax(0, 1fr) 268px; gap: 15px; }
  .laser-panel { padding: 6px; }
}
@media (max-width: 680px) {
  body.laser-active { display: block; height: auto; overflow-y: auto; }
  .laser-active .sim-root { padding-bottom: calc(125px + env(safe-area-inset-bottom)); }
  .laser-panel { height: auto; overflow: visible; padding: 0; }
  .laser-layout { display: block; }
  .laser-header { gap: 8px; margin-bottom: 12px; }
  .laser-header h1 { font-size: 22px; }
  .laser-eyebrow { font-size: 9px; }
  .laser-header .laser-quiet-btn { font-size: 11px; }
  .laser-view-field { width: 100%; max-width: 480px; }
  .laser-panel[data-exercise="tear"] .laser-view-field { width: 100%; }
  .laser-activity { top: 22px; right: 22px; width: 34px; }
  .laser-header-tools { align-items: flex-end; flex-direction: column; gap: 2px; }
  .laser-view-heading { flex-wrap: wrap; }
  .laser-view-tools { gap: 8px; }
  .laser-task { margin-bottom: 14px; }
  .laser-view-heading { padding: 8px 10px; font-size: 10px; }
  .laser-view-note { bottom: 5px; font-size: 8px; }
  .laser-view-wrap { grid-template-columns: minmax(0, 1fr); }
  .laser-danger-warning { right: 10px; left: 10px; top: 10px; font-size: 11px; }
  .laser-pattern-panel { padding: 0 0 12px; }
  .laser-view-note { width: calc(100% - 122px); }
  .laser-focus-control { padding: 12px 5px 3px; }
  .laser-focus-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .laser-input-hint { margin: 4px 0 20px; }
  .laser-console { border-top: 1px solid var(--line); padding-top: 14px; }
  .laser-panel .laser-ready-controls, .laser-panel .laser-status, .laser-panel .laser-fire { display: none; }
  .laser-field-controls button { min-width: 37px; min-height: 37px; }
  .laser-settings > label, .laser-settings > p { font-size: 12px; }
  .laser-delivery .laser-key-hint { display: none; }
  .laser-mobile-firebar { display: block; position: fixed; z-index: 45; bottom: 0; left: 0; right: 0; background: var(--surface-1); border-top: 1px solid var(--line); padding: 9px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); box-shadow: 0 -6px 24px #0005; }
  .laser-mobile-firebar p { font-size: 11px; color: var(--text-muted); line-height: 1.4; margin: 0 0 7px; }
  .laser-mobile-firebar > div { display: flex; align-items: center; gap: 9px; }
  .laser-mobile-firebar button { min-height: 42px; }
  .laser-mobile-firebar #laserMobileFire { flex: 1; color: #fff; background: var(--accent); font-size: 14px; border-color: var(--accent-strong); font-weight: 600; }
  #laserMobileCount { font-size: 11px; min-width: 42px; color: var(--text-muted); }
  .laser-help { padding: 23px; }
}

/* Retinal laser: one reading order, with delivery kept within reach. */
.laser-header, .laser-view-heading, .laser-console, .laser-console .laser-pattern-panel {
  --surface-1: #eae9e3;
  --surface-2: #f5f4ef;
  --surface-3: #deded6;
  --line: #bfc3ba;
  --line-soft: #cdd0c6;
  --text: #292e2b;
  --text-muted: #485249;
  --text-dim: #596359;
  background: var(--surface-1);
}
.laser-console { display: flex; flex-direction: column; padding: 14px; gap: 12px; }
.laser-console-body { min-width: 0; }
.laser-console-section { min-width: 0; }
.laser-console-section + .laser-console-section { margin-top: 10px; padding-top: 10px; }
.laser-console-section > h2, .laser-section-heading h2 { font-size: 13px; margin: 0 0 7px; }
.laser-map-heading { margin-bottom: 6px; }
.laser-panel .laser-eye-toggle button { min-height: 26px; padding: 3px 8px; }
.laser-navigation { display: flex; flex-direction: column; gap: 7px; }
.laser-overview { width: 75%; margin: 0 auto; }
.laser-console #laserMap { width: 100%; max-width: none; margin: 0; }
.laser-map-hint { font-size: 10px; line-height: 1.4; margin: 4px 0 0; color: var(--text-muted); text-align: center; }
.laser-navigation-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.laser-navigation-controls label { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.laser-panel .laser-navigation-controls select, .laser-panel .laser-navigation-controls button { min-height: 28px; padding: 4px 7px; font-size: 11px; }
.laser-panel .laser-navigation-controls #laserHint { min-height: 26px; padding: 3px 7px; text-align: left; }
.laser-pattern-panel { gap: 5px; padding: 0 0 7px; margin: 0; }
.laser-pattern-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.laser-panel .laser-pattern-grid button { min-height: 44px; padding: 3px 5px; font-size: 11px; }
.laser-pattern-grid svg { height: 23px; }
.laser-pattern-options { flex-wrap: nowrap; gap: 14px; }
.laser-pattern-options[hidden] { display: none; }
.laser-panel .laser-pattern-panel select { min-height: 24px; width: 64px; padding: 2px 3px; font-size: 11px; }
.laser-pattern-panel label, .laser-pattern-panel p { font-size: 11px; }
.laser-settings > label, .laser-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; margin: 0; }
.laser-panel .laser-settings > label select { min-height: 28px; padding: 3px 6px; }
.laser-settings > .laser-calculated { display: block; margin: 1px 0 7px; font-size: 11px; color: var(--text-muted); }
.laser-calculated output { margin-left: 4px; }
.laser-aiming-controls { border-top: 1px solid var(--line-soft); padding-top: 6px; }
.laser-setting-row + .laser-setting-row { margin-top: 4px; }
.laser-settings input { width: 115px; }
.laser-panel #laserAimToggle { min-height: 26px; padding: 3px 7px; }
.laser-aim-cue { font-size: 10px; margin-left: 6px; color: var(--text-muted); }
.laser-console .laser-delivery { margin: auto 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); flex: none; }
.laser-delivery .laser-section-heading { align-items: center; margin-bottom: 6px; }
.laser-delivery .laser-section-heading h2 { margin: 0; }
#laserEmissionState { margin-left: 6px; font-size: 11px; font-weight: 400; color: var(--text-muted); }
#laserEmissionState.is-ready { color: var(--accent-deep); font-weight: 700; }
.laser-shot-total { font-size: 11px; color: var(--text-muted); }
.laser-shot-total strong { font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.laser-ready-controls { padding: 2px; }
.laser-ready-controls button { min-height: 28px; padding: 4px 8px; font-size: 12px; letter-spacing: 0; }
.laser-fire-row { display: grid; grid-template-columns: minmax(120px, 0.9fr) minmax(0, 1fr); align-items: center; gap: 12px; margin-top: 7px; }
.laser-panel .laser-fire { min-height: 44px; font-size: 14px; gap: 10px; }
.laser-fire-row .laser-status { margin: 0; min-height: 0; font-size: 11px; line-height: 1.4; color: var(--text); }
.laser-secondary-actions { display: flex; align-items: center; gap: 5px; margin-top: 5px; }
.laser-panel .laser-secondary-actions button { min-height: 26px; padding: 3px 5px; border-color: transparent; background: transparent; color: var(--text-muted); font-size: 11px; }
.laser-secondary-actions #laserClear { margin-left: auto; border-left: 1px solid var(--line); border-radius: 0; padding-left: 12px; }
.laser-model-note { margin: 5px 0 0; font-size: 10px; color: var(--text-muted); }
.laser-panel .laser-pattern-grid button[aria-pressed="true"],
.laser-panel .laser-eye-toggle button[aria-pressed="true"],
.laser-panel #laserStandby[aria-pressed="true"] { background: var(--surface-2); border-color: var(--text-muted); color: var(--text); box-shadow: inset 0 0 0 1px var(--text-muted); }
.laser-pattern-grid button[aria-pressed="true"] svg { fill: #a94438; }
.laser-panel .laser-pattern-grid button[aria-pressed="true"]:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.laser-panel #laserAimToggle[aria-pressed="true"], .laser-panel #laserSound[aria-pressed="true"] { background: transparent; border-color: var(--line); color: var(--text); }
.laser-panel #laserAimToggle[aria-pressed="true"]::before, .laser-panel #laserSound[aria-pressed="true"]::before { content: '✓'; margin-right: 5px; }
.laser-panel #laserReady[aria-pressed="true"] { background: var(--accent); color: white; }
.laser-console .laser-key-hint { color: var(--text-muted); }
.laser-guidance { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: none; padding: 9px 12px; color: #dedfd6; font-size: 12px; line-height: 1.5; }
.laser-guidance #laserTask { display: contents; }
.laser-guidance #laserTask[hidden] { display: none; }
.laser-guidance #laserDetailCue::before, .laser-guidance #laserFocusStatus::before { content: '·'; color: #a9afa4; margin-right: 8px; }
.laser-guidance #laserFocusStatus { color: #e0c69c; }
.laser-guidance #laserFocusStatus.is-sharp, .laser-guidance #laserDetailCue.is-sharp { color: #c2d9b6; }
.laser-panel .laser-guidance #laserGuide { order: 1; margin-left: auto; min-height: 26px; padding: 3px 7px; font-size: 11px; background: transparent; color: #dedfd6; border-color: #50594d; }

@media (min-width: 1000px) {
  body.laser-active .sim-root { height: 100dvh; max-height: 100dvh; max-width: 1664px; padding: 8px 12px; gap: 8px; }
  .laser-active .mode-switcher { padding: 3px; margin: 0; }
  .laser-active .mode-btn { padding: 7px 14px; }
  .laser-panel { display: flex; flex-direction: column; max-width: none; height: auto; padding: 0; }
  .laser-header { flex: none; padding: 7px 14px; margin-bottom: 8px; }
  .laser-header h1 { font-size: 19px; }
  .laser-header-tools { gap: 12px; }
  .laser-header-tools select, .laser-header-tools button { min-height: 30px; padding: 4px 9px; }
  .laser-layout { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) clamp(380px, 28vw, 420px); grid-template-rows: minmax(0, 1fr); gap: 12px; }
  .laser-examination { min-height: 0; }
  .laser-view-heading { flex: none; padding: 7px 12px; }
  .laser-view-wrap { min-height: 0; container-type: size; }
  .laser-panel .laser-view-field, .laser-panel[data-exercise="tear"] .laser-view-field { width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); max-width: 100%; max-height: 100%; }
  .laser-console { min-height: 0; padding: 12px; gap: 10px; }
  .laser-console-body { min-height: 0; overflow-y: auto; scrollbar-width: thin; }
  .laser-console .laser-delivery { margin-top: auto; }
}
@media (min-width: 1000px) and (max-height: 760px) {
  .laser-console { padding: 10px 12px; gap: 8px; }
  .laser-map-hint { font-size: 9px; }
  .laser-console-section + .laser-console-section { margin-top: 7px; padding-top: 7px; }
  .laser-console-section > h2 { margin-bottom: 5px; }
  .laser-pattern-panel { padding-bottom: 5px; }
}
@media (min-width: 1000px) and (max-height: 850px) {
  .laser-console { padding: 10px 12px; gap: 7px; }
  .laser-navigation { gap: 4px; }
  .laser-map-heading { margin-bottom: 4px; }
  .laser-console-section + .laser-console-section { margin-top: 7px; padding-top: 7px; }
  .laser-console-section > h2 { margin-bottom: 5px; }
  .laser-panel .laser-pattern-grid button { flex-direction: row; justify-content: center; gap: 5px; min-height: 32px; padding: 3px 4px; }
  .laser-pattern-grid svg { flex: none; width: 32px; height: 23px; }
  .laser-pattern-panel { gap: 4px; padding-bottom: 5px; }
  .laser-settings > .laser-calculated { margin-bottom: 5px; }
  .laser-console .laser-delivery { padding-top: 7px; }
  .laser-delivery .laser-section-heading { margin-bottom: 4px; }
  .laser-fire-row { margin-top: 5px; }
  .laser-secondary-actions { margin-top: 3px; }
  .laser-model-note { margin-top: 3px; }
}
@media (max-width: 999px) {
  .laser-pattern-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .laser-pattern-options { flex-wrap: wrap; }
  .laser-aim-cue { display: block; margin-left: 0; }
}
@media (max-width: 680px) {
  .laser-fire-row { display: none; }
  .laser-guidance { padding: 9px 5px; font-size: 11px; }
}

/* Phone preview, including embedded browsers such as Instagram. */
body.phone-preview {
  display: block;
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
}
.phone-preview .sim-root {
  width: 100%;
  max-width: 680px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  gap: 16px;
}
.phone-preview .mode-switcher,
.phone-preview .fullscreen-tip,
.phone-preview #layoutBanner,
.phone-preview #browserModal,
.phone-preview #generalModePanel,
.phone-preview .controls,
.phone-preview .slit-panel,
.phone-preview .orientation-label,
.phone-preview .challenge-badge,
.phone-preview .focus-indicator,
.phone-preview .joystick-indicator,
.phone-preview #tutorialOverlay {
  display: none !important;
}
.phone-preview #retinaModeContent {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
}
.phone-preview .canvas-wrapper {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  border: 0;
  background: transparent;
}
.phone-preview .sim-view {
  width: 100%;
  padding: 0;
  gap: 18px;
}
.phone-preview #simCanvas {
  display: block;
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  aspect-ratio: 880 / 550;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.phone-preview .phone-gesture-coach.is-active {
  position: absolute;
  z-index: 12;
  display: block;
  overflow: hidden;
  border-radius: 6px;
  pointer-events: none;
  --lens-x: 50%;
  --lens-y: 50%;
  --lens-top: 19%;
  --lens-bottom: 81%;
  --target-fly-distance: clamp(64px, 22vw, 100px);
}
.phone-focus-coach {
  position: absolute;
  left: var(--lens-x);
  top: var(--lens-y);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: #fff;
  animation: phone-focus-swipe 1.85s cubic-bezier(0.45, 0, 0.25, 1) infinite;
  filter: drop-shadow(0 2px 5px rgb(0 0 0 / 75%));
}
.phone-focus-finger {
  font-size: clamp(28px, 9vw, 42px);
  line-height: 1;
}
.phone-focus-label {
  padding: 4px 9px;
  border: 1px solid rgb(126 203 255 / 75%);
  border-radius: 999px;
  background: rgb(4 21 34 / 82%);
  color: #e9f7ff;
  font-size: clamp(11px, 3.2vw, 13px);
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.phone-lens-target {
  position: absolute;
  left: var(--lens-x);
  width: clamp(20px, 6vw, 28px);
  height: clamp(20px, 6vw, 28px);
  border: 2px solid #83d1ff;
  border-radius: 50%;
  background: rgb(29 151 255 / 30%);
  box-shadow: 0 0 0 0 rgb(48 174 255 / 70%), 0 0 13px rgb(65 188 255 / 90%);
  opacity: 0;
  visibility: hidden;
}
.phone-lens-target.is-top { top: var(--lens-top); }
.phone-lens-target.is-bottom {
  top: var(--lens-bottom);
  animation-delay: 0.18s;
}
.phone-lens-label {
  position: absolute;
  left: var(--lens-x);
  top: var(--lens-y);
  z-index: 2;
  padding: 5px 10px;
  border: 1px solid rgb(126 203 255 / 75%);
  border-radius: 999px;
  background: rgb(4 21 34 / 84%);
  color: #e9f7ff;
  font-size: clamp(10px, 3vw, 12px);
  font-weight: 700;
  line-height: 1.2;
  opacity: 0;
  visibility: hidden;
  white-space: nowrap;
  transform: translate(-50%, -50%) scale(0.92);
}
.phone-gesture-coach.is-focus-complete .phone-focus-coach {
  animation: phone-coach-fade 0.28s ease-out forwards;
}
.phone-gesture-coach.is-focus-complete:not(.is-lens-complete) .phone-lens-target {
  visibility: visible;
  animation: phone-lens-target-arrive 0.34s ease-out both, phone-lens-target-pulse 1.35s 0.34s ease-out infinite;
}
.phone-gesture-coach.is-focus-complete:not(.is-lens-complete) .phone-lens-target.is-bottom {
  animation-delay: 0.1s, 0.44s;
}
.phone-gesture-coach.is-focus-complete:not(.is-lens-complete) .phone-lens-label {
  visibility: visible;
  animation: phone-lens-label-arrive 0.3s 0.16s ease-out both;
}
.phone-gesture-coach.is-lens-complete::after {
  content: '';
  position: absolute;
  left: var(--lens-x);
  top: var(--lens-y);
  width: 42%;
  aspect-ratio: 1;
  border: 3px solid rgb(101 198 255 / 85%);
  border-radius: 50%;
  animation: phone-lens-grip-burst 0.5s ease-out forwards;
}
.phone-gesture-coach.is-lens-complete .phone-lens-target.is-top {
  visibility: visible;
  animation: phone-target-fly-top 0.52s cubic-bezier(0.12, 0.76, 0.24, 1) forwards;
}
.phone-gesture-coach.is-lens-complete .phone-lens-target.is-bottom {
  visibility: visible;
  animation: phone-target-fly-bottom 0.52s cubic-bezier(0.12, 0.76, 0.24, 1) forwards;
}
.phone-gesture-coach.is-lens-complete .phone-lens-label {
  animation: phone-coach-fade 0.24s ease-out forwards;
}
@keyframes phone-focus-swipe {
  0% { opacity: 0; transform: translate(-50%, -68px) scale(0.92); }
  18% { opacity: 1; }
  72% { opacity: 1; transform: translate(-50%, 30px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, 44px) scale(1); }
}
@keyframes phone-lens-target-pulse {
  0% { opacity: 0.75; transform: translate(-50%, -50%) scale(0.84); box-shadow: 0 0 0 0 rgb(48 174 255 / 70%), 0 0 10px rgb(65 188 255 / 80%); }
  65% { opacity: 1; transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 10px rgb(48 174 255 / 0%), 0 0 18px rgb(65 188 255 / 95%); }
  100% { opacity: 0.75; transform: translate(-50%, -50%) scale(0.84); box-shadow: 0 0 0 0 rgb(48 174 255 / 0%), 0 0 10px rgb(65 188 255 / 80%); }
}
@keyframes phone-lens-target-arrive {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.55); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes phone-lens-label-arrive {
  from { opacity: 0; transform: translate(-50%, -35%) scale(0.92); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
@keyframes phone-coach-fade {
  to { opacity: 0; transform: translate(-50%, 56px) scale(0.9); visibility: hidden; }
}
@keyframes phone-target-fly-top {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.78); }
  24% { opacity: 1; transform: translate(-50%, -50%) scale(1.18); box-shadow: 0 0 0 12px rgb(48 174 255 / 16%), 0 0 28px rgb(65 188 255 / 100%); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - var(--target-fly-distance))) scale(0.32); visibility: hidden; }
}
@keyframes phone-target-fly-bottom {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(0.78); }
  24% { opacity: 1; transform: translate(-50%, -50%) scale(1.18); box-shadow: 0 0 0 12px rgb(48 174 255 / 16%), 0 0 28px rgb(65 188 255 / 100%); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% + var(--target-fly-distance))) scale(0.32); visibility: hidden; }
}
@keyframes phone-lens-grip-burst {
  from { opacity: 0.9; transform: translate(-50%, -50%) scale(0.72); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(1.16); }
}
.phone-preview .overview-cluster { margin: 0; gap: 0; }
.phone-preview #overviewCanvas {
  display: block;
  width: min(66vw, 260px);
  height: auto;
  aspect-ratio: 360 / 230;
}
.phone-preview .overview-label { max-width: 260px; font-size: 11px; }
.phone-preview .phone-slit-control {
  display: grid;
  width: min(86vw, 320px);
  gap: 7px;
  margin-top: 8px;
  padding: 12px 14px 10px;
  border: 1px solid rgb(255 255 255 / 11%);
  border-radius: 6px;
  background: #101412;
  color: var(--text);
}
.phone-slit-control-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.03em;
}
.phone-slit-control-heading span:last-child {
  color: var(--text-dim);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.phone-slit-joystick {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 54px;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.phone-slit-joystick:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.phone-slit-track {
  position: relative;
  display: block;
  width: calc(100% - 34px);
  height: 7px;
  margin: 0 auto;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 999px;
  background: #272d2a;
  box-shadow: inset 0 1px 3px rgb(0 0 0 / 55%);
}
.phone-slit-centre-mark {
  position: absolute;
  left: 50%;
  top: -5px;
  width: 1px;
  height: 15px;
  background: rgb(255 255 255 / 26%);
}
.phone-slit-thumb {
  position: absolute;
  left: var(--phone-slit-position, 50%);
  top: 50%;
  width: 38px;
  height: 38px;
  border: 1px solid #708078;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #89958f 0 8%, #4a5550 34%, #242a27 72%);
  box-shadow: 0 5px 10px rgb(0 0 0 / 45%), inset 0 1px 1px rgb(255 255 255 / 22%);
  transform: translate(-50%, -50%);
  transition: transform 120ms ease, border-color 120ms ease;
}
.phone-slit-thumb-highlight {
  position: absolute;
  inset: 8px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 50%;
}
.phone-slit-joystick.is-active .phone-slit-thumb {
  border-color: #9eb4a9;
  transform: translate(-50%, -50%) scale(1.06);
}
.phone-slit-help {
  margin: -2px 0 0;
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}
.phone-slit-control.is-used .phone-slit-help { color: #9faaa4; }
.phone-preview .phone-preview-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  text-align: center;
}
.phone-preview-footer button {
  border: 0;
  background: none;
  color: var(--text-muted);
  line-height: 1.5;
  cursor: pointer;
}
.phone-preview-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.phone-preview-footer .phone-help-link {
  min-height: 44px;
  padding: 8px 16px;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.phone-preview-footer .phone-reset-btn {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-1);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}
.phone-preview-footer .phone-copyright {
  padding: 4px 8px;
  font-size: 11px;
}
.phone-preview-footer p {
  margin: 4px 0 0;
  max-width: 340px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}
@media (orientation: landscape) and (max-height: 600px) {
  .phone-preview .sim-root { max-width: none; gap: 10px; }
  .phone-preview .sim-view {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
    align-items: center;
    gap: 12px;
  }
  .phone-preview .overview-cluster,
  .phone-preview .overview-shell { min-width: 0; width: 100%; }
  .phone-preview #overviewCanvas { width: 100%; }
  .phone-preview .phone-slit-control { width: 100%; margin-top: 2px; }
  .phone-preview .phone-preview-footer { gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .phone-focus-coach,
  .phone-lens-label,
  .phone-lens-target {
    animation: none;
    transform: translate(-50%, -50%);
  }
  .phone-gesture-coach.is-focus-complete .phone-focus-coach,
  .phone-gesture-coach.is-lens-complete .phone-lens-target {
    animation: none;
    opacity: 0;
    visibility: hidden;
  }
  .phone-gesture-coach.is-lens-complete::after { display: none; }
}
