/* ── Design system: Evreghen Command Center ── */
:root {
  --bg:               #fcfaf7;
  --surface:          #f3f4f6;
  --surface-soft:     #edebe9;
  --surface-elevated: #ffffff;
  --on-bg:            #423d38;
  --on-muted:         #797067;
  --outline:          #e3e0dd;
  --outline-strong:   #d1d5dc;

  --primary:          #fe6e00;
  --primary-strong:   #ff6b00;
  --primary-focus:    #f97015;
  --on-primary:       #ffffff;

  --success:          #00c758;
  --warning:          #edb200;
  --danger:           #fb2c36;
  --info:             #3080ff;

  --shell-bg:         rgba(0, 0, 0, 0.70);
  --shell-blur:       12px;
  --shell-border:     rgba(255, 255, 255, 0.10);
  --shell-text:       #ffffff;
  --shell-text-muted: rgba(255, 255, 255, 0.60);

  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-pill: 9999px;

  --shadow-subtle: 0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-raised: 0 4px 12px rgba(0,0,0,0.12);

  --fast:   150ms;
  --normal: 200ms;
  --slow:   300ms;
  --ease:   cubic-bezier(0.4, 0, 0.2, 1);

  --font: ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  background-color: var(--bg);
  color: var(--on-bg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5rem;
  min-height: 100vh;
}

/* ── Shell header ── */
.shell-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  background: var(--shell-bg);
  backdrop-filter: blur(var(--shell-blur));
  -webkit-backdrop-filter: blur(var(--shell-blur));
  border-bottom: 1px solid var(--shell-border);
}

.shell-inner {
  max-width: 640px;
  margin: 0 auto;
  height: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.shell-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 8px var(--primary);
  animation: pulse-dot 2.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.shell-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--shell-text);
}

.shell-node {
  font-size: 0.75rem;
  color: var(--shell-text-muted);
  font-family: var(--font-mono);
}

/* ── Workspace ── */
.workspace {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Status bar ── */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-elevated);
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  box-shadow: var(--shadow-subtle);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warning);
  flex-shrink: 0;
  transition: background var(--normal) var(--ease);
}

.status-indicator.ok    { background: var(--success); box-shadow: 0 0 8px rgba(0,199,88,0.4); animation: pulse-dot 2.5s ease-in-out infinite; }
.status-indicator.warn  { background: var(--warning); }
.status-indicator.error { background: var(--danger); }

.status-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--on-bg);
}

.status-detail {
  font-size: 0.75rem;
  color: var(--on-muted);
  margin-left: auto;
  text-align: right;
}

/* ── Panel (card) ── */
.panel {
  background: var(--surface-elevated);
  border: 1px solid var(--outline);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.panel-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.panel-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--primary);
}

.panel-title {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.75rem;
  color: var(--on-bg);
}

.panel-badge {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-soft);
  color: var(--on-muted);
  white-space: nowrap;
  transition: background var(--normal) var(--ease), color var(--normal) var(--ease);
}

.panel-badge.active {
  background: rgba(0, 199, 88, 0.12);
  color: #016630;
}

.panel-badge.loading {
  background: rgba(254, 110, 0, 0.10);
  color: var(--primary);
  animation: blink-badge 1s ease-in-out infinite;
}

.panel-badge.error {
  background: rgba(251, 44, 54, 0.10);
  color: var(--danger);
}

@keyframes blink-badge {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Video container ── */
.video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--surface-soft);
  border: 1px solid var(--outline);
  border-radius: var(--radius-md);
  overflow: hidden;
}

#videoEl {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

#videoEl.active {
  display: block;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--on-muted);
  font-size: 0.875rem;
}

.video-placeholder svg {
  opacity: 0.4;
}

.video-placeholder.hidden {
  display: none;
}

/* ── Panel actions ── */
.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  height: 40px;
  padding: 0 16px;
  cursor: pointer;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) { background: var(--primary-strong); }
.btn-primary:active:not(:disabled) { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.40; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--on-bg);
  border: 1px solid var(--outline-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  height: 40px;
  padding: 0 16px;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
  white-space: nowrap;
}

.btn-ghost:hover:not(:disabled) { background: var(--surface-soft); border-color: var(--primary); color: var(--primary); }
.btn-ghost:disabled { opacity: 0.40; cursor: not-allowed; }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(251, 44, 54, 0.30);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 500;
  height: 40px;
  padding: 0 16px;
  cursor: pointer;
  transition: background var(--fast) var(--ease);
  white-space: nowrap;
}

.btn-danger:hover:not(:disabled) { background: rgba(251, 44, 54, 0.07); }
.btn-danger:disabled { opacity: 0.40; cursor: not-allowed; }

/* ── Panel hint ── */
.panel-hint {
  font-size: 0.8125rem;
  color: var(--on-muted);
  line-height: 1rem;
}

.panel-hint strong {
  color: var(--on-bg);
  font-weight: 600;
}

/* ── Audio level bar ── */
.level-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.level-bar-wrap {
  flex: 1;
  height: 24px;
  background: var(--surface-soft);
  border: 1px solid var(--outline);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.level-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-strong) 100%);
  border-radius: var(--radius-pill);
  transition: width 80ms linear;
}

.level-value {
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--primary);
  min-width: 44px;
  text-align: right;
}

.level-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.6875rem;
  color: var(--on-muted);
  padding: 0 2px;
  margin-top: -8px;
}

/* ── Desktop ── */
@media (min-width: 600px) {
  .workspace { padding: 32px 32px 64px; }
}
