:root {
    --bg-color: #0b0b0d;
    --surface-color: #16161a;
    --primary-color: #00d4ff;
    --accent-color: #ffd700;
    --text-color: #e0e0e0;
    --text-dim: #a0a0a0;
    --border-color: #333;
    --input-bg: #202025;
    --menu-bg: #2a2a35;
}

a {
    color: var(--primary-color);
}

a:visited {
    color: var(--accent-color);
}

/* Explicit Box Sizing Reset */
html,
body,
header,
main,
footer,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video,
button,
input,
select,
textarea {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    /* V86.25.0: Block display, allow wrapper to define first screen */
    display: block;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* V86.25.0: Viewport Wrapper to enforce exact screen height for Main */
.viewport-wrapper {
    height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
}

header {
    padding: 0 2rem;
    background-color: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
    height: 70px;
}

h1 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 0.8rem;
    color: var(--text-dim);
}

main {
    flex: 1;
    /* Fills remaining space in viewport-wrapper */
    display: flex;
    padding: 1.5rem;
    gap: 1.5rem;
    align-items: stretch;
    overflow: hidden;
    /* Contain panels */
    height: auto;
    /* Let flex handle height */
}

/* Left Panel - Inputs */
.input-panel {
    flex: 1;
    /* V87.11.0: Increased max-width by ~3% (340 * 1.03 = 350) */
    max-width: 350px;
    background-color: var(--surface-color);
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-height: 0;
    /* Important for flex scrolling */
    overflow-y: auto;
    /* Internal Scroll */
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ... existing styles ... */

.status-bar {
    position: absolute;
    bottom: 20px;
    left: 20px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    color: var(--text-dim);
    font-family: monospace;
    border: 1px solid var(--border-color);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    max-width: 24%;
    /* Default width limit */
    white-space: normal;
    overflow-wrap: break-word;
    /* V87.11.0: transitions - collapse to left */
    transition: max-width 0.3s ease, padding 0.3s ease, opacity 0.3s ease, border-radius 0.3s ease;
    /* Added border-radius transition */
    max-height: 500px;
    overflow: hidden;
    /* Ensure it doesn't shrink vertically when collapsed horizontally */
    min-height: 40px;
}

.status-bar.collapsed {
    /* Collapse to Left: Shrink Width */
    max-width: 40px;
    padding-right: 0;
    padding-left: 0;
    /* Minimal padding */
    width: 40px;
    /* Force small width */
    border-radius: 8px;
    /* Square shape when collapsed */
}

.status-bar.collapsed #instruction-text,
.status-bar.collapsed #result-text,
.status-bar.collapsed #recommendation-text,
.status-bar.collapsed #show-work-btn {
    opacity: 0;
    pointer-events: none;
    display: none;
    /* Hide fully to prevent layout issues */
}

#collapse-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-weight: bold;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 1002;
    pointer-events: auto;
    transition: transform 0.3s ease;
    padding: 0;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#collapse-btn:hover {
    color: var(--primary-color);
}

.status-bar.collapsed #collapse-btn {
    /* Rotate to point right when collapsed */
    transform: rotate(-90deg);
    /* Center it in the small box */
    left: 50%;
    top: 50%;
    margin-left: -12px;
    margin-top: -12px;
}

/* V87.11.0: Canvas Controls Steps Scaling */
/* Base styles (Large) are default */

/* Medium Scale */
.canvas-controls.scale-md {
    transform: scale(0.9);
    transform-origin: top right;
}

/* Small Scale */
.canvas-controls.scale-sm {
    transform: scale(0.8);
    transform-origin: top right;
}

/* Extra Small Scale */
.canvas-controls.scale-xs {
    transform: scale(0.7);
    transform-origin: top right;
}

.section-title {
    font-size: 0.95rem;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 4px;
    margin-bottom: 8px;
}

/* ... Existing Styles Unchanged below ... */

.input-group {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Rate Inputs */
.rate-group {
    margin-bottom: 2px;
}

.column-group {
    flex-direction: column;
    align-items: flex-start;
}

.column-group label {
    margin-bottom: 2px;
    font-size: 0.85rem;
}

.column-group input[type="range"],
.column-group select {
    width: 100%;
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2300d4ff%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 8px auto;
}

.input-group label {
    font-size: 0.75rem;
    color: var(--text-dim);
    flex: 1;
    text-align: right;
    margin-right: 10px;
    white-space: normal;
}


.column-group label {
    text-align: left;
    margin-right: 0;
}

.input-group.wrap-group {
    flex-wrap: wrap;
}

.input-group.wrap-group select {
    flex-grow: 1;
    min-width: 160px;
}

.input-group input[type="number"] {
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 4px 8px;
    border-radius: 6px;
    width: 75px;
    text-align: left;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.radio-group {
    display: flex;
    gap: 15px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    text-align: left;
    margin-right: 0;
    flex: unset;
}

.input-group input:focus,
select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
}

.actions {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

button {
    flex: 1;
    padding: 10px;
    background-color: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

button:hover {
    opacity: 0.9;
}

button:active {
    transform: scale(0.98);
}

.btn-reset {
    background-color: #333;
    color: #fff;
    flex: 0.5;
}

/* Right Panel - Visualization */
.viz-panel {
    flex: 2;
    background-color: var(--surface-color);
    border-radius: 12px;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    min-height: 0;
    /* Shrink to fit main */
}

canvas {
    max-width: 100%;
    max-height: 100%;
    cursor: crosshair;
}

.status-bar {
    position: absolute;
    bottom: 20px;
    left: 20px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 20px;
    color: var(--text-dim);
    font-family: monospace;
    border: 1px solid var(--border-color);
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    max-width: 24%;
    white-space: normal;
    overflow-wrap: break-word;
    /* V87.8.0: transitions */
    transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
    max-height: 500px;
    /* arbitrary max for transition */
    overflow: hidden;
}

.status-bar.collapsed {
    max-height: 40px;
    padding-bottom: 0;
    overflow: hidden;
}

.status-bar.collapsed #instruction-text,
.status-bar.collapsed #result-text {
    opacity: 0;
    pointer-events: none;
}

#collapse-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-weight: bold;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 1002;
    pointer-events: auto;
    transition: transform 0.3s ease;
    padding: 0;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#collapse-btn:hover {
    color: var(--primary-color);
}

.status-bar.collapsed #collapse-btn {
    transform: rotate(180deg);
}

#instruction-text {
    white-space: nowrap;
}

#result-text {
    color: var(--accent-color);
    font-weight: bold;
}

/* Config Management Styles */
.config-actions-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-config {
    padding: 6px 12px;
    background-color: var(--surface-color);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-config:hover {
    background-color: var(--primary-color);
    color: #000;
}

/* Dialogs */
dialog {
    background-color: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
}

dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.6);
}

dialog h3 {
    margin-top: 0;
    color: var(--primary-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.dialog-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dialog-content input,
.dialog-content textarea {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px;
    border-radius: 4px;
    font-family: inherit;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.btn-cancel {
    background-color: #444;
    color: #fff;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #000;
}

/* Config List in Load Dialog */
.config-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.config-item {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.config-info {
    flex: 1;
}

.config-name {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1rem;
}

.config-meta {
    font-size: 0.8em;
    color: #aaa;
    margin-top: 2px;
}

.config-desc {
    margin-top: 4px;
    font-style: italic;
    color: #888;
}

.config-actions {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

.btn-load-item {
    background-color: var(--accent-color);
    color: #000;
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn-delete-item {
    background-color: #ff4444;
    color: #fff;
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* Inline Feedback */
.status-msg {
    color: #4CAF50;
    font-weight: bold;
    margin-right: auto;
    align-self: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.btn-delete-confirm {
    background-color: #d32f2f !important;
    border: 1px solid #b71c1c;
    font-weight: bold;
}

details {
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 8px;
}

.btn-overwrite-confirm {
    background-color: #d32f2f !important;
    border: 1px solid #b71c1c;
    color: #fff !important;
    font-weight: bold;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(211, 47, 47, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0);
    }
}

summary {
    cursor: pointer;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

/* Screw Menu */
#screw-menu {
    position: absolute;
    display: none;
    background-color: var(--menu-bg);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 100;
    flex-direction: column;
    gap: 5px;
    min-width: 150px;
}

#screw-menu h4 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: var(--text-dim);
    text-align: center;
}

.menu-item {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-radius: 4px;
    color: var(--text-color);
    cursor: pointer;
    text-align: left;
    transition: background 0.2s;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--primary-color);
}

.viz-panel {
    position: relative;
}

/* V87.15.0: Collapsible Canvas Controls */
.canvas-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 12px;
    border-radius: 8px;
    color: #eee;
    font-size: 13px;
    z-index: 10;
    backdrop-filter: blur(4px);
    border: 1px solid #444;
    /* V87.9.0: Narrower panel */
    max-width: 210px;
    /* V87.15.0: Transitions */
    transition: max-width 0.3s ease, padding 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
    overflow: hidden;
    /* Ensure height adapts */
    max-height: 200px;
    min-height: 40px;
    min-width: 40px;
}

.canvas-controls.collapsed {
    max-width: 40px;
    max-height: 40px;
    padding: 0;
    /* Optional: Ensure it sticks to top right */
}

/* Hide children when collapsed */
.canvas-controls.collapsed .toggle-group,
.canvas-controls.collapsed label {
    opacity: 0;
    pointer-events: none;
    display: none;
    /* Hide fully to prevent layout issues */
}

/* Toggle Button Style */
#controls-collapse-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-weight: bold;
    cursor: pointer;
    font-size: 1.2rem;
    z-index: 1002;
    pointer-events: auto;
    transition: transform 0.3s ease;
    padding: 0;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

#controls-collapse-btn:hover {
    color: var(--primary-color);
}

.canvas-controls.collapsed #controls-collapse-btn {
    transform: rotate(90deg);
    /* Points Left */
    /* Center in small box */
    top: 50%;
    right: 50%;
    margin-top: -12px;
    margin-right: -12px;
}

.canvas-controls label {
    display: flex;
    align-items: flex-start;
    /* Align checkbox to top of text */
    cursor: pointer;
    gap: 8px;
    line-height: 1.4;
    /* Better reading for wrapped text */
    /* Pad top to avoid overlap with button if expanded? */
    /* Actually current button is absolute top-right. */
    /* We should make sure content doesn't overlap it. */
    margin-right: 20px;
    /* Space for button */
}

.header-logo {
    height: 65px;
    margin-right: 0;
    width: auto;
}

.separator {
    border: 0;
    border-bottom: 1px solid var(--border-color);
    margin: 10px 0;
}

.interpolated-input {
    background-color: rgba(255, 215, 0, 0.2) !important;
    color: #ffd700 !important;
    border-color: rgba(255, 215, 0, 0.4) !important;
}

.toggle-group {
    display: flex;
    flex-direction: column;
    /* Stack Label above Toggle */
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-bottom: 12px;
}

.switch-toggle {
    display: flex;
    background: #333;
    border-radius: 20px;
    padding: 2px;
    border: 1px solid var(--border-color);
}

.switch-toggle input {
    display: none;
}

.switch-toggle label {
    padding: 5px 15px;
    cursor: pointer;
    border-radius: 16px;
    transition: all 0.2s ease;
    font-size: 0.9em;
    user-select: none;
    color: #888;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
    margin-right: 0;
}

.switch-toggle label .sub-label {
    font-size: 0.85em;
    font-weight: normal;
    opacity: 0.7;
    margin-top: 2px;
}

.switch-toggle input:checked+label {
    background: var(--accent-color);
    color: #000;
    font-weight: bold;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
    /* Increased to cover z-index 1002 buttons */
}

.modal-content {
    background: #2a2a2a;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    overflow-y: auto;
    position: relative;
    font-family: 'Courier New', monospace;
    color: #e0e0e0;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: #888;
    cursor: pointer;
}

.modal-close:hover {
    color: white;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.8rem;
    background: #444;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.btn-sm:hover {
    background: #555;
}

.math-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.math-table th,
.math-table td {
    padding: 6px;
    text-align: right;
    border-bottom: 1px solid #444;
}

.math-table th:first-child,
.math-table td:first-child {
    text-align: left;
}

.math-heading {
    color: #a020f0;
    margin-top: 15px;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

#show-work-btn {
    pointer-events: auto;
}

.help-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
    z-index: 1001;
    position: relative;
    flex: none;
    /* Prevent flex growth from generic button rule */
    padding: 0;
    /* Reset generic button padding */
}

#about-btn {
    margin-left: auto;
}

.help-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.help-content {
    width: 90vw;
    height: 85vh;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 30px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.close-help-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.noBullet {
    list-style-type: none;
}

.close-help-btn:hover {
    color: #fff;
}

.help-columns {
    display: flex;
    gap: 30px;
    height: 100%;
}

.help-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    border-right: 1px solid #333;
    overflow-y: auto;
    min-height: 0;
}

.help-section:last-child {
    border-right: none;
}

.help-section h2 {
    color: #e0e0e0;
    font-size: 1.4rem;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
    flex-shrink: 0;
}

.help-images {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
}

.help-placeholder {
    width: 120px;
    height: 120px;
    background-color: #333;
    border: 2px dashed #555;
    border-radius: 8px;
}

.help-thumb {
    width: 45%;
    max-width: 120px;
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    height: auto;
}

.help-thumb:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.help-text {
    color: #ccc;
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: left;
}

.help-text li {
    margin-bottom: 10px;
}

.help-text li em {
    color: var(--primary-color);
    font-style: normal;
    font-weight: bold;
}

.pos-icon {
    width: 30px;
    height: 30px;
    vertical-align: middle;
    margin-right: 0;
    margin-left: 7px;
    display: inline-block;
}

.pos-icon-example {
    width: 70px;
    height: 70px;
    vertical-align: middle;
    margin-right: 15px;
    margin-left: 0px;
    display: inline-block;
}

.image-modal {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.image-modal-content {
    display: flex;
    gap: 20px;
    max-width: 95vw;
    max-height: 95vh;
    padding: 20px;
    background: rgba(40, 40, 40, 0.5);
    border-radius: 10px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    justify-content: center;
}

.full-image {
    max-width: 45vw;
    max-height: 90vh;
    object-fit: contain;
    border: 1px solid #444;
    border-radius: 4px;
}

.close-image-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.3s;
    z-index: 3001;
}

.close-image-modal:hover,
.close-image-modal:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Footer (v86.14) */
.footer-panel {
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    font-size: 0.9rem;
    color: var(--text-dim);
    flex-wrap: wrap;
    /* Support for wrapping */
}

.footer-left {
    flex: 0 0 20%;
    text-align: left;
    padding-right: 15px;
    /* Added Padding */
}

.footer-center {
    flex: 0 0 20%;
    text-align: center;
    padding: 0 15px;
    /* Added Padding */
}

.footer-right {
    flex: 0 0 60%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 15px;
    padding-left: 15px;
    /* Added Padding */
}

.footer-right form {
    margin: 0;
    display: flex;
    align-items: center;
}

/* V87.0.0: Mobile Responsive */
@media (max-width: 800px) {
    .viewport-wrapper {
        min-height: 100vh;
        height: auto;
    }

    main {
        flex-direction: column;
        overflow: visible;
        height: auto;
    }

    .input-panel {
        width: 100%;
        max-width: none;
        flex: none;
        margin-bottom: 0;
        /* Separation */
    }

    .viz-panel {
        width: 100%;
        flex: none;
        min-height: 400px;
    }

    .status-bar {
        max-width: 40%;
    }

    /* Mobile Footer Layout */
    .footer-left {
        flex: 0 0 50%;
    }

    .footer-center {
        flex: 0 0 50%;
    }

    .footer-right {
        flex: 0 0 100%;
        justify-content: center;
        margin-top: 10px;
        padding-left: 0;
        /* Reset for mobile stack */
    }

    /* Mobile Help Modal */
    .help-columns {
        flex-direction: column;
        height: 100%;
        /* Constrain to parent height */
        overflow-y: auto;
        /* Enable vertical scrolling */
        gap: 0;
    }

    .help-section {
        border-right: none;
        border-bottom: 1px solid #333;
        flex: none;
        padding: 20px 10px;
    }

    .help-section:last-child {
        border-bottom: none;
    }
}

/* V87.21.0: Measurements Panel */
.measurements-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 180px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #333;
    border-radius: 15px;
    padding: 10px;
    color: #ffd700;
    /* V87.22.0: Restored gold text color */
    font-family: monospace;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.measurements-panel.offset-down {
    top: 80px;
}

.measurements-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.measurements-panel .panel-header h3 {
    margin: 0;
    font-size: 1.25em;
    /* 1.2 * 16px roughly */
    color: #ffd700;
}

/* Re-use collapse-btn style but ensure it fits */
/* Re-use collapse-btn style but ensure it fits */
.measurements-panel .collapse-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    /* Match other buttons */
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
    transition: transform 0.3s ease;
    /* Animate like others */
}

.measurements-panel .collapse-btn:hover {
    color: var(--primary-color);
}

.measurements-panel .panel-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.measurement-row {
    display: flex;
    justify-content: space-between;
    font-size: 1em;
}

.measurement-separator {
    height: 1px;
    background: #555;
    margin: 5px 0;
}

.measurement-row.highlight {
    font-weight: bold;
    margin-top: 2px;
}

/* Collapsed State */
.measurements-panel.collapsed {
    width: 40px;
    height: 40px;
    padding: 0;
    overflow: hidden;
    border-radius: 8px;
    /* Match other collapsed items */
    justify-content: center;
    align-items: center;
}

.measurements-panel.collapsed .panel-header {
    margin: 0;
    width: 100%;
    height: 100%;
    justify-content: center;
}

.measurements-panel.collapsed .panel-header h3 {
    display: none;
}

.measurements-panel.collapsed .panel-content {
    display: none;
}

.measurements-panel.collapsed .collapse-btn {
    transform: rotate(-90deg);
    /* Point Right */
    width: 100%;
    height: 100%;
}

/* V87.31.0: About Modal */
.about-content {
    width: 90%;
    max-width: 950px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 30px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    overflow-y: auto;
}

/* V87.32.0: Flex Header for Logo + Title */
.about-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 1px solid #333;
    padding-bottom: 15px;
}

.about-modal-logo {
    width: 50px;
    height: auto;
    object-fit: contain;
}

.about-content h2 {
    color: #e0e0e0;
    font-size: 1.4rem;
    margin: 0;
    /* Remove default margins as flex handles alignment */
    text-align: left;
    border-bottom: none;
    padding-bottom: 0;
}

.about-text {
    color: #ccc;
    line-height: 1.6;
    text-align: left;
}