*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0f172a, #020617);
  color: #e5e7eb;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  padding: 1.5rem 1.5rem 0.5rem;
  text-align: center;
}

.header h1 {
  margin: 0;
  font-size: 1.8rem;
}

.header p {
  margin: 0.5rem 0 0;
  color: #9ca3af;
}

.nav {
  margin-top: 0.75rem;
}

.link {
  color: #93c5fd;
  text-decoration: none;
  border-bottom: 1px solid rgba(147, 197, 253, 0.35);
}

.link:hover {
  border-bottom-color: rgba(147, 197, 253, 0.9);
}

.content {
  flex: 1;
  max-width: 960px;
  margin: 0 auto 2rem;
  padding: 0 1.5rem 2rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

.card {
  background: rgba(15, 23, 42, 0.95);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

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

.card h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.hint {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  color: #9ca3af;
}

.field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.field span {
  min-width: 160px;
  font-size: 0.9rem;
}

.field input[type="text"],
.field input[type="number"] {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.6rem;
  border-radius: 0.5rem;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
}

.field input[type="color"] {
  width: 2.5rem;
  height: 2rem;
  padding: 0;
  border-radius: 0.5rem;
  border: 1px solid #4b5563;
  background: transparent;
}

.field input[type="range"] {
  flex: 1;
}

.field-value {
  font-size: 0.9rem;
  color: #9ca3af;
  min-width: 3rem;
  text-align: right;
}

button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  background: linear-gradient(to right, #22c55e, #0ea5e9);
  color: #020617;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.08s ease;
  box-shadow: 0 10px 20px rgba(34, 197, 94, 0.3);
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: none;
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

button.danger {
  background: linear-gradient(to right, #f97316, #ef4444);
  color: #020617;
  box-shadow: 0 10px 20px rgba(248, 113, 113, 0.3);
}

.row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.row-between {
  justify-content: space-between;
}

.row-wrap {
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
}

.device-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.device-table th,
.device-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  vertical-align: middle;
}

.device-table th {
  font-size: 0.85rem;
  color: #cbd5e1;
  font-weight: 600;
}

.device-table tbody tr:hover {
  background: rgba(2, 6, 23, 0.35);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
}

.muted {
  color: #9ca3af;
}

.nowrap {
  white-space: nowrap;
}

.actions {
  text-align: right;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #e5e7eb;
  background: rgba(148, 163, 184, 0.12);
  text-transform: lowercase;
}

.badge-online {
  border-color: rgba(34, 197, 94, 0.65);
  background: rgba(34, 197, 94, 0.15);
  color: #bbf7d0;
}

.badge-offline {
  border-color: rgba(248, 113, 113, 0.65);
  background: rgba(248, 113, 113, 0.15);
  color: #fecaca;
}

.connection-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.connection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.connection-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.connection-line {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.connection-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: #9ca3af;
}

.color-swatch {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.9);
}

.feedback {
  grid-column: 1;
}

.status,
.error {
  margin-top: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
}

.status {
  background: rgba(22, 163, 74, 0.15);
  border: 1px solid rgba(22, 163, 74, 0.6);
  color: #bbf7d0;
}

.error {
  background: rgba(248, 113, 113, 0.15);
  border: 1px solid rgba(248, 113, 113, 0.6);
  color: #fecaca;
}

@media (min-width: 900px) {
  .content {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feedback {
    grid-column: 1 / -1;
  }
}

