.bse-shell {
  --bse-panel: #101820;
  --bse-panel-2: #162530;
  --bse-panel-3: #091118;
  --bse-line: rgba(165, 205, 228, 0.12);
  --bse-text: #eaf7ff;
  --bse-muted: #a9c4d8;
  --bse-accent: #56e3b9;
  --bse-accent-2: #84fff2;
  --bse-warm: #ffb96b;
  --bse-danger: #ff6b6b;
  margin: 1.5rem auto;
  max-width: 1200px;
  color: var(--bse-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.bse-panel {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(190, 225, 245, 0.12);
  background:
    radial-gradient(circle at top left, rgba(90, 186, 255, 0.14), transparent 28%),
    radial-gradient(circle at bottom right, rgba(86, 227, 185, 0.14), transparent 24%),
    linear-gradient(145deg, #1a2730 0%, #101820 36%, #091118 100%);
  box-shadow:
    0 28px 60px rgba(4, 10, 16, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
}

.bse-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 16%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.02) 0,
      rgba(255, 255, 255, 0.02) 1px,
      transparent 1px,
      transparent 22px
    );
  pointer-events: none;
}

.bse-panel__screws span {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.22), rgba(0, 0, 0, 0.5));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 4px rgba(0, 0, 0, 0.35);
}

.bse-panel__screws span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 3px;
  right: 3px;
  height: 1px;
  background: rgba(10, 16, 22, 0.8);
  transform: translateY(-50%);
}

.bse-panel__screws span:nth-child(1) { top: 14px; left: 14px; }
.bse-panel__screws span:nth-child(2) { top: 14px; right: 14px; }
.bse-panel__screws span:nth-child(3) { bottom: 14px; left: 14px; }
.bse-panel__screws span:nth-child(4) { bottom: 14px; right: 14px; }

.bse-panel__header,
.bse-layout {
  position: relative;
  z-index: 1;
}

.bse-panel__header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.35rem 1.35rem 0.5rem;
}

.bse-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bse-brand__power {
  position: relative;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #6b7076, #1c252d 70%, #0d1217 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.15), 0 0 0 4px rgba(255, 255, 255, 0.04);
}

.bse-shell.is-powered .bse-brand__power {
  background: radial-gradient(circle at 35% 35%, #d6fff7, #5de7bd 40%, #0f7d63 100%);
  box-shadow:
    0 0 0 4px rgba(86, 227, 185, 0.09),
    0 0 18px rgba(86, 227, 185, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.42);
}

.bse-brand__eyebrow {
  margin: 0 0 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--bse-muted);
}

.bse-brand__title {
  margin: 0;
  font-size: clamp(1.45rem, 1.15rem + 1vw, 2.2rem);
  letter-spacing: -0.03em;
}

.bse-brand__subtitle {
  margin: 0.35rem 0 0;
  max-width: 62ch;
  color: var(--bse-muted);
  font-size: 0.95rem;
}

.bse-readouts {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 0.75rem;
  min-width: min(100%, 420px);
}

.bse-readout {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(200, 230, 248, 0.1);
  background: linear-gradient(180deg, rgba(23, 34, 44, 0.95), rgba(10, 17, 24, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.bse-readout__label {
  display: block;
  color: var(--bse-muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
  margin-bottom: 0.3rem;
}

.bse-readout__value {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
}

.bse-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.95fr);
  gap: 1rem;
  padding: 0.75rem 1.35rem 1.35rem;
}

.bse-display,
.bse-controls {
  display: grid;
  gap: 1rem;
}

.bse-screen,
.bse-bitstream-panel,
.bse-section,
.bse-metrics {
  border-radius: 24px;
  border: 1px solid rgba(196, 226, 244, 0.12);
  background:
    linear-gradient(180deg, rgba(24, 37, 47, 0.98), rgba(9, 17, 24, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 14px 28px rgba(0, 0, 0, 0.2);
}

.bse-screen {
  padding: 1rem;
}

.bse-screen__header,
.bse-bitstream-panel__header,
.bse-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.bse-screen__header span:first-child,
.bse-section__header h3,
.bse-bitstream-panel__header h3 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.bse-bitstream-panel__header p,
.bse-section__header p {
  margin: 0.2rem 0 0;
  color: var(--bse-muted);
  font-size: 0.88rem;
}

.bse-screen__status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--bse-muted);
  font-size: 0.82rem;
}

.bse-led-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #606870;
}

.bse-shell.is-playing .bse-led-dot {
  background: var(--bse-accent);
  box-shadow: 0 0 12px rgba(86, 227, 185, 0.65);
  animation: bse-pulse 1.25s ease-in-out infinite;
}

@keyframes bse-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.25); opacity: 0.72; }
}

.bse-scope,
.bse-spectrum {
  display: block;
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #02070a;
}

.bse-scope {
  height: 280px;
}

.bse-spectrum {
  height: 150px;
  margin-top: 0.8rem;
}

.bse-bitstream-panel {
  padding: 1rem;
}

.bse-led-display {
  min-width: 5.8rem;
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 190, 105, 0.2);
  background:
    linear-gradient(180deg, rgba(34, 19, 6, 0.96), rgba(22, 11, 2, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 18px rgba(255, 185, 84, 0.15);
  color: var(--bse-warm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.12em;
}

.bse-bitstream {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.35rem;
  max-height: 240px;
  overflow: auto;
}

.bse-bitstream::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.bse-bitstream::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

.bse-byte {
  display: grid;
  grid-template-columns: repeat(8, minmax(32px, 1fr));
  gap: 0.35rem;
  padding: 0.45rem;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.015));
  transition: box-shadow 0.22s ease, transform 0.22s ease;
}

.bse-byte.is-active-byte {
  box-shadow: 0 0 0 1px rgba(86, 227, 185, 0.24), 0 0 18px rgba(86, 227, 185, 0.12);
  transform: translateY(-1px);
}

.bse-bit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 38px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background:
    linear-gradient(180deg, rgba(15, 21, 27, 0.96), rgba(6, 11, 16, 0.96));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color: #d7ebf9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
}

.bse-bit.is-active {
  color: #03140f;
  background: linear-gradient(180deg, var(--bse-accent-2), var(--bse-accent));
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    0 0 0 1px rgba(86, 227, 185, 0.18),
    0 0 18px rgba(86, 227, 185, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.bse-bitstream-note,
.bse-empty {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: var(--bse-muted);
  background: rgba(255, 255, 255, 0.02);
}

.bse-controls {
  align-content: start;
}

.bse-section {
  padding: 1rem;
}

.bse-section__header h3 {
  font-size: 1rem;
}

.bse-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--bse-muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.68rem;
}

.bse-toggle-row {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.bse-toggle,
.bse-button,
.bse-shell select,
.bse-shell textarea,
.bse-shell input[type="range"] {
  font: inherit;
}

.bse-toggle {
  flex: 1;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--bse-muted);
  cursor: pointer;
  padding: 0.7rem 1rem;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.bse-toggle:hover,
.bse-button:hover {
  transform: translateY(-1px);
}

.bse-toggle.is-active {
  background: linear-gradient(180deg, rgba(99, 253, 220, 0.98), rgba(86, 227, 185, 0.92));
  color: #021612;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(86, 227, 185, 0.16);
}

.bse-field {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.95rem;
}

.bse-field > span {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  color: var(--bse-muted);
  font-size: 0.87rem;
}

.bse-field textarea,
.bse-field select {
  width: 100%;
  border: 1px solid rgba(204, 231, 247, 0.12);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(5, 11, 15, 0.98), rgba(10, 16, 23, 0.98));
  color: var(--bse-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.bse-field textarea {
  min-height: 128px;
  resize: vertical;
  padding: 0.9rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.55;
}

.bse-field select {
  padding: 0.78rem 0.95rem;
}

.bse-field textarea:focus,
.bse-field select:focus,
.bse-button:focus,
.bse-toggle:focus,
.bse-shell input[type="range"]:focus {
  outline: 2px solid rgba(86, 227, 185, 0.38);
  outline-offset: 2px;
}

.bse-inline-actions,
.bse-transport {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.bse-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  cursor: pointer;
  color: var(--bse-text);
  background:
    linear-gradient(180deg, rgba(37, 49, 60, 0.98), rgba(12, 18, 24, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 10px 16px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.bse-button:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 20px rgba(0, 0, 0, 0.2);
}

.bse-button--primary {
  color: #041612;
  border-color: rgba(255, 255, 255, 0.22);
  background: linear-gradient(180deg, var(--bse-accent-2), var(--bse-accent));
}

.bse-button--ghost {
  background: rgba(255, 255, 255, 0.02);
}

.bse-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.8rem;
  color: var(--bse-muted);
  font-size: 0.9rem;
}

.bse-switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--bse-accent);
}

.bse-slider-grid {
  display: grid;
  gap: 0.9rem;
}

.bse-field--slider {
  margin-bottom: 0;
}

.bse-shell input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(86, 227, 185, 0.2), rgba(255, 185, 106, 0.2));
  appearance: none;
}

.bse-shell input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: linear-gradient(180deg, #f2fbff, #8fe8ff);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.28);
}

.bse-shell input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(180deg, #f2fbff, #8fe8ff);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.28);
}

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

.bse-metric {
  padding: 0.9rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.bse-metric span {
  display: block;
  color: var(--bse-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  margin-bottom: 0.28rem;
}

.bse-metric strong {
  display: block;
  font-size: 1.05rem;
}

.bse-field.is-hidden {
  display: none;
}

.bse-editor-placeholder {
  padding: 1.2rem 1.25rem;
  border-radius: 24px;
  border: 1px solid rgba(196, 226, 244, 0.18);
  background:
    radial-gradient(circle at top left, rgba(90, 186, 255, 0.15), transparent 26%),
    linear-gradient(145deg, #17242d, #0c1319);
  color: var(--bse-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.bse-editor-placeholder__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--bse-muted);
}

.bse-editor-placeholder__title {
  margin: 0.45rem 0 0;
  font-size: 1.35rem;
}

.bse-editor-placeholder__text {
  margin: 0.55rem 0 0;
  color: var(--bse-muted);
}

.bse-editor-placeholder__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.bse-editor-placeholder__meta span {
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--bse-muted);
  font-size: 0.84rem;
}

@media (max-width: 980px) {
  .bse-layout {
    grid-template-columns: 1fr;
  }

  .bse-readouts {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    width: 100%;
  }
}

@media (max-width: 640px) {
  .bse-panel__header,
  .bse-layout {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .bse-panel__header {
    padding-top: 1rem;
  }

  .bse-brand {
    align-items: flex-start;
  }

  .bse-inline-actions,
  .bse-transport,
  .bse-metrics {
    grid-template-columns: 1fr;
  }

  .bse-byte {
    grid-template-columns: repeat(4, minmax(32px, 1fr));
  }
}
