:root {
  color-scheme: dark;
  --bg: #0e1114;
  --panel: #171b20;
  --panel-strong: #20262d;
  --text: #f4f0e8;
  --muted: #a9b0b8;
  --soft: #c9c1b5;
  --line: #303840;
  --red: #ff3f4d;
  --blue: #4aa3ff;
  --green: #69d39b;
  --amber: #f0bd5a;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 63, 77, 0.11), transparent 30%),
    linear-gradient(180deg, #11161a 0%, var(--bg) 58%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.art-shell {
  display: grid;
  min-height: 100vh;
  align-content: center;
  gap: 34px;
  padding: 42px 0;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  align-content: center;
}

.auth-panel {
  max-width: 680px;
}

.auth-copy {
  max-width: 520px;
  margin: 24px 0 28px;
  color: var(--soft);
  font-size: 1.08rem;
  line-height: 1.55;
}

.art-panel {
  max-width: 780px;
}

.arrival,
.eyebrow {
  margin: 0 0 18px;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  max-width: 860px;
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 6.6rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.admin-hero h1 {
  font-size: clamp(2.2rem, 5vw, 4.6rem);
}

.art-copy {
  display: grid;
  gap: 14px;
  max-width: 660px;
  margin: 28px 0 32px;
  color: var(--soft);
  font-size: clamp(1.02rem, 2vw, 1.22rem);
  line-height: 1.58;
}

.art-copy p {
  margin: 0;
}

.light-button,
.heartbeat-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 64px;
  min-width: 220px;
  padding: 0 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--red);
  color: white;
  font: inherit;
  font-size: 1rem;
  font-weight: 850;
  cursor: pointer;
  box-shadow: 0 20px 46px rgba(255, 63, 77, 0.24);
}

.secondary-button {
  min-width: 0;
  min-height: 48px;
  background: var(--panel-strong);
  box-shadow: none;
}

.light-button:disabled,
.heartbeat-button:disabled {
  background: #626a73;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.74;
}

.light-button:disabled .pulse-dot,
.heartbeat-button:disabled .pulse-dot {
  animation: none;
  background: #d8dde3;
  box-shadow: none;
}

.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.65);
  animation: pulse 1.4s infinite;
}

.environment {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  max-width: 780px;
  border: 1px solid var(--line);
  background: var(--line);
}

.environment > div {
  min-height: 132px;
  background: rgba(23, 27, 32, 0.88);
  padding: 20px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0 32px;
}

.status-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 27, 32, 0.92);
  padding: 22px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.panel-heading .eyebrow {
  margin: 0;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(240, 189, 90, 0.14);
  color: var(--amber);
  font-size: 0.82rem;
  font-weight: 750;
}

.status-pill.ready {
  background: rgba(105, 211, 155, 0.14);
  color: var(--green);
}

.sensor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.sensor-grid > div,
.led-card {
  min-height: 112px;
  border-radius: 8px;
  background: var(--panel-strong);
  padding: 18px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  text-transform: uppercase;
}

strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.35rem, 3vw, 2.25rem);
  line-height: 1.05;
}

.error-text {
  min-height: 20px;
  margin: 16px 0 0;
  color: var(--amber);
  font-size: 0.92rem;
}

.led-row {
  display: grid;
  gap: 12px;
}

.led-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.led {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  background: #4a5360;
}

.led.red.active {
  background: var(--red);
  box-shadow: 0 0 24px rgba(255, 63, 77, 0.75);
}

.led.blue.active {
  background: var(--blue);
  box-shadow: 0 0 24px rgba(74, 163, 255, 0.75);
}

.led.count {
  background: var(--green);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f0e8;
  color: #111820;
  font-weight: 800;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

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

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 1120px);
    padding: 24px 0;
  }

  .art-shell {
    align-content: start;
    padding-top: 52px;
  }

  .light-button,
  .heartbeat-button {
    width: 100%;
  }

  .hero,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .status-grid,
  .sensor-grid,
  .environment {
    grid-template-columns: 1fr;
  }
}
