.lr-app { max-width: 1600px; margin: auto; padding: 2rem clamp(1rem, 3vw, 3rem) 3rem; font-size: .91rem; }
.lr-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.7rem; }
.lr-heading h1 { font-size: clamp(2.1rem, 4vw, 3.1rem); margin: .35rem 0 .5rem; }
.lr-back { font-size: .8rem; text-decoration: none; font-weight: 650; }
.lr-back span { margin-left: .7rem; color: #a3afaa; }
.lr-app button, .lr-app select, .lr-app input[type="text"] { font: inherit; color: var(--ink); border: 1px solid #c7d2cc; border-radius: 5px; background: white; padding: .4rem .6rem; min-height: 2.3rem; }
.lr-app button { cursor: pointer; }
.lr-app button:hover { background: #e4eeea; border-color: var(--accent); }
.lr-app .lr-primary { background: var(--accent); color: white; border-color: var(--accent); }
.lr-app .lr-primary:hover { background: #173e3b; }
.lr-app :focus-visible { outline: 3px solid #d37a40; outline-offset: 3px; }
.lr-app input[type="checkbox"], .lr-app input[type="range"] { accent-color: var(--accent); }
.lr-app input[type="checkbox"] { width: 1rem; height: 1rem; }
.lr-toolbar { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; padding: .9rem 1.2rem; background: #e8eeea; border: 1px solid #d4dfd8; border-radius: 9px; margin-bottom: 1rem; }
.lr-app fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
.lr-app legend { font-size: .69rem; text-transform: uppercase; letter-spacing: .09em; font-weight: 750; color: #52665b; margin-bottom: .5rem; }
.lr-toolbar fieldset { display: flex; flex-wrap: wrap; align-items: center; gap: .9rem; }
.lr-toolbar .lr-primary { align-self: center; margin-left: auto; }
.lr-field-select, .lr-math-select { position: relative; }
#field { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-width: 10rem; }
#field-options, .lr-options { position: absolute; top: calc(100% + 5px); left: 0; z-index: 5; margin: 0; padding: .25rem; min-width: 100%; list-style: none; border: 1px solid #c7d2cc; border-radius: 5px; background: white; box-shadow: var(--shadow); }
#field-options [role="option"], .lr-options [role="option"] { padding: .4rem .6rem; white-space: nowrap; border-radius: 3px; cursor: pointer; }
#field-options [aria-selected="true"], .lr-options [aria-selected="true"] { background: #e4eeea; color: var(--accent); font-weight: 650; }
#field-options [role="option"]:hover, #field-options [role="option"]:focus, .lr-options [role="option"]:hover, .lr-options [role="option"]:focus { background: #e4eeea; outline-offset: -2px; }
.lr-app label { display: inline-flex; align-items: center; gap: .4rem; }
.lr-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr); align-items: start; }
.lr-panel { border: 1px solid #cdd8d1; border-radius: 9px; overflow: hidden; background: white; min-width: 0; }
.lr-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: .3rem; padding: .8rem 1rem; border-bottom: 1px solid #e0e6e1; }
.lr-panel h2 { font-family: inherit; font-size: 1rem; letter-spacing: -.02em; margin: 0; font-weight: 650; }
.lr-view-buttons { display: flex; gap: .25rem; }
.lr-view-buttons button { min-width: 2rem; min-height: 2rem; padding: .15rem .45rem; }
.lr-stage { position: relative; height: clamp(330px, 43vw, 560px); min-height: 260px; max-height: 1000px; overflow: hidden; resize: vertical; background: #fcfcf8; }
.lr-stage canvas { position: absolute; width: 100%; height: 100%; inset: 0; display: block; }
.lr-grid-notice { position: absolute; bottom: .6rem; left: .6rem; max-width: calc(100% - 1.2rem); margin: 0; padding: .4rem .6rem; border: 1px solid #d4dfd8; border-radius: 5px; background: #fcfcf8eb; color: #344c45; font-size: .73rem; pointer-events: none; }
.lr-overlay { touch-action: none; cursor: grab; }
.lr-overlay:active { cursor: grabbing; }
.lr-divider { align-self: stretch; cursor: col-resize; display: grid; place-items: center; touch-action: none; }
.lr-divider span { height: 40px; width: 4px; background: #b9c9bf; border-radius: 4px; }
.lr-divider:hover span { background: var(--accent); }
.lr-workspace.lr-single { grid-template-columns: minmax(0,1fr); }
.lr-app [hidden] { display: none !important; }
.lr-legend { display: flex; flex-wrap: wrap; gap: .65rem 1.4rem; align-items: center; padding: 0 .3rem 1rem; font-size: .77rem; color: var(--muted); }
.lr-legend > span { display: inline-flex; align-items: center; gap: .45rem; }
.lr-key { display: inline-block; height: 10px; width: 10px; border-radius: 50%; background: #167d78; }
.lr-reduced { background: #d66b3a; border-radius: 1px; }
.lr-plastic { background: #4569c4; border-radius: 1px; transform: rotate(45deg); }
.lr-gradient { width: 80px; height: 8px; border-radius: 2px; background: linear-gradient(90deg,#3b4cc0,#90b2fe,#ddd,#f59c7d,#b40426); }
#renderer-status { margin-left: auto; font-size: .7rem; }
.lr-settings { display: grid; grid-template-columns: 1.2fr 1fr 1.05fr .85fr; gap: 1.7rem; border: 1px solid #d5ded7; background: #fff; border-radius: 9px; padding: 1.3rem; margin-top: 1rem; }
.lr-settings fieldset { display: flex; flex-direction: column; gap: .7rem; }
.lr-settings label { font-size: .8rem; }
.lr-vector-row { display: flex; align-items: center; gap: .65rem; }
.lr-vector-row strong { color: var(--accent); }
.lr-vector-row input { width: 4.4rem; min-width: 0; }
.lr-settings .lr-range-label { display: grid; grid-template-columns: 1fr auto; gap: .3rem; }
.lr-range-label input { grid-column: 1/-1; width: 100%; margin: .4rem 0; }
.lr-range-label output { font-variant-numeric: tabular-nums; }
.lr-beta-control { grid-column: 1/-1; min-width: 0; }
.lr-beta-marks { position: relative; height: 2.8rem; margin: 0 8px; }
.lr-app .lr-beta-marks button { position: absolute; top: 3px; display: flex; flex-direction: column; align-items: center; padding: 0; min-height: 0; border: 0; background: transparent; font-size: .64rem; line-height: 1.35; color: var(--muted); transform: translateX(-50%); }
.lr-beta-marks button::before { content: ""; position: absolute; height: 8px; width: 2px; top: -11px; background: var(--accent); }
.lr-beta-marks button span { font-weight: 700; color: var(--accent); }
.lr-beta-square { left: 12.5%; }
.lr-beta-triangular { left: 83.333333%; }
.lr-app .lr-beta-marks button:hover { color: var(--accent); text-decoration: underline; }
.lr-basis math { font-size: 1.1rem; color: var(--accent); }
.lr-app button:disabled { opacity: .4; cursor: default; }
.lr-shear-buttons { display: flex; gap: .4rem; }
.lr-shear-buttons button { font-size: .8rem; flex: 1; }
#energy-max { width: 5.5rem; }
.lr-readout { border-left: 1px solid #e1e7e2 !important; padding-left: 1.2rem !important; min-width: 0; font-size: .79rem; }
.lr-readout dl { margin: 0; }
.lr-readout dl > div { margin-bottom: .65rem; }
.lr-readout dt { color: var(--muted); font-size: .7rem; }
.lr-readout dd { margin: 0; font-variant-numeric: tabular-nums; }
#input-message { color: #a13d28; font-size: .74rem; margin-bottom: 0; }
.lr-help { margin-top: 1.4rem; color: var(--muted); max-width: 65rem; font-size: .85rem; }
.lr-help summary { color: var(--accent); cursor: pointer; margin-bottom: .7rem; }
.lr-empty { padding: 4rem 1rem; text-align: center; background: white; border-radius: 9px; }
.phd-heading { margin-bottom: 1.7rem; }
.phd-project-grid { max-width: 23rem; }
.phd-card-art { aspect-ratio: 4/3; width: 100%; display: block; }
.lr-panel-heading { min-height: 5.6rem; flex-wrap: wrap; align-content: center; gap: .4rem .6rem; }
#disk-title { display: inline-flex; align-items: baseline; gap: .35rem; white-space: nowrap; }
#disk-title math { font-size: .96rem; }
.lr-reference-key { background: transparent; border: 1.5px solid #687786; }
.lr-cross-key { position: relative; display: inline-block; width: 13px; height: 13px; background: #617075; border-radius: 2px; }
.lr-cross-key::before, .lr-cross-key::after { content: ""; position: absolute; background: white; }
.lr-cross-key::before { left: 2px; top: 6px; width: 9px; height: 1px; }
.lr-cross-key::after { left: 6px; top: 2px; width: 1px; height: 9px; }
.lr-setting-note { color: var(--muted); font-size: .76rem; line-height: 1.6; margin: 0; }
.lr-reference-equation { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.lr-reference-equation math, .lr-metric-readouts math { font-size: 1.05rem; }
.lr-readout { align-items: flex-start; }
.lr-readout dl { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem 1rem; width: 100%; }
.lr-readout dl > div:last-child { grid-column: 1/-1; }
.lr-readout dl > div { margin: 0; }
.lr-metric-readouts { display: flex; flex-direction: column; align-items: flex-start; gap: .8rem; }
#input-message:empty { display: none; }
.lr-transform-stage { box-sizing: border-box; height: clamp(330px, 43vw, 560px); min-height: 260px; max-height: 1000px; overflow: auto; resize: vertical; padding: 1rem; display: flex; flex-direction: column; gap: 1.1rem; }
.lr-transform-choice { display: block !important; color: var(--muted); font-size: .74rem; margin-bottom: .35rem; }
#transformation-pair { width: 100%; min-width: 0; font-size: .8rem; }
.lr-transform-options { display: flex; flex-wrap: wrap; gap: .65rem; align-items: center; font-size: .75rem; margin: .8rem 0; }
#shear-step { width: 5rem; }
.lr-shear-row { display: grid; grid-template-columns: minmax(0,1fr) 2.7rem 2.7rem; gap: .4rem; align-items: center; font-size: .8rem; margin-top: .35rem; }
.lr-shear-row button { min-height: 2rem; padding: .25rem; }
.lr-transform-equation { display: flex; flex-direction: column; align-items: flex-start; gap: .7rem; padding-top: 1rem; border-top: 1px solid #e1e7e2; }
.lr-transform-equation p { margin: 0; }
#transform-space { color: var(--muted); font-size: .76rem; }
#transform-equation { font-size: 1.5rem; color: var(--accent); }
#operator-matrix { font-size: 1.2rem; }
#last-shear { font-size: .79rem; }
.lr-angle-edit { display: inline-flex; align-items: center; gap: .3rem; min-width: 0; font-size: .75rem; }
.lr-angle-edit input { width: 4rem; min-width: 0; padding: .25rem .35rem !important; min-height: 2rem !important; }
.lr-potential-choice { display: flex !important; flex-direction: column; align-items: stretch !important; gap: .35rem; }
#potential-model { width: 100%; min-width: 0; font-size: .8rem; }
.lr-potential-controls { display: flex; flex-direction: column; gap: .65rem; }
#quadratic-controls label { justify-content: space-between; }
#quadratic-controls input { width: 6.2rem; min-width: 0; }
.lr-transform-stage { gap: .8rem; }
.lr-transform-equation { gap: .45rem; padding-top: .75rem; }
#operator-matrix, #transform-f-matrix { font-size: 1.05rem; }
#transform-equation { font-size: 1.35rem; }
#reference-basis { display: flex; justify-content: space-between; align-items: center; gap: .6rem; width: 100%; }
#reference-label, .lr-options [role="option"] { display: inline-flex; align-items: center; gap: .3rem; }
.lr-options [role="option"] { display: flex; }
.lr-options math, #reference-label math { font-size: 1.1rem; }
.lr-view-buttons { margin-left: auto; }
.lr-app .lr-background-toggle { font-size: 1.1rem; padding: 0 .4rem; }
.lr-background-toggle[aria-pressed="true"] { background: #e0ece6; border-color: var(--accent); }
@media(max-width: 1050px) { .lr-settings { grid-template-columns: 1fr 1fr; } }
@media(max-width: 760px) {
  .lr-workspace { display: flex; flex-direction: column; gap: 1rem; }
  .lr-panel { width: 100%; }
  .lr-divider { display: none; }
  .lr-heading { align-items: flex-start; }
  .lr-toolbar { gap: 1rem; }
  .lr-stage, .lr-transform-stage { height: 380px; }
  .lr-settings { grid-template-columns: 1fr; }
  .lr-readout { border-left: 0 !important; border-top: 1px solid #e1e7e2 !important; padding: 1rem 0 0 !important; }
  .lr-metric-readouts { flex-direction: row; flex-wrap: wrap; gap: 1.5rem; }
}
@media(max-width: 440px) { .lr-heading { flex-wrap: wrap; } }

/* Quiet, plot-only presentation; also a viewport fallback for mobile browsers. */
body.lr-presentation-active { overflow: hidden; }
.lr-app.lr-presenting { position: fixed; inset: 0; z-index: 1000; width: 100%; height: 100dvh; max-width: none; margin: 0; padding: 0; background: #fcfcf8; }
.lr-presenting > :not(.lr-workspace) { display: none !important; }
.lr-presenting .lr-workspace { position: relative; display: grid; height: 100%; align-items: stretch; gap: 0; }
.lr-presenting .lr-panel { border: 0; border-radius: 0; width: auto; height: 100%; }
.lr-presenting .lr-panel-heading, .lr-presenting #transformations-panel, .lr-presenting #transform-divider { display: none !important; }
.lr-presenting .lr-stage { height: 100% !important; min-height: 0; max-height: none; resize: none; }
.lr-presenting .lr-divider { display: grid; background: #f0f2ed; }
.lr-presenting .lr-divider span { width: 2px; height: 24px; opacity: .4; }
.lr-presentation-menu { position: absolute; z-index: 10; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right)); color: #344c45; }
.lr-presentation-menu summary { list-style: none; cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center; margin-left: auto; border: 1px solid #c7d2cc80; border-radius: 50%; background: #fcfcf8b8; opacity: .35; }
.lr-presentation-menu summary::-webkit-details-marker { display: none; }
.lr-presentation-menu:hover summary, .lr-presentation-menu:focus-within summary, .lr-presentation-menu[open] summary { opacity: 1; }
.lr-presentation-options { display: flex; flex-direction: column; gap: .8rem; margin-top: .5rem; padding: 1rem; border: 1px solid #c7d2cc; border-radius: 9px; background: #fcfcf8f5; box-shadow: 0 6px 28px #173e3b14; }
.lr-visual-settings { max-width: none; border-top: 1px solid #d5ded7; padding-top: 1.2rem; }
.lr-visual-fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 1rem 2rem; margin-block: 1.4rem; }
.lr-visual-fields label { display: flex; justify-content: space-between; }
.lr-visual-fields input[type="number"] { width: 5rem; padding: .35rem; font: inherit; border: 1px solid #c7d2cc; border-radius: 5px; }
.lr-visual-fields input[type="color"] { width: 3rem; height: 2rem; padding: 2px; border: 1px solid #c7d2cc; background: white; border-radius: 5px; }
.lr-visual-actions { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; margin-block: 1rem; }
.lr-import-label { flex-wrap: wrap; }
.lr-import-label input { max-width: 14rem; font: inherit; }
#visual-consent { max-width: min(34rem,calc(100vw - 2rem)); padding: 1.5rem; color: var(--ink); border: 1px solid #c7d2cc; border-radius: 12px; }
#visual-consent h2 { font-size: 1.6rem; }
#visual-consent::backdrop { background: #132a2766; }
@media(max-aspect-ratio: 4/5) {
  .lr-presenting .lr-workspace { grid-template-columns: minmax(0,1fr) !important; grid-auto-rows: minmax(0,1fr); }
  .lr-presenting .lr-divider { display: none; }
  .lr-presenting .lr-panel { min-height: 0; }
}
.lr-heading-actions { display: flex; gap: .5rem; flex-shrink: 0; }
#share-status:empty { display: none; }
#share-status { margin-bottom: .8rem; }
#share-fallback { width: 100%; margin-bottom: 1rem; }
.lr-animation { margin-block: 1rem; padding: 1.3rem; border: 1px solid #cdd8d1; border-radius: 9px; background: #fff; }
.lr-animation-heading { display: flex; gap: 1rem; justify-content: space-between; align-items: center; }
.lr-animation h2 { font-family: inherit; font-size: 1.25rem; margin-bottom: .5rem; }
.lr-animation p { font-size: .8rem; color: var(--muted); }
.lr-animation-frames { list-style: none; padding: 0; margin: 1.3rem 0; display: flex; flex-direction: column; gap: 1rem; }
.lr-animation-frames > li { border: 1px solid #d5ded7; border-radius: 7px; padding: 1rem; }
.lr-keyframe-heading { display: flex; align-items: center; gap: .7rem; justify-content: space-between; flex-wrap: wrap; margin-bottom: .75rem; }
.lr-keyframe-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.lr-keyframe-actions button { font-size: .75rem; }
.lr-animation details summary { cursor: pointer; color: var(--accent); padding-block: .4rem; font-size: .82rem; }
.lr-keyframe-settings { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: .8rem 1.4rem; padding-block: .7rem; }
.lr-keyframe-settings label { justify-content: space-between; font-size: .78rem; }
.lr-keyframe-settings input[type="number"] { min-width: 0; width: 6rem; }
.lr-keyframe-settings select { max-width: 13rem; }
.lr-keyframe-settings p { grid-column: 1/-1; margin-bottom: 0; }
.lr-animation input[type="number"] { font: inherit; color: var(--ink); padding: .4rem; border: 1px solid #c7d2cc; border-radius: 5px; }
.lr-transition { border-top: 1px dashed #cdd8d1; margin-top: .5rem; padding-top: .4rem; }
.lr-animation-export { display: flex; flex-wrap: wrap; gap: 1rem; padding-block: 1rem !important; }
.lr-animation-export label { font-size: .8rem; }
#animation-canvas { display: block; width: 100%; max-height: 75vh; object-fit: contain; background: #fcfcf8; border: 1px solid #d5ded7; border-radius: 7px; }
#animation-progress { width: 100%; accent-color: var(--accent); }
#operator-symbolic { font-size: 1.1rem; max-width: 100%; overflow-x: auto; }
@media(max-width:760px) { .lr-heading-actions { margin-top: .5rem; } .lr-animation-heading { flex-wrap: wrap; } }

/* Keep each label and its control together rather than spanning a wide row. */
.lr-visual-fields > label, .lr-keyframe-settings > label, .lr-animation-export > label,
.lr-settings fieldset > label, .lr-transform-options > label, .lr-visual-settings > label {
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
  gap: .35rem; padding: .65rem .75rem; border: 1px solid #dce3de; border-radius: 6px;
  background: #fafbf8; font-size: .78rem; min-width: 0;
}
.lr-visual-fields, .lr-keyframe-settings { gap: .65rem; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); }
.lr-visual-fields input[type="number"], .lr-keyframe-settings input[type="number"], .lr-keyframe-settings select { width: 100%; max-width: none; }
.lr-app label.lr-setting-toggle, .lr-settings label:has(> input[type="checkbox"]), .lr-transform-options label:has(> input[type="checkbox"]) { flex-direction: row; align-items: center; justify-content: flex-start; gap: .5rem; }
.lr-setting-toggle input[type="checkbox"] { flex: 0 0 auto; }
.lr-animation-export { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: .65rem; }
.lr-settings .lr-vector-row { padding: .6rem; border: 1px solid #dce3de; border-radius: 6px; background: #fafbf8; }
.lr-visual-settings > label { max-width: 18rem; }
.lr-keyframe-heading { margin-bottom: 0; gap: .7rem; }
.lr-keyframe-heading > strong { white-space: nowrap; font-size: .83rem; }
.lr-keyframe-tabs { display: flex; gap: .25rem; }
.lr-app .lr-keyframe-tabs button { background: transparent; border-color: transparent; font-size: .78rem; }
.lr-app .lr-keyframe-tabs button:hover, .lr-app .lr-keyframe-tabs button.is-active { background: #e6eeea; border-color: #c7d2cc; }
.lr-keyframe-actions { margin-left: auto; gap: .25rem; }
.lr-keyframe-actions button { padding: .3rem .45rem; }
.lr-keyframe-dropdown { margin-top: .8rem; padding-top: .4rem; border-top: 1px solid #dce3de; }
.lr-keyframe-dropdown .lr-transition { border: 0; margin: 0; padding: .7rem 0; }
@media(max-width:600px) {
  .lr-keyframe-heading { gap: .4rem; }
  .lr-keyframe-tabs { margin-left: auto; }
  .lr-keyframe-actions { flex-basis: 100%; margin-left: 0; }
  .lr-keyframe-settings, .lr-visual-fields { grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); }
}
.lr-keyframe-tabs button::after { content: "⌄"; margin-left: .4rem; opacity: .65; }
.lr-keyframe-tabs button.is-active::after { content: "⌃"; }

.lr-operator-row { display:flex; align-items:center; gap:.55rem; width:100%; min-width:0; white-space:nowrap; }
.lr-operator-row > math { flex-shrink:0; }
.lr-operator-row.lr-hide-symbolic #operator-symbolic { display:none; }
.lr-app.lr-presenting { background:var(--view-background,#fcfcf8); }

.lr-operator-row:not(.lr-hide-symbolic) .lr-numeric-operator { display:none; }

.lr-help math { font-family: "STIX Two Math", "Cambria Math", math; font-size:1.08em; }
.lr-help-equation { max-width:100%; overflow-x:auto; padding:.65rem .3rem; margin:.4rem 0; }
.lr-help-equation math { font-size:1.2em; }
.lr-help h3 { margin-top:1.5rem; font-size:1rem; }
.lr-references { padding-left:1.5rem; }
.lr-references li { margin:.7rem 0; scroll-margin-top:5rem; }

#transform-c-equation { max-width:100%; overflow-x:auto; font-size:1.05rem; }
#transform-c-matrix { font-size:1.05rem; }

#image-export-dialog { width:min(36rem,calc(100vw - 2rem)); max-height:90dvh; overflow:auto; padding:1.5rem; border:1px solid #c7d2cc; border-radius:12px; color:var(--ink); }
#image-export-dialog::backdrop { background:#132a2766; }
#image-export-dialog h2 { font-size:1.5rem; margin-top:0; }
.lr-export-fields { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:.65rem; }
.lr-export-fields label { display:flex; flex-direction:column; gap:.4rem; padding:.65rem; border:1px solid #d5ded7; border-radius:7px; font-size:.85rem; }
.lr-export-fields input,.lr-export-fields select { width:100%; min-width:0; font:inherit; padding:.4rem; }
.lr-alpha-warning { padding:.7rem .9rem; border-left:3px solid #b57a24; background:#fff7e7; color:#654414; font-size:.85rem; }
#animation-canvas { background-color:#fff; background-image:repeating-conic-gradient(#e4e7e5 0% 25%,transparent 0% 50%); background-size:16px 16px; }
@media(max-width:480px){.lr-heading { flex-wrap:wrap; }.lr-heading-actions{flex-wrap:wrap;}}

.lr-reference-equation { gap:.75rem 1rem; }
