.bf-page.br-page {
  --br-ivory: #fbfaf6;
  --br-card: #fffcf8;
  --br-line: #e6e0d4;
  --br-ink: #1d3328;
  --br-muted: #5d675f;
  --br-gold: #a67c45;
  --br-pill: #f4ead8;
  --br-forest: #1c3b2c;
  background: #f6f3ec;
  color: var(--br-ink);
  font-family: var(--bf-font-sans);
}

.br-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("/assets/botanical/woodland-frame-v1.webp") center / cover no-repeat;
  opacity: 0.28;
}

.br-page > :not(.bf-skip) {
  position: relative;
  z-index: 1;
}

.br-page[data-bf-theme="dark"] {
  --br-ivory: rgba(8, 22, 16, 0.72);
  --br-card: rgba(9, 26, 18, 0.82);
  --br-line: rgba(226, 196, 138, 0.38);
  --br-ink: #f4efe4;
  --br-muted: #d5cbb8;
  --br-gold: #e2c48a;
  --br-pill: rgba(226, 196, 138, 0.14);
  --br-forest: #e2c48a;
  background:
    linear-gradient(rgba(5, 14, 10, 0.78), rgba(5, 14, 10, 0.84)),
    url("/assets/botanical/forest-forager-night-v3.webp") center / cover fixed;
  color: var(--br-ink);
}

.br-page[data-bf-theme="dark"]::before {
  opacity: 0;
}

.br-ui-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.br-screen {
  width: min(1440px, calc(100% - 2rem));
  margin: 0.4rem auto 2rem;
}

.br-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(18rem, 1fr);
  grid-template-areas:
    "question side"
    "actions side";
  gap: 0 1.1rem;
  align-items: start;
}

.br-question { grid-area: question; border-radius: 24px 24px 0 0; border-bottom: 0; }

.br-actions { grid-area: actions; }

.br-side { grid-area: side; align-self: stretch; }

.br-question,
.br-side {
  min-width: 0;
  padding: 1.15rem 1.2rem 1.25rem;
  border: 1px solid var(--br-line);
  border-radius: 24px;
  background: var(--br-card);
  box-shadow: 0 14px 32px rgba(55, 42, 22, 0.06);
}

.br-question-head {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.br-question-icon {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
}

.br-question-icon svg,
.br-question-icon img {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.br-question h1 {
  max-width: none;
  margin: 0;
  color: var(--br-ink);
  font-family: var(--bf-font-serif);
  font-size: clamp(2.25rem, 3vw, 2.75rem);
  font-weight: 560;
  line-height: 1.12;
}

.br-question h1::after {
  content: "";
  display: block;
  width: 4.6rem;
  height: 3px;
  margin-top: 0.45rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #6e8b62, var(--br-gold));
}

.br-help,
.br-notice,
.br-status {
  margin: 0.7rem 0 0;
  color: var(--br-muted);
  font-size: 1rem;
  line-height: 1.45;
}

.br-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}

.br-option {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0.75rem;
  border: 1px solid var(--br-line);
  border-radius: 18px;
  background: #fff;
  color: var(--br-ink);
  text-align: left;
  box-shadow: 0 6px 16px rgba(55, 42, 22, 0.04);
}

.br-page[data-bf-theme="dark"] .br-option {
  background: rgba(6, 20, 14, 0.55);
}

.br-option.is-wide {
  grid-column: 1 / -1;
}

.br-option-icon {
  flex: 0 0 120px;
  width: 120px;
}

.br-option-icon svg,
.br-option-icon img {
  display: block;
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.br-option-copy {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.br-option-label {
  color: var(--br-ink);
  font-family: var(--bf-font-serif);
  font-size: 1.5rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.br-option-description {
  color: var(--br-muted);
  font-size: 0.95rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.br-option-count {
  align-self: flex-start;
  margin-top: 0.35rem;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--br-pill);
  color: #8a5a28;
  font-size: 0.84rem;
  font-weight: 700;
}

.br-page[data-bf-theme="dark"] .br-option-count {
  color: var(--br-gold);
}

.br-chevron {
  display: inline-flex;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--br-line);
  border-radius: 999px;
  color: var(--br-forest);
}

.br-option.is-excluded,
.br-option:disabled {
  opacity: 0.55;
}

.br-option[aria-pressed="true"] {
  border-color: var(--br-gold);
  background: var(--br-pill);
}

.br-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0;
  padding: 0 1.2rem 1.15rem;
  border: 1px solid var(--br-line);
  border-top: 0;
  border-radius: 0 0 24px 24px;
  background: var(--br-card);
}

.br-actions button,
.br-retry,
.br-more {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--br-line);
  border-radius: 14px;
  background: var(--br-card);
  color: var(--br-ink);
  font-weight: 700;
}

.br-actions button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.br-actions [data-br-reset] {
  border-color: var(--br-forest);
  background: var(--br-forest);
  color: #f7f3ea;
}

.br-page[data-bf-theme="dark"] .br-actions [data-br-reset] {
  border-color: var(--br-gold);
  background: transparent;
  color: var(--br-gold);
}

.br-actions [data-br-confirm] {
  background: var(--br-pill);
  color: #3e2912;
}

.br-skip-short { display: none; }

.br-side-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.br-side h2 {
  margin: 0;
  color: var(--br-ink);
  font-family: var(--bf-font-serif);
  font-size: clamp(1.8rem, 2.4vw, 2.35rem);
  font-weight: 560;
}

.br-leaf {
  width: 46px;
  height: 32px;
  color: #7d9a78;
}

.br-safety {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin: 0.85rem 0;
  padding: 0.8rem 0.85rem;
  border: 1px solid #e4c48a;
  border-radius: 14px;
  background: #fff4e2;
  color: #6d4b22;
}

.br-safety p {
  margin: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.br-safety-icon {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  color: #d07a1e;
}

.br-page[data-bf-theme="dark"] .br-safety {
  border-color: rgba(226, 196, 138, 0.55);
  background: rgba(92, 48, 16, 0.55);
  color: #f3e2c4;
}

.br-candidates {
  display: grid;
  max-height: 34rem;
  overflow: auto;
}

.br-candidate {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 36px;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
  padding: 0.7rem 0.15rem;
  border-top: 1px solid var(--br-line);
  color: inherit;
  text-decoration: none;
}

.br-candidate img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 12px;
  background: #efe8dc;
}

.br-candidate-copy {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.br-candidate-name,
.br-candidate i,
.br-candidate-note {
  display: block;
  overflow-wrap: anywhere;
}

.br-candidate-name {
  font-family: var(--bf-font-serif);
  font-size: 1.12rem;
  font-style: normal;
}

.br-candidate i,
.br-candidate-note {
  color: var(--br-muted);
  font-size: 0.92rem;
}

.br-more {
  width: 100%;
  margin-top: 0.35rem;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--br-muted);
  font-weight: 650;
}

.br-loader {
  display: none;
  align-items: center;
  gap: 0.8rem;
  min-height: 4.5rem;
  margin-bottom: 0.8rem;
}

[data-br-app][data-br-state="loading"] .br-loader {
  display: flex;
}

.br-loader-mark {
  width: 4.6rem;
  height: 2.6rem;
  color: var(--br-gold);
}

.br-loader-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: br-grow 900ms ease forwards;
}

.br-loader-logo {
  width: 32px;
  height: 40px;
  object-fit: contain;
  opacity: 0;
  animation: br-logo 900ms ease 420ms forwards;
}

@keyframes br-grow { to { stroke-dashoffset: 0; } }

@keyframes br-logo { to { opacity: 1; } }

[data-br-app][data-br-state="idle"] [data-br-actions],
[data-br-app][data-br-state="loading"] [data-br-actions],
[data-br-app][data-br-state="unavailable"] [data-br-actions],
[data-br-app][data-br-state="error"] [data-br-actions],
[data-br-app][data-br-state="unavailable"] .br-layout {
  display: none;
}

[data-br-app][data-br-state="loading"] .br-question h1 {
  visibility: hidden;
}

.br-retry { display: none; }

[data-br-app][data-br-state="error"] .br-retry {
  display: inline-flex;
}

@media (hover: hover) and (pointer: fine) {
.br-option,
.br-candidate {
    transition: transform var(--bf-motion-duration) ease, border-color var(--bf-motion-duration) ease;
  }

.br-option:hover,
.br-candidate:hover {
    transform: translateY(-1px);
  }

}

@media (max-width: 800px) {
.br-screen {
    width: min(100% - 1rem, 1440px);
  }

.br-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "question"
      "side"
      "actions";
    gap: 0.8rem;
  }

.br-question,
.br-actions {
    border-radius: 24px;
    border-bottom: 1px solid var(--br-line);
  }

.br-question h1 {
    font-size: 1.75rem;
  }

.br-question-icon,
.br-question-icon svg,
.br-question-icon img {
    width: 42px;
    height: 42px;
  }

.br-options {
    grid-template-columns: 1fr;
  }

.br-option.is-wide {
    grid-column: auto;
  }

.br-option-icon,
.br-option-icon svg,
.br-option-icon img {
    flex-basis: 80px;
    width: 80px;
    height: 80px;
  }

.br-option-label {
    font-size: 1.2rem;
  }

.br-candidate {
    grid-template-columns: 72px minmax(0, 1fr) 32px;
  }

.br-candidate img {
    width: 72px;
    height: 72px;
  }

.br-candidates {
    max-height: none;
    overflow: visible;
  }

.br-back-label,
.br-skip-long {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

.br-skip-short { display: inline; }

.br-actions {
    position: sticky;
    z-index: 3;
    right: auto;
    bottom: 0;
    left: auto;
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.1fr) minmax(0, 0.95fr);
    margin: 0;
    padding: 0.45rem;
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom));
    border: 1px solid var(--br-line);
    border-radius: 18px;
    background: var(--br-card);
    box-shadow: 0 8px 24px rgba(20, 16, 10, 0.12);
  }

.br-page[data-bh-menu="open"] .br-actions {
    visibility: hidden;
  }

.br-actions button {
    width: 100%;
    min-width: 0;
    padding-inline: 0.35rem;
    font-size: 0.78rem;
  }

.br-actions [data-br-confirm] {
    grid-column: 1 / -1;
  }

}

@media (max-width: 360px) {
.br-option-icon,
.br-option-icon svg,
.br-option-icon img {
    flex-basis: 72px;
    width: 72px;
    height: 72px;
  }

}

@media (prefers-reduced-motion: reduce) {
.br-loader-stroke,
.br-loader-logo,
.br-option,
.br-candidate {
    animation: none;
    transition: none;
    opacity: 1;
    stroke-dashoffset: 0;
  }

}

.br-step {
  margin: 0.35rem 0 0;
  color: var(--br-muted);
  font-size: 0.92rem;
}

.br-corrections {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.br-corrections button {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  min-height: 48px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--br-line);
  border-radius: 12px;
  background: var(--br-card);
  color: var(--br-ink);
  text-align: left;
}

/* Preserve readable answer copy between desktop and phone breakpoints. */

@media (min-width: 801px) and (max-width: 1180px) {
.br-page .br-options { grid-template-columns: minmax(0,1fr); }

.br-page .br-option-icon,
.br-page .br-option-icon img,
.br-page .br-option-icon svg { width: 88px; height: 88px; }

.br-page .br-option-icon { flex-basis: 88px; }

.br-page .br-question h1 { font-size: 2rem; }

}

@media (min-width: 1181px) {
.br-page .br-question h1 { font-size: 2.25rem; }

.br-page .br-actions { margin-top: 0; }

}

@media (max-width: 360px) {
.br-page .br-question,
.br-page .br-side { padding: .75rem; }

.br-page .br-option { padding: .6rem; gap: .5rem; }

.br-page .br-option-icon,
.br-page .br-option-icon img,
.br-page .br-option-icon svg { width: 60px; height: 60px; }

.br-page .br-option-icon { flex-basis: 60px; }

.br-page .br-chevron { flex-basis: 28px; width: 28px; height: 28px; }

}

@media (max-width: 800px) {
.br-page .br-actions { background: #fffaf4; }

.br-page[data-bf-theme="dark"] .br-actions { background: #081b13; }

}

.br-page:not([data-bf-theme="dark"])::before {
  background-image: url("/assets/botanical/recognition-fern-v1.webp"), url("/assets/botanical/recognition-fern-v1.webp");
  background-size: 330px 330px, 240px 240px;
  background-position: left -70px bottom -45px, right -70px top 70px;
  background-repeat: no-repeat;
  opacity: .34;
}

.br-page [data-br-state="error"] .br-layout { display: none; }

@media (min-width: 801px) {
.br-page .br-layout { align-items: stretch; }

.br-page .br-question { display: flex; flex-direction: column; border-radius: 24px 24px 0 0; border-bottom: 0; }

.br-page .br-options { flex: 1; }

}

/* Page placement; shared shell owns its appearance and behavior. */
@media(min-width:900px){ .br-page .br-screen {padding-top:84px;} }
@media(max-width:800px){ .br-page .bh-footer {padding-bottom:calc(7rem + env(safe-area-inset-bottom));} }

/* Original raster cells are clipped without recoloring or distorting anatomy. */
.br-page .br-answer-art { overflow: hidden; }

/* A finished run gives the candidate list the full content width. */
.br-screen[data-br-complete="true"] .br-layout {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "question" "side" "actions";
  gap: 1rem;
}
.br-screen[data-br-complete="true"] .br-question {
  border-radius: 24px;
  border-bottom: 1px solid var(--br-line);
}
.br-screen[data-br-complete="true"] .br-options { display: none; }
@media (min-width: 801px) {
  .br-screen[data-br-complete="true"] .br-candidates {
    max-height: none;
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 0 1rem;
  }
}

/* Keep candidate names readable on tablets and narrow desktop panels. */
@media (min-width: 801px) and (max-width: 1199px) {
  .br-page .br-layout {
    grid-template-columns: minmax(0,1fr);
    grid-template-areas: "question" "actions" "side";
  }
  .br-page .br-options { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .br-page .br-side { margin-top: 1rem; }
  .br-page .br-candidates {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr));
    gap: 0 1rem;
  }
}

@media (min-width:900px) { .br-page .br-screen { margin-top:0; } }

/* The mobile unknown answer shares the full answer hit area. */
@media (max-width: 800px) {
  .br-page .br-option { min-height: 106px; }
  .br-page .br-skip-option {
    justify-content: center;
    font-family: var(--bf-font-serif);
    font-size: 1.2rem;
    font-weight: 400;
  }
  .br-page .br-actions[data-br-skip-as-answer] {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 360px) {
  .br-page .br-option { min-height: 82px; }
}

.br-answer-search { display:flex; align-items:end; flex-wrap:wrap; gap:.75rem; margin:1rem 0; }
.br-answer-search label { display:grid; gap:.35rem; flex:1 1 220px; font:inherit; }
.br-answer-search input { box-sizing:border-box; width:100%; min-height:44px; border:1px solid var(--bf-line,#c9c6ba); border-radius:10px; padding:.6rem .8rem; font:inherit; color:inherit; background:var(--bf-card,#fff); }
.br-answer-search button { min-height:44px; border:1px solid var(--bf-line,#c9c6ba); border-radius:10px; padding:.6rem .8rem; font:inherit; color:inherit; background:transparent; cursor:pointer; }
.br-options > [hidden] { display:none!important; }
.br-options > .br-option { min-height:7.125rem; }
.br-question-icon:empty { display:none; }
.br-result-dialog { box-sizing:border-box; width:calc(100% - 2rem); max-width:40rem; max-height:calc(100dvh - 2rem); padding:0; overflow:hidden; border:1px solid var(--br-line); border-radius:24px; background:var(--br-card); color:var(--br-ink); box-shadow:0 24px 64px rgba(12,29,19,.28); }
.br-result-dialog[open] { display:flex; flex-direction:column; }
.br-result-scroll { min-height:0; overflow:auto; }
.br-result-dialog::backdrop { background:rgba(10,24,17,.65); }
.br-result-figure { margin:0; }
.br-result-figure > img { display:block; box-sizing:border-box; width:100%; height:clamp(11rem,30dvh,17rem); object-fit:cover; background:var(--bf-color-surface); }
.br-result-figure > figcaption { padding:.6rem 1.5rem 0; color:var(--br-muted); font-size:.75rem; line-height:1.5; overflow-wrap:anywhere; }
.br-result-body { padding:1.25rem 1.5rem 1.5rem; }
.br-result-body h2 { margin:0; color:var(--br-ink); font:560 clamp(1.6rem,4vw,2.25rem)/1.15 var(--bf-font-serif); }
.br-result-latin { margin:.35rem 0 0; font-style:italic; color:var(--br-muted); }
.br-result-body > [data-br-result-description] { margin:1rem 0 1.25rem; line-height:1.65; }
.br-result-actions { flex:none; padding:.9rem 1.5rem; border-top:1px solid var(--br-line); }
.br-result-close { position:absolute; z-index:1; top:.75rem; right:.75rem; display:grid; place-items:center; width:44px; height:44px; border:1px solid var(--br-line); border-radius:50%; background:var(--br-card); color:var(--br-ink); cursor:pointer; }
.br-result-dialog a:focus-visible,.br-result-close:focus-visible { outline:3px solid var(--br-gold); outline-offset:3px; }
@media (max-width:480px) { .br-result-body { padding:1.1rem; } .br-result-actions { padding:.8rem 1.1rem; } .br-result-figure > figcaption { padding-inline:1.1rem; } .br-result-card-link { width:100%; } }
/* Absolute sprite children cannot give their wrapper an intrinsic height. */
.br-option-icon.br-option-sprite{position:relative;overflow:hidden;flex-shrink:0;isolation:isolate;aspect-ratio:1 / 1}
.br-sprite-crop{position:absolute;left:50%;top:50%;width:var(--br-sprite-cell-width,100%);height:var(--br-sprite-cell-height,100%);transform:translate(-50%,-50%);overflow:hidden}
.br-option-icon.br-option-sprite img{position:absolute;max-width:none!important;width:var(--br-sprite-image-width,calc(var(--br-sprite-columns)*100%))!important;height:var(--br-sprite-image-height,calc(var(--br-sprite-rows)*100%))!important;left:var(--br-sprite-image-left,calc(var(--br-sprite-column)*-100%));top:var(--br-sprite-image-top,calc(var(--br-sprite-row)*-100%));object-fit:fill!important}
[data-br-skip]:not(.br-skip-option) .br-option-icon{width:24px;height:24px;min-height:0;flex:0 0 24px}
[data-br-skip]:not(.br-skip-option) .br-option-icon img{width:24px;height:24px}
