/* Orea — interactive blocks inside replies (assets/js/chat-blocks.js).
   Built on the chat's own tokens (chat.css): one ivory accent, quiet lines, the reading font.
   A block is a calm card in the reading column; it never competes with the text around it. */

.md .dwb {
  --dwb-ink: var(--fg, #ede7dd);
  --dwb-muted: var(--muted, #a4adbb);
  --dwb-line: var(--line-2, rgba(237,231,221,.13));
  --dwb-grid: rgba(237,231,221,.06);
  --dwb-fill: var(--fill-2, #252a34);
  --dwb-path: rgba(242,236,226,.5);
  --dwb-accent: var(--ivory, #f2ece2);
  --dwb-cone: rgba(242,236,226,.1);
  margin: 18px 0;
  padding: 14px 16px 16px;
  border: 1px solid var(--dwb-line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--raised, #191f29) 55%, transparent);
  font-size: var(--fs-ui, 14px);
  line-height: 1.7;
  color: var(--dwb-ink);
}
.md .dwb:first-child { margin-top: 0; }
.md .dwb:last-child { margin-bottom: 0; }

.dwb__head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.dwb__kind { font-size: var(--fs-meta, 12.5px); color: var(--dwb-muted); letter-spacing: .01em; }
.dwb__title { font-weight: 600; font-size: 15px; }
.dwb__badge { margin-inline-start: auto; padding: 1px 8px; border: 1px solid var(--dwb-line); border-radius: 99px; font-size: 11.5px; color: var(--dwb-muted); }
.dwb__q { margin: 0 0 12px; font-size: var(--fs-read, 16px); font-weight: 500; }
.dwb-label { margin: 0 0 6px; font-size: var(--fs-meta, 12.5px); color: var(--dwb-muted); }
.dwb-note { margin: 10px 0 0; font-size: var(--fs-meta, 12.5px); color: var(--dwb-muted); }
.dwb-note--muted { opacity: .85; }
.md .dwb-note:only-child { margin: 0; }

.dwb.is-superseded { opacity: .55; }
.dwb.is-superseded .dwb-stage__canvas { filter: grayscale(.6); }

/* buttons */
.dwb-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  border: 1px solid var(--dwb-line); border-radius: 10px;
  background: transparent; color: var(--dwb-ink);
  font: 500 var(--fs-ui, 14px)/1 var(--font, system-ui); cursor: pointer;
  transition: background .2s var(--ease, ease), border-color .2s var(--ease, ease);
}
.dwb-btn:hover:not(:disabled) { background: var(--hover, rgba(237,231,221,.055)); border-color: var(--line-3, rgba(237,231,221,.24)); }
.dwb-btn--primary { background: var(--dwb-accent); border-color: var(--dwb-accent); color: var(--on-ivory, #0b0d11); }
.dwb-btn--primary:hover:not(:disabled) { background: #fff; border-color: #fff; }
.dwb-btn:disabled { opacity: .45; cursor: default; }
.dwb :focus-visible { outline: 2px solid var(--dwb-accent); outline-offset: 2px; }

.dwb-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.dwb-foot .dwb-note { margin: 0; flex-basis: 100%; }

/* choices */
.dwb-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.dwb-options.has-sketch { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.dwb-option {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px;
  padding: 11px 13px; min-height: 48px;
  border: 1px solid var(--dwb-line); border-radius: 12px;
  background: transparent; color: var(--dwb-ink);
  font: inherit; text-align: start; cursor: pointer;
  transition: background .2s var(--ease, ease), border-color .2s var(--ease, ease), transform .2s var(--ease, ease);
}
.dwb-option:hover { background: var(--hover, rgba(237,231,221,.055)); border-color: var(--line-3, rgba(237,231,221,.24)); }
.dwb-option:active { transform: scale(.985); }
.dwb-option[aria-pressed="true"] { border-color: var(--dwb-accent); background: color-mix(in srgb, var(--dwb-accent) 9%, transparent); }
.dwb-option__label { font-weight: 500; }
.dwb-option__desc { font-size: var(--fs-meta, 12.5px); color: var(--dwb-muted); line-height: 1.55; }
.dwb-sketch { display: block; width: 100%; height: 56px; margin-bottom: 6px; border-radius: 8px; background: rgba(237,231,221,.03); overflow: visible; }
.dwb-sketch__path { fill: none; stroke: var(--dwb-path); stroke-width: 2; stroke-linecap: round; }
.dwb-sketch__start { fill: var(--dwb-muted); }
.dwb-sketch__head { fill: var(--dwb-accent); }
.dwb-option[aria-pressed="true"] .dwb-sketch__path { stroke: var(--dwb-accent); }

.dwb-custom { display: flex; gap: 8px; flex: 1 1 260px; }
.dwb-input {
  flex: 1; min-width: 0; min-height: 36px; padding: 0 12px;
  border: 1px solid var(--dwb-line); border-radius: 10px;
  background: rgba(0,0,0,.18); color: var(--dwb-ink); font: inherit;
}
.dwb-input::placeholder { color: var(--dwb-muted); }
.dwb-input:focus { outline: none; border-color: var(--line-3, rgba(237,231,221,.24)); }

/* slider + scene ranges */
.dwb-slider__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.dwb-slider__val { font-variant-numeric: tabular-nums; font-weight: 600; }
.dwb-slider__ends { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--dwb-muted); }
.dwb-range { width: 100%; accent-color: var(--dwb-accent); margin: 6px 0; }

/* diagram + charts */
.dwb-scroll { overflow-x: auto; }
.dwb-diagram { display: block; width: 100%; height: auto; margin-inline: auto; }
.dwb-node rect { fill: var(--dwb-fill); stroke: var(--dwb-line); }
.dwb-node__label { fill: var(--dwb-ink); font: 500 13px var(--font, system-ui); }
.dwb-edge { fill: none; stroke: var(--dwb-path); stroke-width: 1.5; }
.dwb-arrow { fill: var(--dwb-path); }
.dwb-edge__label { fill: var(--dwb-muted); font: 11.5px var(--font, system-ui); paint-order: stroke; stroke: var(--bg, #0e1118); stroke-width: 4px; }

.dwb-bars { display: grid; gap: 8px; }
.dwb-bar { display: grid; grid-template-columns: minmax(64px, 28%) 1fr auto; align-items: center; gap: 10px; }
.dwb-bar__label { font-size: var(--fs-meta, 12.5px); color: var(--fg-2, #c6cbd3); overflow-wrap: anywhere; }
.dwb-bar__track { height: 10px; border-radius: 99px; background: rgba(237,231,221,.06); overflow: hidden; }
.dwb-bar__fill { display: block; height: 100%; border-radius: 99px; background: var(--dwb-accent); }
.dwb-bar__fill.is-neg { background: var(--danger, #ff9e92); }
.dwb-bar__val { font-size: var(--fs-meta, 12.5px); font-variant-numeric: tabular-nums; }
.dwb-line { display: block; width: 100%; height: auto; }
.dwb-axis { stroke: var(--dwb-line); }
.dwb-line__path { fill: none; stroke: var(--dwb-accent); stroke-width: 2; stroke-linejoin: round; }
.dwb-line__dot { fill: var(--dwb-accent); }
.dwb-line__val { fill: var(--dwb-ink); font: 600 11px var(--font, system-ui); }
.dwb-line__x { fill: var(--dwb-muted); font: 11px var(--font, system-ui); }

/* timeline */
.md .dwb-timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.dwb-timeline::before { content: ""; position: absolute; inset-block: 8px; inset-inline-start: 5px; width: 1px; background: var(--dwb-line); }
.md .dwb-timeline li { position: relative; display: flex; gap: 12px; align-items: baseline; margin: 0; padding: 0 0 12px 0; padding-inline-start: 22px; }
.dwb-timeline li::before { content: ""; position: absolute; inset-inline-start: 1px; top: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--dwb-accent); }
.dwb-timeline li:last-child { padding-bottom: 0; }
.dwb-timeline__at { flex: none; min-width: 44px; font-size: var(--fs-meta, 12.5px); color: var(--dwb-muted); font-variant-numeric: tabular-nums; }
.md .dwb-timeline p { margin: 2px 0 0; font-size: var(--fs-meta, 12.5px); color: var(--fg-2, #c6cbd3); }

/* storyboard */
.md .dwb-board { list-style: none; margin: 0; padding: 0 0 4px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(170px, 1fr); gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; }
.md .dwb-frame { margin: 0; scroll-snap-align: start; }
.dwb-frame__shot { position: relative; aspect-ratio: 16/9; border: 1px solid var(--dwb-line); border-radius: 10px; background: rgba(237,231,221,.03); margin-bottom: 8px; }
.dwb-frame__n { position: absolute; inset-block-start: 6px; inset-inline-start: 8px; font: 600 12px var(--latin, system-ui); color: var(--dwb-muted); }
.dwb-frame__cam { position: absolute; inset-block-end: 6px; inset-inline: 8px; font-size: 11.5px; color: var(--fg-2, #c6cbd3); }
.md .dwb-frame p { margin: 2px 0 0; font-size: var(--fs-meta, 12.5px); color: var(--fg-2, #c6cbd3); }

/* compare */
.dwb-compare { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 10px; }
.dwb-compare__col { padding: 12px; border: 1px solid var(--dwb-line); border-radius: 12px; }
.md .dwb-compare__col p { margin: 4px 0 0; font-size: var(--fs-meta, 12.5px); color: var(--fg-2, #c6cbd3); }
.md .dwb-compare__col ul { margin: 6px 0 0; padding-inline-start: 18px; font-size: var(--fs-meta, 12.5px); }
.md .dwb-compare__col li { margin: 2px 0; }

/* note */
.md .dwb--note { padding: 12px 14px; }
.md .dwb-callout { margin: 0; }
.dwb--note:has(.dwb-callout--warn) { border-color: color-mix(in srgb, var(--danger, #ff9e92) 45%, transparent); }

/* decisions + production */
.md .dwb-decisions { display: grid; margin: 0; border: 1px solid var(--dwb-line); border-radius: 10px; overflow: hidden; }
.dwb-decision { display: grid; grid-template-columns: minmax(90px, 32%) 1fr; gap: 12px; padding: 9px 12px; }
.dwb-decision + .dwb-decision { border-top: 1px solid var(--dwb-line); }
.md .dwb-decision dt { color: var(--fg-2, #c6cbd3); font-size: var(--fs-meta, 12.5px); }
.md .dwb-decision dd { margin: 0; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.dwb-status { flex: none; font-size: 11px; color: var(--dwb-muted); }
.dwb-decision.is-confirmed .dwb-status { color: var(--dwb-accent); }
.dwb-decision.is-open dd > span:first-child { color: var(--dwb-muted); }
.dwb-produce > * + * { margin-top: 12px; }
.dwb-details summary { cursor: pointer; color: var(--fg-2, #c6cbd3); font-size: var(--fs-meta, 12.5px); }
.md .dwb-prompt { margin: 8px 0 0; padding: 10px 12px; max-height: 220px; overflow: auto; white-space: pre-wrap; border-radius: 10px; background: rgba(0,0,0,.25); font: 12.5px/1.6 var(--mono, monospace); color: var(--fg-2, #c6cbd3); }

/* scene */
.dwb-stage { position: relative; border: 1px solid var(--dwb-line); border-radius: 12px; overflow: hidden; background: rgba(0,0,0,.22); }
.dwb-stage__canvas { display: block; width: 100%; }
.dwb-stage__tag { position: absolute; inset-block-start: 8px; inset-inline-end: 10px; font-size: 11px; color: var(--dwb-muted); pointer-events: none; }
.md .dwb-stage__caption { min-height: 1.7em; margin: 8px 0 0; font-size: var(--fs-meta, 12.5px); font-weight: 500; color: var(--fg-2, #c6cbd3); }
.dwb-controls { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.dwb-controls--wrap { flex-wrap: wrap; }
.dwb-controls .dwb-range { flex: 1; margin: 0; }
.dwb-controls--wrap .dwb-btn--primary { margin-inline-start: auto; }
.dwb-clock { flex: none; min-width: 64px; font-size: 12px; color: var(--dwb-muted); font-variant-numeric: tabular-nums; text-align: end; }
.dwb-icon-btn { flex: none; width: 36px; height: 36px; border: 1px solid var(--dwb-line); border-radius: 50%; background: transparent; color: var(--dwb-ink); cursor: pointer; display: grid; place-items: center; }
.dwb-icon-btn::before { content: ""; width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 10px solid currentColor; margin-left: 3px; }
.dwb-icon-btn[data-state="pause"]::before { width: 10px; height: 12px; border: 0; margin: 0; background: linear-gradient(90deg, currentColor 0 35%, transparent 35% 65%, currentColor 65%); }
.dwb-icon-btn:hover { background: var(--hover, rgba(237,231,221,.055)); }
.dwb-segs { display: inline-flex; border: 1px solid var(--dwb-line); border-radius: 10px; overflow: hidden; }
.dwb-seg { min-height: 34px; padding: 0 11px; border: 0; background: transparent; color: var(--fg-2, #c6cbd3); font: 500 13px var(--font, system-ui); cursor: pointer; }
.dwb-segs .dwb-seg + .dwb-seg { border-inline-start: 1px solid var(--dwb-line); }
.dwb-controls > .dwb-seg { border: 1px solid var(--dwb-line); border-radius: 10px; }
.dwb-seg[aria-pressed="true"] { background: color-mix(in srgb, var(--dwb-accent) 14%, transparent); color: var(--dwb-ink); }

/* header tools: full screen, float */
.dwb__tools { display: inline-flex; gap: 4px; margin-inline-start: auto; }
.dwb__badge + .dwb__tools { margin-inline-start: 6px; }
.dwb-tool { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--dwb-muted); cursor: pointer; }
.dwb-tool:hover { color: var(--dwb-ink); border-color: var(--dwb-line); background: var(--hover, rgba(237,231,221,.055)); }
.dwb-tool svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width:var(--orea-icon-stroke,1.5); stroke-linecap: round; stroke-linejoin: round; }

@keyframes dwb-in { from { opacity: 0; transform: translateY(6px) scale(.985); } }

/* full screen */
.dwb-full { width: min(1180px, calc(100vw - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 0; background: transparent; color: inherit; overflow: visible; }
.dwb-full::backdrop { background: rgba(4,6,10,.72); backdrop-filter: blur(6px); }
.dwb-host { font-size: var(--fs-read, 16px); line-height: 1.95; color: var(--fg, #ede7dd); }
.dwb-full .dwb { margin: 0; max-height: calc(100dvh - 32px); overflow: auto; background: var(--raised, #191f29); box-shadow: 0 30px 80px -30px rgba(0,0,0,.9); }
.dwb-full .dwb__title { font-size: 17px; }
.dwb.is-full .dwb-stage__canvas { margin-inline: auto; }
.dwb.is-full .dwb-diagram { max-width: none !important; }
.dwb-full[open] { animation: dwb-in .3s var(--ease, ease) both; }

/* floating (picture in picture) */
.dwb.is-pip {
  position: fixed; z-index: 60; inset-block-end: 150px; inset-inline-end: 20px; width: min(360px, calc(100vw - 32px)); margin: 0;
  background: var(--raised, #191f29); box-shadow: 0 24px 60px -20px rgba(0,0,0,.85); font-size: 13px;
}
.dwb.is-pip .dwb-controls--wrap, .dwb.is-pip .dwb-stage__caption, .dwb.is-pip > .dwb-note { display: none; }
.dwb-pip-spot { display: grid; place-items: center; margin: 18px 0; border: 1px dashed var(--line-2, rgba(237,231,221,.13)); border-radius: 14px; color: var(--muted, #a4adbb); font-size: var(--fs-meta, 12.5px); }

/* cards view of choices */
.dwb-options--cards { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); grid-template-columns: none; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.dwb-option--card { scroll-snap-align: start; gap: 6px; padding: 14px; min-height: 150px; }
.dwb-option__tag { align-self: flex-start; padding: 1px 8px; border-radius: 99px; background: color-mix(in srgb, var(--dwb-accent) 12%, transparent); font-size: 11px; color: var(--dwb-ink); }
.dwb-option--card .dwb-option__label { font-size: 15px; }
.md .dwb-option__pts { margin: 2px 0 0; padding-inline-start: 16px; font-size: var(--fs-meta, 12.5px); color: var(--fg-2, #c6cbd3); }
.md .dwb-option__pts li { margin: 1px 0; }
.dwb-option__cta { margin-top: auto; padding-top: 8px; font-size: 12.5px; font-weight: 600; color: var(--dwb-accent); }

/* ask: questions one by one */
.dwb-steps { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.dwb-steps__dot { width: 18px; height: 4px; border-radius: 99px; background: var(--dwb-line); transition: background .25s var(--ease, ease); }
.dwb-steps__dot.is-done { background: color-mix(in srgb, var(--dwb-accent) 55%, transparent); }
.dwb-steps__dot.is-now { background: var(--dwb-accent); }
.dwb-steps__n { margin-inline-start: auto; font-size: 11.5px; color: var(--dwb-muted); font-variant-numeric: tabular-nums; }
.dwb-btn--quiet { border-color: transparent; color: var(--dwb-muted); }

/* explore: a live explainer */
/* lesson: content stages and optional local comprehension, without chat submission */
.dwb--lesson, .dwb-lesson, .dwb-lesson__panel { min-width: 0; overflow-wrap: anywhere; }
.md .dwb-lesson__steps { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
.dwb-lesson__steps li { min-width: 0; max-width: 100%; }
.dwb-lesson__step { display: block; max-width: 100%; min-height: 36px; padding: 6px 10px; border: 1px solid var(--dwb-line); border-radius: 8px; background: transparent; color: var(--dwb-muted); font: inherit; text-align: start; overflow-wrap: anywhere; cursor: pointer; }
.dwb-lesson__step[aria-current="step"] { color: var(--dwb-ink); border-color: var(--dwb-accent); background: color-mix(in srgb, var(--dwb-accent) 8%, transparent); }
.md .dwb-lesson__heading { margin: 0 0 8px; font-size: var(--fs-read, 16px); font-weight: 600; }
.md .dwb-lesson__text { margin: 0 0 12px; white-space: pre-wrap; }
.dwb-lesson .dwb-details { margin-block: 12px; }
.dwb-lesson__question { min-width: 0; margin: 16px 0 0; padding: 12px; border: 1px solid var(--dwb-line); border-radius: 10px; }
.dwb-lesson__question legend { max-width: 100%; padding-inline: 6px; font-weight: 500; white-space: normal; }
.dwb-lesson__response { display: flex; align-items: baseline; gap: 10px; padding-block: 8px; cursor: pointer; }
.dwb-lesson__response input { flex: none; accent-color: var(--dwb-accent); }
.dwb-lesson__response span { min-width: 0; }
.md .dwb-lesson__feedback { margin: 8px 0 0; color: var(--fg-2, #c6cbd3); }
.dwb-lesson__feedback:empty { margin: 0; }
.dwb-lesson__nav { justify-content: space-between; }
.dwb-lesson__nav .dwb-btn { min-width: 0; padding: 10px; line-height: 1.4; }
.dwb-lesson__position { color: var(--dwb-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.dwb-lesson__map { margin-block: 4px 16px; }
.dwb-lesson__map .dwb-scroll { padding: 4px; }
.dwb-lesson__map .dwb-diagram { display: block; margin-inline: auto; }
.dwb-map-node { display: block; width: 100%; height: 100%; padding: 3px 7px; border: 1px solid var(--dwb-line); border-radius: 9px; background: var(--dwb-fill); color: var(--dwb-ink); font: 500 12px/1.3 var(--font, system-ui); text-align: center; overflow-wrap: anywhere; cursor: pointer; }
.dwb-map-node.is-active { border: 2px solid var(--dwb-accent); background: color-mix(in srgb, var(--dwb-accent) 18%, var(--dwb-fill)); }
.dwb-map-node:focus-visible { outline-offset: -4px; }
.dwb-map-node--static { display: grid; place-items: center; box-sizing: border-box; cursor: default; }
.dwb-lesson__map .dwb-node.is-active rect { stroke: var(--dwb-accent); stroke-width: 2; }
.dwb-lesson__map .dwb-edge.is-active { stroke: var(--dwb-accent); stroke-width: 2; }

.md .dwb-formula { margin: 0 0 8px; font: 500 14px/1.5 var(--mono, monospace); color: var(--fg-2, #c6cbd3); text-align: left; }
.dwb-plot { direction: ltr; unicode-bidi: isolate; display: block; width: 100%; height: auto; border-radius: 10px; background: rgba(0,0,0,.2); }
.dwb-plot__frame { fill: none; stroke: var(--dwb-grid); }
.dwb-plot__axis { stroke: var(--dwb-line); }
.dwb-plot__line { fill: none; stroke: var(--dwb-accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.dwb-plot__tick { fill: var(--dwb-muted); font: 9px var(--font, system-ui); direction: ltr; unicode-bidi: plaintext; }
.dwb-readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-top: 10px; }
.dwb-readout { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--dwb-line); border-radius: 10px; font-size: var(--fs-meta, 12.5px); color: var(--fg-2, #c6cbd3); }
.dwb-readout__v { font-size: 18px; color: var(--dwb-ink); font-variant-numeric: tabular-nums; }
.dwb-vars { display: grid; gap: 4px; margin-top: 12px; }
.dwb-var { display: block; }
.dwb-var__head { display: flex; align-items: baseline; gap: 8px; font-size: var(--fs-meta, 12.5px); }
.dwb-var__head code { font: 12px var(--mono, monospace); color: var(--dwb-muted); }
.dwb-var__head output { margin-inline-start: auto; }

/* next: follow-up chips, only under the latest reply */
.md .dwb--next { margin: 14px 0 0; padding: 0; border: 0; background: none; }
.dwb-next { display: flex; flex-wrap: wrap; gap: 8px; }
.dwb-chip { min-height: 34px; padding: 0 14px; border: 1px solid var(--line-2, rgba(237,231,221,.13)); border-radius: 99px; background: transparent; color: var(--fg-2, #c6cbd3); font: 500 13px var(--font, system-ui); cursor: pointer; transition: background .2s var(--ease, ease), color .2s var(--ease, ease); }
.dwb-chip:hover { background: var(--hover, rgba(237,231,221,.055)); color: var(--fg, #ede7dd); }
.msg--bot:not(.last) .dwb--next, .msg.streaming .dwb--next { display: none; }

/* write: a finished draft */
.dwb-tabs { display: flex; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid var(--dwb-line); overflow-x: auto; }
.dwb-tab { flex: none; min-height: 34px; padding: 0 12px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--dwb-muted); font: 500 13.5px var(--font, system-ui); cursor: pointer; }
.dwb-tab[aria-selected="true"] { color: var(--dwb-ink); border-bottom-color: var(--dwb-accent); }
.md .dwb-subject { margin: 0 0 8px; font-size: var(--fs-ui, 14px); color: var(--fg-2, #c6cbd3); }
.dwb-paper { padding: 14px 16px; border: 1px solid var(--dwb-line); border-radius: 12px; background: rgba(0,0,0,.18); font-size: var(--fs-read, 16px); line-height: 1.9; }
.md .dwb-paper > :last-child { margin-bottom: 0; }
.md .dwb-paper ul:has(.dwb-task) { list-style: none; padding-inline-start: 0; }
.dwb-task { display: flex; align-items: baseline; gap: 10px; }
.dwb-check { flex: none; width: 17px; height: 17px; accent-color: var(--dwb-accent); transform: translateY(3px); }
.dwb-task:has(.dwb-check:checked) { color: var(--dwb-muted); text-decoration: line-through; }
.dwb-editor { width: 100%; min-height: 160px; padding: 14px 16px; border: 1px solid var(--line-3, rgba(237,231,221,.24)); border-radius: 12px; background: rgba(0,0,0,.25); color: var(--dwb-ink); font: inherit; font-size: var(--fs-read, 16px); line-height: 1.9; resize: vertical; }
.dwb-editor:focus { outline: 2px solid var(--dwb-accent); outline-offset: 1px; }
a.dwb-btn { text-decoration: none; }
.dwb-next--refine { margin-top: 10px; }
.dwb-write.is-writing .dwb-paper { border-style: dashed; }

/* while a block is still being written */
.dwb--pending { padding: 14px 16px; }
.dwb-shimmer { color: var(--dwb-muted); background: linear-gradient(90deg, var(--dwb-muted) 30%, var(--dwb-ink) 50%, var(--dwb-muted) 70%) 0 0/200% 100%; -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; animation: dwb-shimmer 1.6s linear infinite; }
@keyframes dwb-shimmer { to { background-position: -200% 0; } }

@media (max-width: 560px) {
  .md .dwb { padding: 12px; border-radius: 12px; }
  .dwb-compare { grid-template-columns: 1fr; }
  .dwb-decision { grid-template-columns: 1fr; gap: 2px; }
  .dwb-controls--wrap .dwb-btn--primary { margin-inline-start: 0; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .dwb-full[open] { animation: none; }
  .dwb-shimmer { animation: none; -webkit-text-fill-color: currentColor; }
  .dwb-option, .dwb-btn { transition: none; }
}

/* ---------------------------------------------------------------- live widgets (assets/js/chat-widget.js)
   The frame is borderless and transparent: the widget's own design system already matches this page, so
   the card adds only its header. While it streams, a soft shimmer says it is still being built. */
.md .dwb--widget { padding: 12px 12px 10px; }
.dwb-widget { position: relative; }
.dwb-frame { display: block; width: 100%; height: 160px; border: 0; background: transparent; color-scheme: dark; transition: height .25s var(--ease, ease); }
.dwb-widget.is-full .dwb-frame { height: calc(100dvh - 120px); }
.dwb--widget.is-building .dwb-frame { opacity: .92; }
.dwb--widget.is-building .dwb__kind::after { content: ' · يُبنى الآن…'; animation: dwb-pulse 1.4s ease-in-out infinite; }
@keyframes dwb-pulse { 50% { opacity: .45; } }
.dwb-frame__status:empty { display: none; }
.dwb-frame__status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: var(--fs-meta, 12.5px); color: var(--danger, #ff9e92); }
.dwb-widget__request:empty { display: none; }
.dwb-widget__request { margin-top: 10px; padding: 10px; border: 1px solid var(--dwb-line); border-radius: 10px; }
.dwb-widget__request p { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.dwb-widget__request .dwb-btn + .dwb-btn { margin-inline-start: 8px; }
@media (prefers-reduced-motion: reduce) { .dwb-frame { transition: none; } .dwb--widget.is-building .dwb__kind::after { animation: none; } }

/* memory: what the model kept or dropped, quietly, with an undo */
.md .dwb--remember, .md .dwb--forget { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; margin: 10px 0; border-style: dashed; font-size: var(--fs-meta, 12.5px); color: var(--dwb-muted); }
.dwb--remember .dwb__head, .dwb--forget .dwb__head { margin: 0; }
.dwb-memory { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.dwb-memory b { color: var(--dwb-ink); font-weight: 500; }
.dwb-memory .dwb-btn { min-height: 26px; padding: 0 10px; font-size: 12px; }
.dwb-memory.is-undone b { text-decoration: line-through; opacity: .6; }

dwb-spatial-view { display: block; min-width: 0; }
.dwb-spatial__stage {
  position: relative;
  min-width: 0;
  height: clamp(200px, 42vw, 360px);
  background: radial-gradient(ellipse at 50% 45%, var(--dwb-line), transparent 75%);
  touch-action: none;
  cursor: grab;
}
.dwb-spatial__stage:active { cursor: grabbing; }
.dwb-spatial__stage canvas { display: block; width: 100%; height: 100%; }
.is-full .dwb-spatial__stage { height: min(55dvh, 540px); }
.dwb-spatial__tools, .dwb-spatial__parts { display: flex; flex-wrap: wrap; align-items: center; }
.dwb-spatial__parts { gap: 0 12px; }
.dwb--scene3d .dwb-tool, .dwb-spatial__part {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--dwb-muted);
}
.dwb--scene3d .dwb-tool:hover, .dwb-spatial__part:hover { background: transparent; color: var(--dwb-ink); }
.dwb--scene3d .dwb-tool[aria-pressed="true"], .dwb-spatial__part[aria-pressed="true"] { color: var(--accent, #e1c19b); }
.dwb--scene3d .dwb-tool:disabled { opacity: .4; cursor: default; }
.dwb--scene3d :is(.dwb-tool, .dwb-spatial__part, .dwb-spatial__stage):focus-visible { outline: 2px solid var(--accent, #e1c19b); outline-offset: -2px; }
.dwb-spatial__part {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 2px;
  cursor: pointer;
  font: inherit;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.dwb-spatial__dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--part-color); }
.dwb-spatial__status { position: absolute; inset: 40% 12px auto; text-align: center; }
.dwb-spatial__status:empty { display: none; }
.md .dwb-spatial__detail { margin: 4px 0 0; color: var(--dwb-muted); overflow-wrap: anywhere; }
