:root {
  color-scheme: light;
  --bg: #f6fbff;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --edge: rgba(31, 111, 120, 0.16);
  --ink: #123039;
  --muted: #607880;
  --cyan: #13b7b3;
  --accent: #0e8f86;
  --amber: #ffad2f;
  --red: #e64d5f;
  --blue: #4b8dff;
  --mint: #dff9f2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at 14% 0%, rgba(75, 141, 255, 0.2), transparent 34%),
    radial-gradient(circle at 90% 12%, rgba(255, 173, 47, 0.22), transparent 28%),
    radial-gradient(circle at 50% 100%, rgba(19, 183, 179, 0.22), transparent 38%),
    linear-gradient(180deg, #f9fdff 0%, #edf8f7 54%, #f8fbf2 100%);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  overflow-x: hidden;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(14, 143, 134, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(75, 141, 255, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 70%);
}

.site-shell {
  position: relative;
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 24px 18px 32px;
}

.app-header,
.hero-grid,
.metrics,
.button-grid,
.status-card,
.signal-stack,
.route-chip {
  display: flex;
}

.app-header {
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 62px);
  line-height: 0.98;
  color: #123039;
  text-shadow: 0 12px 32px rgba(19, 183, 179, 0.16);
}

.subtitle {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.status-card,
.glass-card,
.route-monitor,
.speed-hud,
.route-chip {
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--panel-strong), var(--panel));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 18px 38px rgba(46, 96, 108, 0.13);
  backdrop-filter: blur(16px);
}

.status-card {
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: #123039;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.signal-stack {
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(31, 111, 120, 0.12);
}

.signal {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: block;
  background: currentColor;
  box-shadow: 0 0 16px currentColor;
}

.green { color: #35b279; }
.amber { color: var(--amber); opacity: 0.65; }
.red { color: var(--red); opacity: 0.35; }

.hero-grid {
  align-items: stretch;
  gap: 18px;
}

.engine-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 720px;
  overflow: hidden;
  border: 1px solid rgba(31, 111, 120, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, #eaf8ff, #f6fbff);
  box-shadow: 0 30px 70px rgba(46, 96, 108, 0.2), 0 0 56px rgba(19, 183, 179, 0.13);
}

.engine-stage.shake {
  animation: cabinShake 0.13s linear infinite;
}

.engine-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 8%, rgba(255, 255, 255, 0.2) 18%, transparent 34%),
    radial-gradient(circle at 50% 5%, rgba(255, 255, 255, 0.34), transparent 28%);
  mix-blend-mode: screen;
}

.engine-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  box-shadow: inset 0 0 80px rgba(18, 48, 57, 0.18);
}

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

.speed-hud {
  position: absolute;
  z-index: 5;
  top: 18px;
  right: 18px;
  width: 162px;
  padding: 15px 12px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 173, 47, 0.18), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(225, 249, 245, 0.88));
}

.speed-hud span,
.speed-hud small,
.route-monitor span,
.route-monitor small,
.label {
  display: block;
  color: #a9d7d1;
  color: #5d7980;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.speed-hud strong {
  display: block;
  margin-top: 4px;
  font-size: 54px;
  line-height: 1;
  color: #123039;
  text-shadow: 0 10px 26px rgba(19, 183, 179, 0.2);
  letter-spacing: 0;
}

.route-chip {
  position: absolute;
  z-index: 5;
  top: 18px;
  left: 18px;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 210px);
  padding: 10px 12px;
  color: #123039;
  font-size: 14px;
  font-weight: 800;
}

.route-chip i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(14, 143, 134, 0.32);
  animation: pulse 1.4s infinite;
}

.route-monitor {
  position: absolute;
  z-index: 5;
  right: 18px;
  bottom: 24px;
  width: 182px;
  padding: 12px;
}

.route-line,
.power-track {
  position: relative;
  height: 8px;
  margin: 10px 0 9px;
  border-radius: 99px;
  background: rgba(18, 48, 57, 0.08);
  overflow: hidden;
}

.route-line b,
.power-track i {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--amber));
  box-shadow: 0 0 14px rgba(19, 183, 179, 0.28);
}

.control-deck {
  width: 360px;
  display: grid;
  gap: 14px;
}

.glass-card {
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 0%, rgba(75, 141, 255, 0.12), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(255, 173, 47, 0.12), transparent 30%);
}

.primary-gauge {
  min-height: 132px;
}

.glass-card strong {
  position: relative;
  display: block;
  margin-top: 8px;
  color: #123039;
  font-size: 24px;
}

.graph-card {
  padding-bottom: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(232, 250, 247, 0.82));
}

#graphCanvas {
  width: 100%;
  height: 92px;
  display: block;
  margin-top: 10px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 0%, rgba(19, 183, 179, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(233, 249, 255, 0.92), rgba(255, 255, 255, 0.86));
  border: 1px solid rgba(31, 111, 120, 0.1);
  box-shadow: inset 0 1px 18px rgba(19, 183, 179, 0.08);
}

.primary-gauge strong {
  font-size: 40px;
  color: #0e8f86;
  text-shadow: 0 10px 24px rgba(14, 143, 134, 0.16);
}

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

.button-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.button-grid.single-action {
  grid-template-columns: 1fr 1fr;
}

button {
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.5), transparent 32%), linear-gradient(180deg, #18bdb2, #0d827a);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(14, 143, 134, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.single-action button {
  min-height: 48px;
  font-size: 13px;
}

button.secondary {
  border: 1px solid rgba(31, 111, 120, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(232, 248, 247, 0.78));
  color: #123039;
  box-shadow: 0 10px 20px rgba(46, 96, 108, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
}

#stopButton {
  color: #e64d5f;
}

button.danger {
  background: linear-gradient(180deg, #ff7d8a, #d63f53);
  box-shadow: 0 12px 24px rgba(230, 77, 95, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

button.wide {
  grid-column: 1 / -1;
}

.seo-content {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(232, 250, 247, 0.72));
  box-shadow: 0 16px 32px rgba(46, 96, 108, 0.1);
}

.seo-content h2,
.seo-content h3,
.seo-content p,
.seo-content li,
.seo-content summary {
  color: #123039;
}

.seo-content h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.seo-content h2:not(:first-child) {
  margin-top: 18px;
}

.seo-content h3 {
  margin: 0 0 5px;
  font-size: 13px;
}

.seo-content p,
.seo-content li {
  font-size: 12px;
  line-height: 1.5;
}

.seo-content ol {
  padding-left: 18px;
}

.seo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.seo-grid article,
.seo-content details {
  border: 1px solid rgba(31, 111, 120, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
}

.seo-content details {
  margin-top: 8px;
}

.seo-content summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: default;
  filter: saturate(0.55);
  opacity: 0.58;
  transform: none;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 12px rgba(86, 221, 205, 0); }
  100% { box-shadow: 0 0 0 0 rgba(86, 221, 205, 0); }
}

@keyframes cabinShake {
  0% { transform: translate3d(0, 0, 0); }
  35% { transform: translate3d(1px, -1px, 0); }
  70% { transform: translate3d(-1px, 1px, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

@media (max-width: 980px) {
  .app-header,
  .hero-grid {
    flex-direction: column;
  }

  .status-card,
  .control-deck {
    width: 100%;
  }

  .engine-stage {
    min-height: 620px;
  }
}

@media (max-width: 640px) {
  .site-shell {
    padding-inline: 12px;
  }

  .engine-stage {
    min-height: 560px;
  }

  .route-chip {
    max-width: calc(100% - 150px);
    font-size: 12px;
  }

  .speed-hud {
    width: 126px;
  }

  .speed-hud strong {
    font-size: 40px;
  }

  .route-monitor {
    display: none;
  }

  .metrics,
  .button-grid {
    grid-template-columns: 1fr;
  }

  button.wide {
    grid-column: auto;
  }
}

/* Compact phone-app layout: optimized for roughly 5.6 inch screens. */
.site-shell {
  width: min(100%, 430px);
  padding: 8px;
}

.app-header {
  gap: 8px;
  margin-bottom: 8px;
}

.eyebrow {
  margin-bottom: 3px;
  font-size: 9px;
}

h1 {
  font-size: 24px;
}

.subtitle {
  max-width: 255px;
  margin-top: 5px;
  font-size: 10.5px;
  line-height: 1.25;
}

.status-card {
  gap: 6px;
  padding: 6px;
  font-size: 9px;
}

.signal-stack {
  gap: 4px;
  padding: 5px;
}

.signal {
  width: 10px;
  height: 10px;
}

.hero-grid {
  display: block;
}

.engine-stage {
  height: 48vh;
  min-height: 330px;
  max-height: 410px;
}

.speed-hud {
  top: 10px;
  right: 10px;
  width: 96px;
  padding: 8px 7px;
}

.speed-hud span,
.speed-hud small,
.route-monitor span,
.route-monitor small,
.label {
  font-size: 8.5px;
}

.speed-hud strong {
  font-size: 31px;
}

.route-chip {
  top: 10px;
  left: 10px;
  max-width: calc(100% - 118px);
  gap: 6px;
  padding: 7px 8px;
  font-size: 9.5px;
}

.route-chip i {
  width: 8px;
  height: 8px;
}

.route-monitor {
  right: 10px;
  bottom: 10px;
  width: 116px;
  padding: 7px;
}

.route-line,
.power-track {
  height: 6px;
  margin: 6px 0 5px;
}

.control-deck {
  width: 100%;
  gap: 6px;
  margin-top: 6px;
}

.glass-card {
  padding: 8px;
}

.primary-gauge {
  min-height: 62px;
}

.glass-card strong {
  margin-top: 4px;
  font-size: 14px;
}

.primary-gauge strong {
  font-size: 22px;
}

.metrics {
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.graph-card {
  padding-bottom: 7px;
}

#graphCanvas {
  height: 56px;
  margin-top: 6px;
}

.button-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.button-grid.single-action {
  grid-template-columns: 1fr 1fr;
}

button {
  min-height: 34px;
  padding: 6px 5px;
  font-size: 10px;
  line-height: 1.05;
}

.single-action button {
  min-height: 42px;
  font-size: 12px;
}

button.wide {
  grid-column: span 3;
}

@media (max-width: 380px) {
  .site-shell {
    padding: 6px;
  }

  h1 {
    font-size: 21px;
  }

  .subtitle {
    display: none;
  }

  .engine-stage {
    height: 45vh;
    min-height: 300px;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

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