:root {
  color-scheme: light;
  --background: #f8f7f4;
  --paper: #fffefa;
  --ink: #242a25;
  --muted: #606962;
  --green: #3b5144;
  --green-dark: #2e4136;
  --accent: #dfe6db;
  --line: #e2e2d8;
  --serif: Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--ink); font: 1rem/1.45 var(--sans); }
button, input { font: inherit; }
button, summary { cursor: pointer; }
button:disabled { opacity: .47; cursor: default; }
:focus-visible { outline: 3px solid #546e57; outline-offset: 3px; }
h1, h2, p { margin: 0; }
.icon { inline-size: 1.08rem; block-size: 1.08rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icons { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.shell { width: min(100% - 96px, 1312px); margin-inline: auto; }
.catalog-filters { display: grid; gap: 8px; margin-top: 12px; }
.catalog-filters select { width: 100%; min-width: 0; min-height: 40px; margin-top: 4px; padding: 5px 8px; background: var(--paper); color: var(--ink); border: 1px solid #d5d9cb; border-radius: 6px; font: inherit; }
.catalog-filters select:disabled { opacity: .6; }

.intro { padding-block: 39px 32px; }
.intro h1 { font: 400 clamp(2.3rem, 4.3vw, 3.6rem)/1.04 var(--serif); letter-spacing: -.045em; }
.intro p { margin-top: 11px; color: var(--muted); font-size: 1.06rem; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(292px, 330px); grid-template-rows: auto 1fr; grid-template-areas: "simulation photo" "simulation catalog"; gap: 13px 23px; align-items: start; }
.simulation { grid-area: simulation; min-width: 0; display: grid; gap: 13px; }
.photo-panel { grid-area: photo; }
.catalog { grid-area: catalog; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; }
.preview { min-width: 0; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 18px; }
.preview-title { min-width: 0; }
.panel h2 { font-size: 1.055rem; line-height: 1.25; font-weight: 650; }
.preview-title p { margin-top: 4px; color: var(--muted); font-size: .865rem; overflow-wrap: anywhere; }
.view-modes { display: flex; gap: 2px; padding: 3px; border-radius: 8px; background: #efefe8; flex: none; }
.view-modes button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid transparent; border-radius: 6px; background: transparent; min-height: 34px; padding: 3px 10px; font-size: .865rem; color: var(--muted); }
.view-modes button:hover { color: var(--green-dark); }
.view-modes button[aria-pressed="true"] { background: var(--paper); border-color: #dedfd5; color: var(--green-dark); font-weight: 650; box-shadow: 0 1px 2px #2433240e; }
.view-modes .icon { inline-size: .9rem; block-size: .9rem; }

.stage { display: grid; place-items: center; background: #ebe9e0; overflow: hidden; min-height: 210px; }
.stage-empty { display: grid; place-items: center; min-height: 300px; max-width: 26rem; padding: 20px; color: var(--muted); text-align: center; }
.surface { position: relative; flex: none; width: min(100%, var(--photo-width, 100%)); isolation: isolate; }
.surface canvas { display: block; width: 100%; height: auto; }
.photo-label { position: absolute; left: 14px; bottom: 14px; padding: 5px 9px; background: #262c24d9; color: #fff; border-radius: 5px; font-size: .78rem; pointer-events: none; }
.photo-label[hidden] { display: none; }
.comparison, .guides, .wall-pins { position: absolute; inset: 0; }
.wall-pins { pointer-events: none; }
.wall-pin { position: absolute; display: grid; place-items: center; min-width: 28px; height: 28px; padding-inline: 5px; border: 1px solid #fff; border-radius: 99px; background: #242a25d9; color: #fff; transform: translate(-50%, -50%); font-size: .86rem; font-weight: 700; }
.wall-pin.active { background: var(--green-dark); box-shadow: 0 0 0 3px #ffffffba; }
.comparison { overflow: hidden; }
.compare-line { position: absolute; width: 2px; top: 0; bottom: 0; left: var(--split, 50%); background: #fff; box-shadow: 0 0 6px #18291a60; }
.compare-line span { position: absolute; display: grid; place-items: center; top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 50%; width: 38px; height: 38px; background: #fffefa; color: var(--green-dark); border: 1px solid #eeeae0; }
.compare-label { position: absolute; top: 12px; padding: 4px 9px; background: #262c24d9; border-radius: 5px; font-size: .83rem; color: white; }
.compare-label.before { left: 12px; }
.compare-label.after { right: 12px; }
.comparison input { position: absolute; inset: 0; margin: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; touch-action: none; }
.comparison:focus-within { outline: 3px solid #fff; outline-offset: -4px; }
.guides { touch-action: manipulation; cursor: crosshair; }
.guides[data-busy="true"] { cursor: progress; }
.guides:focus-visible { outline: 3px solid #fff; outline-offset: -4px; }
.tap-target { position: absolute; width: 32px; height: 32px; border: 2px solid white; border-radius: 50%; box-shadow: 0 0 0 2px #3b5144; transform: translate(-50%, -50%); pointer-events: none; background: #ffffff29; }
.tap-target.waiting { animation: target-pulse .9s ease-in-out infinite alternate; }
@keyframes target-pulse { to { box-shadow: 0 0 0 8px #3b514460; } }
@media (prefers-reduced-motion: reduce) { .tap-target.waiting { animation: none; } }
.editor-strip { background: #f1f3ed; border-block: 1px solid var(--line); padding: 10px 17px; }
.editor-strip p { color: var(--green-dark); font-size: .91rem; }
.selection-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 5px 14px; flex-wrap: wrap; }
.detection-status { font-size: .79rem; font-weight: 600; color: var(--muted); }
.detection-status[data-ready="true"] { color: var(--green-dark); }
.editor-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
.selection-heading + .editor-actions { margin-top: 8px; }
.selection-tool { background: var(--paper); border-color: #d5d9cb; color: var(--green-dark); }
.selection-tool[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: white; }
.selection-message { margin-top: 7px; color: #7c4c33; font-size: .86rem; }
.preview-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; padding: 14px 17px; }
.preview-footer .muted { margin: 0; }
.button { display: inline-flex; min-height: 40px; justify-content: center; align-items: center; gap: 8px; border: 1px solid; border-radius: 7px; padding: 7px 12px; font-size: .89rem; font-weight: 650; }
.button-secondary { color: var(--green-dark); background: var(--paper); border-color: #d5d9cb; }
.button-secondary:not(:disabled):hover { background: #eef0e8; }
.button-primary { color: #fff; background: var(--green); border-color: var(--green); }
.button-primary:not(:disabled):hover { background: var(--green-dark); }
.text-button { display: inline-flex; min-height: 30px; align-items: center; gap: 6px; padding: 1px 0; color: var(--green-dark); font-size: .88rem; font-weight: 650; background: transparent; border: 0; }
.text-button:not(:disabled):hover { text-decoration: underline; text-underline-offset: 3px; }

.control-panel { min-width: 0; padding: 16px; }
.upload-zone { position: relative; width: 100%; display: flex; text-align: left; align-items: center; gap: 11px; padding: 12px 11px; margin-top: 12px; background: #f7f8f1; color: var(--green-dark); border: 1px dashed #a6b3a0; border-radius: 8px; cursor: pointer; }
.upload-zone:hover, .upload-zone.drop-active { background: #e9efe4; border-color: var(--green); }
.upload-zone:focus-within { outline: 3px solid #546e57; outline-offset: 3px; }
.upload-zone input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.upload-zone input::file-selector-button { width: 100%; height: 100%; cursor: pointer; }
.upload-icon { width: 35px; height: 35px; border-radius: 6px; display: grid; place-items: center; flex: none; background: #e7ede2; }
.upload-zone strong, #upload-formats { display: block; }
.upload-zone strong { font-size: .94rem; }
#upload-formats { color: var(--muted); font-size: .79rem; margin-top: 1px; }
.photo-actions { margin-top: 6px; display: flex; flex-direction: column; align-items: flex-start; }
.notice { font-size: .875rem; margin-top: 7px; color: var(--green-dark); overflow-wrap: anywhere; }
.notice.error { color: #953a2e; }

.muted { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.wall-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 11px; }
.wall-choice { display: flex; align-items: center; gap: 7px; min-width: 0; min-height: 44px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink); text-align: left; }
.wall-choice[aria-pressed="true"] { border-color: var(--green); box-shadow: inset 0 0 0 1px var(--green); background: #f1f3ed; }
.wall-choice-tile { flex: 0 0 24px; height: 28px; border: 1px solid #262c2424; border-radius: 4px; background-size: 42px 42px; }
.wall-choice strong, .wall-choice small { display: block; line-height: 1.15; }
.wall-choice strong { font-size: .88rem; }
.wall-choice small { margin-top: 3px; color: var(--muted); font-size: .76rem; }
#swatches { min-inline-size: 0; padding: 0; border: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.swatch { position: relative; min-width: 0; padding: 0; cursor: pointer; background: transparent; border: 0; text-align: left; }
#swatches:disabled .swatch { cursor: wait; opacity: .65; }
.swatch-card { display: block; height: 100%; border: 1px solid #e2e2d9; border-radius: 8px; overflow: hidden; background: var(--paper); }
.swatch[aria-pressed="true"] .swatch-card { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.swatch:hover .swatch-card { border-color: #7a8c7c; }
.swatch-tile { display: block; width: 100%; height: 56px; object-fit: cover; background-color: #e4e1d6; }
.swatch-name { display: grid; align-items: center; min-height: 38px; padding: 4px 5px; font-size: .78rem; line-height: 1.2; overflow-wrap: anywhere; }
.swatch[aria-pressed="true"] .swatch-name { font-weight: 650; }
.swatch-check { display: none; position: absolute; top: 5px; right: 5px; width: 17px; height: 17px; place-items: center; background: var(--green-dark); color: white; border-radius: 50%; }
.swatch-check .icon { width: 12px; height: 12px; stroke-width: 2.2; }
.swatch[aria-pressed="true"] .swatch-check { display: grid; }
.catalog-pagination { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-top: 12px; }
.catalog-pagination p { color: var(--muted); font-size: .83rem; white-space: nowrap; }
.catalog-pagination .button { padding-inline: 8px; }
.catalog-pagination[aria-busy="true"] .button:not(:disabled) { cursor: wait; }

.roll-calculator h2 { display: flex; align-items: center; gap: 7px; }
.calculator-paper, .calculator-wall, .calculator-opening { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.calculator-paper { margin-top: 14px; }
.calculator-paper + .calculator-paper { padding-top: 8px; border-top: 1px solid var(--line); }
.calculator-paper > legend, .calculator-wall > legend, .calculator-opening > legend { padding: 0; font-size: .91rem; font-weight: 650; }
.calculator-paper > legend { margin-bottom: 6px; color: var(--green-dark); }
.calculator-paper > .remove-paper { margin: -4px 0 6px; }
.measure-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.measure-field { min-width: 0; color: var(--muted); font-size: .875rem; }
.measure-wide { grid-column: 1 / -1; }
.measure-wide .muted { margin-left: 4px; font-size: .78rem; }
.measure-field input { display: block; width: 100%; min-height: 38px; margin-top: 4px; padding: 5px 8px; border: 1px solid #d5d9cb; border-radius: 6px; background: var(--paper); color: var(--ink); font-size: 1rem; }
.measure-field input[aria-invalid="true"] { border-color: #953a2e; }
.calculator-walls { display: grid; gap: 9px; margin: 13px 0 9px; }
.calculator-wall { padding: 5px 9px 8px; border: 1px solid var(--line); border-radius: 8px; background: #f5f6f0; }
.calculator-wall > legend { margin-left: -2px; padding: 0 4px; color: var(--green-dark); }
.calculator-wall .text-button { font-size: .84rem; }
.remove-wall-size { min-height: 26px; margin: -3px 0 3px; }
.discount-toggle { margin-top: 4px; }
.calculator-opening { margin-top: 4px; }
.calculator-opening > legend { margin-bottom: 3px; }
.calculator-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 7px; margin-top: 13px; }
.roll-result { margin-top: 12px; padding: 11px 12px; border: 1px solid #dae3d7; border-radius: 8px; background: #f0f4ee; }
.roll-total { color: var(--green-dark); font: 400 2rem/1.15 var(--serif); margin: 4px 0; }
.roll-area, .paper-totals, .roll-method { font-size: .85rem; }
.paper-totals { margin: 7px 0 0; padding-left: 19px; }
.roll-method { color: var(--muted); margin-top: 7px; }
.page-footer { display: flex; gap: 7px; align-items: center; color: var(--muted); padding: 18px 0 25px; font-size: .88rem; }
.page-footer .icon { width: .95rem; height: .95rem; }

@media (max-width: 1050px) {
  .shell { width: min(100% - 55px, 1312px); }
  .workspace { gap: 15px; }
}
@media (max-width: 790px) {
  .shell { width: calc(100% - 32px); }
  .intro { padding-block: 30px 22px; }
  .workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "photo" "simulation" "catalog"; }
}
@media (max-width: 545px) {
  .intro h1 { max-width: 15ch; }
  .preview-heading, .preview-footer, .editor-strip { padding: 11px; }
  .view-modes { width: 100%; }
  .view-modes button { flex: 1; padding-inline: 4px; }
  .editor-actions, .preview-footer { gap: 6px; }
  .editor-actions .button, .preview-footer .button { padding-inline: 8px; }
  .swatch-tile { height: 62px; }
  .photo-label { bottom: 8px; left: 8px; }
}
