:root {
  --sky-top: #8FE3D8;
  --sky-bottom: #6FD1E8;
  --panel: #FFFFFF;
  --ink: #1F3B45;
  --ink-soft: #4B6B72;
  --coral: #FF7A59;
  --coral-dark: #E85F3E;
  --gold: #FFB93F;
  --line: #DCEFEF;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky-top), var(--sky-bottom));
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 3px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--coral), var(--gold));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-size: 20px; font-weight: 800; color: var(--ink); }
.brand-sub { font-size: 13px; color: var(--ink-soft); }

.topbar-actions { display: flex; gap: 10px; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px) scale(0.98); }

.btn-run {
  background: var(--coral);
  color: white;
  box-shadow: 0 3px 0 var(--coral-dark);
}
.btn-run:hover { box-shadow: 0 4px 10px rgba(232,95,62,0.4); }

.btn-reset {
  background: var(--panel);
  color: var(--ink-soft);
  border: 2px solid var(--line);
}
.btn-reset:hover { background: #F3FAFA; }

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 38%) 1fr;
  height: calc(100% - 68px);
}

.blockly-pane {
  background: var(--panel);
  border-right: 3px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.pane-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 8px;
}

#blocklyDiv {
  flex: 1;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid var(--line);
}

.scene-pane {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

#sceneContainer {
  width: 100%;
  height: 100%;
}

#sceneContainer canvas {
  display: block;
}

.hint {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.92);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  white-space: nowrap;
}

.banner {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 14px 28px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 800;
  color: white;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  opacity: 0;
  transition: all 0.25s ease;
  pointer-events: none;
}

.banner.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.banner.win { background: linear-gradient(135deg, #34C759, #1FA24A); }
.banner.fail { background: linear-gradient(135deg, #FF6B6B, #E84C4C); }

.hidden { display: none; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
  .blockly-pane { border-right: none; border-bottom: 3px solid var(--line); }
}
