@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;600;700;800&family=Sora:wght@600;700&display=swap');

:root {
  --bg-a: #f3f8ff;
  --bg-b: #fff8f2;
  --panel: #ffffffd9;
  --panel-solid: #ffffff;
  --border: #d5deea;
  --ink: #0f2136;
  --muted: #5f6e82;
  --blue: #1e40af;
  --blue-strong: #14328a;
  --green: #2f9e44;
  --yellow: #f59e0b;
  --red: #e03131;
  --shadow: 0 6px 16px rgba(18, 36, 68, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Manrope, Segoe UI, Arial, sans-serif;
  background: linear-gradient(160deg, var(--bg-a), var(--bg-b));
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: Sora, Manrope, Segoe UI, Arial, sans-serif;
  letter-spacing: -0.02em;
}

.page,
.landing {
  max-width: 1160px;
  margin: 0 auto;
  padding: 1.2rem;
}

.landing {
  min-height: 100vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 1rem;
}

.landing h1 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  margin-bottom: 0.4rem;
}

.links {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.page-header h1 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.3rem, 2.8vw, 2rem);
}

#status {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f7fbff;
  color: #174069;
  font-size: 0.84rem;
  font-weight: 700;
}

.grid.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin-bottom: 0.8rem;
  font-size: 1.08rem;
}

video {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #c8d2e1;
  background: #07111e;
  min-height: 240px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.button {
  background: linear-gradient(145deg, var(--blue), var(--blue-strong));
  color: #fff;
  border: none;
  border-radius: 11px;
  padding: 0.62rem 1rem;
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(30, 64, 175, 0.2);
}

.button.secondary {
  background: linear-gradient(145deg, #45566f, #2f3b4e);
  box-shadow: 0 3px 8px rgba(28, 40, 58, 0.18);
}

.button.danger {
  background: linear-gradient(145deg, #f04444, #c31f1f);
  box-shadow: 0 3px 8px rgba(200, 35, 35, 0.22);
}

.hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.device-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field span {
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 700;
}

.field select {
  border-radius: 10px;
  border: 1px solid #c6d1e1;
  padding: 0.58rem 0.65rem;
  font-size: 0.93rem;
  background: #fdfefe;
  color: var(--ink);
}

.field select:focus {
  outline: 2px solid rgba(30, 64, 175, 0.2);
  border-color: #8ca8e3;
}

.device-actions {
  display: flex;
  align-items: end;
  gap: 0.6rem;
}

.device-actions .button {
  min-width: 108px;
}

#deviceStatus {
  margin-top: 0.65rem;
}

.traffic-light {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.light {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #bcc8d5;
  background: #d8dfe7;
}

.light.active.high {
  background: var(--green);
}

.light.active.medium {
  background: var(--yellow);
}

.light.active.low {
  background: var(--red);
}

.bar-wrap {
  background: #e4ebf6;
  border-radius: 999px;
  overflow: hidden;
  height: 16px;
  margin-bottom: 0.6rem;
}

.bar {
  height: 16px;
  width: 0%;
  background: var(--red);
  transition: width 220ms ease;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--border);
  text-align: left;
  padding: 0.56rem 0.4rem;
  font-size: 0.92rem;
}

.level-pill {
  display: inline-block;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  color: #fff;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.level-high {
  background: var(--green);
}

.level-medium {
  background: var(--yellow);
}

.level-low {
  background: var(--red);
}

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

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

  .page-header {
    flex-direction: column;
  }

  .links {
    flex-direction: column;
  }

  .device-actions {
    align-items: stretch;
    flex-wrap: wrap;
  }
}
