.bc-page {
  background: #FFD500; /* Scratch Yellow Background */
  color: #333;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.bc-top-nav {
  height: 50px;
  background: #4D97FF; /* Scratch Blue Nav Bar */
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1rem;
  position: relative;
  z-index: 10;
  color: white;
}

.bc-nav-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 800;
  color: #FFFFFF;
  letter-spacing: 0.3px;
  font-size: 1.1rem;
}

.bc-nav-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.bc-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  font-size: 0.85rem;
}

.bc-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.bc-btn-primary {
  background: #FFAB19; /* Scratch Orange */
  border: none;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

.bc-btn-primary:hover {
  background: #FFBF00;
}

.bc-workspace {
  display: grid;
  grid-template-columns: 250px 1fr 340px; /* Palette | Script | Stage */
  grid-template-rows: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.5rem;
  height: calc(100vh - 50px);
}

.bc-panel {
  background: #FFFFFF;
  border-radius: 8px;
  border: 1px solid #D9D9D9;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  position: relative;
  display: flex;
  flex-direction: column;
}

.bc-panel-header {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #D9D9D9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  background: #F2F2F2;
  color: #575E75;
  font-weight: 700;
  font-size: 0.8rem;
}

.bc-panel-body {
  padding: 0.5rem;
  overflow: hidden;
  flex: 1;
}

.bc-chat-panel {
  grid-column: 3;
  grid-row: 2;
}

.bc-builder-panel {
  grid-column: 1 / span 2;
  grid-row: 1 / span 2;
  display: grid;
  grid-template-columns: 250px 1fr;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.bc-world-panel {
  grid-column: 3;
  grid-row: 1;
}

.bc-chat-container {
  padding: 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  background: white;
}

.bc-msg {
  display: flex;
  gap: 0.75rem;
  animation: bc-slideIn 0.2s ease-out forwards;
}

@keyframes bc-slideIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bc-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid #4D97FF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: #E1F0FF;
  flex-shrink: 0;
}

.bc-msg-content {
  background: #F2F2F2;
  border: 1px solid #D9D9D9;
  padding: 0.5rem 0.75rem;
  border-radius: 4px 12px 12px 12px;
  color: #333;
  font-size: 0.85rem;
  line-height: 1.4;
}

.bc-msg-content blockquote {
  margin: 0.4rem 0 0;
  border-left: 2px solid #4D97FF;
  padding-left: 0.5rem;
  color: #4D97FF;
  font-family: monospace;
  font-size: 0.8rem;
}

.bc-agent-actions {
  padding: 0.5rem 0.75rem;
  border-top: 1px solid #D9D9D9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  background: #F2F2F2;
}

.bc-agent-progress {
  color: #575E75;
  font-weight: 700;
  font-size: 0.8rem;
}

.bc-builder-split {
  display: contents; /* Grid layout is handled by bc-builder-panel from parent */
}

.bc-block-palette,
.bc-script-area {
  overflow: auto;
  padding: 0.75rem;
  background: white;
  border: 1px solid #D9D9D9;
}

.bc-block-palette {
  background: #F9F9F9;
  border-right: 1px solid #D9D9D9;
  border-radius: 8px 0 0 8px;
}

.bc-script-area {
  background: #F9F9F9;
  background-image: radial-gradient(#D9D9D9 1px, transparent 1px);
  background-size: 20px 20px;
  border-left: none;
  border-radius: 0 8px 8px 0;
}

.bc-section-title {
  color: #575E75;
  font-weight: 700;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bc-palette-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.bc-block-btn {
  text-align: left;
  border-radius: 4px 16px 16px 4px;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.15);
  background: #4C97FF; /* Default Motion Color */
  color: white;
  cursor: pointer;
  font-weight: 600;
  transition: transform 0.1s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  position: relative;
}

.bc-block-btn:hover {
  transform: scale(1.02);
  z-index: 2;
}

.bc-block-card {
  border-radius: 4px 20px 20px 4px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.4rem;
  background: white;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: fit-content;
  min-width: 140px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
}

.bc-block-card.highlight {
  border: 2px solid #FFAB19;
  box-shadow: 0 0 0 4px rgba(255, 171, 25, 0.3);
}

.bc-block-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.bc-block-label {
  font-weight: 600;
  letter-spacing: 0.1px;
  color: white;
  font-size: 0.85rem;
}

.bc-block-meta {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

.bc-block-actions {
  display: flex;
  gap: 0.2rem;
}

.bc-icon-btn {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  font-weight: 700;
  font-size: 10px;
  transition: background 0.12s ease;
}

.bc-icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.3);
}

.bc-icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.bc-block-inner {
  border-radius: 4px 12px 12px 4px;
  padding: 0.4rem;
  border-left: 10px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.05);
  margin-top: 0.25rem;
}

.bc-block-inner-title {
  color: white;
  font-weight: 600;
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
  opacity: 0.9;
}

.bc-script-controls {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #D9D9D9;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.bc-script-empty {
  color: #A0A0A0;
  font-weight: 500;
  padding: 1rem 0.5rem;
  font-size: 0.85rem;
  font-style: italic;
}

.bc-world-body {
  padding: 0.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #F9F9F9;
}

.bc-canvas-wrap {
  border-radius: 8px;
  border: 2px solid #D9D9D9;
  background: white;
  padding: 0.5rem;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.bc-canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  display: block;
}

.bc-world-hud {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: center;
  color: #575E75;
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
}

.bc-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: #4D97FF;
  color: white;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid white;
}

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

.bc-choice-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.bc-choice-card {
  width: min(680px, 92vw);
  border-radius: 12px;
  border: 4px solid #4D97FF;
  background: white;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.bc-choice-header {
  padding: 0.75rem 1rem;
  border-bottom: 2px solid #F2F2F2;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: #E1F0FF;
}

.bc-choice-title {
  font-weight: 800;
  color: #4D97FF;
  font-size: 1.1rem;
}

.bc-choice-body {
  padding: 1rem;
}

.bc-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.bc-choice-option {
  border-radius: 10px;
  border: 2px solid #F2F2F2;
  background: #FFFFFF;
  padding: 0.85rem;
  cursor: pointer;
  transition: all 0.1s ease;
  min-height: 120px;
  text-align: left;
}

.bc-choice-option:hover {
  border-color: #4D97FF;
  background: #F9FBFF;
}

.bc-choice-option h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: #4D97FF;
}

.bc-choice-option p {
  margin: 0;
  color: #575E75;
  font-weight: 500;
  line-height: 1.3;
  font-size: 0.8rem;
}

.bc-hint-bar {
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid #D9D9D9;
  background: #E1F0FF;
  color: #4D97FF;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.bc-hint-bar small {
  color: #575E75;
  font-weight: 600;
}

@media (max-width: 980px) {
  .bc-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    height: auto;
    padding-bottom: 2rem;
  }
  .bc-chat-panel,
  .bc-builder-panel,
  .bc-world-panel {
    grid-column: 1;
  }
  .bc-chat-panel,
  .bc-builder-panel {
    grid-row: auto;
    min-height: 280px;
  }
  .bc-world-panel {
    grid-row: auto;
    min-height: 520px;
  }
  .bc-canvas {
    max-width: 520px;
    max-height: 520px;
  }
  .bc-choice-grid {
    grid-template-columns: 1fr;
  }
}

