    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    .logo {
      text-align: center;
      margin-bottom: 16px;
      overflow: hidden;
    }

    .pulse-logo {
      width: 160px;
      height: 32px;
      filter: drop-shadow(0 0 8px rgba(233, 69, 96, 0.6));
    }

    .pulse-line {
      stroke: #e94560;
      stroke-width: 1.5;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
      stroke-dasharray: 600;
      stroke-dashoffset: 600;
      animation: pulse-draw 2.5s ease-out infinite;
    }

    .pulse-line-glow {
      stroke: #e94560;
      stroke-width: 3;
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
      stroke-dasharray: 600;
      stroke-dashoffset: 600;
      opacity: 0.3;
      filter: blur(2px);
      animation: pulse-draw 2.5s ease-out infinite;
    }

    @keyframes pulse-draw {
      0% {
        stroke-dashoffset: 600;
      }
      100% {
        stroke-dashoffset: 0;
      }
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
      background: #1a1a2e;
      color: #eee;
      min-height: 100vh;
      padding: 12px;
    }

    .container {
      max-width: 400px;
      margin: 0 auto;
      padding-bottom: 80px;
    }

    .video-container {
      position: relative;
      width: 100px;
      height: 100px;
      margin: 0 auto 12px;
      border-radius: 50%;
      overflow: hidden;
      border: 3px solid #e94560;
    }

    video {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    canvas#captureCanvas {
      display: none;
    }

    .metrics {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-bottom: 12px;
    }

    .metric-card {
      background: #16213e;
      border-radius: 12px;
      padding: 12px;
      text-align: center;
    }

    .metric-card.large {
      grid-column: span 2;
    }

    .metric-label {
      font-size: 0.75rem;
      color: #888;
      margin-bottom: 4px;
    }

    .metric-value {
      font-size: 2rem;
      font-weight: bold;
      color: #e94560;
    }

    .metric-value.small {
      font-size: 1.5rem;
    }

    .metric-unit {
      font-size: 0.875rem;
      color: #888;
    }

    .waveform-container {
      background: #16213e;
      border-radius: 12px;
      padding: 8px;
      margin-bottom: 12px;
    }

    .waveform-label {
      font-size: 0.75rem;
      color: #888;
      margin-bottom: 8px;
    }

    canvas#waveformCanvas {
      width: 100%;
      height: 100px;
      display: block;
    }

    .controls-wrapper {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: rgba(26, 26, 46, 0.3);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      z-index: 100;
      padding-bottom: env(safe-area-inset-bottom);
    }

    .controls {
      display: flex;
      gap: 12px;
      padding: 12px 16px;
      max-width: 400px;
      margin: 0 auto;
    }

    button {
      flex: 1;
      padding: 16px;
      font-size: 1rem;
      font-weight: bold;
      border: none;
      border-radius: 12px;
      cursor: pointer;
      transition: transform 0.1s, opacity 0.2s;
    }

    button:active {
      transform: scale(0.98);
    }

    button:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    #startBtn {
      background: #e94560;
      color: white;
    }

    #stopBtn {
      background: #333;
      color: white;
    }

    .status {
      text-align: center;
      margin-top: 16px;
      font-size: 0.875rem;
      color: #888;
    }

    .status.measuring {
      color: #4ade80;
    }

    .status.warmup {
      color: #fbbf24;
    }

    .instruction {
      background: #16213e;
      border-radius: 12px;
      padding: 12px;
      margin-bottom: 12px;
      font-size: 0.8rem;
      line-height: 1.5;
    }

    .instruction h2 {
      font-size: 1rem;
      margin-bottom: 8px;
      color: #e94560;
    }

    .debug-panel {
      background: #0a0a15;
      border-radius: 8px;
      padding: 12px;
      margin-bottom: 16px;
      font-family: monospace;
      font-size: 0.7rem;
      line-height: 1.4;
      color: #888;
    }

    .debug-row {
      display: flex;
      justify-content: space-between;
    }

    .debug-value {
      color: #4ade80;
    }

    .debug-value.warning {
      color: #fbbf24;
    }

    .debug-value.bad {
      color: #ef4444;
    }

    .finger-guide {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 70px;
      height: 70px;
      border: 2px dashed rgba(255,255,255,0.3);
      border-radius: 50%;
      pointer-events: none;
    }

    .finger-guide.covered {
      border-color: #4ade80;
      background: rgba(74, 222, 128, 0.1);
    }

    .signal-quality {
      display: flex;
      align-items: center;
      gap: 8px;
      justify-content: center;
      margin-bottom: 16px;
    }

    .signal-bar {
      width: 8px;
      height: 20px;
      background: #333;
      border-radius: 2px;
    }

    .signal-bar.active {
      background: #4ade80;
    }

    .signal-bar.warning {
      background: #fbbf24;
    }

    .quality-reason {
      text-align: center;
      font-size: 0.75rem;
      color: #888;
      margin: -8px 0 16px;
      min-height: 1.2em;
    }

    .progress-container {
      position: fixed;
      bottom: 70px;
      left: 0;
      right: 0;
      padding: 0 16px;
      max-width: 400px;
      margin: 0 auto;
      z-index: 99;
    }

    .progress-bar {
      height: 8px;
      background: #16213e;
      border-radius: 4px;
      overflow: hidden;
    }

    .progress-fill {
      height: 100%;
      background: linear-gradient(90deg, #e94560, #4ade80);
      width: 0%;
      transition: width 0.3s;
    }

    .progress-text {
      text-align: center;
      font-size: 0.75rem;
      color: #888;
      margin-top: 4px;
    }

    .result-panel {
      background: linear-gradient(135deg, #16213e 0%, #1a1a2e 100%);
      border: 2px solid #4ade80;
      border-radius: 16px;
      padding: 20px;
      margin-bottom: 16px;
      text-align: center;
    }

    .result-panel h2 {
      color: #4ade80;
      font-size: 1rem;
      margin-bottom: 16px;
    }

    .result-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 8px 0;
      border-bottom: 1px solid #2a2a4a;
    }

    .result-row:last-child {
      border-bottom: none;
    }

    .result-value {
      font-size: 1.5rem;
      font-weight: bold;
      color: #e94560;
    }

    .result-value.small {
      font-size: 1rem;
    }

    .result-row.subtle {
      opacity: 0.6;
    }

    .result-unit {
      font-size: 0.75rem;
      color: #888;
      width: 30px;
    }

    .measurement-quality-container {
      text-align: center;
      padding: 16px 0;
      margin-bottom: 16px;
      border-bottom: 1px solid #2a2a4a;
    }

    .measurement-quality-label {
      font-size: 1.2rem;
      font-weight: bold;
      margin-bottom: 8px;
    }

    .measurement-quality-label.good { color: #4ade80; }
    .measurement-quality-label.moderate { color: #fbbf24; }
    .measurement-quality-label.limited { color: #f87171; }

    .measurement-quality-note {
      margin-top: 8px;
      font-size: 0.85rem;
      color: #aaa;
      line-height: 1.4;
    }

    .quality-evidence {
      margin: 12px auto 0;
      max-width: 280px;
      text-align: left;
      font-size: 0.8rem;
      color: #aaa;
    }

    .quality-evidence-row {
      display: flex;
      justify-content: space-between;
      padding: 4px 0;
      border-bottom: 1px solid #2a2a4a;
    }

    .quality-evidence-row:last-child {
      border-bottom: none;
    }

    .quality-evidence-value {
      color: #eee;
      font-weight: bold;
    }

    .estimate-note {
      font-size: 0.75rem;
      color: #888;
      margin-bottom: 8px;
    }

    .result-disclaimer {
      margin-top: 12px;
      padding: 10px;
      border: 1px solid #fbbf24;
      border-radius: 8px;
      font-size: 0.8rem;
      line-height: 1.5;
      color: #fbbf24;
      background: rgba(251, 191, 36, 0.08);
    }

    .result-compare-note {
      margin-top: 8px;
      font-size: 0.8rem;
      line-height: 1.5;
      color: #aaa;
    }

    .log-panel {
      margin-top: 16px;
    }

    .log-toggle {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 6px;
      background: none;
      border: none;
      color: #666;
      font-size: 0.7rem;
      cursor: pointer;
      padding: 8px;
      width: 100%;
    }

    .log-toggle:hover {
      color: #888;
    }

    .log-toggle svg {
      transition: transform 0.2s;
    }

    .log-toggle.open svg {
      transform: rotate(180deg);
    }

    .log-content {
      display: none;
      background: #0a0a15;
      border-radius: 8px;
      padding: 12px;
      margin-top: 8px;
      font-family: monospace;
      font-size: 0.65rem;
      max-height: 150px;
      overflow-y: auto;
    }

    .log-content.open {
      display: block;
    }

    .log-entry {
      color: #666;
      padding: 2px 0;
      border-bottom: 1px solid #1a1a2e;
    }

    .log-entry:last-child {
      border-bottom: none;
    }

    .log-entry.info { color: #888; }
    .log-entry.success { color: #4ade80; }
    .log-entry.warning { color: #fbbf24; }
    .log-entry.error { color: #f87171; }

    /* ---- Focused 3-state UI/UX layer (visual + a11y only; no logic changes) ---- */
    .skip-link {
      position: absolute;
      left: 12px;
      top: -48px;
      background: #e94560;
      color: #fff;
      padding: 10px 14px;
      border-radius: 8px;
      z-index: 200;
      text-decoration: none;
      font-weight: bold;
      transition: top 0.2s;
    }

    .skip-link:focus {
      top: 12px;
    }

    :focus-visible {
      outline: 3px solid #4ade80;
      outline-offset: 2px;
      border-radius: 6px;
    }

    button {
      min-height: 48px;
    }

    .sr-only {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    .app-subtitle {
      text-align: center;
      font-size: 0.8rem;
      color: #888;
      margin: -8px 0 16px;
    }

    .flow-steps {
      list-style: none;
      display: flex;
      gap: 8px;
      margin-bottom: 12px;
      padding: 0;
    }

    .flow-steps li {
      flex: 1;
      text-align: center;
      font-size: 0.75rem;
      color: #888;
      background: #16213e;
      border: 1px solid #2a2a4a;
      border-radius: 10px;
      padding: 8px 4px;
    }

    .flow-steps li .step-num {
      display: block;
      font-weight: bold;
      font-size: 0.9rem;
      margin-bottom: 2px;
      color: #aaa;
    }

    .flow-steps li[aria-current="step"] {
      border-color: #e94560;
      color: #eee;
    }

    .flow-steps li[aria-current="step"] .step-num {
      color: #e94560;
    }

    .stage {
      border: 1px solid #2a2a4a;
      border-radius: 16px;
      padding: 14px;
      margin-bottom: 12px;
      background: #141428;
      display: none;
    }

    body[data-phase="prepare"] #prepareStage,
    body[data-phase="measuring"] #measureStage,
    body[data-phase="result"] #resultStage {
      display: block;
      border-color: #e94560;
    }

    .stage-heading {
      font-size: 0.95rem;
      margin-bottom: 10px;
      color: #eee;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .stage-num {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: #e94560;
      color: #fff;
      font-size: 0.8rem;
      font-weight: bold;
      flex-shrink: 0;
    }

    #prepareStage .instruction {
      margin-bottom: 0;
    }

    .start-error {
      background: rgba(248, 113, 113, 0.08);
      border: 1px solid #f87171;
      border-radius: 8px;
      padding: 10px;
      margin-top: 8px;
      font-size: 0.8rem;
      line-height: 1.5;
      color: #f87171;
    }

    .start-error[hidden] {
      display: none;
    }

    .prep-list {
      padding-left: 1.2em;
    }

    .progress-note {
      font-size: 0.75rem;
      color: #888;
      line-height: 1.5;
      margin-top: 8px;
    }

    .debug-disclosure {
      border: 1px solid #2a2a4a;
      border-radius: 12px;
      margin-bottom: 16px;
      background: #101024;
    }

    .debug-disclosure summary {
      min-height: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      color: #666;
      font-size: 0.8rem;
      padding: 10px 12px;
      list-style: none;
    }

    .debug-disclosure summary::-webkit-details-marker {
      display: none;
    }

    .debug-disclosure summary:hover {
      color: #888;
    }

    .debug-disclosure .debug-body {
      padding: 0 12px 12px;
    }

    .debug-disclosure .debug-panel {
      margin-bottom: 8px;
    }

    .debug-disclosure .log-panel {
      margin-top: 0;
    }

    .log-toggle {
      min-height: 44px;
    }

    @media (min-width: 720px) {
      .container {
        max-width: 560px;
      }

      .controls {
        max-width: 560px;
      }

      .progress-container {
        max-width: 560px;
      }

      .video-container {
        width: 140px;
        height: 140px;
      }

      .stage {
        padding: 20px;
      }

      .metric-value {
        font-size: 2.4rem;
      }
    }

    @media (prefers-reduced-motion: reduce) {
      *,
      *::before,
      *::after {
        animation: none !important;
        transition: none !important;
      }

      html {
        scroll-behavior: auto;
      }
    }
