:root {
  --bg: #0b1220;
  --card: rgba(255, 255, 255, 0.06);
  --card2: rgba(255, 255, 255, 0.10);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.66);
  --muted2: rgba(255, 255, 255, 0.48);
  --border: rgba(255, 255, 255, 0.12);
  --accent: #6ee7ff;
  --accent2: #9bffd0;
  --danger: #ff6b6b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: radial-gradient(1200px 800px at 20% 0%, rgba(110, 231, 255, 0.18), transparent 55%),
              radial-gradient(900px 700px at 100% 30%, rgba(155, 255, 208, 0.14), transparent 55%),
              var(--bg);
  color: var(--text);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
}

.wrap {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 18px 40px;
}

.header h1 {
  margin: 0 0 6px 0;
  font-size: 28px;
  letter-spacing: -0.02em;
}
.titleRow {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modeIcon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.14);
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}
.modeIcon svg {
  width: 22px;
  height: 22px;
  display: block;
}
.modeIcon.wheel { color: rgba(155, 255, 208, 0.95); }
.modeIcon.steering { color: rgba(110, 231, 255, 0.95); }
.sub {
  margin: 0 0 18px 0;
  color: var(--muted);
  line-height: 1.35;
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  backdrop-filter: blur(10px);
}

.tabs {
  display: flex;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  background: rgba(0,0,0,0.14);
  margin-bottom: 12px;
}
.tab {
  flex: 1;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 10px;
  background: transparent;
  color: rgba(255,255,255,0.78);
  font-weight: 700;
  cursor: pointer;
}
.tab.active {
  border-color: rgba(110, 231, 255, 0.28);
  background: rgba(110, 231, 255, 0.14);
  color: rgba(255,255,255,0.92);
}

.panel { display: none; }
.panel.active { display: block; }
.hidden { display: none !important; }

#navRow {
  margin-bottom: 24px;
}

.home { margin-bottom: 12px; }

.big {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: rgba(0,0,0,0.14);
  margin: 12px 0;
}
.big-value {
  margin-top: 8px;
  font-size: 44px;
  font-weight: 820;
  letter-spacing: -0.03em;
}
.value.small {
  font-size: 16px;
  font-weight: 650;
  color: rgba(255,255,255,0.82);
  letter-spacing: 0;
}

.input {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 12px;
  padding: 10px 10px;
  background: rgba(0,0,0,0.18);
  color: rgba(255,255,255,0.9);
  font: inherit;
}
.input::placeholder { color: rgba(255,255,255,0.40); }
select.input { appearance: none; }

.plot {
  width: 100%;
  height: auto;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: rgba(0,0,0,0.12);
}
.qrBox {
  width: 200px;
  height: 200px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.qrBox img, .qrBox canvas {
  display: block;
}

.qrRow {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  align-items: start;
}
.qrMeta .value.small {
  margin-top: 8px;
  word-break: break-all;
  line-height: 1.35;
}

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

.cubeSection {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(0,0,0,0.12);
}
.worldScene {
  margin-top: 10px;
  display: grid;
  place-items: center;
  height: 260px;
  perspective: 900px;
}
.world {
  position: relative;
  width: 240px;
  height: 220px;
  transform-style: preserve-3d;
  transform: rotateX(56deg) rotateZ(45deg);
}
.worldBox {
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
  transform: translateZ(40px);
}
.ground {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 18px;
  bottom: 18px;
  border-radius: 14px;
  background:
    linear-gradient(rgba(255,255,255,0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.10) 1px, transparent 1px);
  background-size: 18px 18px;
  opacity: 0.28;
  transform: translateZ(0px);
}

.phone3d {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70px;
  height: 140px;
  transform-style: preserve-3d;
  transform: translate(-50%, -50%) rotateX(0deg) rotateY(0deg) rotateZ(0deg);
  transition: transform 30ms linear;
}
.pface {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(110, 231, 255, 0.10);
  backface-visibility: hidden;
}
.pfront {
  background: linear-gradient(180deg, rgba(110,231,255,0.22), rgba(110,231,255,0.08));
  transform: translateZ(6px);
}
.pback {
  background: rgba(255,255,255,0.08);
  transform: rotateY(180deg) translateZ(6px);
}
.pright { transform: rotateY(90deg) translateZ(35px); width: 12px; left: auto; right: 0; border-radius: 10px; }
.pleft  { transform: rotateY(-90deg) translateZ(35px); width: 12px; border-radius: 10px; }
.ptop   { transform: rotateX(90deg) translateZ(70px); height: 12px; border-radius: 10px; }
.pbottom{ transform: rotateX(-90deg) translateZ(70px); height: 12px; border-radius: 10px; }
.big-sub {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 13px;
}

.dial {
  position: relative;
  width: min(360px, 78vw);
  height: min(360px, 78vw);
  margin: 10px auto 18px;
}

.dial-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at center, rgba(255,255,255,0.05), transparent 60%),
    conic-gradient(from 0deg,
      rgba(255,255,255,0.20) 0deg 1deg,
      transparent 1deg 9deg,
      rgba(255,255,255,0.10) 9deg 10deg,
      transparent 10deg 30deg);
  box-shadow:
    inset 0 0 0 10px rgba(0,0,0,0.12),
    inset 0 0 0 1px rgba(255,255,255,0.08);
}

.arrow {
  position: absolute;
  inset: 0;
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  transition: transform 60ms linear;
}
.arrow::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: translate(-50%, -92%);
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-bottom: 140px solid rgba(110, 231, 255, 0.95);
  filter: drop-shadow(0 14px 22px rgba(0,0,0,0.35));
}
.arrow::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: translate(-50%, 8%);
  border-left: 14px solid transparent;
  border-right: 14px solid transparent;
  border-top: 110px solid rgba(255, 255, 255, 0.18);
}

.center-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.7);
  box-shadow: 0 0 0 8px rgba(255,255,255,0.06);
}

.dial-label {
  position: absolute;
  font-weight: 650;
  color: rgba(255,255,255,0.78);
  text-shadow: 0 10px 24px rgba(0,0,0,0.35);
  user-select: none;
}
.dial-label.n { left: 50%; top: 10px; transform: translateX(-50%); }
.dial-label.s { left: 50%; bottom: 10px; transform: translateX(-50%); }
.dial-label.e { right: 12px; top: 50%; transform: translateY(-50%); }
.dial-label.w { left: 12px; top: 50%; transform: translateY(-50%); }

.readouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 6px 0 14px;
}
.readout {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 12px 10px;
  background: rgba(0,0,0,0.14);
}
.label {
  color: var(--muted2);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.value {
  margin-top: 6px;
  font-size: 30px;
  font-weight: 760;
  letter-spacing: -0.02em;
}
.unit {
  font-size: 18px;
  color: rgba(255,255,255,0.72);
  margin-left: 2px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.actions.actions-1 { grid-template-columns: 1fr; }
.actions.actions-2 { grid-template-columns: repeat(2, 1fr); }
.btn {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 12px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
}
.btn.primary {
  border-color: rgba(110, 231, 255, 0.35);
  background: linear-gradient(180deg, rgba(110, 231, 255, 0.22), rgba(110, 231, 255, 0.10));
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.small {
  padding: 6px 10px;
  font-size: 0.85em;
  border-radius: 10px;
}

.status {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.status .hint {
  flex-basis: 100%;
}
.pill {
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(0,0,0,0.16);
  color: rgba(255,255,255,0.78);
  font-size: 12px;
}
.pill.ok {
  border-color: rgba(155, 255, 208, 0.35);
  color: rgba(155, 255, 208, 0.95);
}
.pill.warn {
  border-color: rgba(255, 219, 110, 0.35);
  color: rgba(255, 219, 110, 0.95);
}
.pill.bad {
  border-color: rgba(255, 107, 107, 0.35);
  color: rgba(255, 107, 107, 0.95);
}
.hint {
  color: var(--muted);
  line-height: 1.35;
  font-size: 13px;
}

.footer {
  margin-top: 16px;
  color: var(--muted2);
}

@media (max-width: 440px) {
  .readouts { grid-template-columns: 1fr; }
  .actions { grid-template-columns: 1fr; }
}

/* Big buttons for home page */
.big-actions {
  margin-top: 24px;
  gap: 16px;
}
.big-btn {
  padding: 24px 20px;
  font-size: 18px;
  border-radius: 18px;
}

