:root {
  --bg: #040814;
  --bg-secondary: #07111f;
  --panel: rgba(9, 16, 31, 0.88);
  --panel-strong: rgba(11, 19, 37, 0.96);
  --panel-soft: rgba(15, 23, 42, 0.78);
  --line: rgba(148, 163, 184, 0.18);
  --line-strong: rgba(148, 163, 184, 0.28);
  --text: #e6edf7;
  --muted: #95a4bd;
  --accent: #4cc3ff;
  --accent-strong: #2ea8ff;
  --success: #1ec66b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --amber: #f59e0b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --sidebar-width: 360px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: "Inter", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(76, 195, 255, 0.08), transparent 26%),
    radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.08), transparent 22%),
    linear-gradient(180deg, #020617, #06101e 38%, #0a1527 100%);
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, var(--sidebar-width)) minmax(0, 1fr);
}

.sidebar {
  padding: 24px;
  background: linear-gradient(180deg, rgba(7, 17, 31, 0.96), rgba(9, 16, 31, 0.92));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(16px);
  overflow-y: auto;
}

.workspace {
  padding: 24px;
}

.brand-block {
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(1.8rem, 2.2vw, 2.4rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.sidebar-copy,
.panel-heading p,
.canvas-toolbar-text,
.explanation-panel,
.empty-state {
  color: var(--muted);
}

.panel {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(12, 20, 38, 0.92), rgba(9, 16, 31, 0.92));
  box-shadow: var(--shadow);
}

.panel-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.panel-heading-inline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}

.panel-heading p {
  margin-bottom: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.control-grid {
  display: grid;
  gap: 10px;
}

button,
input,
select {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 31, 56, 0.96), rgba(9, 16, 31, 0.96));
  color: var(--text);
}

button {
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(76, 195, 255, 0.55);
  box-shadow: 0 10px 24px rgba(46, 168, 255, 0.12);
  filter: brightness(1.05);
}

button:active {
  transform: translateY(0);
}

.button-accent {
  background: linear-gradient(180deg, rgba(133, 77, 255, 0.96), rgba(109, 40, 217, 0.96));
  border-color: rgba(167, 139, 250, 0.45);
}

.button-success {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.96), rgba(22, 163, 74, 0.96));
  border-color: rgba(74, 222, 128, 0.42);
}

.button-danger {
  background: linear-gradient(180deg, rgba(239, 68, 68, 0.96), rgba(220, 38, 38, 0.96));
  border-color: rgba(252, 165, 165, 0.35);
}

.selected-panel {
  min-height: 78px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.guide-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}

.workspace-title {
  font-size: clamp(1.3rem, 2vw, 1.8rem);
}

.workspace-badges,
.canvas-toolbar-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-soft {
  background: rgba(76, 195, 255, 0.08);
  color: #bce7ff;
}

.canvas-panel,
.readings-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, rgba(12, 20, 38, 0.9), rgba(9, 16, 31, 0.94));
  box-shadow: var(--shadow);
}

.canvas-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 18px 0;
}

.canvas-toolbar-text {
  line-height: 1.5;
}

.canvas-wrap {
  padding: 18px;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 420px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at top, rgba(139, 92, 246, 0.08), transparent 30%),
    linear-gradient(180deg, #040814, #030712 100%);
  background-size: 20px 20px, 20px 20px, auto, auto;
  cursor: crosshair;
}

.explanation-panel {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: rgba(10, 18, 34, 0.84);
  line-height: 1.55;
}

.stats-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(11, 19, 37, 0.94), rgba(8, 15, 30, 0.96));
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-value {
  font-size: 1.22rem;
  line-height: 1.1;
}

.readings-panel {
  margin-top: 16px;
  padding: 16px;
}

.readings-list {
  display: grid;
  gap: 10px;
}

.reading-item {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(8, 15, 30, 0.85);
  line-height: 1.5;
}

.empty-state {
  padding: 6px 0;
}

.good {
  color: var(--success);
}

.bad {
  color: var(--danger);
}

@media (max-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-header,
  .canvas-toolbar,
  .panel-heading-inline {
    flex-direction: column;
    align-items: start;
  }

  canvas {
    aspect-ratio: 16 / 10;
    min-height: 340px;
  }
}

@media (max-width: 720px) {
  .sidebar,
  .workspace {
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel,
  .readings-panel,
  .canvas-panel {
    border-radius: 18px;
  }

  button,
  input,
  select {
    min-height: 48px;
  }
}

@media (max-width: 520px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  canvas {
    min-height: 280px;
  }
}
.component-search-wrap {
  margin-bottom: 10px;
}

.component-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hidden-component {
  display: none;
}

@media (max-width: 720px) {
  .component-edit-grid {
    grid-template-columns: 1fr;
  }
}
