/* Shared readability and interaction sizes; retain existing workspace colors. */
:is(.home-page,.rcwa-page) .selected-materials .material-chip {
 border:0; border-radius:0; background:transparent; padding:2px 0;
}
.rcwa-page .rcwa-option-fields {
 display:grid; grid-template-columns:repeat(2,minmax(0,1fr));
 gap:var(--workspace-space-medium); padding:var(--workspace-space-small);
}
.rcwa-page .rcwa-option-fields > div { display:flex; flex-direction:column; gap:6px; min-width:0; }
.rcwa-page .rcwa-option-fields label { margin:0; padding:0; background:none; border:0; width:auto; color:#666; }
.rcwa-page .rcwa-option-fields :is(input,select) { width:100%; min-width:0; }
.rcwa-page #angle-panel-multi .small-row { position:relative; align-items:center; }
.rcwa-page .control-info { display:inline-flex; flex-shrink:0; }
.rcwa-page .info-button {
 width:18px; height:18px; padding:0; border:1px solid #777;
 border-radius:50%; background:white; color:#555;
 font:italic 12px Georgia,serif; cursor:help;
}
.rcwa-page .info-tooltip {
 display:none; position:absolute; right:0; top:100%; width:260px;
 max-width:100%; box-sizing:border-box; padding:10px;
 border:1px solid #aaa; border-radius:3px; background:white; color:#333;
 box-shadow:0 2px 6px #0002; line-height:1.5; z-index:10;
}
.rcwa-page .control-info:hover .info-tooltip,
.rcwa-page .control-info:focus-within .info-tooltip { display:block; }
body.home-page, body.rcwa-page {
 --workspace-space-small:clamp(6px, 0.5vw, 10px);
 --workspace-space-medium:clamp(8px, 0.75vw, 14px);
 --workspace-space-large:clamp(12px, 1vw, 20px);
 --workspace-text:clamp(0.875rem, 0.75rem + 0.2vw, 1rem);
 --workspace-heading:clamp(1.125rem, 0.95rem + 0.3vw, 1.5rem);
 --workspace-subheading:clamp(1rem, 0.9rem + 0.15vw, 1.125rem);
 font-size:var(--workspace-text); line-height:1.5;
}
.home-page .main-section > .section-title,
.home-page .stack-editor > .editor-heading,
.rcwa-page .rcwa-settings > .section-title,
.rcwa-page .rcwa-layers > .section-title,
.home-page .layout-grid .plots-column > .plots-heading,
.rcwa-page .layout-grid .preview > .preview-header,
:is(.home-page,.rcwa-page) .layout-grid #config-summary > .summary-header {
 display:flex; align-items:center; gap:var(--workspace-space-small); box-sizing:border-box;
 min-height:calc(max(1.3em, 28px) + 2 * var(--workspace-space-medium) + 2px);
 font-size:var(--workspace-heading); font-weight:650; line-height:1.3; margin:0; padding:var(--workspace-space-medium);
 background:#e6e6e6; border-bottom:2px solid #cfcfcf;
}
.home-page .stack-editor > .editor-heading { width:100%; margin-bottom:var(--workspace-space-medium); justify-content:flex-start; }
.home-page .stack-editor > .editor-heading .section-title,
.home-page .layout-grid .plots-heading > .section-title {
 margin:0; padding:0; background:transparent; border:0;
 font-size:inherit; font-weight:inherit; line-height:inherit;
}
.home-page .layout-grid .plots-column > .plots-heading,
.rcwa-page .layout-grid .preview > .preview-header,
:is(.home-page,.rcwa-page) .layout-grid #config-summary > .summary-header {
 margin-bottom:var(--workspace-space-medium); color:#222; text-transform:none; letter-spacing:normal;
}
/* Fluid spacing shared by both scientific workspaces. Keep layer geometry intact. */
.rcwa-page .rcwa-settings > .material-selection-panel {
 margin-bottom:var(--workspace-space-medium);
}
.home-page .layout-grid, .rcwa-page .layout-grid {
 gap:var(--workspace-space-large); margin:var(--workspace-space-large) 0;
}
.home-page .layout-grid > :is(.main-section,.materials-column,.plots-column),
.rcwa-page .rcwa-settings, .rcwa-page .rcwa-layers,
.rcwa-page .layout-grid > .structure-preview {
 padding:var(--workspace-space-large);
}
.home-page .materials-column > .structure-preview,
.home-page .materials-column > .structure-preview:has(> #si-model-panel[hidden]),
.rcwa-page .layout-grid > .structure-preview,
.home-page .simulation-settings-content > .parameters-form,
.home-page .panels-row, .home-page .panels-row :is(.left-panels,.right-panels),
.rcwa-page .rcwa-settings > .form-row {
 gap:var(--workspace-space-large);
}
:is(.home-page,.rcwa-page) .layout-grid :is(.panel,.options-box,.example-picker) {
 padding:var(--workspace-space-medium);
}
:is(.home-page,.rcwa-page) .layout-grid .example-picker {
 margin-top:var(--workspace-space-large);
}
.home-page .main-section > .section-title,
.rcwa-page :is(.rcwa-settings,.rcwa-layers) > .section-title,
.home-page .stack-editor > .layers-control,
.home-page .simulation-settings-content > .section-description,
.rcwa-page .rcwa-settings > .form-row,
.rcwa-page .rcwa-structure-choices {
 margin-bottom:var(--workspace-space-medium);
}
.home-page .layout-grid :is(.range-panel .panel-right,.small-panel,.options-body,.aside-controls,.radio-container),
.rcwa-page .layout-grid :is(.layer-environment-fields,.rcwa-structure-choices,.rcwa-run-actions,.rcwa-plot-controls),
:is(.home-page,.rcwa-page) #config-summary > .summary-content {
 gap:var(--workspace-space-medium);
}
.home-page .plots-column > .simulation-actions {
 padding-top:var(--workspace-space-large); margin-bottom:var(--workspace-space-large);
}
.home-page #plot-material-control, .rcwa-page .rcwa-plot-controls {
 margin-bottom:var(--workspace-space-medium);
}
/* Legacy ID and inline font rules need explicit overrides for essential content. */
:is(.home-page,.rcwa-page) .layout-grid :is(label,p,small,input,select,textarea,button,
 .section-description,.summary-content,.summary-item,.summary-section-title,.panel-key,
 .material-list-heading,.material-chart-title,.control-help-row,.info-tooltip,
 .stack-medium,.layer-number,.ms-col-number,[role=status],[data-model-warnings]) {
 font-size:var(--workspace-text) !important; line-height:1.5;
}
:is(.home-page,.rcwa-page) .layout-grid :is(.summary-header,.options-title,.material-selection-title,.range-heading,.ms-header,.preview-header) { font-size:var(--workspace-subheading); }
:is(.home-page,.rcwa-page) .layout-grid input:not([type=radio]):not([type=checkbox]),
:is(.home-page,.rcwa-page) .layout-grid select,
:is(.home-page,.rcwa-page) .layout-grid textarea {
 min-height:36px !important; height:auto !important; padding:6px 8px !important;
 box-sizing:border-box; max-width:100%;
}
:is(.home-page,.rcwa-page) .layout-grid button:not(.info-button) {
 min-height:36px; max-height:none; height:auto; padding:6px 10px; cursor:pointer;
}
.home-page .plots-heading #active-plot-close { height:auto; max-height:none; min-height:36px; width:auto; flex-basis:auto; line-height:1.5; }
:is(.home-page,.rcwa-page) .layout-grid input:is([type=checkbox],[type=radio]) { width:18px; height:18px; flex-shrink:0; }
:is(.home-page,.rcwa-page) .info-button { min-width:28px; min-height:28px; }
:is(.home-page,.rcwa-page) :is(input,select,textarea,button,a,summary):focus-visible { outline:3px solid #3267c8 !important; outline-offset:3px; }
:is(.home-page,.rcwa-page) .layout-grid :is(input,select,textarea,button):disabled {
 background:#e9edf1 !important; color:#68717c !important; border-color:#c5ccd3 !important;
 opacity:1; cursor:not-allowed;
}
:is(.home-page,.rcwa-page) .layout-grid :is([role=status],[data-model-warnings],#output,#recent-runs-list,#calculation-progress) { font-size:var(--workspace-text) !important; line-height:1.5; overflow-wrap:anywhere; }
.home-page .silicon-model-choice, .rcwa-page .rcwa-run-actions { flex-wrap:wrap; }
.rcwa-page .grating-band .grating-dimensions label { padding-left:30px; padding-right:8px; }
@media(max-width:767px) {
 :is(.home-page,.rcwa-page) .layout-grid :is(input,select,textarea) { font-size:16px !important; }
 :is(.home-page,.rcwa-page) .layout-grid button:not(.info-button) { min-height:40px; }
}
/* Preserve the original chip size instead of using full-size action buttons. */
:is(.home-page,.rcwa-page) .layout-grid .material-chip .material-remove {
 width:1.25rem; min-width:0; height:1.25rem; min-height:0;
 padding:0; font-size:1rem !important; line-height:1;
}

/* Compact laptop workspace: scroll panels, not the document. */
@media (min-width:1200px) and (max-width:1600px) and (min-height:600px) and (max-height:1000px) and (hover:hover) and (pointer:fine) {
 body.home-page, body.rcwa-page {
  --workspace-text:0.8125rem; --workspace-heading:1rem;
  --workspace-subheading:0.875rem;
  --workspace-space-small:4px; --workspace-space-medium:6px; --workspace-space-large:8px;
  height:100dvh; min-height:0; overflow:hidden;
 }
 .home-page .page-container, .rcwa-page .page-container {
  height:100dvh; min-height:0; overflow:hidden; gap:0;
 }
 .home-page .site-header, .rcwa-page .site-header,
 .home-page .site-footer, .rcwa-page .site-footer { flex-shrink:0; min-height:44px; }
 .home-page .layout-grid, .rcwa-page .layout-grid {
  flex:1 1 0; min-height:0; grid-template-rows:minmax(0,1fr); overflow:hidden;
 }
 .home-page .layout-grid > :is(.main-section,.materials-column,.plots-column),
 .rcwa-page .rcwa-settings, .rcwa-page .rcwa-layers,
 .rcwa-page .layout-grid > .structure-preview {
  min-height:0; max-height:100%; overflow:auto; scrollbar-gutter:stable;
 }
 .rcwa-page .layout-grid > .structure-preview > * { flex-shrink:0; }
 :is(.home-page,.rcwa-page) .layout-grid input:not([type=radio]):not([type=checkbox]),
 :is(.home-page,.rcwa-page) .layout-grid select,
 :is(.home-page,.rcwa-page) .layout-grid textarea {
  min-height:28px !important; padding:3px 6px !important;
 }
 :is(.home-page,.rcwa-page) .layout-grid button:not(.info-button):not(.material-remove) {
  min-height:28px; padding:3px 8px;
 }
 :is(.home-page,.rcwa-page) .layout-grid .info-button {
  width:18px; height:18px; min-width:18px; min-height:18px; padding:0;
  font-size:11px !important; line-height:1;
 }
 :is(.home-page,.rcwa-page) .layout-grid input:is([type=radio],[type=checkbox]) { width:14px; height:14px; }
 .home-page .stack-editor > .material-selection,
 .rcwa-page .editable-stack {
  max-height:min(360px, 42dvh); overflow:auto; flex-shrink:0;
 }
 .home-page .stack-layer-row { min-height:64px; padding:4px 6px; row-gap:4px; }
 .rcwa-page .editable-layer { min-height:64px; padding:4px 6px; gap:4px; }
 .rcwa-page .grating-band { padding:4px 0; }
 .rcwa-page .layer-controls { gap:4px; }
 :is(.home-page,.rcwa-page) .stack-medium { padding:6px 4px; }
 :is(.home-page,.rcwa-page) #config-summary > .summary-content { padding:8px; gap:6px; }
 :is(.home-page,.rcwa-page) .summary-section { margin-bottom:4px; }
 :is(.home-page,.rcwa-page) .summary-item { margin-bottom:2px; padding:0; }
}

/* Equal summary heights in the desktop results panels. */
@media (min-width:1200px) and (hover:hover) and (pointer:fine) {
 :is(.home-page,.rcwa-page) .layout-grid #config-summary > .summary-content {
  height:clamp(180px,26dvh,310px);
  max-height:clamp(180px,26dvh,310px);
  overflow:auto; scrollbar-gutter:stable; box-sizing:border-box;
  align-content:start;
 }
}

/* Fit RCWA results into the laptop column; only individual data views scroll. */
@media (min-width:1200px) and (max-width:1600px) and (min-height:600px) and (max-height:1000px) and (hover:hover) and (pointer:fine) {
 .rcwa-page .layout-grid > .structure-preview {
  display:flex; flex-direction:column; overflow:hidden; scrollbar-gutter:auto;
 }
 .rcwa-page .layout-grid > .structure-preview > .preview {
  display:flex; flex-direction:column; flex:1 1 0; min-height:0; overflow:hidden;
 }
 .rcwa-page .preview > :is(.preview-header,.rcwa-plot-tabs) { flex-shrink:0; }
 .rcwa-page .preview > [role=tabpanel]:not([hidden]) {
  display:flex; flex-direction:column; flex:1 1 0; min-height:0; overflow:auto;
 }
 .rcwa-page .preview > #rcwa-simulation-panel:not([hidden]) { overflow:hidden; }
 .rcwa-page .rcwa-plot-controls { flex-shrink:0; }
 .rcwa-page .layout-grid > .structure-preview .plot-content {
  flex:1 1 0; height:auto; min-height:0;
 }
}

/* Shorter main heading bars on laptop displays. */
@media (min-width:1200px) and (max-width:1600px) and (min-height:600px) and (max-height:1000px) and (hover:hover) and (pointer:fine) {
 .home-page .main-section > .section-title,
 .home-page .stack-editor > .editor-heading,
 .rcwa-page .rcwa-settings > .section-title,
 .rcwa-page .rcwa-layers > .section-title,
 .home-page .layout-grid .plots-column > .plots-heading,
 .rcwa-page .layout-grid .preview > .preview-header,
 :is(.home-page,.rcwa-page) .layout-grid #config-summary > .summary-header {
  min-height:38px; padding:4px 6px;
 }
}

/* Phone controls and navigation. Desktop navigation remains expanded. */
.workspace-menu-toggle { display:none; }
@media(max-width:767px) {
 :is(.home-page,.rcwa-page) .site-header { min-height:58px; gap:8px; }
 :is(.home-page,.rcwa-page) .workspace-menu-toggle:not([hidden]) {
  display:inline-flex; align-items:center; justify-content:center; margin-left:auto;
  width:40px; height:40px; padding:0; background:white; color:#333;
  border:1px solid #ccc; border-radius:4px; font-size:24px; cursor:pointer;
 }
 :is(.home-page,.rcwa-page) .site-header .site-nav { width:100%; margin:0; }
 .workspace-menu-toggle:not([hidden])[aria-expanded=false] + .site-nav { display:none; }
 :is(.home-page,.rcwa-page) .site-header .site-nav ul { gap:8px 20px; }
 :is(.home-page,.rcwa-page) .selected-materials .material-chip {
  border:1px solid #9db9d2; border-radius:999px; background:#edf5fb;
  padding:0.35rem 0.5rem 0.35rem 0.65rem;
 }
 .rcwa-page .radio-container { display:flex; flex-direction:row; flex-wrap:wrap; gap:8px !important; }
 .rcwa-page .radio-group { display:flex; flex-direction:row; align-items:center; flex:0 0 auto; min-width:0; gap:5px; }
 .rcwa-page .radio-group label { width:auto; margin:0; white-space:nowrap; }
 .rcwa-page :is(#angle-panel-single,#angle-panel-multi) .small-row {
  display:flex; flex-direction:row; align-items:center; flex-wrap:nowrap !important; gap:6px;
 }
 .rcwa-page :is(#angle-panel-single,#angle-panel-multi) .small-row > label {
  min-width:0 !important; width:auto; flex:0 0 auto; margin:0; white-space:nowrap;
 }
 .rcwa-page :is(#theta_deg,#angles) { width:0; min-width:0; flex:1 1 0; }
 .rcwa-page .rcwa-structure-choices > div:first-child { flex-direction:row; flex-wrap:nowrap; width:100%; }
 .rcwa-page .rcwa-structure-choices > div:first-child label { width:auto; margin:0; white-space:nowrap; }
 :is(.home-page,.rcwa-page) .editor-actions,
 .rcwa-page .rcwa-run-actions { display:flex; flex-direction:row; flex-wrap:wrap; gap:6px; }
 :is(.home-page,.rcwa-page) .editor-actions .action-btn,
 .rcwa-page .rcwa-run-actions .action-btn { width:auto; flex:0 0 auto; margin:0; }
 .rcwa-page .layout-grid .rcwa-run-actions .action-btn { padding:6px 8px; }
 .rcwa-page .example-picker > label {
  display:block; padding:8px; margin:0 0 10px; background:#e6e6e6;
  border-bottom:2px solid #cfcfcf; font-weight:600;
 }
}
@media(max-width:767px) {
 .rcwa-page .rcwa-run-actions { display:grid; grid-template-columns:max-content max-content; }
 .rcwa-page .rcwa-run-actions #btn-clear { grid-column:1 / -1; justify-self:start; }
 .rcwa-page .rcwa-run-actions #status { grid-column:1 / -1; min-width:0; }
}

/* Keep phone navigation above the scrolling workspace, including its open menu. */
@media(max-width:767px) {
 :is(.home-page,.rcwa-page) .page-container { overflow:visible; }
 :is(.home-page,.rcwa-page) .site-header {
  position:sticky; top:0; z-index:1000; background:#fff;
  padding-top:max(6px, env(safe-area-inset-top));
  box-shadow:0 2px 6px #0000000d;
 }
 :is(.home-page,.rcwa-page) .layout-grid :is(input,select,button,textarea),
 :is(.home-page,.rcwa-page) #main { scroll-margin-top:120px; }
}

.selected-material-tooltip {
 position:fixed; z-index:2000; max-width:min(300px,calc(100vw - 16px));
 padding:8px 10px; border:1px solid #aaa; border-radius:3px;
 background:#fff; color:#333; box-shadow:0 2px 6px #0002;
 font-size:13px; line-height:1.5; overflow-wrap:anywhere; pointer-events:none;
}
@media(min-width:768px) {
 :is(.home-page,.rcwa-page) .material-selection-inline {
  display:flex; flex-wrap:wrap; align-items:center; gap:6px 8px; margin-top:10px;
 }
 :is(.home-page,.rcwa-page) .material-selection-inline .material-list-heading {
  margin:0; padding:0; flex:0 0 auto;
 }
 :is(.home-page,.rcwa-page) .material-selection-inline .selected-materials {
  display:contents;
 }
 :is(.home-page,.rcwa-page) .selected-materials .material-chip {
  border:1px solid #9db9d2; border-radius:999px; background:#edf5fb;
  padding:2px 6px 2px 8px; gap:4px;
 }
}

.home-page .optical-models-panel {
 width:100%; min-width:0; padding:var(--workspace-space-medium);
 border:1px solid #cfcfcf; background:#f7f7f7; box-sizing:border-box;
}
.home-page .optical-models-panel > .summary-header { margin:0 0 6px; font-size:var(--workspace-subheading); }
.home-page .optical-models-panel #si-model-panel { padding:0; border:0; margin:0 0 12px; background:transparent; }
.home-page .optical-models-panel #silicon-model-empty { padding:0; border:0; }
.home-page #tmm-dataset-models { padding-top:0; }
.home-page #tmm-dataset-models p { margin:0 0 8px; }
.home-page #tmm-dataset-models select { width:100%; min-width:0; }
.home-page #tmm-dataset-models .dataset-details { overflow-wrap:anywhere; }
.home-page .tmm-material-model { padding:4px 0; }
.home-page .tmm-material-model:first-child { border-top:0; }
.home-page .tmm-material-model > label { display:block; font-weight:600; }
.home-page .tmm-material-model select { display:block; margin-top:6px; max-width:100%; }
.home-page .tmm-material-model p { margin:6px 0; overflow-wrap:anywhere; }
.home-page .tmm-model-control-row {
 position:relative; display:flex; align-items:center; gap:6px; margin-top:3px;
}
.home-page #tmm-dataset-models .tmm-model-control-row select { flex:1; width:0; margin:0; }
.home-page .tmm-model-control-row .control-info { flex-shrink:0; }
.home-page .tmm-model-control-row .info-tooltip {
 left:auto; right:0; top:auto; bottom:100%; max-width:100%;
 font-weight:400; overflow-wrap:anywhere;
}

/* Plot views sit alongside the section title, wrapping naturally on phones. */
.home-page .layout-grid .plots-column > .plots-heading { flex-wrap:wrap; gap:6px 12px; }
.home-page .plots-heading #plot-tabs {
 display:flex; flex-wrap:wrap; gap:4px; margin:0 0 0 auto; padding:0; border:0;
}
.home-page .plots-heading #plot-tabs button {
 padding:4px 8px; background:transparent; border:0; border-bottom:2px solid transparent;
}
.home-page .plots-heading #plot-tabs button[aria-selected=true] {
 background:#fff; border-bottom-color:#555; color:#222;
}
.home-page .plots-heading #active-plot-title { display:none; }
@media(max-width:767px) {
 .home-page .plots-heading #plot-tabs { flex:1 1 auto; }
}

.rcwa-page .layout-grid .preview > .preview-header { flex-wrap:wrap; gap:6px 12px; }
.rcwa-page .preview-header .rcwa-plot-tabs {
 display:flex; flex-wrap:wrap; gap:4px; margin:0 0 0 auto; padding:0; border:0;
}
.rcwa-page .preview-header .rcwa-plot-tabs button {
 padding:4px 8px; background:transparent; border:0; border-bottom:2px solid transparent;
 font-weight:400;
}
.rcwa-page .preview-header .rcwa-plot-tabs button[aria-selected=true] {
 background:#fff; border-bottom-color:#555; color:#222; font-weight:600;
}
.rcwa-page .preview-header #rcwa-plot-title { display:none; }
@media(max-width:767px) {
 .rcwa-page .preview-header .rcwa-plot-tabs { flex:1 1 auto; }
}

/* Keep material selection, source details, and chart visually grouped. */
.home-page .plots-column #plot-material-control { margin-bottom:4px; }
.home-page .plots-column #material-dataset-controls { padding:2px 0 !important; }
.home-page .plots-column #material-dataset-controls .dataset-details { margin:2px 0 4px; }
.home-page .plots-content > :is(#material-chart-panel,#silicon-chart-panel) { gap:0; margin-top:0; }
.home-page #silicon-chart-panel > [data-coverage] { margin:2px 0 4px; }

/* Large, tall desktop displays: use the available workspace generously. */
@media(min-width:1800px) and (min-height:1000px) and (hover:hover) and (pointer:fine) {
 body.home-page, body.rcwa-page {
  --workspace-space-small:10px;
  --workspace-space-medium:16px;
  --workspace-space-large:24px;
 }
 .home-page .layout-grid, .rcwa-page .layout-grid {
  flex:1 0 auto; align-items:stretch;
 }
 .home-page .layout-grid > :is(.main-section,.materials-column,.plots-column),
 .rcwa-page .rcwa-settings, .rcwa-page .rcwa-layers,
 .rcwa-page .layout-grid > .structure-preview { align-self:stretch; }
 :is(.home-page,.rcwa-page) .layout-grid input:not([type=radio]):not([type=checkbox]),
 :is(.home-page,.rcwa-page) .layout-grid select { min-height:42px !important; padding:8px 10px !important; }
 .home-page .stack-layer-row { min-height:110px; padding:12px; row-gap:10px; }
 .rcwa-page .editable-layer { min-height:110px; padding:12px; gap:12px; }
 .rcwa-page .grating-band { padding:12px 0; }
 :is(.home-page,.rcwa-page) .stack-medium { padding:20px 8px; }
 .home-page .tmm-material-model { padding:10px 0; }
 .home-page .tmm-model-control-row { margin-top:8px; }
 :is(.home-page,.rcwa-page) .layout-grid #config-summary > .summary-content {
  height:clamp(320px,28dvh,440px); max-height:clamp(320px,28dvh,440px);
  padding:18px; gap:18px;
 }
 .home-page .plots-column > .plots-content { flex:1 0 auto; }
 .home-page .plots-content .material-chart-wrap,
 .home-page .plots-column #tmm-results-panel .material-chart-wrap,
 .rcwa-page #material-chart-panel .material-chart-wrap,
 .rcwa-page .layout-grid > .structure-preview .plot-content {
  height:clamp(440px,40dvh,720px);
 }
}

/* Presets use the same subsection heading treatment as other settings. */
:is(.home-page,.rcwa-page) .layout-grid .example-picker > label {
 display:block; padding:8px; margin:0 0 10px;
 background:#e6e6e6; border:0; border-bottom:2px solid #cfcfcf;
 color:#222; font-weight:600; font-size:var(--workspace-subheading) !important;
}

/* Keep both page bars visible on large desktop screens. */
@media(min-width:1800px) and (min-height:1000px) {
 body.home-page, body.rcwa-page { height:100dvh; min-height:0; overflow:hidden; }
 .home-page .page-container, .rcwa-page .page-container {
  display:grid; grid-template-rows:auto minmax(0,1fr) auto;
  height:100dvh; min-height:0; overflow:hidden; gap:0;
 }
 :is(.home-page,.rcwa-page) :is(.site-header,.site-footer) { flex-shrink:0; }
 .home-page .layout-grid, .rcwa-page .layout-grid {
  height:auto; min-height:0; max-height:100%; align-self:stretch;
  grid-template-rows:minmax(0,1fr); overflow:hidden;
 }
 .home-page .layout-grid > :is(.main-section,.materials-column,.plots-column),
 .rcwa-page .rcwa-settings, .rcwa-page .rcwa-layers {
  min-height:0; max-height:100%; overflow:auto; scrollbar-gutter:stable;
 }
 .rcwa-page .layout-grid > .structure-preview {
  display:flex; flex-direction:column; min-height:0; max-height:100%; overflow:hidden;
 }
 .rcwa-page .layout-grid > .structure-preview > * { flex-shrink:0; }
 .rcwa-page .layout-grid > .structure-preview > .preview {
  display:flex; flex-direction:column; flex:1 1 0; min-height:0; overflow:hidden;
 }
 .rcwa-page .preview > .preview-header { flex-shrink:0; }
 .rcwa-page .preview > [role=tabpanel]:not([hidden]) {
  display:flex; flex-direction:column; flex:1 1 0; min-height:0; overflow:auto;
 }
 .rcwa-page .preview > #rcwa-simulation-panel:not([hidden]) { overflow:hidden; }
 .rcwa-page .rcwa-plot-controls { flex-shrink:0; }
 .rcwa-page .layout-grid > .structure-preview .plot-content {
  flex:1 1 0; height:auto; min-height:0;
 }
}

/* Consistent material-chip borders at every screen size. */
:is(.home-page,.rcwa-page) .selected-materials .material-chip {
 border-width:2px;
}

.rcwa-page .radio-container.incident-angle-choices {
 padding:8px 8px 0; flex-wrap:wrap; gap:8px;
}
@media(min-width:1800px) and (min-height:1000px) {
 .rcwa-page .radio-container.incident-angle-choices {
  gap:12px 20px !important; margin-bottom:8px;
 }
 .rcwa-page .incident-angle-choices .radio-group { gap:6px; }
}

/* More breathing room in the material library on large desktop displays. */
@media(min-width:1800px) and (min-height:1000px) {
 :is(.home-page,.rcwa-page) .material-selection-panel > .material-selection-title {
  margin-bottom:18px;
 }
 :is(.home-page,.rcwa-page) .material-selection-inline {
  margin-top:18px; gap:14px 12px; align-items:center;
 }
 :is(.home-page,.rcwa-page) .selected-materials .material-chip {
  padding:6px 12px; gap:8px;
 }
 :is(.home-page,.rcwa-page) .layout-grid .material-chip .material-remove {
  width:24px; height:24px; padding:2px;
 }
}

/* Preserve the 2560 × 1440 reference proportions on larger monitors. */
@media(min-width:1800px) and (min-height:1000px) {
 .home-page .page-container, .rcwa-page .page-container {
  max-width:2560px; height:min(100dvh,1440px); min-height:0;
  margin:0 auto;
 }
 :is(.home-page,.rcwa-page) .layout-grid #config-summary > .summary-content {
  height:clamp(320px,28dvh,403.2px); max-height:clamp(320px,28dvh,403.2px);
 }
 .home-page .plots-content .material-chart-wrap,
 .home-page .plots-column #tmm-results-panel .material-chart-wrap,
 .rcwa-page #material-chart-panel .material-chart-wrap {
  height:clamp(440px,40dvh,576px);
 }
}
@media(min-width:2560px) and (min-height:1000px) {
 body.home-page, body.rcwa-page {
  --workspace-heading:calc(0.95rem + 7.68px);
 }
}
