/* ==========================================================================
   PROJECT ARES — Scratch-style block renderer
   Pure CSS. No images, no JS at runtime, no external fonts.
   Palette is the official Scratch 3 category palette.
   ========================================================================== */

:root {
  --sb-motion:    #4C97FF;
  --sb-looks:     #9966FF;
  --sb-sound:     #CF63CF;
  --sb-events:    #FFBF00;
  --sb-control:   #FFAB19;
  --sb-sensing:   #5CB1D6;
  --sb-operators: #59C059;
  --sb-variables: #FF8C1A;
  --sb-myblocks:  #FF6680;
  --sb-pen:       #0FBD8C;
  --sb-ink:       #575E75;
  --sb-ink-soft:  #8B93A7;
}

.sb-script {
  margin: 18px 0 22px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  break-inside: avoid;
  page-break-inside: avoid;
}

.sb-stack { display: block; }

/* --- base block ---------------------------------------------------------- */
.sb-block {
  position: relative;
  display: block;
  width: max-content;
  max-width: 100%;
  min-width: 120px;
  padding: 8px 12px;
  margin: 0;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.1px;
  background: var(--sb-motion);
  border-radius: 4px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12),
              inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* the notch that makes blocks look like they snap together */
.sb-block::before {
  content: "";
  position: absolute;
  left: 14px;
  bottom: -3px;
  width: 14px;
  height: 4px;
  border-radius: 0 0 4px 4px;
  background: inherit;
}
.sb-block + .sb-block { margin-top: 1px; }

/* --- categories ---------------------------------------------------------- */
.sb-motion    { background: var(--sb-motion); }
.sb-looks     { background: var(--sb-looks); }
.sb-sound     { background: var(--sb-sound); }
.sb-events    { background: var(--sb-events); }
.sb-control   { background: var(--sb-control); }
.sb-sensing   { background: var(--sb-sensing); }
.sb-operators { background: var(--sb-operators); }
.sb-variables { background: var(--sb-variables); }
.sb-myblocks  { background: var(--sb-myblocks); }
.sb-pen       { background: var(--sb-pen); }

/* --- hats ---------------------------------------------------------------- */
.sb-hat {
  border-radius: 20px 20px 4px 4px;
  padding-top: 12px;
}
.sb-hat::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 20px 20px 4px 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.10);
  pointer-events: none;
}

/* --- C-blocks (repeat / forever / if / if-else) -------------------------- */
.sb-c {
  padding: 0;
  background: transparent;
  box-shadow: none;
  width: max-content;
  max-width: 100%;
  color: #fff;
}
.sb-c::before { display: none; }

.sb-c > .sb-head {
  position: relative;
  padding: 8px 12px;
  background: var(--sb-control);
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.sb-c.sb-hat > .sb-head {
  border-radius: 20px 20px 0 0;
  padding-top: 12px;
}

.sb-c > .sb-body {
  position: relative;
  padding: 4px 0 4px 16px;
}
.sb-c > .sb-body::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 16px;
  background: var(--sb-control);
}
.sb-c > .sb-body > .sb-block,
.sb-c > .sb-body > .sb-c { margin-left: 4px; }
.sb-c > .sb-body:empty::after {
  content: "";
  display: block;
  height: 20px;
}

.sb-mouth {
  position: relative;
  height: 16px;
  background: var(--sb-control);
  border-radius: 0 0 4px 4px;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}
.sb-mouth::after {
  content: "";
  position: absolute;
  left: 14px;
  bottom: -3px;
  width: 14px;
  height: 4px;
  border-radius: 0 0 4px 4px;
  background: inherit;
  z-index: 2;
}

.sb-elsebar {
  position: relative;
  padding: 7px 12px;
  background: var(--sb-control);
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

/* --- reporters and inputs ------------------------------------------------ */
.sb-num,
.sb-oval,
.sb-round {
  display: inline-block;
  padding: 3px 8px;
  margin: 0 3px;
  background: #fff;
  color: var(--sb-ink);
  font-weight: 500;
  font-size: 12px;
  vertical-align: 1px;
  white-space: nowrap;
}
.sb-num   { border-radius: 11px; min-width: 18px; text-align: center; }
.sb-oval  { border-radius: 999px; }
.sb-round { border-radius: 4px; }

.sb-op {
  display: inline-block;
  padding: 3px 7px;
  background: var(--sb-operators);
  color: #fff;
  border-radius: 999px;
  font-weight: 700;
}
.sb-op .sb-num, .sb-op .sb-oval { margin: 0 2px; vertical-align: 0; }

.sb-label { opacity: 0.97; }
.sb-block .sb-dim { opacity: 0.75; font-weight: 600; }

/* --- annotations that sit beside a script -------------------------------- */
.sb-note {
  display: inline-block;
  margin-left: 12px;
  padding: 3px 8px;
  background: #FFF6C7;
  border: 1px solid #EBDB89;
  border-radius: 3px;
  color: #6B5B14;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.3;
  vertical-align: middle;
  max-width: 186px;
  white-space: normal;
  text-align: left;
}

/* --- dark hint used inside cards ---------------------------------------- */
.sb-hint {
  margin: 10px 0 0;
  padding: 8px 11px;
  background: #f3f5f9;
  border-left: 3px solid var(--sb-control);
  border-radius: 0 4px 4px 0;
  color: var(--sb-ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
}

@media print {
  .sb-script { break-inside: avoid; page-break-inside: avoid; }
  .sb-block { box-shadow: none; }
  .sb-note  { background: #FFF6C7 !important; border-color: #D8C46A !important; }
  .sb-hint  { background: #f3f5f9 !important; }
}
