/* RGB illustrations follow the typography and restrained palette of the paper page. */
.rgb-playground { border: 1px solid #dce3e9; border-radius: 8px; background: #fff; overflow: hidden; }
.rgb-playground [hidden] { display: none !important; }
.rgb-tabs { display: flex; border-bottom: 1px solid #dce3e9; background: #fafbfc; }
.rgb-tab { flex: 1; padding: 16px 20px 13px; border: 0; border-bottom: 3px solid transparent; background: none; color: #697581; font-size: 17px; font-weight: 600; line-height: 1.3; }
.rgb-tab span { display: inline-block; margin-left: 10px; font-size: 11px; font-weight: 400; color: #7d8790; }
.rgb-tab[aria-selected=true] { background: #fff; color: #236aa5; border-bottom-color: #327db9; }
.rgb-loading { padding: 24px; color: #66788b; text-align: center; font-size: 14px; }
.rgb-panel { padding: 25px; }
.rgb-panel-heading { margin-bottom: 20px; }
.rgb-panel-heading h3 { font-size: 21px; margin-bottom: 8px; }
.rgb-panel-heading p { font-size: 14px; color: #687581; line-height: 1.7; max-width: 820px; }
.rgb-shuffle-controls { display: grid; grid-template-columns: 1.05fr 1fr auto; align-items: center; gap: 20px; border: 1px solid #e1e7ec; border-radius: 6px; padding: 16px; background: #fafcfe; }
.rgb-ratio-control > div, .rgb-k-control > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.rgb-ratio-control label, .rgb-k-control label { font-weight: 600; color: #445363; }
.rgb-ratio-control output, .rgb-k-control output { font-variant-numeric: tabular-nums; color: #216aa8; font-size: 15px; font-weight: 600; }
.rgb-playground input[type=range] { display: block; width: 100%; margin: 8px 0 5px; accent-color: #317bb8; cursor: pointer; }
.rgb-ratio-control > p { font-size: 10px; line-height: 1.6; color: #7d8791; }
.rgb-checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; line-height: 1.6; color: #536273; }
.rgb-checkbox input { margin: 4px 0 0; accent-color: #317bb8; }
.rgb-control-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rgb-primary { color: #fff; background: #3279b1; border-color: #3279b1; }
.rgb-primary:hover { color: #fff; background: #28689b; border-color: #28689b; }
.rgb-playground button:disabled, .rgb-playground input:disabled { cursor: wait; opacity: .6; }
.rgb-donor-area { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin: 23px 0; padding: 18px 20px; border: 1px solid #e2e8ed; border-radius: 5px; }
.rgb-donor-text { max-width: 320px; }
.rgb-donor-text h4 { margin: 0 0 7px; font-size: 15px; font-weight: 600; }
.rgb-donor-text p { font-size: 12px; line-height: 1.75; color: #75818c; }
.rgb-donors { display: flex; gap: 13px; flex-shrink: 0; }
.rgb-donors figure { width: 94px; }
.rgb-donor-image { position: relative; width: 94px; height: 94px; border-radius: 4px; overflow: hidden; background: #edf1f5; border: 1px solid #d8e1e8; }
.rgb-donor-image svg { width: 100%; height: 100%; display: block; }
.rgb-source-outline { position: absolute; width: 25%; height: 25%; outline: 2px solid #27a4e1; outline-offset: -2px; background: #2a9bea24; pointer-events: none; }
.rgb-donors figcaption { margin-top: 6px; font-size: 10px; color: #4c6073; line-height: 1.45; }
.rgb-donors figcaption span { display: block; font-size: 9px; color: #8a939b; margin-top: 1px; }
.rgb-bags { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.rgb-bag-article { min-width: 0; }
.rgb-bag-heading { display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.rgb-bag-heading h4 { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.5; }
.rgb-bag-heading > span { font-size: 10px; color: #8b949d; white-space: nowrap; margin-top: 4px; }
.rgb-label { display: inline-block; padding: 2px 7px; border: 1px solid #dfe5eb; background: #f6f8fa; border-radius: 4px; font-size: 10px; font-weight: 500; line-height: 1.5; white-space: nowrap; margin-left: 5px; color: #526577; }
.rgb-label.real { color: #306b57; background: #f0f6f2; border-color: #d6e5db; }
.rgb-label.generated { color: #94661c; background: #fcf6eb; border-color: #eadfc8; }
.rgb-bag { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 5px; padding: 7px; border: 1px solid #d5dee6; background: #f4f7f9; border-radius: 5px; }
.rgb-instance { padding: 0; position: relative; border: 2px solid transparent; border-radius: 3px; overflow: hidden; background: #dce5ed; aspect-ratio: 1; min-width: 0; transition: border-color .15s, box-shadow .15s; }
.rgb-instance svg, .rgb-scored-tile svg { width: 100%; height: 100%; display: block; }
.rgb-instance.is-inserted { border-color: #2383c1; }
.rgb-instance.is-kept { border-color: #bd8627; }
.rgb-instance.is-inspected { box-shadow: 0 0 0 2px #172f46; z-index: 1; }
.rgb-instance.rgb-incoming { opacity: 0; pointer-events: none; }
.rgb-kept-tag { position: absolute; right: 0; bottom: 0; background: #906017; color: #fff; padding: 1px 5px; border-radius: 3px 0 0; font-size: 9px; line-height: 1.5; }
.rgb-bag-count { text-align: center; font-size: 11px; color: #6f7c89; margin-top: 9px; font-variant-numeric: tabular-nums; }
.rgb-key { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 18px; color: #7a8691; font-size: 10px; line-height: 1.7; margin-top: 17px; }
.rgb-key > span { display: inline-flex; align-items: center; gap: 6px; }
.rgb-key i { width: 12px; height: 12px; border: 2px solid; display: inline-block; border-radius: 2px; background: transparent; }
.rgb-key .rgb-key-inserted { border-color: #2383c1; }
.rgb-key .rgb-key-boundary { border-color: #758597; border-style: dashed; }
.rgb-key .rgb-key-kept { border-color: #bd8627; }
.rgb-status { font-size: 12px; color: #526a7f; margin-top: 16px; line-height: 1.7; }
.rgb-inspector, .rgb-crop-inspector { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 17px; padding: 15px 17px; border: 1px solid #e0e7ed; border-radius: 5px; background: #fbfcfe; margin-top: 15px; }
.rgb-inspector-crop { width: 92px; height: 92px; background: #e8edf3; border: 1px solid #ced9e3; border-radius: 4px; overflow: hidden; }
.rgb-inspector-crop svg { width: 100%; height: 100%; display: block; }
.rgb-inspector strong, .rgb-crop-inspector strong { font-size: 13px; font-weight: 600; color: #334d65; }
.rgb-inspector p, .rgb-crop-inspector p { font-size: 11px; color: #7a8794; line-height: 1.7; margin-top: 4px; }
.rgb-inspector small { display: block; font-size: 10px; color: #8a96a0; margin-top: 5px; }
.rgb-flying { position: fixed; z-index: 100; border: 2px solid #2383c1; box-shadow: 0 3px 16px #15324d38; border-radius: 3px; pointer-events: none; overflow: hidden; transform-origin: 0 0; background: #fff; }
.rgb-flying svg { display: block; width: 100%; height: 100%; }
.rgb-fatas-controls { display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 23px; align-items: center; padding: 15px 17px; background: #fafcfe; border: 1px solid #e1e7ec; border-radius: 5px; margin-bottom: 23px; }
.rgb-fatas-controls > label { font-size: 12px; font-weight: 600; color: #526273; }
.rgb-playground select { display: block; border: 1px solid #cdd8e1; border-radius: 4px; background: #fff; color: #405a70; padding: 6px 9px; height: 35px; max-width: 100%; font: inherit; font-size: 12px; }
.rgb-fatas-controls > label select { margin-top: 5px; width: 100%; }
.rgb-presets { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.rgb-presets .button { font-size: 11px; padding: 5px 8px; }
.rgb-presets .button[aria-pressed=true] { border-color: #3279b1; color: #23669a; background: #edf5fc; }
.rgb-fatas-layout { display: grid; grid-template-columns: 1fr 1.05fr; gap: 28px; align-items: start; }
.rgb-overview-column, .rgb-tiles-column { min-width: 0; }
.rgb-image-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 38px; margin-bottom: 10px; }
.rgb-image-heading strong { font-size: 14px; font-weight: 600; color: #425b72; }
.rgb-image-heading .rgb-label { font-size: 9px; margin: 0; }
.rgb-order-label { display: flex; align-items: center; gap: 6px; font-size: 10px; color: #7c8791; }
.rgb-order-label select { font-size: 10px; height: 29px; padding: 3px 5px; }
.rgb-overview { border: 1px solid #d6e0e8; border-radius: 5px; overflow: hidden; background: #f1f5f8; }
.rgb-overview svg { width: 100%; height: auto; display: block; }
.rgb-overview [role=button] { cursor: pointer; }
.rgb-overview [role=button]:focus-visible { outline: none; filter: drop-shadow(0 0 2px #fff); }
.rgb-overview-caption { font-size: 11px; color: #7b8894; line-height: 1.7; margin-top: 8px; }
.rgb-overview-column .rgb-key { margin-top: 8px; }
.rgb-crop-inspector { grid-template-columns: 78px 1fr; gap: 12px; padding: 12px; }
.rgb-crop-inspector .rgb-inspector-crop { width: 78px; height: 78px; }
.rgb-crop-inspector strong { font-size: 11px; }
.rgb-crop-inspector p { font-size: 10px; line-height: 1.6; }
.rgb-tile-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; padding: 3px; max-height: 590px; overflow-y: auto; }
.rgb-tile-grid.rgb-many-tiles { grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; }
.rgb-scored-tile { display: flex; flex-direction: column; position: relative; padding: 0; min-width: 0; overflow: hidden; border: 2px solid #e1e7ed; border-radius: 4px; background: #f9fbfd; }
.rgb-scored-tile > svg { aspect-ratio: 1; flex-shrink: 0; height: auto; }
.rgb-scored-tile.is-selected { border-color: #3180bb; background: #eaf3fb; }
.rgb-scored-tile.is-inspected { box-shadow: 0 0 0 1px #ae781e; border-color: #bd8627; }
.rgb-tile-score { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 4px; font-size: 11px; line-height: 1.5; padding: 5px 6px; color: #566c80; font-variant-numeric: tabular-nums; }
.rgb-tile-score b { font-size: 10px; font-weight: 500; }
.rgb-scored-tile.is-selected .rgb-tile-score { color: #1a629b; font-weight: 600; }
.rgb-many-tiles .rgb-tile-score { font-size: 9px; padding: 4px; }
.rgb-many-tiles .rgb-tile-score b { font-size: 9px; }
.rgb-grid-note { color: #89939d; font-size: 10px; line-height: 1.7; margin: 10px 3px 0; }
.rgb-aggregate { display: grid; grid-template-columns: 210px 1fr; align-items: center; gap: 26px; padding: 19px 22px; border: 1px solid #d2e2ef; background: #f1f7fc; border-radius: 5px; margin-top: 25px; }
.rgb-aggregate-value { display: flex; flex-direction: column; }
.rgb-aggregate-value > span { color: #526d86; font-size: 12px; }
.rgb-aggregate-value strong { font-size: 36px; line-height: 1.4; font-weight: 550; color: #23669a; font-variant-numeric: tabular-nums; }
.rgb-aggregate-value small { color: #7e8f9e; font-size: 10px; }
.rgb-aggregate-formula { min-width: 0; color: #59758d; font-size: 12px; }
#aggregate-formula > span { display: block; font-size: 11px; line-height: 1.8; overflow-wrap: anywhere; }
#aggregate-formula > strong { display: block; margin-top: 6px; font: 13px/1.7 Consolas,monospace; color: #345b7a; }
.rgb-mean-reference { margin-top: 7px; font-size: 10px; color: #8c9baa; }
.rgb-protocol { margin-top: 18px; border-top: 1px solid #e5ebef; padding-top: 10px; }
.rgb-protocol summary { color: #74889a; font-size: 12px; }
.rgb-protocol p { color: #85929f; font-size: 11px; line-height: 1.8; margin-top: 10px; }
@media(max-width: 950px) {
  .rgb-shuffle-controls { grid-template-columns: 1fr 1fr; gap: 15px 20px; }
  .rgb-control-buttons { grid-column: 1 / -1; }
  .rgb-donor-area { gap: 18px; }
  .rgb-donor-text { max-width: 245px; }
  .rgb-donors { gap: 9px; }
  .rgb-donors figure, .rgb-donor-image { width: 82px; }
  .rgb-donor-image { height: 82px; }
  .rgb-bag-heading { display: block; }
  .rgb-bag-heading > span { display: block; margin-top: 3px; }
  .rgb-fatas-controls { grid-template-columns: 1.2fr 1fr; gap: 13px 20px; }
  .rgb-presets { grid-column: 1 / -1; }
  .rgb-fatas-layout { gap: 20px; }
  .rgb-tile-grid.rgb-many-tiles { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media(max-width: 650px) {
  .rgb-panel { padding: 18px 14px; }
  .rgb-tab { padding: 14px 9px 11px; font-size: 14px; }
  .rgb-tab span { display: block; margin: 4px 0 0; font-size: 10px; }
  .rgb-panel-heading h3 { font-size: 18px; }
  .rgb-panel-heading p { font-size: 12px; }
  .rgb-shuffle-controls { grid-template-columns: 1fr; gap: 13px; padding: 13px; }
  .rgb-control-buttons { grid-column: auto; }
  .rgb-ratio-control > p { font-size: 9px; }
  .rgb-donor-area { flex-direction: column; align-items: stretch; gap: 14px; padding: 14px 10px; margin-block: 18px; }
  .rgb-donor-text { max-width: none; }
  .rgb-donor-text h4 { font-size: 14px; }
  .rgb-donor-text p { font-size: 11px; }
  .rgb-donors { justify-content: center; gap: 10px; }
  .rgb-donors figure, .rgb-donor-image { width: min(80px,22vw); }
  .rgb-donor-image { height: min(80px,22vw); }
  .rgb-donors figcaption { font-size: 9px; }
  .rgb-donors figcaption span { font-size: 8px; }
  .rgb-bags { grid-template-columns: 1fr; gap: 21px; }
  .rgb-bag-heading { display: flex; }
  .rgb-bag-heading h4 { font-size: 14px; }
  .rgb-bag-heading > span { font-size: 9px; }
  .rgb-label { font-size: 9px; padding: 2px 5px; }
  .rgb-bag { gap: 4px; padding: 5px; }
  .rgb-bag-count { font-size: 10px; }
  .rgb-key { gap: 5px 11px; font-size: 9px; margin-top: 12px; }
  .rgb-status { font-size: 11px; }
  .rgb-inspector { grid-template-columns: 70px 1fr; padding: 12px; gap: 12px; }
  .rgb-inspector-crop { width: 70px; height: 70px; }
  .rgb-inspector strong { font-size: 12px; }
  .rgb-inspector p { font-size: 10px; }
  .rgb-inspector small { font-size: 9px; }
  .rgb-fatas-controls { grid-template-columns: 1fr; padding: 13px; gap: 16px; }
  .rgb-presets { grid-column: auto; }
  .rgb-fatas-layout { grid-template-columns: 1fr; gap: 25px; }
  .rgb-image-heading strong { font-size: 13px; }
  .rgb-overview-caption { font-size: 10px; }
  .rgb-tile-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; max-height: 440px; }
  .rgb-tile-grid.rgb-many-tiles { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 5px; max-height: 370px; }
  .rgb-tile-score { font-size: 10px; padding: 4px; }
  .rgb-tile-score b { font-size: 9px; }
  .rgb-many-tiles .rgb-tile-score { font-size: 8px; padding: 3px; gap: 2px; }
  .rgb-many-tiles .rgb-tile-score b { font-size: 8px; }
  .rgb-aggregate { grid-template-columns: 1fr; gap: 15px; padding: 16px; }
  .rgb-aggregate-value strong { font-size: 33px; }
  #aggregate-formula > span { font-size: 10px; }
  #aggregate-formula > strong { font-size: 11px; }
  .rgb-protocol p { font-size: 10px; }
}
@media(prefers-reduced-motion: reduce) {
  .rgb-instance { transition: none; }
}
