﻿:root {
  --bg: #1e1e1e;
  --titlebar: #181818;
  --activity: #333333;
  --sidebar: #252526;
  --panel: #1f1f1f;
  --panel-2: #242424;
  --border: #2f2f2f;
  --line: #3f3f46;
  --line-active: #007acc;
  --text: #d4d4d4;
  --muted: #8d8d8d;
  --accent: #0e639c;
  --accent-strong: #1177bb;
  --unity: #57b6ff;
  --unity-green: #42be65;
  --ok: #42be65;
  --error: #f44747;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #111;
  color: var(--text);
  font-family: Manrope, "Segoe UI", sans-serif;
}

.vscode-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 38px 1fr 24px;
  background: var(--bg);
}

.titlebar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
  background: var(--titlebar);
}

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

.vscode-mark {
  color: #2ea8ff;
  font-size: 0.88rem;
}

.menu-bar {
  display: flex;
  gap: 10px;
  color: #cccccc;
  font-size: 0.8rem;
}

.command-box {
  max-width: 520px;
  margin: 0 auto;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  height: 28px;
  line-height: 26px;
  text-align: center;
  color: #c5c5c5;
  background: #1f1f1f;
  font-size: 0.86rem;
}

.titlebar-right {
  display: flex;
  gap: 6px;
}

.window-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #666;
}

.workbench {
  min-height: 0;
  display: grid;
  grid-template-columns: 48px 290px 1fr;
}

.activity-bar {
  background: var(--activity);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
  gap: 8px;
}

.activity-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: #b7b7b7;
  cursor: pointer;
  font-size: 0.94rem;
}

.activity-btn:hover {
  background: #454545;
}

.activity-btn.is-active {
  border-left-color: #fff;
  color: #fff;
}

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
}

.sidebar-header h1 {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  color: #bbbbbb;
  letter-spacing: 0.08em;
}

.project-name {
  margin-top: 12px;
  margin-bottom: 4px;
  font-size: 0.88rem;
  font-weight: 800;
}

.sidebar-hint {
  margin: 0 0 8px;
  color: #a6a6a6;
  font-size: 0.75rem;
}

.file-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
  max-height: calc(100vh - 145px);
  overflow: auto;
  scrollbar-color: #4a4a4a #252526;
  scrollbar-width: thin;
}

.file-list::-webkit-scrollbar {
  width: 10px;
}

.file-list::-webkit-scrollbar-track {
  background: #252526;
}

.file-list::-webkit-scrollbar-thumb {
  background: #4a4a4a;
  border-radius: 8px;
  border: 2px solid #252526;
}

.file-list::-webkit-scrollbar-thumb:hover {
  background: #5a5a5a;
}

.file-item {
  padding: 7px 8px;
  font: 500 0.84rem/1.35 "JetBrains Mono", "Consolas", monospace;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #cccccc;
}

.file-item.is-active {
  background: #094771;
  border-color: #0e639c;
  color: #ffffff;
}

.task-btn {
  width: 100%;
  text-align: left;
  cursor: pointer;
  background: transparent;
}

.task-btn:hover {
  background: #2f2f2f;
}

.editor-host {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 36px 1fr;
}

.editor-tabs {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: #2d2d2d;
  min-height: 0;
}

.tab {
  display: flex;
  align-items: center;
  padding: 0 12px;
  font: 700 0.84rem/1 "JetBrains Mono", "Consolas", monospace;
  color: #cfcfcf;
  border-right: 1px solid #3a3a3a;
}

.tab.is-active {
  background: #1e1e1e;
  border-top: 2px solid var(--line-active);
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

.btn {
  border: 1px solid #3f3f46;
  background: #313131;
  color: #e8e8e8;
  border-radius: 6px;
  height: 26px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover {
  background: #3a3a3a;
}

.btn-primary {
  background: var(--accent);
  border-color: #1585ce;
}

.btn-primary:hover {
  background: var(--accent-strong);
}

.editor-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(280px, 360px);
}

.editor-panel,
.bank-panel {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.editor-panel {
  background: var(--panel);
  border-right: 1px solid var(--border);
}

.bank-panel {
  background: var(--panel-2);
}

.panel-head {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #a8a8a8;
  margin-bottom: 8px;
}

.task-title {
  margin-bottom: 8px;
  font: 700 0.88rem/1.3 "JetBrains Mono", "Consolas", monospace;
  color: #d6ebff;
}

.hint {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.examples-panel {
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  background: #181818;
}

.examples-title {
  margin: 0;
  color: #d6ebff;
  font: 700 0.78rem/1.3 "JetBrains Mono", "Consolas", monospace;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.examples-title::-webkit-details-marker {
  display: none;
}

.examples-title::before {
  content: "▸ ";
  color: #8fb7d6;
}

.examples-panel[open] .examples-title {
  margin-bottom: 8px;
}

.examples-panel[open] .examples-title::before {
  content: "▾ ";
}

.task-examples {
  display: grid;
  gap: 8px;
}

.task-example-item {
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  background: #151515;
  padding: 6px 8px;
}

.task-example-label {
  margin: 0 0 4px;
  color: #a9a9a9;
  font: 700 0.72rem/1 "JetBrains Mono", "Consolas", monospace;
}

.task-example-subtitle {
  margin: 0 0 4px;
  color: #8fb7d6;
  font: 700 0.72rem/1 "JetBrains Mono", "Consolas", monospace;
}

.task-example-code {
  margin: 0;
  white-space: pre-wrap;
  color: #d8d8d8;
  font: 500 0.78rem/1.4 "JetBrains Mono", "Consolas", monospace;
}

.task-goal {
  margin: 0;
  color: #d8d8d8;
  font: 600 0.8rem/1.45 Manrope, "Segoe UI", sans-serif;
}

.editor-slots {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.editor-slot {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.slot-index {
  color: #858585;
  font: 500 0.78rem/1 "JetBrains Mono", "Consolas", monospace;
  text-align: right;
}

.slot-drop-zone {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  background: #202020;
}

.slot-drop-zone.is-empty {
  color: #6f6f6f;
}

.slot-drop-zone.is-over {
  border-color: #1585ce;
  background: #17232d;
}

.code-line {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  width: 100%;
  color: #dcdcdc;
  font: 500 0.83rem/1.35 "JetBrains Mono", "Consolas", monospace;
}

.brace-line {
  color: #ffd166;
  font-weight: 800;
}

.py-token-keyword {
  color: #569cd6;
}

.py-token-string {
  color: #ce9178;
}

.py-token-number {
  color: #b5cea8;
}

.py-token-comment {
  color: #6a9955;
}

.py-token-builtin {
  color: #4ec9b0;
}

.py-token-function {
  color: #dcdcaa;
}

.py-token-operator {
  color: #d4d4d4;
}

.slot-tools {
  display: flex;
  gap: 4px;
}

.tool-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #4a4a4a;
  background: #2f2f2f;
  color: #d8d8d8;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.78rem;
}

.brace-tool {
  color: #ffd166;
  border-color: #725f2a;
}

.brace-tool:hover:enabled {
  background: #41361d;
}

.tool-btn:hover:enabled {
  background: #3a3a3a;
}

.tool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.result {
  margin-top: 10px;
  min-height: 46px;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  background: #181818;
  padding: 8px 10px;
  font-size: 0.83rem;
  line-height: 1.4;
  white-space: pre-wrap;
}

.result.is-ok {
  border-color: color-mix(in srgb, var(--ok) 55%, #2f2f2f);
  color: #c5f2d3;
}

.result.is-error {
  border-color: color-mix(in srgb, var(--error) 70%, #2f2f2f);
  color: #ffd3d3;
}

.solution-preview {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #3f3f46;
  background: #161616;
  color: #d8d8d8;
  white-space: pre-wrap;
  font: 500 0.8rem/1.45 "JetBrains Mono", "Consolas", monospace;
}

.code-bank {
  display: grid;
  gap: 7px;
  align-content: start;
}

.code-block {
  width: 100%;
  border: 1px solid #494949;
  background: #1f1f1f;
  color: #e8e8e8;
  border-radius: 6px;
  padding: 8px 9px;
  text-align: left;
  cursor: grab;
}

.code-block:active {
  cursor: grabbing;
}

.code-block:hover {
  background: #2a2a2a;
}

.code-block.is-selected {
  border-color: #1495eb;
  box-shadow: 0 0 0 1px #1495eb;
}

.bank-placeholder {
  border: 1px dashed #4a4a4a;
  border-radius: 6px;
  padding: 10px;
  color: #969696;
  font-size: 0.8rem;
}

.test-head {
  margin-top: 14px;
}

.test-scene {
  position: relative;
  height: 210px;
  overflow: hidden;
  border: 1px solid #3f3f46;
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 28%, rgba(87, 182, 255, 0.2), transparent 34%),
    linear-gradient(#111a22 0 55%, #151515 55% 100%);
  perspective: 720px;
  cursor: pointer;
}

.grid-floor {
  position: absolute;
  left: -15%;
  right: -15%;
  bottom: -26px;
  height: 105px;
  transform: rotateX(62deg);
  transform-origin: bottom;
  background-image:
    linear-gradient(rgba(87, 182, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(87, 182, 255, 0.16) 1px, transparent 1px);
  background-size: 28px 28px;
}

.test-object {
  --object-color: #4ea1ff;
  position: absolute;
  left: calc(50% - 30px);
  top: 86px;
  width: 60px;
  height: 60px;
  background: var(--object-color);
  box-shadow:
    inset -14px -16px 0 rgba(0, 0, 0, 0.25),
    0 18px 28px rgba(0, 0, 0, 0.32);
  transition: transform 260ms ease, opacity 260ms ease, background 180ms ease;
}

.test-object::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  top: -28px;
  transform: translateX(-50%);
  color: #d6ebff;
  white-space: nowrap;
  font: 800 0.68rem/1 "JetBrains Mono", "Consolas", monospace;
}

.test-object.cube {
  border-radius: 6px;
  transform: rotateX(55deg) rotateZ(45deg);
}

.test-object.sphere {
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.72), transparent 18%),
    var(--object-color);
}

.test-object.is-destroyed {
  opacity: 0;
  transform: scale(0.25);
}

.test-target,
.test-coin,
.test-projectile,
.test-camera {
  position: absolute;
  pointer-events: none;
}

.test-target {
  right: 36px;
  top: 82px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffcb6b;
  box-shadow: 0 0 24px rgba(255, 203, 107, 0.45);
}

.test-coin {
  right: 58px;
  top: 100px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 5px solid #ffd166;
  background: #9b6b00;
  box-shadow: 0 0 22px rgba(255, 209, 102, 0.45);
}

.test-projectile {
  left: 50%;
  top: 106px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ff9cac;
  opacity: 0;
  box-shadow: 0 0 18px rgba(255, 156, 172, 0.55);
}

.test-camera {
  left: 46px;
  top: 38px;
  width: 150px;
  height: 104px;
  border: 2px solid rgba(87, 182, 255, 0.7);
  border-radius: 6px;
  box-shadow: 0 0 18px rgba(87, 182, 255, 0.18);
}

.test-status {
  margin: 8px 0 0;
  min-height: 36px;
  color: #bdbdbd;
  font: 600 0.78rem/1.45 Manrope, "Segoe UI", sans-serif;
}

.test-scene.is-running.effect-spin .test-object {
  animation: spin-object 1.5s linear infinite;
}

.test-scene.is-running.effect-move-right .test-object,
.test-scene.is-running.effect-clamp .test-object {
  animation: move-right-object 2s ease-in-out infinite alternate;
}

.test-scene.is-running.effect-bob .test-object,
.test-scene.is-running.effect-jump .test-object {
  animation: bob-object 1.15s ease-in-out infinite alternate;
}

.test-scene.is-running.effect-grow .test-object {
  animation: grow-object 1.7s ease-in-out infinite alternate;
}

.test-scene.is-running.effect-ping-pong .test-object,
.test-scene.is-running.effect-patrol .test-object {
  animation: ping-pong-object 1.8s ease-in-out infinite alternate;
}

.test-scene.is-running.effect-look-at .test-object {
  transform: translateX(40px) rotateZ(25deg);
}

.test-scene.is-running.effect-distance-color .test-object {
  animation: distance-color-object 1.7s ease-in-out infinite alternate;
}

.test-scene.is-running.effect-danger .test-object {
  animation: danger-reset-object 1.8s ease-in-out infinite;
}

.test-scene.is-running.effect-timer .test-object {
  animation: timer-destroy-object 2.6s ease-in-out infinite;
}

.test-scene.is-running.effect-spawn .test-projectile,
.test-scene.is-running.effect-shoot .test-projectile {
  opacity: 1;
  animation: projectile-object 1.2s ease-out infinite;
}

.test-scene.is-running.effect-camera .test-object {
  animation: camera-follow-object 1.7s ease-in-out infinite alternate;
}

.test-scene.is-running.effect-camera .test-camera {
  animation: camera-frame-object 1.7s ease-in-out infinite alternate;
}

@keyframes spin-object {
  from {
    transform: rotateX(55deg) rotateZ(45deg) rotateY(0deg);
  }
  to {
    transform: rotateX(55deg) rotateZ(45deg) rotateY(360deg);
  }
}

@keyframes move-right-object {
  from {
    transform: translateX(-52px) rotateX(55deg) rotateZ(45deg);
  }
  to {
    transform: translateX(52px) rotateX(55deg) rotateZ(45deg);
  }
}

@keyframes bob-object {
  from {
    transform: translateY(28px);
  }
  to {
    transform: translateY(-34px);
  }
}

@keyframes grow-object {
  from {
    transform: scale(0.7) rotateX(55deg) rotateZ(45deg);
  }
  to {
    transform: scale(1.4) rotateX(55deg) rotateZ(45deg);
  }
}

@keyframes ping-pong-object {
  from {
    transform: translateX(-64px);
  }
  to {
    transform: translateX(64px);
  }
}

@keyframes distance-color-object {
  from {
    background: #f44747;
    transform: translateX(-48px);
  }
  to {
    background: #42be65;
    transform: translateX(48px);
  }
}

@keyframes danger-reset-object {
  0%,
  100% {
    transform: translateX(-58px) rotateX(55deg) rotateZ(45deg);
  }
  50% {
    transform: translateX(70px) rotateX(55deg) rotateZ(45deg);
  }
  62% {
    transform: translateX(-58px) rotateX(55deg) rotateZ(45deg);
  }
}

@keyframes timer-destroy-object {
  0%,
  58% {
    opacity: 1;
    transform: scale(1);
  }
  85%,
  100% {
    opacity: 0;
    transform: scale(0.2);
  }
}

@keyframes projectile-object {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(96px);
  }
}

@keyframes camera-follow-object {
  from {
    transform: translateX(-36px);
  }
  to {
    transform: translateX(40px);
  }
}

@keyframes camera-frame-object {
  from {
    transform: translateX(-24px);
  }
  to {
    transform: translateX(28px);
  }
}

.statusbar {
  background: #007acc;
  color: #f3fbff;
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 10px;
}

@media (max-width: 1200px) {
  .workbench {
    grid-template-columns: 44px 240px 1fr;
  }

  .editor-grid {
    grid-template-columns: 1fr 300px;
  }
}

@media (max-width: 980px) {
  .vscode-shell {
    grid-template-rows: auto 1fr 24px;
  }

  .titlebar {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 8px;
  }

  .titlebar-right {
    display: none;
  }

  .workbench {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .activity-bar {
    display: none;
  }

  .sidebar {
    display: block;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  .sidebar-header {
    display: none;
  }

  .project-name {
    margin-top: 0;
  }

  .file-list {
    display: flex;
    gap: 6px;
    width: 100%;
    min-width: 0;
    max-height: none;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .file-list li {
    flex: 0 0 auto;
  }

  .task-btn {
    white-space: nowrap;
  }

  .editor-grid {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .editor-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 560px) {
  body {
    overflow-x: hidden;
  }

  .menu-bar {
    gap: 8px;
    font-size: 0.76rem;
  }

  .editor-host {
    grid-template-rows: auto 1fr;
    min-width: 0;
  }

  .editor-tabs {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .tab {
    min-height: 34px;
  }

  .editor-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 6px 8px;
  }

  .btn {
    width: 100%;
    height: auto;
    min-height: 30px;
    padding: 4px 8px;
    white-space: normal;
  }

  .editor-panel,
  .bank-panel {
    padding: 12px;
    min-width: 0;
  }

  .editor-slot {
    grid-template-columns: 26px minmax(0, 1fr);
    align-items: start;
  }

  .slot-drop-zone {
    min-width: 0;
  }

  .slot-tools {
    grid-column: 2;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .tool-btn {
    width: 28px;
    height: 26px;
  }

  .test-scene {
    height: 205px;
  }

  .statusbar {
    min-height: 24px;
    height: auto;
    justify-content: center;
    flex-wrap: wrap;
  }
}
