:root {
  --bg-deep: #02030f;
  --bg-blue: #061733;
  --hot-purple: #c026ff;
  --hot-red: #ff245f;
  --text-main: #f7eaff;
  --text-muted: #9f8fb3;
  --glow-purple: 0 0 24px rgba(192, 38, 255, 0.7);
  --glow-red: 0 0 28px rgba(255, 36, 95, 0.65);
  --button-size: clamp(180px, 38vw, 280px);
  --cursor-green: #5cff87;
  --top-button-width: 70px;
  --dashboard-left: max(18px, env(safe-area-inset-left));
  --dashboard-top: max(18px, env(safe-area-inset-top));
  --dashboard-width: min(520px, calc(100vw - 36px));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--text-main);
  background:
    radial-gradient(circle at 50% 38%, rgba(192, 38, 255, 0.22), transparent 34%),
    radial-gradient(circle at 50% 85%, rgba(255, 36, 95, 0.22), transparent 30%),
    linear-gradient(180deg, var(--bg-blue), var(--bg-deep) 62%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 100% 4px, 48px 100%;
  mix-blend-mode: screen;
  opacity: 0.32;
}

body::after {
  content: "";
  position: fixed;
  left: 50%;
  bottom: -12vh;
  width: 120vw;
  height: 38vh;
  transform: translateX(-50%) perspective(500px) rotateX(62deg);
  background:
    linear-gradient(var(--hot-purple) 1px, transparent 1px),
    linear-gradient(90deg, var(--hot-red) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.24;
  filter: blur(0.2px);
}

@font-face {
  font-family: "DSEG7";
  src: url("/app/assets/fonts/DSEG7Classic-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DSEG7";
  src: url("/app/assets/fonts/DSEG7Classic-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel {
  display: grid;
  place-items: center;
  gap: 22px;
  text-align: center;
  padding-top: 180px;
}

.title {
  margin: 0;
  font-size: clamp(28px, 7vw, 72px);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: var(--glow-purple), var(--glow-red);
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: clamp(12px, 2.2vw, 15px);
}

.talk-button {
  width: clamp(240px, 34vw, 360px);
  height: clamp(82px, 12vw, 110px);

  border: 2px solid var(--hot-red);
 border-radius: 8px;

  color: #ffe3ea;
  cursor: pointer;

  font-size: clamp(24px, 4vw, 42px);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;

  background:
    linear-gradient(
      180deg,
      rgba(35, 0, 10, 0.95),
      rgba(0, 0, 0, 0.98)
    );

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -2px 0 rgba(0,0,0,0.9),
    0 0 10px rgba(255,36,95,0.5),
    0 0 22px rgba(255,36,95,0.3);

  text-shadow:
    0 0 10px rgba(255, 90, 130, 0.9);

  transition:
    transform 160ms ease,
    filter 160ms ease,
    box-shadow 160ms ease;
}

.talk-button:hover {
  transform: scale(1.035);
  filter: brightness(1.08);
}

.talk-button:active {
  transform: scale(0.98);
}

.talk-button.is-live {
  animation: laserPulse 1.1s linear infinite;
}

.refresh-button {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(108px + env(safe-area-inset-bottom));
  z-index: 2;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 1px solid rgba(247, 234, 255, 0.55);
  color: var(--text-main);
  background: rgba(2, 3, 15, 0.72);
  box-shadow: 0 0 18px rgba(192, 38, 255, 0.5);
  cursor: pointer;
  font-size: 24px;
  backdrop-filter: blur(10px);
}

.status {
  min-height: 24px;
  color: var(--text-muted);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.geo-button {
  position: fixed;
  top: calc(var(--dashboard-top) + 28px);
  left: calc(
    var(--dashboard-left) +
    var(--dashboard-width) -
    var(--top-button-width) -
    28px
  );
  right: auto;
  z-index: 4;

  width: var(--top-button-width);
  height: 44px;
  padding: 0 8px 0 18px;

  border: 1px solid rgba(255, 36, 95, 0.7);
  border-radius: 4px;

  color: rgba(255, 210, 220, 0.95);
  background: rgba(0, 0, 0, 0.92);

  box-shadow:
    inset 0 0 12px rgba(0,0,0,0.9),
    0 0 10px rgba(255,36,95,0.35);

  font-family: "DSEG7", monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.geo-button::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 50%;
  width: 7px;
  height: 7px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--hot-red);
  box-shadow:
    0 0 6px rgba(255,36,95,0.95),
    0 0 12px rgba(255,36,95,0.45);
}

.geo-button.is-active {
  border-color: rgba(92,255,135,0.95);
  color: var(--cursor-green);
  box-shadow:
    inset 0 0 12px rgba(0,0,0,0.9),
    0 0 14px rgba(92,255,135,0.45);
}

.geo-button.is-active::before {
  background: var(--cursor-green);
  box-shadow:
    0 0 6px rgba(92,255,135,0.95),
    0 0 14px rgba(92,255,135,0.55);
}

.dashboard {
  position: fixed;
  top: var(--dashboard-top, max(18px, env(safe-area-inset-top)));
  left: var(--dashboard-left, max(18px, env(safe-area-inset-left)));
  z-index: 2;

  width: var(--dashboard-width, min(430px, calc(100vw - 36px)));
  min-height: 250px;
  padding: 14px 118px 16px 16px;

  border-radius: 12px;
  border: 1px solid rgba(255, 36, 95, 0.55);

  background:
    linear-gradient(180deg, rgba(18, 19, 24, 0.98), rgba(0, 0, 0, 0.99) 38%),
    #000;

  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.08),
    inset 0 -2px 0 rgba(0,0,0,0.95),
    inset 0 0 32px rgba(0,0,0,0.95),
    0 0 0 1px rgba(0,0,0,0.95),
    0 14px 34px rgba(0,0,0,0.6);
}

.dashboard::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: inset 0 0 22px rgba(0,0,0,0.9);
  pointer-events: none;
}

.dashboard-message {
  position: relative;
  z-index: 1;
  max-width: calc(100% - 6px);
  margin: 2px 0 16px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;

  color: var(--cursor-green);
  text-shadow:
    0 0 5px rgba(92,255,135,0.9),
    0 0 14px rgba(92,255,135,0.35);
}

.dashboard-grid {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
}

.dashboard-gauge {
  display: grid;
  grid-template-columns: 62px 112px 42px;
  align-items: center;
  gap: 10px;

  min-height: 38px;
  padding: 6px 8px;

  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.075);

  background:
    linear-gradient(180deg, rgba(12,13,16,0.98), rgba(0,0,0,0.98));

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.95),
    inset 0 0 16px rgba(0,0,0,0.9);
}

.dashboard-label {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 15px;
  letter-spacing: 0.08em;
  color: rgba(247,234,255,0.92);
  text-shadow: 0 0 5px rgba(247,234,255,0.35);
}

.dashboard-value-wrap {
  position: relative;
  display: inline-grid;
  align-items: center;
  justify-items: end;
  min-width: 112px;
  height: 28px;
}

.dashboard-value-ghost,
.dashboard-value {
  grid-area: 1 / 1;
  font-family: "DSEG7", monospace;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.dashboard-value-ghost {
  color: rgba(255, 36, 95, 0.08);
  text-shadow: none;
}

.dashboard-value {
  color: var(--hot-red);
  text-shadow:
    0 0 6px rgba(255,36,95,0.95),
    0 0 14px rgba(255,36,95,0.45);
}

.dashboard-unit {
  font-family: "DSEG7", monospace;
  font-size: 13px;
  font-weight: 700;
  color: rgba(247,234,255,0.88);
  text-shadow: 0 0 5px rgba(247,234,255,0.28);
}


#obd-toggle {
  top: calc(var(--dashboard-top) + 82px);
  left: calc(
    var(--dashboard-left) +
    var(--dashboard-width) -
    var(--top-button-width) -
    28px
  );
  width: var(--top-button-width);
}

.geo-button,
#obd-toggle,
.dashboard-unit {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#log {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 2;
  max-width: min(520px, calc(100vw - 96px));
  max-height: 22vh;
  overflow: auto;
  margin: 0;
  color: var(--cursor-green);
  text-shadow: 0 0 8px rgba(92, 255, 135, 0.7);
  font-size: 11px;
  white-space: pre-wrap;
}

#log::-webkit-scrollbar {
  width: 0;
  height: 0;
}

#log::-webkit-scrollbar-track {
  background: transparent;
}

#log::-webkit-scrollbar-thumb {
  background: transparent;
}

@keyframes laserPulse {
  0%, 100% {
    box-shadow:
      0 0 10px rgba(255, 36, 95, 0.75),
      0 0 22px rgba(255, 36, 95, 0.55),
      inset 0 0 18px rgba(255, 36, 95, 0.12);
  }

  50% {
    box-shadow:
      0 0 18px rgba(255, 36, 95, 1),
      0 0 42px rgba(255, 36, 95, 0.95),
      0 0 70px rgba(255, 36, 95, 0.7),
      inset 0 0 30px rgba(255, 36, 95, 0.22);
  }
}

.auth-screen {
  position: fixed;
  inset: 0;
  z-index: 20;

  display: grid;
  place-items: start center;

  padding-top: 48px;

  background:
    linear-gradient(
      180deg,
      rgba(2, 3, 15, 0.96),
      rgba(2, 3, 15, 0.92)
    );
}

.auth-card {
  display: flex;
  flex-direction: column;
  gap: 16px;

  width: min(420px, 92vw);

  padding: 28px;

  border: 1px solid rgba(255, 36, 95, 0.5);

  background: rgba(3, 4, 18, 0.92);

  box-shadow:
    0 0 24px rgba(255, 36, 95, 0.35),
    0 0 48px rgba(192, 38, 255, 0.18);
}

.auth-input {
  width: 100%;

  padding: 14px 16px;

  font-size: 24px;

  color: white;
  background: rgba(0, 0, 0, 0.6);

  border: 1px solid rgba(255,255,255,0.2);
}

.auth-button {
  padding: 14px 18px;

  font-size: 20px;
  font-weight: 700;

  cursor: pointer;
}

.auth-error {
  min-height: 20px;
  color: #ff6b8c;
}

#app-screen[hidden],
#auth-screen[hidden] {
  display: none !important;
}

.logout-button {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));

  z-index: 3;

  width: 96px;
  height: 64px;

  border-radius: 8px;

  border: 1px solid rgba(90, 170, 255, 0.75);

  color: #d9ebff;

  background:
    linear-gradient(
      180deg,
      rgba(18, 42, 90, 0.92),
      rgba(3, 8, 24, 0.98)
    );

  box-shadow:
    0 0 12px rgba(80, 150, 255, 0.28),
    inset 0 0 10px rgba(120, 180, 255, 0.08);

  cursor: pointer;

  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  transition:
    transform 140ms ease,
    filter 140ms ease,
    box-shadow 140ms ease;
}

.logout-button:hover {
  filter: brightness(1.08);

  box-shadow:
    0 0 16px rgba(80, 150, 255, 0.38),
    inset 0 0 12px rgba(120, 180, 255, 0.12);
}

.logout-button:active {
  transform: scale(0.96);
}
