:root {
  color-scheme: dark;
  --bg: #070a12;
  --panel: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.12);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.72);
  --nav-h: 56px;
  --sidebar-w: 340px;
  --drawer-w: 560px;
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: radial-gradient(1200px 800px at 30% 10%, rgba(99, 102, 241, 0.14), transparent 60%),
    radial-gradient(900px 700px at 80% 20%, rgba(16, 185, 129, 0.08), transparent 55%), var(--bg);
  color: var(--text);
  font: 14px/1.45 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.brand {
  font-weight: 650;
}

.muted {
  color: var(--muted);
}

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(7, 10, 18, 0.55);
  backdrop-filter: blur(14px);
}

.nav-left {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.nav-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.shell {
  position: relative;
  height: calc(100vh - var(--nav-h));
  margin-top: var(--nav-h);
  display: flex;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 180ms ease, flex-basis 180ms ease, transform 180ms ease, opacity 180ms ease;
  will-change: width, flex-basis, transform, opacity;
}

body.slides-hidden .sidebar {
  width: 0;
  flex-basis: 0;
  opacity: 0;
  transform: translateX(-12px);
  border-right: 0;
  pointer-events: none;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

h2 {
  margin: 0 0 10px;
  font-size: 14px;
}

.form {
  display: grid;
  gap: 8px;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 10px;
  font: inherit;
  -webkit-user-select: text;
  user-select: text;
}

.textarea {
  min-height: 80px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
}

.scene-editor {
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  overflow: auto;
  max-height: min(420px, 48vh);
  overscroll-behavior: contain;
  background: rgba(0, 0, 0, 0.12);
}

.scene-row {
  display: grid;
  grid-template-columns: 52px 1fr 120px 110px 148px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.scene-row:last-child {
  border-bottom: 0;
}

.scene-idx {
  color: rgba(255, 255, 255, 0.72);
  font-variant-numeric: tabular-nums;
}

.scene-input {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.22);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  -webkit-user-select: text;
  user-select: text;
}

.scene-input.tc {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-variant-numeric: tabular-nums;
}

.scene-input.invalid {
  border-color: rgba(244, 63, 94, 0.7);
}

.scene-input.small {
  width: 100%;
}

.scene-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.icon-btn.danger {
  border-color: rgba(244, 63, 94, 0.5);
  background: rgba(244, 63, 94, 0.08);
}

.scene-hint {
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.68);
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.row.compact {
  gap: 8px;
}

.spacer {
  flex: 1;
}

.hr {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 12px 0;
}

.pill {
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.22);
  font-variant-numeric: tabular-nums;
}

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

.input.small {
  width: 88px;
  padding: 8px 10px;
}

.blocker {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.88);
  padding: 18px;
  overflow: auto;
}

.blocker-card {
  width: 100%;
  max-width: 560px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 16px 16px;
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.7);
}

.blocker-title {
  font-weight: 650;
  font-size: 16px;
  margin-bottom: 8px;
}

.blocker-text {
  color: rgba(255, 255, 255, 0.78);
  overflow-wrap: anywhere;
}

.hidden {
  display: none !important;
}

.btn {
  appearance: none;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.btn:focus,
.icon-btn:focus,
.slide-item:focus {
  outline: none;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.slide-item:focus-visible {
  outline: 2px solid rgba(99, 102, 241, 0.55);
  outline-offset: 2px;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.02);
}

.btn.primary {
  background: rgba(99, 102, 241, 0.18);
  border-color: rgba(99, 102, 241, 0.55);
}

.icon-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  width: 42px;
  height: 40px;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.icon-btn.sm {
  width: 40px;
  height: 38px;
  border-radius: 12px;
}

.icon {
  font-size: 16px;
  line-height: 1;
}

.slides {
  margin: 0;
  overflow: auto;
  background: transparent;
  flex: 1;
}

.slide-item {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  width: 100%;
  text-align: left;
  font: inherit;
}

.slide-item:last-child {
  border-bottom: 0;
}

.slide-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.slide-item.active {
  background: rgba(99, 102, 241, 0.16);
}

video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: black;
  object-fit: contain;
}

.vdo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: black;
}

.vdo iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: black;
}

.activity-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: transparent;
  pointer-events: auto;
  touch-action: manipulation;
}

.start-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(900px 600px at 40% 20%, rgba(99, 102, 241, 0.18), transparent 60%),
    rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
  cursor: pointer;
  user-select: none;
}

.start-card {
  width: 100%;
  max-width: 520px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(7, 10, 18, 0.7);
  backdrop-filter: blur(16px);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.68);
  padding: 16px 16px;
  text-align: center;
}

.start-title {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}

.start-text {
  color: rgba(255, 255, 255, 0.78);
  overflow-wrap: anywhere;
}

.stage {
  position: relative;
  flex: 1;
  overflow: hidden;
}

.stage.cursor-hidden,
.stage.cursor-hidden * {
  cursor: none !important;
}

.transport {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
  padding: 0 12px;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 220ms ease, transform 220ms ease;
  will-change: opacity, transform;
}

.transport.is-hidden {
  opacity: 0;
  transform: translateY(12px);
}

.transport.is-hidden .transport-card {
  pointer-events: none;
}

.transport-card {
  pointer-events: auto;
  display: inline-flex;
  width: max-content;
  max-width: calc(100% - 24px);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(7, 10, 18, 0.58);
  backdrop-filter: blur(16px);
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.68);
  padding: 8px 8px;
}

.transport-top {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 34;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 160ms ease;
}

.backdrop.open {
  opacity: 1;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(var(--drawer-w), 92vw);
  z-index: 36;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 10, 18, 0.72);
  backdrop-filter: blur(18px);
  transform: translateX(20px);
  opacity: 0;
  transition: transform 180ms ease, opacity 180ms ease;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
  opacity: 1;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-title {
  font-weight: 650;
}

.drawer-body {
  padding: 12px 12px 18px;
  overflow: auto;
}

@media (max-width: 860px) {
  .sidebar {
    width: min(280px, 42vw);
    flex-basis: min(280px, 42vw);
  }
}
