:root {
  --bg0: #0c1118;
  --bg1: #121a24;
  --bg2: #1a2433;
  --line: rgba(180, 210, 230, 0.12);
  --text: #e8eef5;
  --muted: #8fa0b3;
  --accent: #3dd6c6;
  --accent-dim: rgba(61, 214, 198, 0.16);
  --warn: #f0b429;
  --danger: #ff6b6b;
  --ask: #5b9dff;
  --greet: #7ddea0;
  --tap: 56px;
  --radius: 14px;
  --font: "IBM Plex Sans Thai", "Sarabun", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg0);
  color: var(--text);
  font-family: var(--font);
}

body {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 16px 48px;
  position: relative;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(61, 214, 198, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(91, 157, 255, 0.1), transparent 50%),
    linear-gradient(180deg, var(--bg1), var(--bg0) 40%);
  z-index: -1;
}

.bg-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 70%);
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  animation: rise 0.45s ease-out both;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background:
    linear-gradient(145deg, var(--accent), #2a8f9e 55%, #1d4e6e);
  box-shadow: 0 0 0 1px rgba(61, 214, 198, 0.35);
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
}

.status-pill[data-status="live"] .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
  animation: pulse 1.6s ease-in-out infinite;
}

.status-pill[data-status="connecting"] .status-dot {
  background: var(--warn);
  animation: pulse 0.9s ease-in-out infinite;
}

.status-pill[data-status="error"] .status-dot {
  background: var(--danger);
}

.status-pill[data-status="offline"] .status-dot {
  background: var(--muted);
}

.controls {
  background: rgba(18, 26, 36, 0.85);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  animation: rise 0.55s ease-out 0.05s both;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.field input {
  min-height: var(--tap);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg0);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  font-size: 1.05rem;
}

.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  min-height: var(--tap);
  min-width: 120px;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.15s;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(180deg, #45e0d0, #2bb8a8);
  color: #06201d;
  border-color: transparent;
}

.btn.ghost {
  background: transparent;
}

.btn.answered {
  background: var(--accent-dim);
  border-color: rgba(61, 214, 198, 0.4);
  color: var(--accent);
  flex: 1;
}

.btn.skip {
  background: transparent;
  color: var(--muted);
  flex: 0 0 auto;
  min-width: 96px;
}

.meta {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
  animation: rise 0.55s ease-out 0.1s both;
}

.stats div {
  background: rgba(18, 26, 36, 0.7);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.stats strong {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
}

.stats span {
  color: var(--muted);
  font-size: 0.85rem;
}

.queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cue {
  background: rgba(18, 26, 36, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  animation: slideIn 0.35s ease-out both;
}

.cue-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

.badge.ask {
  background: rgba(91, 157, 255, 0.18);
  color: var(--ask);
}

.badge.greet {
  background: rgba(125, 222, 160, 0.16);
  color: var(--greet);
}

.priority {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.display-name {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 6px;
  line-height: 1.25;
}

.comment-text {
  margin: 0 0 14px;
  font-size: 1.15rem;
  line-height: 1.45;
  color: #d5e0ec;
}

.cue-actions {
  display: flex;
  gap: 10px;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 36px 12px;
  display: none;
}

.empty.show {
  display: block;
}

.foot {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.foot p {
  margin: 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

@media (max-width: 560px) {
  .top {
    flex-direction: column;
  }

  .btn {
    flex: 1 1 auto;
  }
}
