/* ==========================================================================
   modules.css — simulator module cards, component list, Module Library and
   the Create-module wizard. Cards copy the real Raiiotronix modules:
   white face with the component drawn on it, orange band with NAME/subtitle,
   a round button and a green status LED.
   ========================================================================== */
:root { --band-orange: #F37A33; --card-h: 214px; }

/* ---------- Simulator tab layout ---------- */
.sim-scroll { flex: 1; overflow: auto; min-height: 0; background: radial-gradient(circle at 1px 1px, #DDE1E6 1px, transparent 0) 0 0/18px 18px, var(--bg); }
.sim-scroll .board { flex: none; overflow: visible; background: none; padding: 12px 14px 18px; }
.board-stats { display: inline-flex; gap: 10px; }

/* ---------- Component list (palette) ---------- */
.palette { margin: 12px 14px 0; background: #fff; border-radius: 12px; box-shadow: 0 0 0 1px rgba(20,32,48,.07), 0 4px 12px -8px rgba(20,32,48,.25); }
.palette summary { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; font-size: 12.5px; list-style: none; user-select: none; }
.palette summary::-webkit-details-marker { display: none; }
.palette summary::after { content: ""; margin-left: 4px; width: 7px; height: 7px; border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
.palette[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.palette summary [data-pal-count] { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.pal-body { padding: 0 12px 10px; max-height: 172px; overflow: auto; border-top: 1px solid var(--border); }
.pal-group { margin-top: 8px; }
.pal-gname { font: 700 9.5px var(--font); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.pal-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.pal-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 5px 0 8px; border: 1px solid var(--border-strong); border-radius: 999px;
  background: #fff; font-size: 11.5px; font-weight: 500; color: var(--text-2); --ic-accent: #FCD9C3; transition: border-color .12s, background .12s; }
.pal-chip:hover { border-color: var(--accent); color: var(--text); }
.pal-chip em { font-style: normal; font-weight: 700; font-size: 10px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; background: var(--surface-3); color: var(--text-2); }
.pal-chip.used { border-color: var(--accent); background: var(--accent-50); color: var(--accent-600); font-weight: 600; }
.pal-chip.used em { background: var(--accent); color: #fff; }
.pal-chip.added { border-color: #9BC996; background: #F1F8F0; color: #2F6B2A; }
.pal-chip.added em { background: #62A05A; color: #fff; }
.pal-empty { color: var(--muted); font-size: 12px; padding: 10px 0; }

/* ---------- Module cards (uniform grid) ---------- */
.rxm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); grid-auto-rows: var(--card-h); gap: 12px; }
.rxm-card { display: flex; flex-direction: column; border-radius: 14px; overflow: hidden; position: relative; min-width: 0;
  background: linear-gradient(175deg, #FFFFFF 0%, #FAFBFC 40%, #EEF2F6 100%);
  border: 1px solid #D6DCE5; border-bottom: 2.5px solid #BAC4D2;
  box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 6px 16px -4px rgba(15,23,42,.18), 0 16px 28px -8px rgba(15,23,42,.14), inset 0 1px 0.5px rgba(255,255,255,.95), inset 0 -2px 0 rgba(0,0,0,.08);
  transition: transform .18s cubic-bezier(.2,.8,.4,1), box-shadow .18s cubic-bezier(.2,.8,.4,1); }
.rxm-card:hover {
  box-shadow: 0 2px 4px rgba(15,23,42,.08), 0 10px 24px -4px rgba(15,23,42,.22), 0 20px 34px -8px rgba(15,23,42,.18), inset 0 1px 0.5px rgba(255,255,255,.95), inset 0 -2px 0 rgba(0,0,0,.08); }
.rxm-card.wide { grid-column: span 2; }
.rxm-card.extra { box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 6px 16px -4px rgba(15,23,42,.18), 0 0 0 2px rgba(98,160,90,.3); }
.rxm-card.flash { animation: cardFlash .9s ease-out; }
@keyframes cardFlash { 0% { box-shadow: 0 0 0 3px var(--accent), 0 10px 24px -6px rgba(20,32,48,.4); } 100% { box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 6px 16px -4px rgba(15,23,42,.18); } }
.rxm-face { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px 10px 4px; position: relative; }
.rxm-top { display: flex; align-items: center; gap: 6px; height: 18px; flex: none; }
.rxm-logo { font: 700 9.5px var(--font); color: #8F97A3; letter-spacing: .03em; text-shadow: 0 0.5px 0 #fff; }
.rxm-logo b { color: var(--band-orange); font-weight: 800; }
.rxm-pin { margin-left: auto; font: 700 9.5px var(--mono); color: var(--text-2); background: linear-gradient(180deg, #FFFFFF, #E9ECF0); padding: 1px 6px; border-radius: 5px; border: 1px solid #D0D6DF; box-shadow: 0 1px 2px rgba(0,0,0,.06), inset 0 1px 0 #fff; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rxm-pin:empty { display: none; }
.rxm-led { width: 8px; height: 8px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #D4F4DC 0%, #8CD9A0 40%, #3DA65C 85%, #246B3A 100%);
  box-shadow: inset 0 1px 1.5px rgba(255,255,255,.7), inset 0 -1px 1.5px rgba(0,0,0,.3), 0 0 0 0.8px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.12); flex: none; margin-left: auto; transition: all .12s ease; }
.rxm-pin + .rxm-led { margin-left: 0; }
.rxm-card.active .rxm-led, .rxm-led.lit { background: radial-gradient(circle at 40% 35%, #FFFFFF 0%, #68FFA0 35%, #22C55E 70%, #15803D 100%);
  box-shadow: 0 0 8px #22C55E, 0 0 18px rgba(34,197,94,.7), inset 0 1px 2px #fff, inset 0 -1px 2px rgba(0,0,0,.25); }
.rxm-btn { width: 17px; height: 17px; border-radius: 50%; flex: none; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #FFFFFF 0%, #E8ECF0 45%, #BFC7D2 85%, #9AA3B0 100%);
  box-shadow: 0 0 0 1.2px #8892A0, inset 0 1px 1px #fff, inset 0 -1px 2px rgba(0,0,0,.35), 0 2px 4px rgba(15,23,42,.22);
  transition: transform .08s, box-shadow .08s; }
.rxm-btn:active { transform: scale(.91); box-shadow: 0 0 0 1.2px #7A8594, inset 0 2px 3px rgba(0,0,0,.45); }
.rxm-art { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 2px 0; filter: drop-shadow(0 3px 5px rgba(15,23,42,.12)); }
.rxm-art svg.art { width: 100%; height: 100%; max-width: 150px; overflow: visible; }
.rxm-card.wide .rxm-art svg.art { max-width: 290px; }
.rxm-art svg.clickable { cursor: pointer; }
.rxm-ctl { flex: none; display: flex; flex-direction: column; gap: 3px; padding-top: 2px; }
.rxm-read { flex: none; height: 17px; line-height: 17px; font: 700 10.5px var(--mono); color: var(--text-2); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0.5px 0 #fff; }
.rxm-card.active .rxm-read { color: var(--accent-600); }
.rxm-band { height: 44px; flex: none; position: relative; color: #fff; padding: 5px 30px 5px 11px; display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(180deg, color-mix(in srgb, var(--band-orange) 88%, #fff) 0%, var(--band-orange) 35%, color-mix(in srgb, var(--band-orange) 85%, #000) 100%);
  border-top: 1px solid rgba(255,255,255,.3);
  box-shadow: inset 0 1.5px 0.5px rgba(255,255,255,.5), inset 0 -2px 3px rgba(0,0,0,.3), 0 2px 5px rgba(243,122,51,.22); }
.rxm-band b { font: 800 12px var(--font); letter-spacing: .05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.rxm-band small { font: 500 9.5px var(--font); opacity: .94; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.rxm-x { position: absolute; right: 7px; top: 50%; margin-top: -10px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(255,255,255,.22); color: #fff; font-size: 14px; line-height: 20px; padding: 0; }
.rxm-x:hover { background: rgba(255,255,255,.4); }

/* controls inside cards */
.ctl-slider { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 6px; font: 600 10px var(--font); color: var(--muted); }
.ctl-slider input[type=range] { height: 5px; background: linear-gradient(90deg, var(--band-orange), #F9C29F); }
.ctl-slider input[type=range]::-webkit-slider-thumb { width: 15px; height: 15px; }
.ctl-row { display: flex; gap: 4px; align-items: center; justify-content: center; }
.ctl-row.tags { flex-wrap: nowrap; }
.ctl-check { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 10.5px; color: var(--text-2); cursor: pointer; }
.ctl-check input { accent-color: var(--band-orange); margin: 0; }
.mini { height: 22px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border-strong); background: #fff; font: 600 11px var(--font); color: var(--text-2); }
.mini:hover { border-color: var(--band-orange); color: var(--text); }
.mini:active { background: var(--accent-50); }
.mini.wide { flex: 1; }
.mini.tag { padding: 0 5px; font-size: 10px; border-left: 4px solid var(--tag); }
.hint { font-size: 10px; color: var(--muted); }

/* per-kind visuals */
.rxm-card .waves .w { opacity: 0; }
.rxm-card.sounding .waves .w { animation: wv .7s ease-out infinite; }
.rxm-card.sounding .waves .w2, .rxm-card.sounding .waves .w4 { animation-delay: .35s; }
@keyframes wv { 0% { opacity: .9; } 100% { opacity: 0; } }
.rxm-card.sounding .cone { animation: cone .12s linear infinite; }
@keyframes cone { 50% { r: 10.5; } }
.rxm-card .press { cursor: pointer; outline: none; }
.rxm-card .press .cap { transition: transform .05s; transform-origin: 60px 42px; }
.rxm-card.pressed .press .cap { transform: scale(.88); fill: #D9621F; }
.rxm-card .press:focus-visible .cap { stroke: #1E2329; stroke-width: 2; }
.seg path { fill: #3A1D1A; transition: fill .05s; }
.seg path.on { fill: #FF4136; filter: drop-shadow(0 0 2px rgba(255,65,54,.8)); }
.colon { fill: #3A1D1A; }
.keypad-art .key { cursor: pointer; outline: none; }
.keypad-art .key rect { fill: #3F464F; stroke: #59616B; }
.keypad-art .key text { fill: #fff; font: 700 11px var(--font); text-anchor: middle; pointer-events: none; }
.keypad-art .key:hover rect { fill: #4D555F; }
.keypad-art .key.down rect { fill: var(--band-orange); }
.lcd-art .lcd-bg { fill: #0F2A55; }
.lcd-art .cell { fill: rgba(255,255,255,.05); }
.lcd-art .ch { font: 600 12.5px var(--mono); fill: #5F7BAA; text-anchor: middle; white-space: pre; }
.lcd-art.backlight .lcd-bg { fill: #2F6FE0; }
.lcd-art.backlight .cell { fill: rgba(255,255,255,.12); }
.lcd-art.backlight .ch { fill: #F3F8FF; }
.oled-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.oled-cv { height: 100%; max-height: 104px; aspect-ratio: 2 / 1; image-rendering: pixelated;
  background: radial-gradient(circle at 45% 40%, #06090E 0%, #000000 100%);
  border: 5px solid #14171C; border-radius: 6px;
  box-shadow: 0 0 0 1px #2B3038, 0 6px 14px -3px rgba(0,0,0,.6), inset 0 1px 2px rgba(255,255,255,.2); }
.an-grid { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; align-self: center; }
.an-grid .an-row { display: grid; grid-template-columns: 24px 1fr 34px; align-items: center; gap: 6px; padding: 3px 0; opacity: 1; }
.an-grid .an-row b { font: 700 11px var(--mono); color: var(--text-2); }
.an-grid output { font: 600 11px var(--mono); text-align: right; }
.an-grid input[type=range] { height: 5px; background: linear-gradient(90deg, var(--band-orange), #F9C29F); }
.sim-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; grid-row: span 1; }
.sim-empty p { margin: 0; line-height: 1.5; }
.sim-empty .ic { width: 28px; height: 28px; color: var(--muted); }

/* ---------- Module Library ---------- */
.library-view { position: absolute; inset: 0; z-index: 20; background: var(--bg); display: none; flex-direction: column; }
.app[data-panel="library"] .library-view { display: flex; }
.app[data-panel="library"] .side-panel { display: none !important; }
/* v8: the side-menu splitter has nothing to resize here and sat over the first card column (its "Doc" button was unclickable) */
.app[data-panel="library"] #splitLeft { display: none !important; }
/* v11: the tools wrap under / beside the title instead of running out of the library (1280 px) */
.lib-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px 16px; padding: 20px 24px 8px; }
.lib-title { flex: 1 1 300px; min-width: 0; }
.lib-title h2 { margin: 0; font-size: 20px; font-weight: 700; }
.lib-title p { margin: 4px 0 0; color: var(--text-2); font-size: 13px; max-width: 620px; line-height: 1.45; }
.lib-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; align-items: center; flex: 0 1 auto; max-width: 100%; }
.lib-tools .btn-soft { height: 36px; padding: 0 14px; }
.lib-search { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 9px; background: #fff; color: var(--muted); }
.lib-search input { border: 0; outline: 0; width: 190px; background: transparent; color: var(--text); }
.lib-filters { display: flex; gap: 6px; padding: 6px 24px 12px; align-items: center; flex-wrap: wrap; }
.chip { height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: #fff; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.chip:hover { border-color: var(--text-2); }
.chip.active { background: #1E2329; color: #fff; border-color: #1E2329; }
.lib-count { margin-left: auto; font-size: 12px; color: var(--muted); }
.lib-grid { flex: 1; overflow: auto; padding: 4px 24px 28px; display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); grid-auto-rows: 292px; gap: 16px; align-content: start; }
.lib-card { border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; position: relative; min-width: 0;
  background: linear-gradient(175deg, #FFFFFF 0%, #FAFBFC 40%, #EEF2F6 100%);
  border: 1px solid #D6DCE5; border-bottom: 2.5px solid #BAC4D2;
  box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 8px 20px -4px rgba(15,23,42,.18), 0 16px 30px -8px rgba(15,23,42,.14), inset 0 1px 0.5px rgba(255,255,255,.95), inset 0 -2px 0 rgba(0,0,0,.08);
  transition: box-shadow .2s cubic-bezier(.2,.8,.4,1), transform .2s cubic-bezier(.2,.8,.4,1); }
.lib-card:hover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(15,23,42,.08), 0 12px 28px -4px rgba(15,23,42,.24), 0 22px 36px -8px rgba(15,23,42,.2), inset 0 1px 0.5px rgba(255,255,255,.95), inset 0 -2px 0 rgba(0,0,0,.08); }
.lib-card.on { box-shadow: 0 0 0 2.5px var(--band-orange), 0 12px 28px -4px rgba(15,23,42,.24); }
.lib-face { flex: 1; min-height: 0; padding: 10px 12px 8px; display: flex; flex-direction: column; position: relative; }
.lib-fam { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 600; color: var(--text-2); background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px 1px 5px; margin-left: auto; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.lib-fam i { width: 8px; height: 8px; border-radius: 3px; background: var(--fam); }
.lib-fam + .rxm-led { margin-left: 0; }
.lib-art { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 2px; padding: 4px 0; filter: drop-shadow(0 3px 5px rgba(15,23,42,.12)); }
.lib-art .la-part { flex: 1; height: 100%; min-width: 0; display: flex; }
.lib-art .la-part svg, .lib-art .la-part > div { width: 100%; height: 100%; }
.lib-art .la-part .oled-cv { max-height: 70px; }
.lib-art.n1 .la-part { max-width: 180px; }
.lib-art.custom .ic.big, .lib-art.icon .ic.big { width: 76px; height: 76px; color: color-mix(in srgb, var(--band, #F37A33) 75%, #111); --ic-accent: color-mix(in srgb, var(--band, #F37A33) 35%, #fff); stroke-width: 1.3; }
.lib-art.icon { --band: var(--fam); }
.lib-desc { font-size: 12px; line-height: 1.4; color: var(--text-2); margin: 4px 0 6px; height: 34px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.lib-meta { display: flex; gap: 5px; font-size: 10.5px; color: var(--text-2); overflow: hidden; }
.lib-meta span { background: var(--surface-3); padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.lib-band { height: 58px; flex: none; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 10px 0 13px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--band-orange) 88%, #fff) 0%, var(--band-orange) 35%, color-mix(in srgb, var(--band-orange) 85%, #000) 100%);
  border-top: 1px solid rgba(255,255,255,.3);
  box-shadow: inset 0 1.5px 0.5px rgba(255,255,255,.5), inset 0 -2px 3px rgba(0,0,0,.3), 0 2px 5px rgba(243,122,51,.22); }
.lib-band > div:first-child { min-width: 0; }
.lib-band b { display: block; font: 800 12.5px var(--font); letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.lib-band small { display: block; font-size: 10.5px; font-weight: 500; opacity: .94; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.lib-actions { display: flex; gap: 5px; align-items: center; flex: none; }
.lib-toggle { height: 28px; padding: 0 10px; border-radius: 8px; border: 0; background: #fff; color: var(--accent-600); font-weight: 700; font-size: 12px; white-space: nowrap; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.lib-toggle.on { background: rgba(255,255,255,.18); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.9); }
.lib-toggle:hover { filter: brightness(.97); }
.lib-mini { height: 24px; padding: 0 7px; border-radius: 7px; border: 0; background: rgba(255,255,255,.2); color: #fff; font-weight: 600; font-size: 11px; }
.lib-mini:hover { background: rgba(255,255,255,.34); }
.lib-card.create { border: 2px dashed var(--border-strong); background: rgba(255,255,255,.55); box-shadow: none; align-items: center; justify-content: center; gap: 6px; color: var(--text-2); text-align: center; padding: 20px; }
.lib-card.create:hover { border-color: var(--accent); color: var(--accent-600); }
.lib-card.create .ic.big { width: 44px; height: 44px; --ic-accent: var(--accent-100); color: var(--accent); }
.lib-card.create b { font-size: 14px; }
.lib-card.create small { font-size: 12px; color: var(--muted); }
.lib-card.mini { height: 196px; flex: none; transform: none; }
.lib-card.mini .lib-band { height: 50px; }

/* ---------- Create-module wizard ---------- */
.wizard-backdrop { position: fixed; inset: 0; background: rgba(20, 26, 34, .42); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 350; }
.wizard-backdrop[hidden] { display: none; }
.wz { width: min(1120px, 94vw); height: min(740px, 92vh); background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: toastIn .18s; }
.wz-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 22px 10px; }
.wz-head h3 { margin: 0; font-size: 18px; }
.wz-head p { margin: 3px 0 0; color: var(--text-2); font-size: 13px; }
.wz-steps { display: flex; gap: 6px; padding: 0 22px 12px; border-bottom: 1px solid var(--border); }
.wz-step { display: inline-flex; gap: 8px; align-items: center; height: 32px; padding: 0 12px 0 5px; border-radius: 999px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: 13px; }
.wz-step i { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); font-style: normal; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.wz-step:hover { background: var(--surface-3); }
.wz-step.active { background: var(--accent-50); color: var(--accent-600); }
.wz-step.active i { background: var(--accent); color: #fff; }
.wz-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 360px; }
.wz-form { overflow: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; }
.wz-preview { border-left: 1px solid var(--border); background: var(--surface-2); padding: 14px 16px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.fld { display: flex; flex-direction: column; gap: 5px; }
.fld > span { font-size: 12px; font-weight: 600; color: var(--text-2); }
.fld.inline { flex: 1; }
textarea.input { height: auto; padding: 8px 11px; resize: vertical; line-height: 1.45; }
.input.mono, .mono { font-family: var(--mono); font-size: 12.5px; }
.input.sm { width: 110px; }
.swatches { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); background: var(--c); padding: 0; }
.sw.on { box-shadow: 0 0 0 2px #1E2329; }
.swatches input[type=color] { width: 36px; height: 30px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; padding: 2px; }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, 40px); gap: 6px; }
.ip { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text-2); display: grid; place-items: center; --ic-accent: #FCD9C3; padding: 0; }
.ip .ic { width: 22px; height: 22px; }
.ip:hover { border-color: var(--text-2); }
.ip.on { border-color: var(--accent); background: var(--accent-50); color: var(--accent-600); box-shadow: 0 0 0 2px var(--accent-100); }
.wz-help { font-size: 12.5px; line-height: 1.55; color: var(--text-2); margin: 0; background: #F8F9FB; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.wz-help code, .wz-form code { font: 11.5px var(--mono); background: #fff; padding: 1px 4px; border-radius: 4px; border: 1px solid var(--border); white-space: nowrap; }
.wz-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.wz-table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.wz-table td { padding: 0 4px; }
.wz-block { border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: #fff; box-shadow: var(--shadow-xs); }
.wz-brow { display: flex; gap: 8px; align-items: flex-end; }
.wz-brow .select { width: auto; }
.wz-brow .grow { flex: 1; }
.wz-form > .btn-soft { align-self: flex-start; }
.wz-blocks { height: 160px; background: #F4F6F8; border-radius: 10px; border: 1px solid var(--border); overflow: hidden; position: relative; flex: none; }
.wz-code { margin: 0; max-height: 200px; overflow: auto; font-size: 11.5px; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; flex: none; }
.wz-code .ln { display: block; }
.wz-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 22px; border-top: 1px solid var(--border); }
.wz-foot .btn-soft { height: 36px; padding: 0 16px; }
.wz-foot .btn-soft[hidden] { display: none; }
.wz-err { margin-right: auto; color: var(--red); font-size: 12.5px; font-weight: 500; }
.seg-btns { display: inline-flex; gap: 4px; flex-wrap: wrap; }

/* ---------- v9: Documentation tab (rail "Docs") ---------- */
.docs-view { position: absolute; inset: 0; z-index: 20; background: var(--bg); display: none; }
.app[data-panel="docs"] .docs-view { display: flex; }
.app[data-panel="docs"] .side-panel, .app[data-panel="docs"] #splitLeft { display: none !important; }
.dv-side { width: 270px; flex: none; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--surface); }
.dv-title { padding: 18px 16px 8px; }
.dv-title h2 { margin: 0; font-size: 18px; font-weight: 700; }
.dv-title p { margin: 4px 0 0; color: var(--text-2); font-size: 12px; line-height: 1.4; }
.dv-search { margin: 4px 12px 8px; }
.dv-search input { width: 100%; }
.dv-index { flex: 1; overflow: auto; padding: 0 8px 16px; }
.dv-group { margin: 12px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.dv-item { --band: #F37A33; display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; padding: 6px 8px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text); }
.dv-item:hover { background: var(--surface-3); }
.dv-item.active { background: #fff; border-color: var(--band); box-shadow: var(--shadow-xs); }
.dv-item b { display: block; font-size: 12.5px; font-weight: 600; }
.dv-item small { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.dv-ii { width: 26px; height: 26px; flex: none; border-radius: 7px; background: var(--band); color: #fff; display: grid; place-items: center; }
.dv-none { padding: 12px; }
.dv-page { flex: 1; min-width: 0; overflow: auto; padding: 18px 24px 28px; }
.dv-doc.md-dlg { width: auto; max-width: 1080px; max-height: none; margin: 0 auto; }
.dv-doc .md-body { overflow: visible; }
.md-badge { display: inline-block; font: 700 9.5px var(--font); letter-spacing: .05em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; background: var(--accent-50); color: var(--accent-600); vertical-align: 1px; }
.md-b-doc { color: var(--text) !important; }
.md-b-use { font-style: italic; }
.md-exs { display: grid; gap: 8px; }
.md-ex { display: flex; gap: 12px; align-items: center; justify-content: space-between; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.md-ex p { margin: 3px 0 0 !important; font-size: 12.5px !important; color: var(--text-2); }
.md-ex .btn-soft { flex: none; }

/* ---------- v9: Examples panel sections ---------- */
.ex-group { margin-bottom: 8px; }
.ex-group > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 7px 6px; margin-bottom: 6px;
  font: 700 11.5px var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); border-bottom: 1px solid var(--border); }
.ex-group > summary::-webkit-details-marker { display: none; }
.ex-group > summary::before { content: "▸"; margin-right: 6px; color: var(--muted); transition: transform .15s; }
.ex-group[open] > summary::before { transform: rotate(90deg); }
.ex-group > summary span { flex: 1; }
.ex-group > summary small { font-weight: 600; color: var(--muted); background: var(--surface-3); border-radius: 999px; padding: 1px 8px; }
.ex-note { margin: 0 2px 8px; font-size: 11.5px; color: var(--muted); }
/* v12 (Phase 6): LED card colour / resistor pickers and the burned-out look */
.ctl-sel { display: inline-flex; align-items: center; gap: 4px; font: 600 10px var(--font); color: var(--muted); margin-right: 6px; }
.ctl-sel select { font: 500 10.5px var(--font); padding: 1px 2px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: inherit; }
.ctl-btn { font: 600 10.5px var(--font); padding: 2px 8px; border: 1px solid #e0a0a0; border-radius: 6px; background: #fff1f1; color: #9b1c1c; cursor: pointer; }
.led-burned .dome { fill: #3a3a3a !important; opacity: .85; }
.led-burned .art { filter: grayscale(.8); }
/* v12.1 part cards: signal generator, NeoPixel cap, OLED zoom / grid */
.sg-box { width: 100%; font-size: 11.5px; margin-top: 2px; } .sg-box summary { cursor: pointer; color: var(--muted, #667); }
.sg-box .ctl-sel { display: inline-flex; gap: 4px; align-items: center; margin: 2px 6px 2px 0; } .sg-box textarea { width: 100%; font: 11px/1.3 monospace; }
.sg-csv { display: flex !important; flex-direction: column; align-items: stretch !important; width: 100%; }
.rxm-card.np-over .rxm-read { color: #c0392b; font-weight: 600; }
.oled-wrap.zoomed { overflow: auto; max-height: 340px; }
.oled-wrap.zoomed .oled-cv { max-height: none; height: calc(64px * var(--oz) * 1.6); }
.rxm-card.oled-zoomed { grid-column: 1 / -1; }
