/* Diário dos BNs — Laboratório de Modelos Atômicos. Usa as variáveis do sistema visual (ds.css); o palco é sempre escuro. */
.ma-page { --ma-max: 1400px; max-width: var(--ma-max); margin: 0 auto; padding: 10px clamp(14px, 3vw, 32px) 48px; }
.ma-page .breadcrumbs { margin-bottom: 8px; }

/* topo: título, linha do tempo e ações */
.ma-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px 22px; margin-bottom: 12px; }
.ma-title { margin: 0; font-size: clamp(1.35rem, 2.4vw, 1.85rem); white-space: nowrap; }
.ma-timeline { position: relative; display: flex; justify-content: space-between; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ma-timeline::before { content: ""; position: absolute; left: 6%; right: 6%; top: 13px; height: 2px; background: linear-gradient(90deg, var(--line-strong), var(--gold), var(--line-strong)); opacity: .55; }
.ma-timeline li { position: relative; flex: 1; display: flex; justify-content: center; }
.ma-timeline button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 0 2px 2px; border: 0; background: none; color: var(--muted); font: 500 .84rem var(--font); cursor: pointer; }
.ma-timeline button::before { content: ""; width: 14px; height: 14px; margin: 6px 0 5px; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--bg); transition: transform .2s, background .2s, border-color .2s; }
.ma-timeline button.is-past::before { border-color: color-mix(in srgb, var(--gold) 55%, var(--line-strong)); }
.ma-timeline button small { font: 500 .7rem var(--mono); color: var(--subtle); }
.ma-timeline button:hover { color: var(--text); }
.ma-timeline button:hover::before { transform: scale(1.2); }
.ma-timeline button[aria-current="step"] { color: var(--text); }
.ma-timeline button[aria-current="step"]::before { border-color: var(--gold); background: var(--gold); transform: scale(1.25); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 22%, transparent); }
.ma-timeline button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 8px; }
.ma-top-actions { display: flex; gap: 8px; }
html body .ma-page .ma-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text); font: 500 .88rem var(--font); cursor: pointer; white-space: nowrap; }
html body .ma-page .ma-btn:hover { border-color: var(--text); }
html body .ma-page .ma-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
html body .ma-page .ma-btn-accent { background: var(--ds-primary); color: var(--ds-primary-ink); border-color: var(--ds-primary); }
.ma-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ma-menu-wrap { position: relative; }
.ma-menu { position: absolute; z-index: 40; right: 0; top: calc(100% + 6px); display: grid; gap: 2px; width: min(340px, 90vw); padding: 6px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--panel); box-shadow: 0 20px 40px -20px rgba(0, 0, 0, .6); }
.ma-menu[hidden] { display: none; }
.ma-menu button { display: grid; gap: 2px; padding: 9px 11px; border: 0; border-radius: 9px; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.ma-menu button:hover, .ma-menu button:focus-visible { background: color-mix(in srgb, var(--text) 7%, transparent); outline: none; }
.ma-menu b { font-weight: 600; font-size: .9rem; }
.ma-menu small { color: var(--muted); font-size: .76rem; }

/* laboratório: palco + painel */
.ma-lab { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.ma-stage { position: relative; overflow: hidden; height: clamp(460px, calc(100dvh - var(--header-h, 68px) - 130px), 900px); border: 1px solid rgba(160, 180, 220, .16); border-radius: 18px; background: #070a12; color: #e9edf5; color-scheme: dark; isolation: isolate; }
.ma-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; outline: none; }
.ma-stage canvas:active { cursor: grabbing; }
.ma-stage canvas.is-pickable { cursor: pointer; }
.ma-stage canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }
.ma-labels { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.ma-label { position: absolute; left: 0; top: 0; padding: 2px 7px; border-radius: 6px; background: rgba(8, 12, 22, .66); color: #dfe6f3; font: 500 .74rem var(--font); white-space: nowrap; transition: opacity .2s; will-change: transform; }
.ma-label.is-small { font-size: .7rem; }
.ma-label.is-muted { color: #a9b4c8; background: rgba(8, 12, 22, .45); }
.ma-label.is-accent { color: #ffe3a3; border: 1px solid rgba(245, 195, 92, .45); }
.ma-label.is-photon { color: #fff; background: rgba(8, 12, 22, .8); border: 1px solid rgba(255, 255, 255, .25); }
.ma-label.is-axis { padding: 0; background: none; font: 600 .82rem var(--mono); color: #c9d2e3; text-shadow: 0 1px 3px #000; }
.ma-stage-head { position: absolute; z-index: 2; left: 16px; right: 16px; top: 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none; }
.ma-stage-head h2 { margin: 0; font-size: clamp(1.2rem, 2.2vw, 1.6rem); color: #f2f4f8; text-shadow: 0 2px 10px rgba(0, 0, 0, .6); }
.ma-stage-head p { margin: 2px 0 0; color: #b8c2d6; font-size: .84rem; }
.ma-badge { pointer-events: auto; padding: 5px 10px; border: 1px dashed rgba(245, 195, 92, .55); border-radius: 999px; color: #ffe3a3; font: 500 .72rem var(--font); background: rgba(8, 12, 22, .55); cursor: pointer; white-space: nowrap; }
.ma-readout { position: absolute; z-index: 2; left: 50%; top: 64px; transform: translateX(-50%); padding: 6px 14px; border: 1px solid rgba(245, 195, 92, .45); border-radius: 999px; background: rgba(8, 12, 22, .75); color: #ffe3a3; font: 600 .86rem var(--mono); }
.ma-readout[hidden] { display: none; }
.ma-part { position: absolute; z-index: 3; left: 14px; bottom: 74px; max-width: min(380px, calc(100% - 28px)); padding: 12px 34px 12px 14px; border: 1px solid rgba(170, 190, 230, .22); border-radius: 14px; background: rgba(9, 13, 23, .86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 18px 30px -18px rgba(0, 0, 0, .8); animation: ma-pop .25s ease both; }
.ma-part[hidden] { display: none; }
.ma-part b { display: block; margin-bottom: 4px; color: #ffe3a3; font-size: .95rem; }
.ma-part p { margin: 0; color: #d6deec; font-size: .84rem; line-height: 1.45; }
.ma-part-close { position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: #a9b4c8; font-size: 1.3rem; cursor: pointer; }
.ma-part-close:hover { color: #fff; }
@keyframes ma-pop { from { opacity: 0; transform: translateY(6px); } }
.ma-tip { position: fixed; z-index: 1200; padding: 5px 9px; border-radius: 8px; background: rgba(9, 13, 23, .9); border: 1px solid rgba(170, 190, 230, .2); color: #e9edf5; font-size: .76rem; pointer-events: none; transform: translate(14px, 14px); }
.ma-tip[hidden] { display: none; }
.ma-bar { position: absolute; z-index: 2; left: 12px; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid rgba(170, 190, 230, .16); border-radius: 14px; background: rgba(9, 13, 23, .72); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.ma-bar-gap { flex: 1; }
.ma-ctl { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid rgba(170, 190, 230, .2); border-radius: 50%; background: transparent; color: #e9edf5; cursor: pointer; }
.ma-ctl:hover:not(:disabled) { border-color: #e9edf5; background: rgba(255, 255, 255, .06); }
.ma-ctl:disabled { opacity: .3; cursor: default; }
.ma-ctl:focus-visible, .ma-speed:focus-within { outline: 2px solid #f5c35c; outline-offset: 2px; border-radius: 999px; }
.ma-ctl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#ma-play .i-play { display: none; }
#ma-play[aria-pressed="false"] .i-play { display: block; fill: currentColor; stroke: none; }
#ma-play[aria-pressed="false"] .i-pause { display: none; }
.ma-speed { display: inline-flex; align-items: center; gap: 8px; color: #c9d2e3; font-size: .8rem; }
.ma-speed input { width: 110px; accent-color: #f5c35c; }
.ma-speed output { min-width: 2.6em; font: 600 .8rem var(--mono); color: #e9edf5; }
.ma-nogl { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 30px; background: #070a12; text-align: center; }
.ma-nogl[hidden] { display: none; }
.ma-stage:fullscreen { height: 100vh; border-radius: 0; }

/* painel */
.ma-panel { display: grid; gap: 10px; max-height: clamp(460px, calc(100dvh - var(--header-h, 68px) - 130px), 900px); overflow: auto; padding-right: 4px; scrollbar-width: thin; }
.ma-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.ma-card[hidden] { display: none; }
.ma-card h3 { margin: 0 0 10px; font: 600 .74rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ma-card h4 { margin: 12px 0 6px; font: 600 .82rem var(--font); color: var(--text); }
.ma-card p { margin: 0 0 8px; font-size: .88rem; line-height: 1.5; }
.ma-card p:last-child { margin-bottom: 0; }
.ma-field { display: grid; gap: 5px; margin: 0 0 10px; }
.ma-flabel { display: flex; justify-content: space-between; gap: 8px; font-size: .78rem; color: var(--muted); }
.ma-flabel output { font: 600 .78rem var(--mono); color: var(--text); }
.ma-seg { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; }
.ma-seg button { flex: 1 1 auto; min-height: 32px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: 500 .8rem var(--font); cursor: pointer; }
.ma-seg button:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.ma-seg button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.ma-seg button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
html body .ma-page .ma-field select { height: 38px; padding: 0 10px; border-radius: 9px; font-size: .88rem; }
.ma-field input[type="range"] { width: 100%; accent-color: var(--gold); }
.ma-check { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: .86rem; cursor: pointer; }
.ma-check input { width: 16px; height: 16px; accent-color: var(--gold); }
.ma-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.ma-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
html body .ma-page .ma-action { min-height: 36px; font-size: .84rem; }
.ma-scientist { color: var(--muted); font-size: .84rem; }
.ma-history details { border-top: 1px solid var(--line); }
.ma-history summary { padding: 9px 0; font-weight: 600; font-size: .9rem; cursor: pointer; }
.ma-history summary:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.ma-history ul { margin: 0 0 10px; padding-left: 18px; font-size: .86rem; line-height: 1.5; }
.ma-history details p { font-size: .86rem; }
.ma-big { font: 600 1.15rem var(--mono); }
.ma-big small { font: 400 .78rem var(--font); color: var(--muted); }
.ma-note { color: var(--muted); font-size: .78rem !important; }
.ma-hint { color: var(--gold); font-size: .84rem !important; }
.ma-diagram { width: 100%; height: auto; display: block; }
.ma-diagram .lv line { stroke: var(--line-strong); stroke-width: 2; }
.ma-diagram .lv { cursor: pointer; }
.ma-diagram .lv:hover line, .ma-diagram .lv:focus line { stroke: var(--text); }
.ma-diagram .lv:focus { outline: none; }
.ma-diagram .lv.is-cur line { stroke: var(--gold); stroke-width: 3; }
.ma-diagram .lv-inf { stroke: var(--line-strong); stroke-dasharray: 4 4; }
.ma-diagram .lv-e { fill: #6cc8ff; stroke: #fff; stroke-width: 1.5; }
.lv-t { font: 500 10px var(--mono); fill: var(--muted); }
.ma-levels { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.ma-lvl { min-height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; color: var(--text); font: 600 .8rem var(--mono); cursor: pointer; }
.ma-lvl:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.ma-lvl:disabled { opacity: .35; cursor: default; }
.ma-tr { margin: 8px 0; padding: 9px 11px; border-left: 3px solid; border-radius: 0 9px 9px 0; font-size: .84rem; line-height: 1.5; }
.ma-tr.is-abs { border-color: #7fb2ff; background: color-mix(in srgb, #7fb2ff 10%, transparent); }
.ma-tr.is-emi { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.ma-tr small { color: var(--muted); }
.ma-spectrum { width: 100%; height: auto; display: block; border-radius: 4px; background: #05070d; }
.ma-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.ma-chip { padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 999px; font: 500 .72rem var(--mono); color: var(--muted); }
.ma-stats { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: .84rem; }
.ma-stats th, .ma-stats td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; }
html body .ma-page .ma-stats th { color: var(--muted); font: 500 .82rem var(--font); letter-spacing: 0; text-transform: none; }
.ma-stats td { font-family: var(--mono); }
.ma-radial { width: 100%; height: auto; display: block; }
.rd-curve { fill: none; stroke: #6cc8ff; stroke-width: 2.2; }
.rd-node { stroke: var(--muted); stroke-dasharray: 3 3; }
.rd-peak { stroke: var(--gold); stroke-width: 1.5; }
.rd-axis { stroke: var(--line-strong); }

/* experiência guiada */
.ma-exp { border-color: color-mix(in srgb, var(--gold) 50%, var(--line)); background: linear-gradient(160deg, color-mix(in srgb, var(--gold) 10%, var(--surface)), var(--surface) 70%); }
.ma-exp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font: 600 .72rem var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.ma-exp-close { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1.3rem; cursor: pointer; }
.ma-exp h3 { margin: 0 0 6px; font: 600 1.05rem var(--display); letter-spacing: 0; text-transform: none; color: var(--text); }
.ma-steps { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; counter-reset: st; }
.ma-steps li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; font-size: .86rem; line-height: 1.4; counter-increment: st; }
.ma-steps li > span:first-child { display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line-strong); border-radius: 50%; font: 700 .74rem var(--mono); color: var(--bg); }
.ma-steps li:not(.is-done) > span:first-child::before { content: counter(st); color: var(--muted); }
.ma-steps li.is-done > span:first-child { background: var(--ds-success, #5cc58d); border-color: var(--ds-success, #5cc58d); }
.ma-steps li.is-done { color: var(--muted); }
.ma-conclusion { margin-top: 10px !important; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--ds-success, #5cc58d) 12%, transparent); }

/* comparação */
.ma-cmp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.ma-cmp-bar h2 { margin: 0 auto 0 4px; font-size: clamp(1.15rem, 2.2vw, 1.5rem); outline: none; }
.ma-pairs { display: flex; flex-wrap: wrap; gap: 4px; }
.ma-pairs button { min-height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font: 500 .78rem var(--font); cursor: pointer; }
.ma-pairs button:hover { color: var(--text); border-color: var(--line-strong); }
.ma-pairs button[aria-pressed="true"] { color: var(--text); border-color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.ma-cmp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ma-cmp-col { display: grid; gap: 8px; min-width: 0; }
.ma-cmp-pick { display: flex; align-items: center; gap: 10px; font-size: .84rem; color: var(--muted); }
html body .ma-page .ma-cmp-pick select { flex: 1; height: 40px; padding: 0 12px; border-radius: 10px; font-size: .92rem; }
.ma-stage-cmp { height: clamp(320px, 52vh, 560px); }
.ma-stage-cmp .ma-part { bottom: 14px; }
.ma-cmp-open { position: absolute; z-index: 2; right: 10px; top: 10px; background: rgba(9, 13, 23, .6); }
.ma-cmp-change { margin: 14px 0 0; padding: 10px 14px; border-left: 3px solid var(--gold); border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--gold) 8%, transparent); font-size: .92rem; line-height: 1.5; }
html body .ma-page #ma-cmp-title:is(:focus, :focus-visible) { outline: none !important; box-shadow: none !important; }
.ma-cmp-table-wrap { margin-top: 14px; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.ma-cmp-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.ma-cmp-table th, .ma-cmp-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; line-height: 1.5; }
.ma-cmp-table tr:last-child :is(th, td) { border-bottom: 0; }
.ma-cmp-table thead th { background: var(--surface); font: 600 .9rem var(--display); }
html body .ma-page .ma-cmp-table tbody th { width: 16%; color: var(--muted); font: 500 .82rem var(--font); text-transform: none; letter-spacing: 0; }

/* telas menores */
@media (max-width: 1100px) {
  .ma-lab { grid-template-columns: minmax(0, 1fr); }
  .ma-stage { height: clamp(420px, 64vh, 720px); }
  .ma-panel { max-height: none; overflow: visible; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; padding-right: 0; }
  .ma-panel .ma-exp, .ma-panel .ma-history { grid-column: 1 / -1; }
  .ma-top { grid-template-columns: 1fr auto; }
  .ma-timeline { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 760px) {
  .ma-panel { grid-template-columns: minmax(0, 1fr); }
  .ma-cmp-grid { grid-template-columns: 1fr; }
  .ma-stage { height: clamp(380px, 62vh, 600px); border-radius: 14px; }
  .ma-stage-head { left: 12px; right: 12px; top: 10px; }
  .ma-stage-head p { display: none; }
  .ma-bar { left: 8px; right: 8px; bottom: 8px; gap: 6px; padding: 5px 6px; }
  .ma-speed span { display: none; }
  .ma-speed input { width: 80px; }
  .ma-part { left: 8px; bottom: 62px; max-width: calc(100% - 16px); }
  .ma-timeline button { font-size: .72rem; }
  .ma-timeline button small { font-size: .62rem; }
  .ma-top-actions .ma-btn span { display: none; }
  .ma-stage-cmp { height: clamp(280px, 46vh, 420px); }
  .ma-cmp-bar h2 { flex-basis: 100%; order: -1; margin: 0; }
}
@media (max-width: 420px) {
  .ma-timeline::before { left: 4%; right: 4%; }
  .ma-checks { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { .ma-part { animation: none; } }
