    :root {
      color-scheme: light dark;
      --bg: #08130b;
      --bg-alt: #132015;
      --card: rgba(19, 32, 21, 0.78);
      --border: rgba(251, 191, 36, 0.22);
      --accent: #f97316;
      --accent-dark: #ea580c;
      --accent-secondary: #facc15;
      --highlight: #22c55e;
      --muted: rgba(248, 239, 186, 0.76);
      --text: #fefce8;
      --surface: rgba(14, 26, 18, 0.55);
      --shadow: 0 24px 48px rgba(8, 15, 10, 0.42);
    }

    @media (prefers-color-scheme: light) {
      :root {
        --bg: #fff7ed;
        --bg-alt: #fef3c7;
        --card: rgba(255, 255, 255, 0.94);
        --border: rgba(249, 115, 22, 0.22);
        --accent: #ea580c;
        --accent-dark: #c2410c;
        --accent-secondary: #f59e0b;
        --highlight: #16a34a;
        --muted: rgba(100, 73, 27, 0.62);
        --text: #1c1b17;
        --surface: rgba(255, 244, 222, 0.72);
        --shadow: 0 18px 38px rgba(215, 119, 6, 0.22);
      }
    }

    * {
      box-sizing: border-box;
    }

    body {
      margin: 0;
      font: 15px/1.6 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
      min-height: 100vh;
      color: var(--text);
      background:
        radial-gradient(circle at 15% 25%, rgba(250, 204, 21, 0.2), transparent 55%),
        radial-gradient(circle at 80% 85%, rgba(34, 197, 94, 0.2), transparent 60%),
        linear-gradient(160deg, var(--bg), #05070c 70%);
      display: flex;
      flex-direction: column;
      padding: 24px 16px 32px;
    }

    .view {
      flex: 1;
      display: none;
      align-items: center;
      justify-content: center;
    }

    .view.active {
      display: flex;
    }

    .hidden {
      display: none !important;
    }

    .login-view {
      background: transparent;
    }

    .login-card {
      width: min(420px, 100%);
      background: var(--card);
      border-radius: 28px;
      border: 1px solid var(--border);
      box-shadow: var(--shadow);
      padding: 36px 32px;
      display: grid;
      gap: 20px;
      text-align: center;
      backdrop-filter: blur(18px);
    }

    .login-logo {
      width: 96px;
      height: 96px;
      border-radius: 30px;
      margin: 0 auto 6px;
      display: grid;
      place-items: center;
      background: rgba(249, 115, 22, 0.12);
      border: 2px dashed rgba(250, 204, 21, 0.55);
      overflow: hidden;
    }

    .logo-image {
      width: 100%;
      height: 100%;
      object-fit: contain;
      padding: 12px;
    }

    .login-card h1 {
      margin: 0;
      font-size: 28px;
      letter-spacing: -0.02em;
    }

    .login-card p {
      margin: 0;
      color: var(--muted);
      font-size: 14px;
    }

    .login-form {
      display: grid;
      gap: 14px;
      text-align: left;
    }

    .login-form label {
      font-weight: 600;
      font-size: 13px;
      color: var(--muted);
    }

    .login-form input {
      width: 100%;
      padding: 11px 14px;
      border-radius: 14px;
      border: 1px solid rgba(250, 204, 21, 0.24);
      background: rgba(19, 32, 21, 0.6);
      color: inherit;
      font: inherit;
      outline: none;
      transition: border-color 0.18s ease, box-shadow 0.18s ease;
    }

    .login-form input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.18);
    }

    .login-form button {
      width: 100%;
      margin-top: 6px;
    }

    .login-message {
      min-height: 20px;
      font-size: 13px;
      color: #f97316;
      text-align: center;
      font-weight: 600;
    }

    .app-shell {
      width: min(1320px, 100%);
      display: grid;
      gap: 18px;
      margin: 0 auto;
    }

    .app-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 20px;
      flex-wrap: wrap;
    }

    .header-left {
      display: flex;
      align-items: center;
      gap: 16px;
      flex: 1 1 auto;
      min-width: 280px;
    }

    .header-meta {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .logo-slot {
      width: 58px;
      height: 58px;
      border-radius: 20px;
      border: 2px dashed rgba(250, 204, 21, 0.55);
      background: rgba(19, 32, 21, 0.55);
      display: grid;
      place-content: center;
      overflow: hidden;
    }

    .title-block h1 {
      margin: 0 0 4px;
      font-size: 22px;
      letter-spacing: -0.03em;
    }

    .subtitle {
      margin: 0;
      color: var(--muted);
      font-size: 12px;
    }

    .warning {
      border-radius: 16px;
      padding: 18px 20px;
      background: rgba(251, 191, 36, 0.16);
      border: 1px solid rgba(251, 191, 36, 0.45);
      color: var(--accent-secondary);
    }

    .card-grid {
      display: grid;
      gap: 22px;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .card {
      background: var(--card);
      border-radius: 20px;
      padding: 18px 20px;
      border: 1px solid var(--border);
      box-shadow: var(--shadow);
      backdrop-filter: blur(16px);
      position: relative;
    }

    .card h2 {
      margin: 0 0 8px;
      font-size: 20px;
      letter-spacing: -0.015em;
    }

    .card p {
      margin: 0 0 16px;
      color: var(--muted);
      font-size: 14px;
    }

    .port-card {
      display: grid;
      gap: 16px;
    }

    .status-chip {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 6px 12px;
      border-radius: 999px;
      font-size: 13px;
      font-weight: 600;
      background: rgba(249, 115, 22, 0.16);
      color: rgba(249, 115, 22, 0.92);
    }

    .status-chip::before {
      content: "";
      width: 8px;
      height: 8px;
      border-radius: 50%;
      background: currentColor;
      opacity: 0.85;
    }

    .port-card.is-connected .status-chip {
      background: rgba(34, 197, 94, 0.18);
      color: rgba(34, 197, 94, 0.95);
    }

    label {
      font-weight: 600;
      font-size: 13px;
      display: block;
      margin-bottom: 6px;
    }

    select,
    input[type="number"],
    input[type="text"] {
      width: 100%;
      padding: 10px 12px;
      border-radius: 12px;
      border: 1px solid rgba(250, 204, 21, 0.26);
      background: rgba(19, 32, 21, 0.55);
      color: inherit;
      font: inherit;
      outline: none;
      transition: border-color 0.18s ease, box-shadow 0.18s ease;
    }

    select:focus,
    input:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.18);
    }

    button {
      appearance: none;
      border: none;
      border-radius: 12px;
      padding: 11px 18px;
      font: 600 14px/1 "Inter", sans-serif;
      background: var(--accent);
      color: #1a1207;
      cursor: pointer;
      transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
      box-shadow: 0 10px 24px rgba(249, 115, 22, 0.28);
    }

    button:hover {
      transform: translateY(-1px);
      box-shadow: 0 16px 32px rgba(249, 115, 22, 0.32);
      background: var(--accent-dark);
    }

    button:disabled {
      cursor: not-allowed;
      opacity: 0.55;
      transform: none;
      box-shadow: none;
    }

    .button-row {
      display: flex;
      gap: 10px;
      flex-wrap: wrap;
    }

    .port-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 18px;
      gap: 16px;
    }

    .port-header h2 {
      margin: 0;
      font-size: 22px;
      letter-spacing: -0.015em;
    }

    .port-actions {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .port-actions button {
      min-width: 180px;
      font-size: 15px;
    }

    .dashboard-grid {
      display: grid;
      gap: 18px;
      grid-template-columns: minmax(0, 2.55fr) minmax(0, 1.45fr);
      align-items: start;
    }

    .graphs-column {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    .command-column {
      display: flex;
      flex-direction: column;
      gap: 18px;
    }

    .command-panel {
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: 18px;
      padding: 18px 20px;
      box-shadow: var(--shadow);
      backdrop-filter: blur(16px);
    }

    .debug-toggle {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 6px;
    }

    .debug-block {
      display: grid;
      gap: 8px;
      margin-bottom: 16px;
    }

    .debug-area {
      width: 100%;
      min-height: 120px;
      max-height: 160px;
      padding: 10px 12px;
      border-radius: 12px;
      border: 1px solid rgba(250, 204, 21, 0.24);
      background: rgba(15, 23, 42, 0.65);
      color: inherit;
      font: 12px/1.4 "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      resize: vertical;
    }

    .debug-area:focus {
      outline: none;
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.18);
    }

    .ghost-btn {
      padding: 6px 12px;
      border-radius: 999px;
      border: 1px solid rgba(148, 163, 184, 0.4);
      background: transparent;
      color: var(--muted);
      font: 12px/1 "Inter", sans-serif;
      cursor: pointer;
      transition: border-color 0.2s ease, color 0.2s ease;
    }

    .ghost-btn:hover {
      border-color: var(--accent);
      color: var(--accent);
    }

    .graphs-grid {
      display: flex;
      flex-direction: column;
      gap: 12px;
      margin-left: -24px;
      padding-left: 24px;
    }

    @media (max-width: 1080px) {
      .dashboard-grid {
        grid-template-columns: 1fr;
      }

      .graphs-column,
      .command-column {
        gap: 16px;
      }

      .header-meta {
        justify-content: flex-start;
      }
    }

    .graph-placeholder {
      display: flex;
      flex-direction: column;
      gap: 12px;
      padding: 16px 18px 20px;
      color: rgba(250, 204, 21, 0.7);
    }

    .graph-row {
      display: flex;
      gap: 16px;
      align-items: stretch;
    }

    .graph-side {
      width: 80px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: space-between;
      gap: 16px;
    }

    .graph-title {
      font-weight: 700;
      font-size: 16px;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      display: inline-block;
      transform: rotate(-90deg);
      transform-origin: center;
    }

    .graph-title.graph-color-1 { color: hsl(24, 90%, 70%); }
    .graph-title.graph-color-2 { color: hsl(42, 90%, 70%); }
    .graph-title.graph-color-3 { color: hsl(140, 70%, 55%); }

    .axis-y-min,
    .axis-y-max {
      font-weight: 600;
      font-size: 13px;
      color: rgba(226, 232, 240, 0.9);
      display: block;
    }

    .graph-main {
      flex: 1 1 auto;
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    .graph-canvas {
      width: 100%;
      height: 140px;
      border-radius: 14px;
      background: rgba(6, 12, 18, 0.92);
      display: block;
    }

    .axis-x {
      position: relative;
      min-height: 16px;
      font-size: 11px;
      letter-spacing: 0.04em;
      color: rgba(148, 163, 184, 0.75);
    }

    .axis-x span {
      position: absolute;
      bottom: 0;
      transform: translateX(-50%);
      white-space: nowrap;
    }

    .app-footer {
      position: fixed;
      left: 18px;
      bottom: 14px;
      font-size: 12px;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      color: rgba(148, 163, 184, 0.75);
      pointer-events: none;
      z-index: 1000;
    }

    .sensor-preview {
      font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      background: rgba(19, 32, 21, 0.55);
      border-radius: 12px;
      padding: 10px 12px;
      font-size: 12px;
      line-height: 1.4;
      max-height: 60px;
      overflow: auto;
      border: 1px solid rgba(250, 204, 21, 0.22);
    }

    .command-grid {
      display: grid;
      gap: 14px;
    }

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

    .command-block {
      border: 1px solid rgba(148, 163, 184, 0.28);
      background: rgba(15, 23, 42, 0.55);
      border-radius: 18px;
      padding: 14px 16px;
      display: grid;
      gap: 10px;
    }

    .command-block-title {
      font-size: 11px;
      letter-spacing: 0.16em;
      text-transform: uppercase;
      color: rgba(250, 204, 21, 0.7);
    }

    .command-block-row {
      display: grid;
      grid-template-columns: minmax(70px, 1fr) max-content max-content max-content;
      align-items: center;
      gap: 4px;
    }


    .device-pill {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 6px 10px;
      border-radius: 999px;
      background: rgba(15, 23, 42, 0.6);
      border: 1px solid rgba(148, 163, 184, 0.28);
      font-size: 12px;
    }

    .device-pill span {
      font-weight: 600;
      color: var(--accent-secondary);
    }

    .sim-label {
      font-size: 11px;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: rgba(250, 204, 21, 0.65);
    }

    .switch {
      position: relative;
      display: inline-block;
      width: 46px;
      height: 24px;
    }

    .switch input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    .slider {
      position: absolute;
      cursor: pointer;
      inset: 0;
      background: rgba(148, 163, 184, 0.35);
      border-radius: 999px;
      transition: background 0.2s ease;
    }

    .slider::before {
      content: '';
      position: absolute;
      height: 20px;
      width: 20px;
      left: 2px;
      top: 2px;
      border-radius: 50%;
      background: rgba(15, 23, 42, 0.85);
      transition: transform 0.2s ease, background 0.2s ease;
    }

    .switch input:checked + .slider {
      background: var(--accent);
    }

    .switch input:checked + .slider::before {
      transform: translateX(22px);
      background: #0b1120;
    }

    .switch input:focus-visible + .slider {
      box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.35);
    }

    .command-buttons {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      align-items: center;
    }

    .command-buttons button {
      padding-inline: 22px;
      height: 44px;
    }

    .command-buttons .icon-button {
      width: 44px;
      height: 44px;
      padding: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border: 1px solid rgba(249, 115, 22, 0.45);
      background: var(--accent);
      box-shadow: 0 10px 24px rgba(249, 115, 22, 0.28);
      color: #050505;
    }

    .command-buttons .icon-glyph {
      display: inline-block;
      line-height: 1;
      color: currentColor;
    }

    .command-buttons .icon-play .icon-glyph {
      font-size: 20px;
      transform: translateX(2px);
    }

    .command-buttons .icon-stop .icon-glyph {
      font-size: 35px;
    }

    .command-buttons .icon-button:not(:disabled):hover {
      background: var(--accent-dark);
      border-color: rgba(249, 115, 22, 0.6);
      color: #050505;
      box-shadow: 0 16px 32px rgba(234, 88, 12, 0.32);
    }

    .command-buttons .icon-button:focus-visible {
      outline: none;
      box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.32), 0 12px 28px rgba(249, 115, 22, 0.25);
    }

    .command-buttons .icon-button:disabled {
      background: rgba(148, 163, 184, 0.18);
      border-color: rgba(148, 163, 184, 0.35);
      color: rgba(148, 163, 184, 0.55);
      box-shadow: none;
      opacity: 1;
    }

    .sim-toggle-pill {
      gap: 12px;
      padding-right: 14px;
    }

    .sim-toggle-pill .switch {
      transform: scale(0.9);
      transform-origin: left center;
    }

    .humour-quick-block {
      margin-top: 16px;
      display: grid;
      gap: 10px;
      justify-items: center;
    }

    .movement-subtitle {
      font-size: 12px;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: rgba(250, 204, 21, 0.7);
    }

    .vaata-grid,
    .pitta-grid,
    .kapha-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 10px 12px;
      align-items: center;
      justify-items: center;
    }

    .vaata-pill,
    .pitta-grid .vaata-pill,
    .kapha-grid .vaata-pill {
      border-radius: 16px;
      border: 1px solid rgba(249, 115, 22, 0.45);
      background: var(--accent);
      color: #050505;
      font-weight: 600;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      width: 50px;
      height: 50px;
      padding: 0;
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 12px 26px rgba(249, 115, 22, 0.26);
      transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
    }

    .vaata-pill:hover:not(:disabled) {
      transform: translateY(-1px);
      background: var(--accent-dark);
      border-color: rgba(249, 115, 22, 0.65);
      box-shadow: 0 18px 34px rgba(234, 88, 12, 0.32);
    }

    .vaata-pill:disabled {
      cursor: not-allowed;
      opacity: 0.55;
      box-shadow: none;
      transform: none;
      background: rgba(148, 163, 184, 0.18);
      border-color: rgba(148, 163, 184, 0.4);
      color: rgba(148, 163, 184, 0.6);
    }

    .vaata-pill--go {
      letter-spacing: 0.12em;
    }


    .vaata-pill span {
      display: inline-block;
      font-size: 22px;
      line-height: 1;
    }

    .vaata-pill--touch img {
      width: 32px;
      height: 32px;
      object-fit: contain;
      filter: drop-shadow(0 8px 16px rgba(5, 5, 5, 0.35));
    }

    .vaata-input-cell {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 86px;
    }

    .vaata-input,
    .pitta-grid .vaata-input,
    .kapha-grid .vaata-input {
      width: 86px;
      height: 50px;
      padding: 0;
      border-radius: 16px;
      border: 1px solid rgba(250, 204, 21, 0.26);
      background: rgba(19, 32, 21, 0.55);
      color: inherit;
      font: 600 15px/1.1 "Inter", sans-serif;
      text-align: center;
      transition: border-color 0.18s ease, box-shadow 0.18s ease;
    }

    .vaata-input::placeholder {
      color: rgba(248, 239, 186, 0.46);
      letter-spacing: 0.08em;
      text-transform: uppercase;
    }

    .vaata-position-box,
    .pitta-grid .vaata-position-box,
    .kapha-grid .vaata-position-box {
      border-radius: 14px;
      border: 1px solid rgba(148, 163, 184, 0.3);
      background: rgba(14, 26, 18, 0.55);
      width: 56px;
      height: 50px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--accent-secondary);
      box-shadow: inset 0 8px 18px rgba(8, 15, 10, 0.32);
      margin: 0 auto;
    }

    @media (max-width: 1024px) {
      .vaata-grid,
      .pitta-grid,
      .kapha-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
      }
    }

    @media (max-width: 640px) {
      .vaata-grid,
      .pitta-grid,
      .kapha-grid {
        grid-template-columns: 1fr;
        gap: 12px;
      }
    }

    .command-values {
      display: grid;
      gap: 12px;
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .value-card {
      padding: 12px 14px;
      border-radius: 14px;
      background: rgba(19, 32, 21, 0.55);
      border: 1px solid rgba(34, 197, 94, 0.25);
    }

    .value-card span {
      display: block;
    }

    .value-card span.label {
      font-size: 12px;
      text-transform: uppercase;
      color: rgba(250, 204, 21, 0.72);
      letter-spacing: 0.16em;
      margin-bottom: 6px;
    }

    .value-card span.value {
      font-size: 18px;
      font-weight: 600;
      color: var(--highlight);
    }

    .command-input {
      display: flex;
      flex-wrap: wrap;
      gap: 12px;
    }

    .command-input input {
      flex: 1 1 220px;
    }

    .log-panel {
      font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
      background: rgba(17, 26, 19, 0.7);
      border-radius: 18px;
      padding: 16px;
      border: 1px solid rgba(250, 204, 21, 0.25);
      min-height: 160px;
      max-height: 280px;
      overflow: auto;
      font-size: 13px;
      white-space: pre-wrap;
    }

    .log-panel strong {
      color: var(--accent-secondary);
    }

    .footer-note {
      text-align: right;
      color: rgba(250, 204, 21, 0.66);
      font-size: 12px;
      margin-right: 6px;
    }

    @media (max-width: 720px) {
      .logo-slot {
        width: 48px;
        height: 48px;
        border-radius: 16px;
      }

      .title-block h1 {
        font-size: 20px;
      }

      .subtitle {
        font-size: 11px;
      }

      .header-left {
        flex-direction: row;
        gap: 12px;
      }

      .header-meta {
        width: 100%;
        justify-content: flex-start;
      }

      .port-header {
        flex-direction: column;
        align-items: stretch;
      }

      .port-actions {
        width: 100%;
        justify-content: stretch;
      }

      .port-actions button {
        flex: 1 1 auto;
        min-width: 0;
      }

      .graphs-grid {
        grid-template-columns: 1fr;
      }
    }
