/* GCS File Editor Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 20px;
    text-align: center;
}

header h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

header .subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
}

header .subtitle a {
    color: #fff;
    text-decoration: underline;
    text-decoration-style: dotted;
}

header .subtitle a:hover {
    text-decoration-style: solid;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.panel h2 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.hidden {
    display: none !important;
}

/* Drop Zone */
#drop-zone {
    border: 3px dashed #3498db;
    border-radius: 10px;
    padding: 50px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

#drop-zone:hover,
#drop-zone.dragover {
    border-color: #2980b9;
    background-color: #ecf0f1;
}

#drop-zone p {
    margin: 10px 0;
    color: #7f8c8d;
}

#file-input {
    display: none;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 25px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s ease;
}

.btn:hover {
    background: #2980b9;
}

/* Keyboard focus: one consistent, clearly visible ring in the app accent.
   :focus-visible keeps mouse clicks clean (no ring) while Tab shows it.
   Text inputs that suppress outline on :focus keep their existing
   box-shadow ring (same accent) — those rules are more specific and win,
   which is fine because they are already visible. */
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
canvas:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.btn-primary {
    background: #27ae60;
}

.btn-primary:hover {
    background: #219a52;
}

/* Design title and date */
#design-title {
    font-size: 1.4rem;
    margin-bottom: 5px;
}

.design-date {
    color: #7f8c8d;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

/* Data tables row */
.data-tables-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.data-table-section {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
}

.data-table-section h3 {
    font-size: 0.95rem;
    color: #2c3e50;
    margin-bottom: 10px;
    text-align: center;
    font-weight: 600;
}

.data-table {
    width: 100%;
    font-size: 0.85rem;
}

.data-table td {
    padding: 4px 6px;
}

.data-table td:nth-child(odd) {
    color: #7f8c8d;
}

.data-table td:nth-child(even) {
    color: #2c3e50;
    font-weight: 500;
    text-align: right;
}

.data-table .total-row {
    font-weight: bold;
    border-top: 1px solid #ddd;
}

.data-table.design-data td:nth-child(even) {
    text-align: left;
    padding-left: 15px;
}

/* Canvas Grid */
.canvas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    justify-items: center;
}

.canvas-container {
    text-align: center;
}

.canvas-container h3 {
    font-size: 0.95rem;
    color: #7f8c8d;
    margin-bottom: 10px;
}

.canvas-container canvas {
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
}

/* Cutting Chart */
.chart-options {
    margin-bottom: 15px;
}

.chart-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.rotation-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rotation-control label {
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
    min-width: auto;
    cursor: default;
}

.rotation-control input[type="number"] {
    width: 70px;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.rotation-control input[type="number"]:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.table-wrapper {
    overflow-x: auto;
}

.cutting-chart {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.cutting-chart td {
    padding: 10px 12px;
    text-align: left;
    border: 1px solid #ddd;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.cutting-chart td:nth-child(3) {
    /* Index positions column - allow wrapping */
    max-width: 200px;
    word-break: break-word;
}

.cutting-chart tr:hover {
    background-color: #f8f9fa;
}

.cutting-chart .tier-name {
    font-weight: 600;
    color: #3498db;
}

.cutting-chart .notes-input {
    width: 100%;
    min-width: 150px;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
    overflow: hidden;
}

.cutting-chart .notes-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.cutting-chart .girdle-row {
    background-color: #fff9e6;
}

.cutting-chart .hand-shaped-text {
    font-style: italic;
    color: #7f8c8d;
}

#chart-panel h2 {
    margin-top: 15px;
}

/* 3D Preview */
.preview-3d-container {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

#canvas-3d {
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #1a1a2e;
    cursor: grab;
}

/* Single-finger drag rotates the stone instead of scrolling the page
   (the touch handlers in app.js mirror the mouse trackball math). */
#canvas-3d,
#builder-canvas-3d,
#compare-canvas-a,
#compare-canvas-b {
    touch-action: none;
}

#canvas-3d:active {
    cursor: grabbing;
}

.preview-3d-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

/* Ray Traced mode (.rt-active set by the Render Mode handler): the
   viewport (canvas + view controls) and the long inspector column sit
   side by side at wide widths, with the viewport STICKY so adjusting
   any slider keeps the render on screen — it used to scroll away
   under the control stack. Other render modes keep the classic
   stacked flow (short controls, empty inspector). */
@media (min-width: 1100px) {
    #preview-3d-panel.rt-active .preview-3d-layout {
        display: grid;
        grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
        gap: 20px;
        align-items: start;
    }
    #preview-3d-panel.rt-active .preview-3d-viewport {
        position: sticky;
        top: 10px;
    }
    /* (The cutting-sequence toggle + controls moved INSIDE the viewport
       column so the sticky block carries them — as grid siblings they
       scrolled under it and were overlapped.) */
}
/* Narrow windows: one column, but the viewport pins to the top while
   the controls scroll beneath it. */
@media (max-width: 1099.98px) {
    #preview-3d-panel.rt-active .preview-3d-viewport {
        position: sticky;
        top: 0;
        z-index: 20;
        background: #fff;
        padding-bottom: 8px;
        box-shadow: 0 8px 12px -8px rgba(0, 0, 0, 0.3);
    }
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 500;
    color: #7f8c8d;
}

.control-group input[type="range"] {
    width: 100px;
}

.control-group select {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

/* Cutting Sequence Toggle */
.cutting-sequence-toggle {
    margin-top: 20px;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.cutting-sequence-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #333;
}

.cutting-sequence-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Ray Traced mode: the sequence stepper is a wireframe/solid-only feature. */
.cutting-sequence-toggle.seq-disabled {
    opacity: 0.5;
}
.cutting-sequence-toggle.seq-disabled label,
.cutting-sequence-toggle.seq-disabled input[type="checkbox"] {
    cursor: not-allowed;
}

/* Cutting Sequence Controls */
.cutting-sequence-controls {
    margin-top: 10px;
    padding: 15px;
    background: #f0f4f8;
    border-radius: 8px;
    border: 1px solid #d0d8e0;
}

.step-mode-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.step-mode-selector label {
    font-weight: 500;
    color: #555;
}

.step-mode-btn {
    padding: 6px 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.step-mode-btn:hover {
    border-color: #4a90d9;
    color: #4a90d9;
}

.step-mode-btn.active {
    background: #4a90d9;
    color: white;
    border-color: #4a90d9;
}

.cutting-sequence-controls > label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.cutting-sequence-controls > label span {
    font-weight: 700;
    color: #4a90d9;
}

.sequence-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sequence-slider-row input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
}

.sequence-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a90d9;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.sequence-slider-row input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a90d9;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.tier-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 16px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tier-btn:hover {
    background: #f0f0f0;
    border-color: #4a90d9;
    color: #4a90d9;
}

.tier-btn:active {
    background: #e0e0e0;
}

.sequence-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: #666;
}

.sequence-info #tier-progress {
    font-weight: 500;
}

.highlight-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.highlight-toggle input {
    cursor: pointer;
}

/* Export Section */
.export-options-group {
    display: flex;
    gap: 40px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.export-option-section h4 {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 8px;
}

.export-options {
    display: flex;
    gap: 20px;
}

.export-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.export-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.export-buttons .btn {
    padding: 12px 25px;
    font-size: 1rem;
}

.btn-secondary {
    background: #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
}

/* Load New File Button */
.load-new-file {
    margin-bottom: 20px;
    text-align: right;
}

.load-new-file .btn {
    padding: 8px 16px;
    font-size: 0.9rem;
}


/* Manual mode preview panel */
.manual-preview-row {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.manual-preview-row .canvas-grid {
    flex: 1 1 420px;
}

.canvas-grid.canvas-grid-2x2 {
    /* Pack the columns to content width and center them, so the views sit
       close together instead of spreading across the whole panel. */
    grid-template-columns: repeat(2, max-content);
    justify-content: center;
    gap: 12px 32px;
}

/* Main 2D preview: one row of four when there is room, falling back to
   2x2 (then a single column) as the screen narrows. The manual preview
   keeps the 2x2 above. Canvases trimmed a touch for compactness
   (internal resolution unchanged; only display size shrinks). */
#preview-panel .canvas-grid {
    grid-template-columns: repeat(4, max-content);
}

#preview-panel .canvas-container canvas {
    width: 210px;
    height: 210px;
}

.manual-canvas-3d {
    flex: 0 0 auto;
}

.manual-preview-status {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fef9e7;
    border-left: 4px solid #f39c12;
    border-radius: 4px;
    color: #7d6608;
    font-size: 0.9rem;
}

/* Ray-traced render mode panel — three labeled groups:
   Material | Lighting | View */
.raytrace-panel {
    /* Two independent columns: LEFT = Material + View stacked (View sits
       directly under Material with no gap), RIGHT = Lighting. Flex
       columns (not a grid) so the short left stack does not get pushed
       down by the taller Lighting column. Wraps to one column when the
       inspector is narrow. */
    display: flex;
    flex-wrap: wrap;
    gap: 10px 24px;
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid #e4e9f0;
    border-radius: 6px;
    background: #fafbfd;
}

.rt-col {
    flex: 1 1 236px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.rt-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.rt-group h4 {
    margin: 0 0 4px 0;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #8492a6;
    border-bottom: 1px solid #e4e9f0;
    padding-bottom: 4px;
}

.rt-row {
    display: grid;
    grid-template-columns: 64px 1fr;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #34495e;
}

.rt-row label {
    margin: 0;
    color: #5a6371;
    font-size: 0.83rem;
    user-select: none;
}

.rt-row select {
    font-size: 0.83rem;
    padding: 3px 6px;
    border: 1px solid #cbd2db;
    border-radius: 4px;
    background: #fff;
    color: #34495e;
    width: 100%;
    min-width: 0;
}

.rt-row input[type="color"] {
    width: 44px;
    height: 26px;
    border: 1px solid #cbd2db;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
}

.rt-checks {
    grid-template-columns: 1fr;
}

.raytrace-edges-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: #34495e;
    margin-right: 12px;
    cursor: pointer;
}

.raytrace-edges-label input {
    margin: 0;
}

/* Buttons WRAP to fit the column instead of being crushed into a
   2-cell grid (labels "Render HQ", "Record Spin" were clipped). Each
   button sizes to its label; the status line drops below on its own. */
.rt-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
}

.rt-footer .rt-reset-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.raytrace-status {
    flex-basis: 100%;
    font-size: 0.8rem;
    color: #5d6d7e;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rt-param {
    display: grid;
    /* Narrower label + value columns so the SLIDER itself is longer
       (user report: sliders too short). */
    grid-template-columns: 64px 1fr 30px;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #34495e;
}

/* A dropdown sitting in an .rt-param row (e.g. Scope) has no value
   readout, so let it span the slider + value columns and show its full
   option text ("Off (beauty render)" was clipped). */
.rt-param > select {
    grid-column: 2 / 4;
    width: 100%;
    min-width: 0;
    font-size: 0.83rem;
    padding: 3px 6px;
    border: 1px solid #cbd2db;
    border-radius: 4px;
    background: #fff;
    color: #34495e;
}

.rt-param label {
    margin: 0;
    color: #5a6371;
    font-size: 0.83rem;
    user-select: none;
}

.rt-param input[type="range"] {
    width: 100%;
    margin: 0;
    min-width: 0;
}

.rt-param-value {
    font-family: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", monospace;
    font-size: 0.78rem;
    color: #7a8392;
    text-align: right;
}

.rt-group.rt-dimmed {
    opacity: 0.4;
    pointer-events: none;
}

.rt-scope-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 2px;
    font-size: 0.76rem;
    color: #5a6371;
}

.rt-scope-legend .rt-scope-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.rt-scope-legend .rt-scope-swatch {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    flex: 0 0 auto;
}

.rt-reset-btn {
    padding: 4px 12px;
    font-size: 0.78rem;
    background: #fff;
    border: 1px solid #cbd2db;
    border-radius: 4px;
    cursor: pointer;
    color: #5a6371;
    height: 26px;
}

.rt-reset-btn:hover {
    background: #f3f6fa;
    border-color: #a8b3c1;
}

@media (max-width: 1024px) {
    /* Force a single column: each group full width, stacked. */
    .rt-col {
        flex: 1 1 100%;
    }
}

/* Critical-angle warnings on pavilion tier angles */
.cutting-chart td.angle-window {
    background: #fadbd8;
    color: #922b21;
    font-weight: 600;
}

.cutting-chart td.angle-near-critical {
    background: #fdebd0;
    color: #7d6608;
}

.cutting-chart td.angle-window .angle-input,
.cutting-chart td.angle-near-critical .angle-input {
    background: transparent;
    color: inherit;
    font-weight: inherit;
}

.form-readout {
    display: inline-block;
    padding: 6px 0;
    color: #34495e;
    font-weight: 500;
}

/* ISO Brightness panel */
.panel-help {
    margin: 0 0 12px 0;
    color: #5d6d7e;
    font-size: 0.85rem;
    line-height: 1.4;
}

.brightness-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.brightness-controls .control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brightness-controls .control-group label {
    font-size: 0.85rem;
    color: #34495e;
    font-weight: 500;
}

.brightness-controls .control-group select,
.brightness-controls .control-group input[type="number"] {
    padding: 6px 10px;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 140px;
}

.brightness-result {
    margin-top: 16px;
    padding: 14px 16px;
    background: #eaf2f8;
    border-left: 4px solid #2980b9;
    border-radius: 4px;
    color: #1b4f72;
}

.brightness-result.error {
    background: #fdecea;
    border-left-color: #c0392b;
    color: #922b21;
}

.brightness-result.running {
    background: #fef9e7;
    border-left-color: #f39c12;
    color: #7d6608;
}

.brightness-result .brightness-headline {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.brightness-result .brightness-detail {
    font-size: 0.85rem;
    color: #34495e;
}

.brightness-heatmap-wrap {
    margin-top: 16px;
}

.brightness-heatmap-wrap h3 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    color: #34495e;
}

.brightness-heatmap-wrap canvas {
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    display: block;
    background: #1a1a2e;
    image-rendering: pixelated;
}

.brightness-heatmap-legend {
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: #5d6d7e;
}

/* Side-by-side heat map + tilt chart */
.brightness-visuals {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 16px;
    align-items: flex-start;
}

.brightness-visuals > div {
    margin-top: 0;
    /* Let each block shrink so a long status line wraps instead of
       widening the block and bumping the plot onto its own row. */
    min-width: 0;
}

/* Tilt sweep chart */
.brightness-tilt-wrap h3 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    color: #34495e;
}

.brightness-tilt-wrap canvas {
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    display: block;
    background: #fdfefe;
}

.brightness-tilt-status {
    margin-top: 6px;
    font-size: 0.8rem;
    color: #5d6d7e;
    min-height: 1.2em;
    /* A long band-sweep summary must not widen the tilt block (which
       would bump the plot below the heat map). width:0 + min-width:100%
       takes the chart's width without contributing to the block's
       content width, so the text wraps to the chart instead. */
    width: 0;
    min-width: 100%;
    overflow-wrap: anywhere;
}

.tilt-metric-toggles {
    margin-top: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    font-size: 0.85rem;
}

.metric-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.metric-toggle input[type="checkbox"] {
    margin: 0;
}

.metric-swatch {
    display: inline-block;
    width: 14px;
    height: 3px;
    border-radius: 2px;
    background: #999;
}

.metric-iso .metric-swatch { background: #2c3e50; }
.metric-cos .metric-swatch { background: #d4ac0d; }
.metric-window .metric-swatch { background: #d35400; }
.metric-table .metric-swatch { background: #7d3c98; }

.brightness-heatmap-gradient {
    flex: 0 0 140px;
    height: 10px;
    border-radius: 2px;
    background: linear-gradient(to right,
        #1a1a2e 0%,
        #2c2a5b 15%,
        #4b3a8a 30%,
        #7e3f8c 45%,
        #c8527d 60%,
        #f08550 75%,
        #f7c95a 90%,
        #faf3a4 100%
    );
    border: 1px solid #34495e;
}

/* Manual Entry Zone */
#manual-entry-zone {
    border: 3px dashed #95a5a6;
    border-radius: 10px;
    padding: 25px 20px;
    text-align: center;
    margin-top: 20px;
    transition: all 0.3s ease;
}

#manual-entry-zone:hover {
    border-color: #7f8c8d;
    background-color: #f8f9fa;
}

#manual-entry-zone p {
    margin: 0 0 12px 0;
    color: #7f8c8d;
}

/* Manual Info Form */
.manual-info-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-row label {
    min-width: 120px;
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

.form-row input[type="text"],
.form-row input[type="date"],
.form-row input[type="number"] {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    max-width: 300px;
}

.form-row input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.form-row input[readonly] {
    background: #f0f0f0;
    color: #666;
    cursor: default;
}

.form-row-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* Chart section controls */
.chart-section {
    margin-bottom: 20px;
}

.chart-section h3 {
    font-size: 1rem;
    color: #2c3e50;
    margin: 0;
}

.chart-section-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.section-header-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-section-move {
    width: 24px;
    height: 24px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.btn-section-move:hover:not(:disabled) {
    border-color: #3498db;
    color: #3498db;
}

.btn-section-move:disabled {
    opacity: 0.3;
    cursor: default;
}

.btn-small {
    padding: 4px 12px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s ease;
}

.btn-small:hover {
    background: #2980b9;
}

/* Chart table headers (editor charts share the manual chart's style) */
.manual-chart th,
.cutting-chart th {
    padding: 6px 12px;
    text-align: left;
    background: #f8f9fa;
    color: #7f8c8d;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #ddd;
}

/* Angle input */
.angle-input {
    width: 80px;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.angle-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Index input group */
.index-input-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.index-input {
    flex: 1;
    min-width: 120px;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.index-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

/* Fill Sym button */
.btn-sym {
    padding: 4px 8px;
    border: 1px solid #2980b9;
    border-radius: 3px;
    background: #eaf2f8;
    color: #2980b9;
    cursor: pointer;
    font-size: 0.8rem;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-sym:hover {
    background: #2980b9;
    color: white;
}

/* Computed index display */
.index-computed {
    display: block;
    font-size: 0.8rem;
    color: #7f8c8d;
    margin-top: 4px;
    word-break: break-word;
}

.index-error {
    color: #e74c3c;
}

/* Tier action buttons */
.tier-actions {
    display: flex;
    gap: 4px;
    white-space: nowrap;
}

.btn-tier-action {
    width: 28px;
    height: 28px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-tier-action:hover:not(:disabled) {
    border-color: #3498db;
    color: #3498db;
}

.btn-tier-action:disabled {
    opacity: 0.3;
    cursor: default;
}

.btn-delete:hover:not(:disabled) {
    border-color: #e74c3c;
    color: #e74c3c;
    background: #fdf0ef;
}

/* Table toggle */
.table-toggle {
    margin-top: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.table-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    color: #7f8c8d;
    font-size: 0.9rem;
}

footer a {
    color: #3498db;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive */

/* Main 2D preview: drop the one-row layout to 2x2 when four no longer
   fit, then to a single column on the narrowest screens. */
@media (max-width: 1040px) {
    #preview-panel .canvas-grid {
        grid-template-columns: repeat(2, max-content);
    }
}

@media (max-width: 560px) {
    #preview-panel .canvas-grid {
        grid-template-columns: max-content;
    }
}

@media (max-width: 768px) {
    .canvas-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .canvas-container canvas {
        width: 150px;
        height: 150px;
    }
}

@media (max-width: 480px) {
    .canvas-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 1.4rem;
    }
}


/* Cutting Sheet Export modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

/* The render-scene export dialog can be opened FROM the HQ Studio
   (z-index 2000), so it must sit above it. */
#pov-export-modal {
    z-index: 2100;
}

.modal-box {
    background: white;
    border-radius: 8px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    padding: 20px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-box h3 {
    color: #2c3e50;
    font-size: 1.1rem;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #3498db;
}

.modal-columns {
    display: flex;
    gap: 15px;
}

.modal-group {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 12px 12px;
    min-width: 0;
}

.modal-group legend {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c3e50;
    padding: 0 5px;
}

.modal-check {
    display: block;
    font-size: 0.85rem;
    margin: 6px 0;
    cursor: pointer;
}

.modal-check input {
    margin-right: 6px;
}

.modal-check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0 12px;
}

.modal-check-row .modal-check {
    margin: 2px 0;
}

.modal-sublabel {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-top: 8px;
}

#cs-diagram-options {
    margin: 0 0 4px 22px;
}

.modal-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
    font-size: 0.85rem;
}

.modal-row label {
    min-width: 85px;
    color: #555;
}

.modal-row select,
.modal-row input[type="text"] {
    flex: 1;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    min-width: 0;
}

.modal-row input[type="text"]:disabled {
    background: #f5f5f5;
    color: #999;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
}

@media (max-width: 640px) {
    .modal-columns {
        flex-direction: column;
    }
}

/* Edited-design banner */
.edited-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 10px;
    padding: 6px 10px;
    background: #fdf3dc;
    border: 1px solid #e8cf96;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #7a5c14;
}

.edited-badge {
    background: #e67e22;
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 10px;
}

.edited-banner .rt-reset-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.edit-shortcut-hint {
    font-size: 0.72rem;
    color: #a08a4f;
    white-space: nowrap;
}

/* Tangent-ratio dialog */
.tr-controls {
    margin-bottom: 10px;
}

.tr-note {
    font-size: 0.78rem;
    color: #7f8c8d;
    white-space: nowrap;
}

.tr-preview-wrap {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.tr-preview {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.tr-preview th,
.tr-preview td {
    padding: 4px 10px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.tr-preview th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    color: #555;
    font-weight: 600;
}

.tr-preview tr.tr-window td {
    background: #fadbd8;
}

.tr-preview tr.tr-near td {
    background: #fdf3dc;
}

.tr-warning {
    margin-top: 8px;
    padding: 6px 10px;
    background: #fadbd8;
    border-radius: 5px;
    color: #922b21;
    font-size: 0.85rem;
}

/* Chart options row: tools laid out inline, tangent-ratio pushed to the
   far right and styled quiet so it does not compete with the chart. */
#chart-panel .chart-options {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

#tangent-ratio-btn {
    margin-left: auto;
    padding: 5px 12px;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #777;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#tangent-ratio-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

/* Heat map subtitle (R.I. + ISO % label on each map) */
.hm-sub {
    font-weight: 400;
    color: #7f8c8d;
    font-size: 0.8rem;
    margin-left: 6px;
}

/* Conversion note shown directly above the cutting chart */
.chart-edit-note {
    margin: 0 0 12px;
    padding: 6px 10px;
    background: #fdf3dc;
    border-left: 3px solid #e67e22;
    border-radius: 4px;
    font-size: 0.88rem;
    color: #7a5c14;
}

/* One-line editability hint above the editor cutting chart */
.chart-edit-hint {
    margin: 0 0 6px;
    font-size: 0.78rem;
    color: #7f8c8d;
}

/* Chart row flashed by a 3D facet pick (fades back to normal) */
@keyframes chart-row-flash {
    0% { background-color: #f9e79f; }
    100% { background-color: transparent; }
}

.cutting-chart tr.chart-row-flash td {
    animation: chart-row-flash 1.6s ease-out;
}

/* Same flash on a builder cut-list row (click a facet in the builder's
   3D preview to select its tier). */
li.builder-step.chart-row-flash {
    animation: chart-row-flash 1.6s ease-out;
}

/* "Index labels" toggle on the 2D preview panel */
.diagram-labels-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: -6px 0 8px;
    font-size: 0.8rem;
    color: #7f8c8d;
    cursor: pointer;
}

/* Angle optimizer legend */
.optimize-legend {
    font-size: 0.75rem;
    color: #7f8c8d;
    margin: 4px 0;
}

#brightness-optimize-apply {
    margin-top: 6px;
    font-size: 0.9rem;
    padding: 6px 14px;
}

/* Editable chart cells (angle / index inputs in editor mode). The faint
   dashed underline is a persistent "this is editable" affordance — the
   old transparent border read as static text until hovered. */
.cell-edit-input {
    border: 1px solid transparent;
    border-bottom: 1px dashed #b9c9d4;
    border-radius: 4px;
    background: transparent;
    font: inherit;
    color: inherit;
    padding: 4px 6px;
    width: 100%;
}

.cell-edit-input.angle-edit {
    width: 90px;
}

.cell-edit-input:hover {
    border-color: #d5dbe0;
    border-bottom-color: #7fa8c9;
}

.cell-edit-input:focus {
    outline: none;
    border-color: #3498db;
    border-bottom-style: solid;
    background: white;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

.cell-edit-input.cell-error {
    border-color: #c0392b;
    background: #fdecea;
}

#gear-convert-btn {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #777;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#gear-convert-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

/* View snap buttons */
.rt-snap-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.rt-snap-btn {
    padding: 3px 8px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #5a6371;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rt-snap-btn:hover {
    border-color: #3498db;
    color: #3498db;
}

/* Optimizer before/after comparison grid */
.optimize-compare {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 10px 14px;
    margin-top: 12px;
    justify-content: start;
}

.oc-cell h4 {
    font-size: 0.78rem;
    font-weight: 600;
    color: #5a6371;
    margin: 0 0 4px;
}

.oc-cell canvas {
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #1a1a2e;
    display: block;
}

/* Meet-point validator line (info panel) */
.meetpoint-status {
    margin: 10px 0 0;
    font-size: 12px;
}

.meetpoint-status.ok {
    color: #27ae60;
}

.meetpoint-status.warn {
    color: #d35400;
    font-weight: 600;
}

/* Design library */
#library-zone {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

#library-zone p {
    margin: 0 0 10px;
    color: #7f8c8d;
}

.library-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.library-header h2 {
    margin: 0;
    flex: 0 0 auto;
}

.library-header input[type="search"] {
    flex: 1;
    max-width: 320px;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.library-list {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.library-card {
    width: 200px;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.library-card img {
    width: 180px;
    height: 180px;
    border-radius: 4px;
    background: #1a1a2e;
    align-self: center;
}

.library-card-title {
    font-weight: 600;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.library-card-meta {
    font-size: 11px;
    color: #7f8c8d;
    min-height: 14px;
}

.library-card-actions {
    display: flex;
    gap: 6px;
}

.library-card-actions .btn {
    padding: 4px 12px;
    font-size: 12px;
}

.library-empty {
    color: #7f8c8d;
}

/* Width (mm) / density inputs + real-dimension table under Size Data */
.size-mm-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 10px 0 6px;
    flex-wrap: wrap;
}

.size-mm-controls label {
    font-size: 0.8rem;
    color: #7f8c8d;
    white-space: nowrap;
}

.size-mm-controls input {
    width: 70px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85rem;
}

.size-mm-controls input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}

.size-mm-note {
    margin: 4px 0 0;
    font-size: 0.72rem;
    color: #95a5a6;
}

/* Help system */
header {
    position: relative;
}

.help-btn {
    position: absolute;
    top: 14px;
    right: 18px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.7);
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
}

.help-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #fff;
    color: #fff;
}

.panel {
    position: relative;
}

.help-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid #c5ccd3;
    background: #fff;
    color: #8a949e;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
    z-index: 2;
}

.help-icon:hover {
    border-color: #3498db;
    color: #3498db;
}

/* Per-graph help: a small "?" anchored to the top-right corner of a plot.
   Reuses .help-icon's look/wiring; .graph-wrap is the positioning parent.
   inline-block so the wrap hugs the canvas and the icon lands on the
   plot's own corner (not the panel edge) for fixed-size charts. */
.graph-wrap {
    position: relative;
    display: inline-block;
    vertical-align: top;
    max-width: 100%;
}

/* The Compare tilt chart fills its container (width:100%), so its wrap
   must be a full-width block for the canvas to span both heat maps. */
.compare-tilt-wrap .graph-wrap {
    display: block;
}

.graph-help-icon {
    top: 6px;
    right: 6px;
    z-index: 3;
}

.help-box {
    max-width: 680px;
    width: 92%;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
}

.help-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.help-titlebar h3 {
    margin: 0;
}

.help-close {
    border: none;
    background: none;
    font-size: 22px;
    color: #7f8c8d;
    cursor: pointer;
    padding: 0 4px;
}

.help-close:hover {
    color: #2c3e50;
}

.help-content {
    position: relative;
    overflow-y: auto;
    margin-top: 10px;
    padding-right: 8px;
    scroll-behavior: smooth;
}

.help-content section {
    margin-bottom: 16px;
}

.help-content h4 {
    margin: 0 0 6px;
    color: #2c3e50;
    border-bottom: 1px solid #ecf0f1;
    padding-bottom: 3px;
}

.help-content p,
.help-content li {
    font-size: 13px;
    line-height: 1.5;
    color: #444;
}

.help-content p {
    margin: 0 0 6px;
}

.help-content ul {
    margin: 0;
    padding-left: 18px;
}

.help-content li {
    margin-bottom: 4px;
}

/* Compare mode */
#compare-zone {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

#compare-zone p {
    margin: 0 0 10px;
    color: #7f8c8d;
}

.compare-columns {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.compare-columns > * {
    flex: 1 1 0;
    min-width: 280px;
    max-width: 460px;
}

.compare-columns canvas {
    width: 100%;
    max-width: 400px;
    /* Both the 3D/ray canvases and the heat maps are 380x380; force a
       square display box so a heat map is exactly the size of the render
       above it (without this the 3D canvas keeps its 380px attribute
       height while the heat map goes height:auto, and they mismatch). */
    aspect-ratio: 1 / 1;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #1a1a2e;
    cursor: grab;
}

/* The ISO visuals (two heat maps + the tilt chart) share one centered
   container capped at the two-heat-map width (two 400px canvases + the
   16px gap), so the chart spans exactly the width the heat maps take. */
.compare-iso-visuals {
    max-width: 816px;
    margin: 0 auto;
}

/* Render row and heat-map row share the same capped, centered width so
   each heat map sits directly under its render at the same size. */
.compare-pair-row,
.compare-heat-row {
    max-width: 816px;
    margin-left: auto;
    margin-right: auto;
    justify-content: space-between;
}

/* Compare tilt chart: centered below the two heat maps, filling the
   shared container so it is exactly as wide as the two heat maps. */
.compare-tilt-wrap {
    text-align: center;
    margin-top: 16px;
}

.compare-tilt-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.compare-tilt-head h3 {
    margin: 0;
}

.compare-tilt-wrap canvas {
    width: 100%;
    max-width: 100%;
    /* Backing store is set to the displayed size x devicePixelRatio in
       _drawTilt, so the line chart stays crisp on HiDPI screens. */
    aspect-ratio: 8 / 3;
    height: auto;
    margin: 0 auto;
}

.compare-tilt-wrap .brightness-tilt-status {
    text-align: center;
}

.compare-head h3 {
    margin: 0 0 4px;
}

.compare-meta {
    margin: 0 0 8px;
    font-size: 12px;
    color: #7f8c8d;
    min-height: 16px;
}

.compare-result {
    text-align: center;
}

.rt-snap-btn-style {
    padding: 3px 8px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.rt-snap-btn-style:hover {
    border-color: #3498db;
    color: #3498db;
}

#compare-heat-wrap-a,
#compare-heat-wrap-b {
    text-align: center;
}

/* Upload page action cards (replaces the stacked zones) */
.upload-actions {
    display: flex;
    gap: 14px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.upload-action {
    flex: 1 1 0;
    min-width: 200px;
    border: 1px solid #e4e8eb;
    border-radius: 8px;
    padding: 14px 12px;
    background: #fafbfc;
    text-align: center;
}

.upload-action h3 {
    margin: 0 0 4px;
    font-size: 14px;
    color: #2c3e50;
}

.upload-action p {
    margin: 0 0 10px;
    font-size: 12px;
    color: #7f8c8d;
}

.upload-action-btns {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

/* "...or try a sample design" link inside the drop zone */
.sample-link-row {
    font-size: 0.88rem;
}

.sample-link-row a {
    color: #3498db;
    text-decoration: underline dotted;
}

.sample-link-row a:hover {
    color: #2980b9;
    text-decoration-style: solid;
}

/* Recent designs row on the landing page */
.recent-designs {
    margin-top: 18px;
}

.recent-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.recent-head h3 {
    margin: 0 0 8px;
    font-size: 14px;
    color: #2c3e50;
}

.recent-clear {
    background: none;
    border: none;
    padding: 0;
    font-size: 11px;
    color: #95a5a6;
    cursor: pointer;
    text-decoration: underline;
}

.recent-clear:hover {
    color: #7f8c8d;
}

.recent-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.recent-card {
    width: 128px;
    border: 1px solid #e4e8eb;
    border-radius: 6px;
    padding: 8px;
    background: #fafbfc;
    display: flex;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.recent-card:hover {
    border-color: #3498db;
    background: #f2f8fd;
}

.recent-card img {
    width: 112px;
    height: 112px;
    border-radius: 4px;
    background: #1a1a2e;
    align-self: center;
}

.recent-card-name {
    font-weight: 600;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-card-when {
    font-size: 11px;
    color: #7f8c8d;
}

/* Stop button for long analysis runs */
.btn-stop {
    background: #fdecea;
    border-color: #e74c3c;
    color: #c0392b;
}

.btn-stop:hover {
    background: #e74c3c;
    color: #fff;
}

/* Breathing room between the compare RT control rows */
#compare-rt-sliders {
    margin-top: 12px;
}

/* Responsive pass: canvases never overflow their panel (internal pixel
   resolution unchanged; only the displayed size scales). */
.preview-3d-container canvas,
#optimize-compare canvas,
.brightness-heatmap-wrap canvas,
.brightness-tilt-wrap canvas,
.help-content img {
    max-width: 100%;
    height: auto;
}

@media (max-width: 900px) {
    .library-header {
        flex-wrap: wrap;
    }

    .load-new-file {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .compare-columns {
        gap: 12px;
    }

    .chart-options {
        flex-wrap: wrap;
        gap: 10px;
    }
}

/* Meet-point info tier: tiny gaps, deliberately calm styling */
.meetpoint-status.info {
    color: #7f8c8d;
}

/* Optimizer "Try angle" slider */
.optimize-try {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.optimize-try label {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
}

.optimize-try input[type="range"] {
    flex: 1;
    min-width: 160px;
    max-width: 320px;
}

.optimize-try-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #27ae60;
    min-width: 44px;
}

.optimize-try-readout {
    font-size: 12px;
    color: #7f8c8d;
}

/* Optimizer pavilion/crown blocks (dual-graph explorer) */
.opt-block {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eef1f3;
}

/* Optimizer pavilion-chart + tilt-chart side by side */
.opt-chart-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.opt-chart-cell {
    flex: 1 1 380px;
    min-width: 300px;
}

.opt-chart-cell canvas {
    width: 100%;
    height: auto;
}

/* Both chart headings get the same fixed height so the canvases below
   them top-align even when the pavilion heading carries an "at R.I."
   subtitle that the tilt heading does not. */
.opt-chart-cell > h3,
.opt-tilt-head {
    min-height: 34px;
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.opt-tilt-head h3 {
    margin: 0;
    min-height: 0;
}

/* Brightness action buttons on their own row below the settings */
.brightness-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

/* Live "your settings" render control bar (rotation, snap, spin) */
.optimize-live-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #eef1f3;
    font-size: 12px;
}

.optimize-live-controls .oc-live-title {
    font-weight: 600;
    color: #2c3e50;
}

.optimize-live-controls input[type="range"] {
    width: 90px;
}

.optimize-live-controls .oc-live-hint {
    color: #7f8c8d;
}

/* ---- Optimizer comparison: clickable thumbnails + enlarge modal ---- */
.oc-thumb {
    cursor: zoom-in;
    transition: outline 0.12s ease;
    outline: 2px solid transparent;
}

.oc-thumb:hover {
    outline: 2px solid #3498db;
}

.oc-thumb-hint {
    grid-column: 1 / -1;
    margin-top: 4px;
    font-size: 12px;
    color: #7f8c8d;
    text-align: center;
}

.oc-modal-box {
    max-width: 860px;
}

.oc-modal-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.oc-modal-titlebar h3 {
    margin: 0;
    border: none;
    padding: 0;
}

.oc-modal-stage {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: nowrap;
    margin: 14px 0;
}

/* Each cell takes half the stage so the two canvases always sit side by
   side and shrink to fit (min-width:0 lets them go below intrinsic size). */
.oc-modal-cell {
    text-align: center;
    flex: 1 1 0;
    min-width: 0;
}

.oc-modal-cell h4 {
    margin: 0 0 6px;
    font-size: 0.9rem;
    color: #34495e;
}

.oc-modal-cell canvas {
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    background: #1a1a2e;
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
}

.oc-modal-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    border-top: 1px solid #eef1f3;
    padding-top: 12px;
}

#oc-modal-live-controls {
    align-items: flex-start;
}

#oc-modal-live-controls .rt-group {
    flex: 1 1 220px;
    min-width: 200px;
}

/* ==================== Design Builder ==================== */

.builder-top-row {
    display: flex;
    flex-wrap: wrap;
    gap: 28px;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 16px;
}

.builder-3d-col {
    flex: 0 0 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.builder-add-sep { flex: 0 0 12px; }

.builder-steps-col {
    width: 100%;
}

.builder-wheel-col {
    flex: 0 0 360px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.builder-col-head {
    font-size: 12px;
    font-weight: 600;
    color: #7f8c9b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.builder-step-list {
    list-style: none;
    margin: 0 0 10px 0;
    padding: 0;
    border: 1px solid #e3e8ee;
    border-radius: 6px;
    max-height: 420px;
    overflow-y: auto;
}

.builder-step {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 8px;
    border-bottom: 1px solid #eef1f3;
    cursor: pointer;
    background: #fff;
}

.builder-step:last-child { border-bottom: none; }
.builder-step:hover { background: #f4f8fc; }

.builder-step-selected,
.builder-step-selected:hover {
    background: #eaf3fb;
    box-shadow: inset 3px 0 0 #3498db;
}

.builder-step-status {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex: 0 0 auto;
}
.builder-step-status-ok { background: #2ecc71; }
.builder-step-status-warn { background: #f39c12; }
.builder-step-status-err { background: #e74c3c; }

.builder-step-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    flex: 0 0 auto;
}

.builder-step-name {
    font-weight: 600;
    font-size: 13px;
    color: #2c3e50;
    min-width: 26px;
}

.builder-step-fixed-angle {
    font-size: 13px;
    color: #7f8c9b;
    min-width: 58px;
    text-align: right;
}

.builder-step-angle {
    width: 62px;
    padding: 3px 4px;
    font-size: 13px;
    border: 1px solid #cfd8e0;
    border-radius: 4px;
    text-align: right;
}

.builder-step-mode {
    font-size: 12px;
    padding: 3px 2px;
    border: 1px solid #cfd8e0;
    border-radius: 4px;
    background: #fff;
}

.builder-step-depth-val {
    font-family: 'Consolas', 'Menlo', monospace;
    font-size: 12px;
    color: #566573;
    min-width: 44px;
}

.builder-step-tw {
    width: 58px;
    padding: 3px 4px;
    font-size: 13px;
    border: 1px solid #cfd8e0;
    border-radius: 4px;
    text-align: right;
}

.builder-step-spacer { flex: 1 1 auto; }

.builder-step-del { color: #c0392b; }

.builder-add-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.builder-add-row .btn-small:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#index-wheel-canvas {
    touch-action: none;
    cursor: pointer;
}

.builder-wheel-readout {
    font-family: 'Consolas', 'Menlo', monospace;
    font-size: 12px;
    color: #566573;
    text-align: center;
    min-height: 16px;
    max-width: 340px;
    word-break: break-all;
}

.builder-check {
    font-size: 13px;
    color: #34495e;
    display: flex;
    align-items: center;
    gap: 6px;
}

.builder-index-text {
    width: 300px;
    padding: 5px 8px;
    font-family: 'Consolas', 'Menlo', monospace;
    font-size: 12px;
    border: 1px solid #cfd8e0;
    border-radius: 4px;
}

.builder-index-text.cell-error {
    border-color: #e74c3c;
    background: #fdeaea;
}

.builder-status {
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 5px;
    margin-bottom: 12px;
    background: #eef7ee;
    color: #27632a;
}

.builder-status-warn {
    background: #fdf3e3;
    color: #9c6410;
    border: 1px solid #f5d9a8;
}

.builder-footer {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 880px) {
    .builder-wheel-col { flex: 1 1 100%; }
}

/* Builder embedded 3D preview + per-tier symmetry controls */

.builder-3d-label {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #7f8c9b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

#builder-canvas-3d {
    border: 1px solid #bdc3c7;
    border-radius: 6px;
    background: #1a1a2e;
    cursor: grab;
}

#builder-canvas-3d:active { cursor: grabbing; }

.builder-3d-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.builder-3d-controls select {
    font-size: 12px;
    padding: 3px 4px;
    border: 1px solid #cfd8e0;
    border-radius: 4px;
    background: #fff;
}

.builder-3d-hint {
    font-size: 11px;
    color: #95a1ad;
}

.builder-tier-sym {
    display: flex;
    flex-wrap: nowrap;
    white-space: nowrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.builder-tier-sym input[type="number"] {
    width: 40px;
    padding: 3px 4px;
    font-size: 13px;
    border: 1px solid #cfd8e0;
    border-radius: 4px;
    text-align: right;
}


.builder-wheel-preview {
    font-family: 'Consolas', 'Menlo', monospace;
    font-size: 12px;
    font-style: italic;
    color: #98a4b0;
    text-align: center;
    min-height: 16px;
    max-width: 340px;
    word-break: break-all;
}

/* Builder depth fine/coarse controls + meet-point picking */

.builder-step-depth {
    flex: 1 1 200px;
    min-width: 140px;
    max-width: 480px;
}

.builder-step-depth-num {
    width: 62px;
    padding: 3px 2px;
    font-size: 12px;
    font-family: 'Consolas', 'Menlo', monospace;
    border: 1px solid #cfd8e0;
    border-radius: 4px;
    text-align: right;
}

.builder-depth-btn {
    width: 20px;
    height: 22px;
    padding: 0;
    font-size: 12px;
    line-height: 1;
    border: 1px solid #cfd8e0;
    border-radius: 4px;
    background: #f4f6f9;
    color: #4a5568;
    cursor: pointer;
}

.builder-depth-btn:hover { background: #e4ecf5; }

.builder-pick-active,
.builder-pick-active:hover {
    background: #e67e22 !important;
}

.builder-group-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #eef2f7;
    font-size: 12px;
    font-weight: 700;
    color: #46525f;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    border-bottom: 1px solid #e0e6ec;
    user-select: none;
}

.builder-group-head:hover { background: #e4ebf3; }

.builder-group-arrow { color: #7f8c9b; font-size: 11px; }

.builder-group-count {
    color: #8b97a3;
    font-weight: 400;
    text-transform: none;
}

/* Builder outline controls + girdle note + middle-click pick */

.builder-col-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.builder-outline-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    text-transform: none;
    letter-spacing: normal;
}

.builder-outline-controls input[type="number"] {
    width: 56px;
    padding: 3px 4px;
    font-size: 12px;
    border: 1px solid #cfd8e0;
    border-radius: 4px;
    text-align: right;
}

.builder-outline-controls input[type="number"]:disabled {
    background: #f0f2f5;
    color: #a6afb8;
}

.builder-step-depth-note {
    font-size: 11px;
    font-style: italic;
    color: #98a4b0;
    cursor: help;
}

/* Edit Info button + builder critical-angle tint */

.info-edit-btn {
    position: absolute;
    top: 10px;
    right: 40px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid #c5ccd3;
    border-radius: 10px;
    background: #fff;
    color: #6b7683;
    cursor: pointer;
}

.info-edit-btn:hover {
    background: #eaf3fb;
    color: #2f6ea5;
    border-color: #9fc3e0;
}

.builder-step-angle.angle-window {
    background: #fdecea;
    border-color: #e74c3c;
    color: #b03a2e;
}

.builder-step-angle.angle-near-critical {
    background: #fdf3e3;
    border-color: #f39c12;
    color: #9c6410;
}

/* High-quality render dialog */

/* HQ Render Studio: full-screen workspace — dark stage filling the
   viewport left of a fixed control rail. Replaces the old centered
   modal (S1 of PLAN_HQ_STUDIO.md). */
.hq-studio {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    background: #12141c;
}

.hq-studio-stage {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    padding: 18px;
}

.hq-studio-rail {
    background: #fff;
    border-left: 1px solid #dfe4ea;
    padding: 18px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.hq-studio-rail h3 {
    margin: 0 0 12px 0;
    color: #2c3e50;
}

.hq-studio-rail .hq-options {
    flex-direction: column;
    align-items: stretch;
}

.hq-studio-rail .hq-opt {
    justify-content: space-between;
}

.hq-studio-rail .hq-opt-check {
    justify-content: flex-start;
}

.hq-studio-rail .hq-opt select {
    min-width: 190px;
}

.hq-studio-rail .hq-progress-text {
    white-space: normal;
}

.hq-studio-actions {
    margin-top: auto;
    padding-top: 14px;
}

/* Studio rail groups (S2): collapsible sections; collapse state is
   persisted per group in localStorage. */
.hqs-group {
    border-top: 1px solid #eef1f5;
    padding-top: 8px;
    margin-bottom: 10px;
}

.hqs-group-head {
    margin: 0 0 8px 0;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #7f8c8d;
    cursor: pointer;
    user-select: none;
}

.hqs-group-head::before {
    content: '\25BE';
    display: inline-block;
    margin-right: 6px;
    transition: transform 0.15s;
}

.hqs-group.collapsed .hqs-group-head::before {
    transform: rotate(-90deg);
}

.hqs-group.collapsed .hqs-group-body {
    display: none;
}

.hq-studio-rail .rt-param {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.hq-studio-rail .rt-param label {
    flex: 0 0 82px;
    font-size: 12px;
    color: #566573;
}

.hq-studio-rail .rt-param input[type="range"] {
    flex: 1 1 auto;
    min-width: 0;
}

.hq-studio-rail .rt-param-value {
    flex: 0 0 40px;
    text-align: right;
    font-size: 12px;
    color: #566573;
}

.hqs-hint {
    font-size: 11px;
    color: #95a5a6;
    margin-top: 6px;
}

.hqs-copy-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 6px 0 8px 0;
}

.hqs-render-row {
    display: flex;
    gap: 8px;
    width: 100%;
    margin-bottom: 4px;
}

.hqs-render-row .btn {
    flex: 1 1 auto;
}

/* Back-to-editor view choice (replaces the browser confirm(), whose
   OK/Cancel labels fit neither answer). */
.hqs-confirm {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 12, 20, 0.55);
}

.hqs-confirm.hidden {
    display: none;
}

.hqs-confirm-box {
    background: #fff;
    border-radius: 8px;
    padding: 20px 24px;
    max-width: 420px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.hqs-confirm-box p {
    margin: 0 0 14px 0;
    color: #2c3e50;
}

.hqs-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

@media (max-width: 900px) {
    .hq-studio {
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
        overflow-y: auto;
    }
    .hq-studio-rail {
        border-left: none;
        border-top: 1px solid #dfe4ea;
        max-height: 45vh;
    }
}

#hq-preview {
    max-width: 100%;
    max-height: 100%;
    border: 1px solid #2a2f3d;
    border-radius: 6px;
    background: #1a1a2e;
}

.hq-progress-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.hq-progress-track {
    flex: 1 1 auto;
    height: 8px;
    border-radius: 4px;
    background: #e4e8ee;
    overflow: hidden;
}

.hq-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: #3498db;
    transition: width 0.2s linear;
}

.hq-progress-text {
    font-family: 'Consolas', 'Menlo', monospace;
    font-size: 12px;
    color: #566573;
    white-space: nowrap;
}

/* HQ dialog options: labeled controls that never collapse (the generic
   .modal-row flexes selects to zero width with this many controls). */

.hq-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 20px;
    margin: 4px 0 10px 0;
}

.hq-opt {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    color: #34495e;
    white-space: nowrap;
}

.hq-opt select {
    padding: 4px 6px;
    border: 1px solid #cfd8e0;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    max-width: 220px;
}

.hq-opt select:disabled,
.hq-opt input:disabled {
    opacity: 0.55;
}

.hq-opt-check {
    gap: 5px;
}

/* Meet-point status: hide/show affordance */

.meetpoint-status .mp-hide-link {
    margin-left: 10px;
    font-size: 11px;
    color: #8a949e;
    text-decoration: underline;
    cursor: pointer;
    white-space: nowrap;
}

.meetpoint-status .mp-hide-link:hover { color: #4a5560; }

.meetpoint-status.mp-collapsed {
    padding: 2px 8px;
    font-size: 11px;
    opacity: 0.75;
}

.meetpoint-status .mp-show-link {
    color: #6b7683;
    text-decoration: underline;
    cursor: pointer;
}

/* Long-press tooltip: touch fallback for title-attribute tooltips.
   One global element, positioned near the touch point by app.js. Sits
   above every modal (including the HQ studio and the export dialog at
   z-index 2100). pointer-events none so it never eats the touch. */
.touch-tooltip {
    position: fixed;
    z-index: 3000;
    max-width: 280px;
    padding: 8px 10px;
    background: rgba(44, 62, 80, 0.96);
    color: #fff;
    font-size: 12px;
    line-height: 1.45;
    border-radius: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    pointer-events: none;
}

/* ==================================================================
   Bench Mode: full-screen at-the-machine checklist overlay
   (js/bench-mode.js). Same fixed full-screen pattern as the HQ
   studio, but light and HIGH CONTRAST with large type: tier names
   and angles must read at arm's length from the faceting machine.
   ================================================================== */
.bench-mode {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #14181c;
}

.bench-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 18px;
    background: #2c3e50;
    color: #fff;
}

.bench-header h3 {
    margin: 0;
    font-size: 20px;
}

.bench-progress {
    margin-left: auto;
    font-size: 19px;
    font-weight: 600;
    white-space: nowrap;
}

.bench-scroll {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 18px 60px;
}

.bench-top,
.bench-colhead,
.bench-list {
    max-width: 1100px;
    margin: 0 auto;
}

.bench-top {
    display: flex;
    align-items: flex-start;
    gap: 18px;
    margin-bottom: 14px;
}

.bench-thumb {
    flex: 0 0 auto;
    width: 150px;
    height: 150px;
    border: 1px solid #dfe4ea;
    border-radius: 8px;
    background: #fff;
}

.bench-design-title {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
}

.bench-gear {
    margin-top: 2px;
    font-size: 15px;
    color: #566573;
}

.bench-hint {
    margin: 8px 0 0 0;
    max-width: 680px;
    font-size: 13px;
    line-height: 1.5;
    color: #66707a;
}

/* Shared row grid: [check] [tier] [angle] [index] [notes] [cheater]. */
.bench-colhead,
.bench-row {
    display: grid;
    grid-template-columns: 52px minmax(90px, 0.9fr) 140px 2.2fr 1.6fr 150px;
    gap: 10px;
    align-items: center;
}

.bench-colhead {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 6px 8px;
    background: #fff;
    border-bottom: 3px solid #2c3e50;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #566573;
}

.bench-row {
    padding: 12px 8px;
    border-bottom: 1px solid #e2e6ea;
    cursor: pointer;
}

/* The emphasized current tier: big highlight bar. */
.bench-row.bench-current {
    background: #fff3d6;
    box-shadow: inset 8px 0 0 #e67e22;
}

.bench-row.bench-done {
    opacity: 0.45;
}

.bench-check {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    cursor: pointer;
}

.bench-check input {
    width: 28px;
    height: 28px;
    cursor: pointer;
    accent-color: #27ae60;
}

.bench-name {
    font-size: 22px;
    font-weight: 700;
}

.bench-angle {
    font-size: 30px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.bench-indices {
    font-family: 'Consolas', 'Menlo', monospace;
    font-size: 19px;
    letter-spacing: 0.5px;
    word-break: break-word;
}

.bench-notes {
    font-size: 14px;
    line-height: 1.4;
    color: #66707a;
}

.bench-cheat {
    width: 100%;
    padding: 8px 10px;
    font-size: 19px;
    text-align: center;
    border: 2px solid #b8c0c8;
    border-radius: 6px;
    background: #fbfcfd;
}

.bench-cheat:focus {
    border-color: #e67e22;
    outline: none;
}

/* Transfer divider between the pavilion and crown halves. */
.bench-transfer {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin: 20px 0;
    padding: 12px 16px;
    background: #2c3e50;
    color: #fff;
    border-radius: 8px;
}

.bench-transfer-label {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.bench-transfer-sub {
    font-size: 14px;
    opacity: 0.85;
}

/* Tablet widths: stack index + notes under the tier line so the big
   angle and cheater stay on the first row (matches the app's ~880px
   breakpoint family). */
@media (max-width: 880px) {
    .bench-colhead {
        display: none;
    }

    .bench-row {
        grid-template-columns: 44px 1fr 120px 130px;
        grid-template-areas:
            "check name angle cheat"
            "check indices indices indices"
            "check notes notes notes";
        row-gap: 4px;
    }

    .bench-check { grid-area: check; }
    .bench-name { grid-area: name; }
    .bench-angle { grid-area: angle; }
    .bench-indices { grid-area: indices; }
    .bench-notes { grid-area: notes; }
    .bench-cheat { grid-area: cheat; }

    .bench-angle {
        font-size: 26px;
    }

    .bench-thumb {
        width: 110px;
        height: 110px;
    }
}
