:root {
  --bg: #0b0d12;
  --panel: rgba(17, 21, 34, 0.72);
  --panel2: rgba(12, 16, 28, 0.78);
  --border: #232a3a;
  --text: #e7eaf3;
  --muted: #9aa3b2;
  --accent: #5eead4;
  --accent2: #6366f1;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
  --radius: 18px;
}
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  color: var(--text);
  background: radial-gradient(
      1100px 520px at 18% 10%,
      rgba(94, 234, 212, 0.12),
      transparent 55%
    ),
    radial-gradient(
      900px 520px at 88% 20%,
      rgba(99, 102, 241, 0.16),
      transparent 55%
    ),
    radial-gradient(
      900px 520px at 50% 100%,
      rgba(236, 72, 153, 0.08),
      transparent 60%
    ),
    var(--bg);
  min-height: 100vh;
}

/* ------------ SETUP ------------ */
#setup {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.setupCard {
  width: min(1180px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.03),
    rgba(255, 255, 255, 0.015)
  );
  border-radius: 22px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.setupHeader {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.hLeft {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.brandRow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: 0.2px;
  font-size: 16px;
}
.badgeDot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.15);
}
.subText {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  max-width: 820px;
}

.hRight {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 320px;
}

label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-bottom: 6px;
}

input[type="number"] {
  width: 98px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 12, 18, 0.55);
  color: var(--text);
  outline: none;
}
input[type="number"]:focus {
  border-color: rgba(94, 234, 212, 0.35);
  box-shadow: 0 0 0 4px rgba(94, 234, 212, 0.1);
}

.btn {
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(94, 234, 212, 0.38);
  background: linear-gradient(
    180deg,
    rgba(94, 234, 212, 0.18),
    rgba(94, 234, 212, 0.08)
  );
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.2px;
  transition: transform 0.08s ease, filter 0.2s ease, border-color 0.2s ease,
    background 0.2s ease;
  user-select: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.btn:hover {
  filter: brightness(1.05);
}
.btn:active {
  transform: translateY(1px);
}

.btnGhost {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}
.btnGhost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btnOn {
  border-color: rgba(94, 234, 212, 0.55);
  background: linear-gradient(
    180deg,
    rgba(94, 234, 212, 0.24),
    rgba(94, 234, 212, 0.1)
  );
}

/* Start düyməsi 100% + mərkəz */
#startBtn {
  flex: 1 1 100%;
  width: 100%;
  justify-content: center;
  text-align: center;
}

.setupBody {
  padding: 14px 18px 14px;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--panel);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.cardHeader {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  font-size: 12.5px;
  font-weight: 900;
}

.chip {
  font-size: 11px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  font-weight: 800;
}

textarea {
  width: 100%;
  height: 330px;
  padding: 12px;
  border: 0;
  outline: none;
  resize: vertical;
  background: var(--panel2);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
textarea::placeholder {
  color: rgba(154, 163, 178, 0.55);
}
textarea:focus {
  box-shadow: inset 0 0 0 2px rgba(94, 234, 212, 0.18);
}

.assetsRow {
  display: flex;
  gap: 12px;
  padding: 0 18px 18px;
  align-items: stretch;
}

.assetBox {
  flex: 1;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 92px;
}
.assetTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.assetTitle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 12.5px;
  letter-spacing: 0.2px;
}
.assetTitle i {
  color: rgba(255, 255, 255, 0.75);
}
.assetHint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.assetInput {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
input[type="file"] {
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 12, 18, 0.35);
  color: var(--muted);
  width: min(520px, 100%);
}
.assetCount {
  font-size: 12px;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.02);
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 800;
  white-space: nowrap;
}

.setupFooter {
  padding: 12px 18px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.015);
}

/* ------------ IDE ------------ */
#ide {
  display: none;
  height: 100vh;
  width: 100vw;
}
.ideWrap {
  height: 100%;
  display: flex;
}

.sidebar {
  width: 260px;
  background: rgba(17, 21, 34, 0.65);
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

.sbTop {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}
.brand {
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent2);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.sub {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.fileList {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 4px;
}

.sectionLabel {
  padding: 10px 10px 6px;
  font-size: 11px;
  color: rgba(154, 163, 178, 0.95);
  text-transform: uppercase;
  letter-spacing: 0.9px;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.sectionLabel i {
  opacity: 0.9;
}

.file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  transition: background 0.15s ease, border 0.15s ease;
  user-select: none;
}
.file:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
}
.file.active {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
}

.ico {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-weight: 900;
  color: var(--muted);
  flex: 0 0 auto;
}
.ico i {
  font-size: 14px;
  line-height: 1;
}

.ico-html {
  color: #f59e0b;
}
.ico-css {
  color: #60a5fa;
}
.ico-js {
  color: #facc15;
}
.ico-asset {
  color: rgba(231, 234, 243, 0.9);
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.fname {
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hint {
  font-size: 11px;
  color: var(--muted);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border);
  background: rgba(11, 13, 18, 0.25);
}

.mainTop {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.tabTitle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 13px;
}
.pill {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  font-weight: 800;
}
.progress {
  font-size: 12px;
  color: var(--muted);
}

.editorArea {
  flex: 1;
  overflow: auto;
  padding: 14px;
  background: rgba(30, 30, 30, 0.55);
}

pre {
  margin: 0;
}
code {
  white-space: pre-wrap;
}

.preview {
  width: 50%;
  background: #0d1018;
  position: relative;
  overflow: hidden;
}
.previewTop {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
  font-size: 12px;
}
.frames {
  position: absolute;
  inset: 52px 0 0 0;
}
.previewFrame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  background: transparent;
}
.fadeIn {
  opacity: 0;
  animation: fadeIn 240ms ease-out forwards;
}
@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(17, 21, 34, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--text);
  font-size: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* -------- Camera bubble (fixed bottom-left) -------- */
.camBubble {
  position: fixed;
  left: 16px;
  bottom: 16px;
  width: 170px;
  height: 170px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.55);
  display: none;
  z-index: 10000;
  backdrop-filter: blur(6px);
}
.camBubble.show {
  display: block;
}
.camBubble video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: block;
}
.camRing {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  pointer-events: none;
  box-shadow: inset 0 0 0 3px rgba(94, 234, 212, 0.18);
}
.camBadge {
  position: absolute;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(231, 234, 243, 0.95);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
  min-width: 92px;
  text-align: center;
}
.camDot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
}

@media (max-width: 980px) {
  .grid {
    grid-template-columns: 1fr;
  }
  textarea {
    height: 250px;
  }
  .preview {
    width: 45%;
  }
  .sidebar {
    width: 230px;
  }
  .assetsRow {
    flex-direction: column;
  }
  .camBubble {
    width: 140px;
    height: 140px;
    left: 12px;
    bottom: 12px;
  }
}
