:root {
  color-scheme: dark;
  --bg: #111827;
  --text: #f8fafc;
  --muted: #aeb8c8;
  --panel-line: rgba(255, 255, 255, 0.12);
  --in: #22c55e;
  --in-strong: #15803d;
  --out: #38bdf8;
  --out-strong: #0369a1;
  --warn: #f59e0b;
  --danger: #ef4444;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: linear-gradient(135deg, #101827 0%, #172033 52%, #0f172a 100%);
  color: var(--text);
}

button {
  font: inherit;
}

.garage-app {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 32px);
}

.garage-panel {
  width: min(100%, 1160px);
  min-height: calc(100svh - clamp(32px, 6vw, 64px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(16px, 2.4vw, 28px);
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: clamp(76px, 14svh, 120px);
  padding-bottom: clamp(12px, 2vw, 22px);
  border-bottom: 1px solid var(--panel-line);
}

h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 54px);
  line-height: 1;
  font-weight: 760;
  letter-spacing: 0;
}

.status-text {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 1.9vw, 24px);
  line-height: 1.35;
}

.signal {
  display: grid;
  grid-template-columns: repeat(3, 15px);
  gap: 8px;
  flex: 0 0 auto;
}

.signal span {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--in);
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.62);
}

.button-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: end;
  gap: clamp(18px, 2.8vw, 32px);
  min-height: 0;
}

.action-button {
  min-height: clamp(280px, 66svh, 560px);
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  user-select: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 20px 42px rgba(0, 0, 0, 0.28);
  transition:
    transform 150ms ease,
    filter 150ms ease,
    box-shadow 150ms ease;
}

.action-button-in {
  background: linear-gradient(180deg, var(--in), var(--in-strong));
}

.action-button-out {
  background: linear-gradient(180deg, var(--out), var(--out-strong));
}

.action-button:hover {
  filter: brightness(1.06);
}

.action-button:active,
.action-button.is-sending {
  transform: translateY(4px) scale(0.99);
  box-shadow:
    inset 0 6px 22px rgba(0, 0, 0, 0.22),
    0 10px 24px rgba(0, 0, 0, 0.22);
}

.action-button:focus-visible {
  outline: 5px solid rgba(255, 255, 255, 0.88);
  outline-offset: 5px;
}

.action-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.button-label {
  font-size: clamp(86px, 16vw, 176px);
  font-weight: 840;
  line-height: 0.95;
  letter-spacing: 0;
}

.garage-app.is-error .signal span {
  background: var(--danger);
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.62);
}

.garage-app.is-warning .signal span {
  background: var(--warn);
  box-shadow: 0 0 22px rgba(245, 158, 11, 0.62);
}

@media (max-width: 720px) {
  .garage-app {
    align-items: stretch;
    padding: 16px;
  }

  .garage-panel {
    min-height: calc(100svh - 32px);
    gap: 16px;
  }

  .status-bar {
    align-items: center;
    min-height: 84px;
    padding-bottom: 12px;
  }

  .button-grid {
    grid-template-columns: 1fr;
    align-content: stretch;
  }

  .action-button {
    min-height: clamp(170px, 34svh, 270px);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .garage-app {
    padding: 12px;
  }

  .garage-panel {
    min-height: calc(100svh - 24px);
    gap: 12px;
  }

  .status-bar {
    min-height: 64px;
    padding-bottom: 10px;
  }

  h1 {
    font-size: clamp(28px, 4.5vw, 42px);
  }

  .status-text {
    margin-top: 6px;
    font-size: clamp(16px, 2.4vw, 20px);
  }

  .action-button {
    min-height: 0;
  }

  .button-label {
    font-size: clamp(76px, 17vw, 140px);
  }
}

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