/* 블록 레시피 도우미 — 데스크톱 폭 계약(720~960px) 준수, 모바일 360px 안전 */

.br-wrap {
  max-width: 1080px;
  margin: 0 auto;
}

.br-header {
  text-align: center;
  margin-bottom: 1.5rem;
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}
.br-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--color-ink-primary, #1f2333);
}
.br-sub {
  margin-top: 0.5rem;
  color: var(--color-ink-secondary, #4b5168);
  line-height: 1.6;
}
.br-kit {
  margin-top: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-ink-tertiary, #6b7280);
}

.br-card {
  background: var(--color-surface, #ffffff);
  border: 1px solid rgba(51, 65, 85, 0.14);
  border-radius: 8px;
  padding: 1.4rem;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
  max-width: 100%;
  box-sizing: border-box;
}

.br-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}

.br-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.br-field > label,
.br-field-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-ink-primary, #1f2333);
}

.br-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 0.85rem;
  font-size: 1rem;
  line-height: 1.5;
  border: 1.5px solid rgba(51, 65, 85, 0.22);
  border-radius: 8px;
  background: #fff;
  color: #1f2333;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.br-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.br-textarea {
  resize: vertical;
  min-height: 3.2rem;
}

.br-examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.br-example {
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  background: #f0fdfa;
  color: #115e59;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
}

.br-example:hover {
  background: #ccfbf1;
}

.br-advanced {
  border: 1px solid rgba(51, 65, 85, 0.14);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  background: #f8fafc;
}

.br-advanced > summary {
  color: #334155;
  cursor: pointer;
  font-weight: 800;
}

.br-advanced[open] {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.br-hint {
  font-size: 0.82rem;
  color: var(--color-ink-tertiary, #6b7280);
}

.br-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem;
}

.br-choice {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.br-choice .br-radio {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  width: 100%;
}

.br-choice .br-radio > div {
  min-width: 0;
}

.br-choice label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.5rem 0.75rem;
  border: 1.5px solid rgba(99, 102, 141, 0.22);
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  background: #fff;
  white-space: nowrap;
}
.br-choice input[type="radio"] {
  accent-color: #0f766e;
}

.br-submit {
  width: min(100%, 420px);
  align-self: center;
  min-height: 48px;
  padding: 0.85rem 1.2rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fff;
  background: #0f766e;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: filter 160ms ease, transform 120ms ease;
}
.br-submit:hover { filter: brightness(1.05); }
.br-submit:active { transform: translateY(1px); }
.br-submit:disabled { opacity: 0.7; cursor: progress; }

.br-error,
.br-field-error {
  color: #c2410c;
  font-size: 0.88rem;
}
.br-error {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
}

.br-result {
  margin-top: 1.4rem;
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
  scroll-margin-top: calc(var(--main-nav-height, 88px) + 1rem);
}
.br-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}
.br-result-head h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--color-ink-primary, #1f2333);
}
.br-copy {
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 700;
  color: #1d4ed8;
  background: rgba(37, 99, 235, 0.08);
  border: 1.5px solid rgba(37, 99, 235, 0.26);
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
}
.br-copy.is-copied {
  color: #15803d;
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.4);
}
.br-notice {
  font-size: 0.88rem;
  color: #475569;
  background: #f8fafc;
  border: 1px solid rgba(100, 116, 139, 0.2);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.9rem;
}

.br-assembly {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.br-assembly-note {
  margin: 0;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.5;
}

.br-assembly-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.br-summary-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.25rem 0.55rem;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 999px;
  background: #f0fdfa;
  color: #115e59;
  font-size: 0.86rem;
  font-weight: 700;
  word-break: keep-all;
}

.br-blockly-mount {
  width: 100%;
}

.br-blockly-wrap {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.br-blockly-step {
  border-top: 1px solid rgba(51, 65, 85, 0.14);
  padding-top: 1rem;
}

.br-blockly-step--ezmaker-setup,
.br-blockly-step--ezmaker-loop {
  border: 1px solid rgba(126, 98, 201, 0.22);
  border-radius: 8px;
  padding: 1rem;
  background: #fbfaff;
}

.br-blockly-step:first-child {
  border-top-color: rgba(126, 98, 201, 0.22);
}

.br-blockly-canvas {
  position: relative;
  width: 100%;
  min-height: 260px;
  height: 340px;
  overflow: hidden;
  border: 1px solid rgba(51, 65, 85, 0.16);
  border-radius: 8px;
  background: #f8fbff;
}

.br-blockly-canvas .blocklySvg {
  background: #f8fbff;
}

.br-blockly-canvas .blocklyText {
  font-family: Arial, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}

.br-fallback-note {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 1px solid rgba(100, 116, 139, 0.22);
  border-radius: 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 0.88rem;
  line-height: 1.45;
}

.br-diagram-scroller {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.br-step {
  border-top: 1px solid rgba(51, 65, 85, 0.14);
  padding-top: 1rem;
}

.br-step:first-child {
  border-top: 0;
  padding-top: 0;
}

.br-step-head {
  margin-bottom: 0.65rem;
}

.br-step-head h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: #0f172a;
}

.br-step-head p {
  margin: 0.2rem 0 0;
  color: #64748b;
  font-size: 0.88rem;
}

.br-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: min(620px, 100%);
}

.br-block {
  --block-bg: #e2e8f0;
  --block-border: rgba(15, 23, 42, 0.18);
  --block-text: #0f172a;
  position: relative;
  display: inline-block;
  max-width: 100%;
  color: var(--block-text);
  background: var(--block-bg);
  border: 1px solid var(--block-border);
  border-radius: 8px;
  box-shadow: inset 0 -2px 0 rgba(15, 23, 42, 0.12), 0 1px 2px rgba(15, 23, 42, 0.08);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.35;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.br-block--cat-control {
  --block-bg: #fbbf24;
  --block-border: #d97706;
  --block-text: #3b2600;
}

.br-block--cat-sensor {
  --block-bg: #22c55e;
  --block-border: #15803d;
  --block-text: #052e16;
}

.br-block--cat-output {
  --block-bg: #fb7185;
  --block-border: #be123c;
  --block-text: #3f0612;
}

.br-block--cat-logic {
  --block-bg: #60a5fa;
  --block-border: #2563eb;
  --block-text: #082f49;
}

.br-block--cat-debug {
  --block-bg: #a78bfa;
  --block-border: #7c3aed;
  --block-text: #2e1065;
}

.br-block--cat-missing {
  --block-bg: #e5e7eb;
  --block-border: #94a3b8;
  --block-text: #334155;
  border-style: dashed;
}

.br-block--color-green {
  --block-bg: #118c5c;
  --block-border: #0f6f49;
  --block-text: #ffffff;
}

.br-block--color-teal {
  --block-bg: #13bfae;
  --block-border: #0f8f83;
  --block-text: #ffffff;
}

.br-block--color-blue {
  --block-bg: #388dde;
  --block-border: #246fb4;
  --block-text: #ffffff;
}

.br-block--color-navy {
  --block-bg: #34495e;
  --block-border: #26384a;
  --block-text: #ffffff;
}

.br-block--color-purple {
  --block-bg: #8e44ad;
  --block-border: #6d3485;
  --block-text: #ffffff;
}

.br-block--color-deep-purple {
  --block-bg: #4c1d95;
  --block-border: #35116f;
  --block-text: #ffffff;
}

.br-block--color-violet {
  --block-bg: #7e62c9;
  --block-border: #6148a7;
  --block-text: #ffffff;
}

.br-block--color-pink {
  --block-bg: #ec5a9a;
  --block-border: #c63d7b;
  --block-text: #ffffff;
}

.br-block--color-rose {
  --block-bg: #ff4f7a;
  --block-border: #d93661;
  --block-text: #ffffff;
}

.br-block--color-red {
  --block-bg: #ef4438;
  --block-border: #c72d24;
  --block-text: #ffffff;
}

.br-block--color-orange {
  --block-bg: #f39c12;
  --block-border: #c87c08;
  --block-text: #ffffff;
}

.br-block--color-brown {
  --block-bg: #a65f49;
  --block-border: #7f4939;
  --block-text: #ffffff;
}

.br-block--color-cyan {
  --block-bg: #02c4c7;
  --block-border: #039296;
  --block-text: #ffffff;
}

.br-block--color-gold {
  --block-bg: #d4af37;
  --block-border: #a88722;
  --block-text: #ffffff;
}

.br-block--color-sky {
  --block-bg: #82b5de;
  --block-border: #5f95c0;
  --block-text: #ffffff;
}

.br-block--color-slate {
  --block-bg: #5d6ba8;
  --block-border: #465385;
  --block-text: #ffffff;
}

.br-block-face {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.38rem;
  min-height: 38px;
  padding: 0.5rem 0.7rem;
}

.br-block-label {
  display: inline-block;
  max-width: 100%;
}

.br-block-missing {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  color: #475569;
  background: #f8fafc;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.br-block--hat {
  border-top-left-radius: 24px;
  border-top-right-radius: 12px;
}

.br-block--hat::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 14px;
  width: 58px;
  height: 22px;
  border-radius: 28px 28px 0 0;
  background: var(--block-bg);
  border: 1px solid var(--block-border);
  border-bottom: 0;
}

.br-block--command::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 34px;
  width: 34px;
  height: 8px;
  border-radius: 0 0 8px 8px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-top: 0;
}

.br-block--value {
  border-radius: 999px;
}

.br-block--boolean {
  border-radius: 0;
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0 50%);
}

.br-block--wrapper {
  display: inline-block;
  min-width: min(520px, 88vw);
  padding-bottom: 0.6rem;
}

.br-block--wrapper > .br-block-face {
  border-bottom: 1px solid rgba(15, 23, 42, 0.14);
}

.br-block-children,
.br-else-children {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  margin: 0.55rem 0.65rem 0 1.1rem;
  padding: 0.45rem 0 0.45rem 0.8rem;
  border-left: 6px solid rgba(255, 255, 255, 0.75);
}

.br-else-children {
  margin-top: 0.25rem;
}

.br-else-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  color: rgba(15, 23, 42, 0.78);
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  font-weight: 800;
}

.br-slots,
.br-condition-slot {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.br-condition-slot {
  width: 100%;
  margin-top: 0.1rem;
}

.br-slot,
.br-condition-label {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.br-slot-label,
.br-condition-label {
  color: rgba(15, 23, 42, 0.68);
  font-size: 0.72rem;
  font-weight: 900;
}

.br-slot-value {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(15, 23, 42, 0.13);
  font-weight: 800;
}

.br-block--inline {
  font-size: 0.78rem;
  vertical-align: middle;
  box-shadow: inset 0 -1px 0 rgba(15, 23, 42, 0.12);
}

.br-block--inline .br-block-face {
  min-height: 28px;
  padding: 0.24rem 0.5rem;
}

.br-block--inline::before,
.br-block--inline.br-block--hat::before {
  display: none;
}

.br-missing-panel {
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  background: #f8fafc;
}

.br-missing-panel h3 {
  margin: 0 0 0.4rem;
  color: #334155;
  font-size: 0.95rem;
  font-weight: 800;
}

.br-missing-panel ul {
  margin: 0;
  padding-left: 1.1rem;
  color: #475569;
}

.br-details {
  margin-top: 1rem;
  border-top: 1px solid rgba(51, 65, 85, 0.14);
  padding-top: 0.75rem;
}

.br-details summary {
  cursor: pointer;
  color: #334155;
  font-weight: 800;
}

/* 마크다운 렌더 영역 */
.br-md-render {
  color: #2a2e3f;
  line-height: 1.7;
}
.br-md-render h2 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 1.3rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid rgba(37, 99, 235, 0.18);
  color: #1d4ed8;
}
.br-md-render h3 { font-size: 1rem; font-weight: 700; margin: 1rem 0 0.4rem; }
.br-md-render ul,
.br-md-render ol { margin: 0.4rem 0 0.8rem 1.2rem; }
.br-md-render li { margin: 0.2rem 0; }
.br-md-render p { margin: 0.5rem 0; }
.br-md-render strong { color: #1f2333; }
.br-md-render table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6rem 0 1rem;
  font-size: 0.92rem;
}
.br-md-render th,
.br-md-render td {
  border: 1px solid rgba(99, 102, 141, 0.2);
  padding: 0.45rem 0.6rem;
  text-align: left;
  vertical-align: top;
}
.br-md-render th { background: rgba(37, 99, 235, 0.06); font-weight: 700; }

.br-raw {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  line-height: 1.7;
  color: #2a2e3f;
}

@media (max-width: 640px) {
  .br-grid-2 { grid-template-columns: 1fr; }
  .br-examples {
    display: grid;
    grid-template-columns: 1fr;
  }
  .br-example {
    min-height: 44px;
  }
  .br-card { padding: 1.1rem; }
  .br-result-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .br-copy {
    width: 100%;
    min-height: 42px;
  }
  .br-submit {
    width: 100%;
  }
  .br-stack {
    min-width: 0;
    width: 100%;
  }
  .br-block {
    max-width: 100%;
  }
  .br-block--wrapper {
    min-width: 0;
    width: 100%;
  }
  .br-block-children,
  .br-else-children {
    margin-left: 0.55rem;
    margin-right: 0.45rem;
    padding-left: 0.55rem;
    border-left-width: 4px;
  }
  .br-condition-slot {
    align-items: flex-start;
    flex-direction: column;
  }
  .br-blockly-canvas {
    height: 320px;
    min-height: 300px;
  }
  .br-blockly-canvas .blocklyZoom {
    display: none;
  }
}

/* Guided recipe flow, scoped to this service. */
.br-wrap [hidden] { display: none !important; }
.br-form-errors { border: 1px solid #f1b4ae; border-left: 4px solid #b42318; border-radius: 8px; background: #fff5f4; color: #8f2118; padding: 1rem; line-height: 1.6; }
.br-form-errors h3 { font-size: 1rem; font-weight: 750; margin-bottom: .4rem; }
.br-form-errors ul { list-style: disc; padding-left: 1.2rem; }
.br-form-errors:focus { outline: 3px solid #efc1ba; outline-offset: 3px; }
.br-submit-status { margin-top: 1rem; padding: .85rem 1rem; border-radius: 8px; background: #edf8f4; color: #245c4c; line-height: 1.6; }
.br-header { text-align: left; padding-top: 1.5rem; }
.br-eyebrow { color: #0f766e; font-size: .8rem; font-weight: 750; letter-spacing: .04em; margin-bottom: .6rem; }
.br-form h2 { font-size: 1.15rem; font-weight: 750; margin: 0 0 1rem; }
.br-recipe-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.br-recipe-card { cursor: pointer; display: flex; flex-direction: column; gap: .65rem; position: relative; border: 1px solid #d8e4df; border-radius: 14px; padding: 1rem; background: #f7faf8; }
.br-recipe-card input { position: absolute; right: .85rem; top: .85rem; accent-color: #0f766e; }
.br-recipe-card:has(input:checked), .br-recipe-card:hover { border-color: #0f766e; background: #ecf9f3; }
.br-recipe-card:focus-within { outline: 3px solid #99d5c7; outline-offset: 3px; }
.br-recipe-art { display: flex; align-items: center; height: 70px; color: #0f766e; font-size: 2rem; letter-spacing: .2rem; }
.br-recipe-card strong { font-size: 1rem; color: #183a31; }
.br-recipe-card > span:last-child { font-size: .8rem; color: #536b62; }
.br-custom-choice { display: flex; align-items: center; gap: .6rem; padding: 1.2rem .2rem 0; cursor: pointer; }
.br-config-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.br-chosen-title { color: #0f766e; font-weight: 700; margin-bottom: 1rem; }
#brConfigure > .br-field, #brConfigure > .br-grid-2, .br-wiring { margin-bottom: 1.2rem; }
.br-parameters { max-width: 560px; }
.br-wiring { background: #f6f8fb; padding: 1rem; border-radius: 10px; }
.br-wiring h3 { font-weight: 700; margin-bottom: .4rem; }
.br-wiring .br-hint { margin-bottom: .8rem; }
#brConfigure > .br-submit { display: block; margin: 1.2rem auto 0; }
.br-stage-nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .5rem; }
.br-stage-nav button { padding: .75rem .5rem; border: 1px solid #dbe4df; border-radius: 8px; background: #f8faf9; font-size: .9rem; font-weight: 700; color: #52645c; cursor: pointer; }
.br-stage-nav button[aria-current="step"] { background: #0f766e; border-color: #0f766e; color: white; }
.br-success-check { background: #eff9f2; color: #215a38; border-left: 3px solid #54a675; padding: .9rem 1rem; line-height: 1.65; margin: 0; }
.br-blockly-canvas { height: 480px; }
.br-result-head h2 { line-height: 1.6; }
.br-step-head p { line-height: 1.65; }
@media (max-width: 640px) {
  .br-recipe-grid { grid-template-columns: 1fr; }
  .br-recipe-card { padding: .9rem 1rem .9rem 5rem; min-height: 84px; justify-content: center; gap: .25rem; }
  .br-recipe-art { position: absolute; left: .8rem; top: .7rem; height: 52px; font-size: 1.2rem; letter-spacing: 0; }
  .br-stage-nav { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .br-config-head { flex-direction: column; gap: .2rem; margin-bottom: .8rem; }
  .br-config-head .br-copy { width: auto; }
  .br-blockly-canvas { height: 420px; }
  .br-blockly-canvas .blocklyZoom { display: block; }
}

.br-edit-form { max-width: 880px; margin: 0 auto 1rem; }
.br-edit-form > summary { cursor: pointer; padding: .85rem 1rem; border: 1px solid #d8e4df; border-radius: 8px; background: white; font-weight: 700; color: #335d51; }
.br-edit-form[open] > summary { margin-bottom: .6rem; }
.br-canvas-help { font-size: .8rem; color: #64748b; margin: .5rem 0 0; }

.br-followup { padding: 1rem; margin-bottom: 1.2rem; background: #edf8f4; border: 1px solid #b5dccc; border-radius: 10px; }
.br-followup h3 { font-size: 1.1rem; font-weight: 750; }
.br-followup > p { color: #466657; line-height: 1.6; margin: .6rem 0 1rem; }
.br-followup .br-field { margin-bottom: .85rem; }
