.rc-dialog {
  width: min(1180px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 20px;
  color: #3a2915;
  font-size: 16px;
  background: #fffdf4;
  box-shadow: 0 25px 80px rgba(65, 42, 14, .28);
}
.rc-dialog::backdrop { background: rgba(42, 32, 22, .58); backdrop-filter: blur(3px); }
.rc-shell { padding: 24px; }
.rc-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.rc-heading h2 { margin: 0; font-size: 23px; }
.rc-sample-image { display: block; width: min(100%, 460px); max-height: 210px; margin: 14px 0 0; object-fit: contain; object-position: left center; border: 1px solid #efca8d; border-radius: 12px; background: #fff; }
.rc-sample-image[hidden] { display: none; }
.rc-reference-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.rc-reference-buttons .rc-button { min-height: 44px; min-width: 100px; }
.rc-heading p { margin: 7px 0 0; color: #7b6241; font-size: 16px; line-height: 1.55; }
.rc-close { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #f4dfad; cursor: pointer; font-size: 22px; }
.rc-flow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 18px 0; }
.rc-flow span { padding: 10px 8px; border: 1px solid #f0c77a; border-radius: 10px; color: #7b6241; background: #fffaf0; font-size: 16px; font-weight: 900; text-align: center; }
.rc-flow span.active { border-color: #e48b22; color: #5b3a16; background: #ffe1a0; box-shadow: inset 0 0 0 1px #e48b22; }
.rc-flow span.complete { color: #456552; background: #e5f3db; }
.rc-section { margin-top: 14px; padding: 17px; border: 1px solid #f0c77a; border-radius: 16px; background: #fffaf0; }
.rc-section h3 { margin: 0 0 5px; font-size: 17px; }
.rc-section > p { margin: 0 0 18px; color: #7b6241; font-size: 16px; line-height: 1.55; }
.rc-instructions { margin: 0 0 18px; color: #7b6241; }
.rc-instructions summary { color: #3a2915; cursor: pointer; font-size: 17px; font-weight: 900; }
.rc-instructions-copy { margin-top: 9px; color: #7b6241; font-size: 16px; line-height: 1.55; }
.rc-file-grid, .rc-canvas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.rc-file { display: grid; gap: 8px; min-width: 0; padding: 16px; border: 1px dashed #e5ad55; border-radius: 12px; background: #fffdf4; font-size: 16px; font-weight: 900; }
.rc-single-file { max-width: 760px; }
.rc-file small { color: #7b6241; font-size: 16px; font-weight: 400; line-height: 1.55; }
.rc-file input { width: 100%; }
.rc-preset-label { display: grid; max-width: 760px; gap: 7px; margin-top: 18px; color: #5b3a16; font-size: 16px; font-weight: 900; }
.rc-preset-label select { min-height: 46px; padding: 8px 10px; border: 1px solid #e5ad55; border-radius: 9px; background: #fff; font: inherit; }
.rc-size-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(130px, 1fr); align-items: end; gap: 14px; max-width: 760px; margin-top: 18px; }
.rc-size-row label { color: #5b3a16; font-size: 16px; font-weight: 900; }
.rc-size-row input { width: 100%; min-height: 39px; margin-top: 5px; padding: 7px 9px; border: 1px solid #e5ad55; border-radius: 9px; background: white; }
.rc-button { min-height: 40px; padding: 8px 14px; border: 1px solid #d98b2b; border-radius: 10px; color: #3a2915; background: #fffaf0; cursor: pointer; font-weight: 900; }
.rc-button:hover { background: #ffe8ad; }
.rc-button.primary { color: white; background: #f28c28; }
.rc-button.primary:hover { background: #bd6419; }
.rc-button:disabled { cursor: not-allowed; opacity: .45; }
.rc-canvas-card { min-width: 0; overflow: hidden; border: 1px solid #f0c77a; border-radius: 12px; background: white; }
.rc-canvas-title { padding: 8px 10px; color: #5b3a16; background: #fff1c9; font-size: 16px; font-weight: 900; }
.rc-canvas-card canvas { display: block; width: 100%; height: auto; background: #eeeae4; touch-action: none; }
.rc-reference-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .6fr); align-items: start; gap: 13px; }
.rc-reference-image { position: relative; }
.rc-reference-colors { position: relative; z-index: 1; width: auto; max-width: 100%; padding: 4px 7px; border: 1px solid #a7a7a7; border-radius: 6px; background: rgba(255,255,255,.96); color: #252525; font-size: 13pt; font-weight: 700; box-shadow: 0 1px 5px rgba(0,0,0,.25); }
.rc-reference-colors summary { cursor: pointer; list-style: none; }
.rc-reference-colors summary::-webkit-details-marker { display: none; }
.rc-reference-colors-short { display: none; }
.rc-reference-colors select { min-width: 0; margin-top: 4px; padding: 4px; border: 1px solid #777; border-radius: 4px; background: white; color: #222; font: inherit; }
.rc-reference-colors:not([open]) { width: auto; padding: 4px 7px; }
.rc-reference-colors:not([open]) .rc-reference-colors-full { display: none; }
.rc-reference-colors:not([open]) .rc-reference-colors-short { display: inline; font-size: 13pt; }
.rc-reference-zoom { display: grid; grid-template-columns: auto minmax(100px, 1fr) auto auto; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid #ead3ab; color: #5b3a16; font-size: 13pt; font-weight: 800; }
.rc-reference-zoom input { width: 100%; accent-color: #ef9b20; }
.rc-reference-zoom output { min-width: 48px; font-size: 13pt; text-align: right; }
.rc-reference-preview-card { width: 100%; align-self: start; }
.rc-reference-preview-card canvas { cursor: default; }
[data-rc-reference-canvas]:focus { outline: 3px solid rgba(242,140,40,.55); outline-offset: -3px; }
.rc-result-image { position: relative; padding-bottom: 64px; }
.rc-crop-colors { position: absolute; right: 8px; bottom: 6px; z-index: 1; display: grid; gap: 4px; width: 188px; max-width: calc(100% - 16px); padding: 7px 8px; border: 1px solid #a7a7a7; border-radius: 6px; background: rgba(255,255,255,.96); color: #252525; font-size: 16px; font-weight: 700; box-shadow: 0 1px 5px rgba(0,0,0,.25); }
.rc-crop-colors select { width: 100%; min-width: 0; padding: 4px; border: 1px solid #777; border-radius: 4px; background: white; color: #222; font: inherit; }
.rc-canvas-card small { display: block; padding: 10px 12px; color: #7b6241; font-size: 16px; line-height: 1.55; }
.rc-result-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; }
.rc-result-meta { align-self: start; padding: 14px; border: 1px solid #f0c77a; border-radius: 12px; background: white; }
.rc-result-meta b, .rc-result-meta span { display: block; }
.rc-result-meta b { font-size: 16px; }
.rc-result-meta span { margin-top: 6px; color: #7b6241; font-size: 16px; line-height: 1.55; }
.rc-rotate-panel + .rc-result-meta { margin-top: 14px; }
.rc-result-meta .rc-button { display: block; width: 100%; margin-top: 14px; }
.rc-rotate-panel { margin-top: 14px; padding: 14px; border: 1px solid #f0c77a; border-radius: 12px; background: #fffaf0; }
.rc-rotate-panel p { margin: 0 0 10px; color: #5b3a16; font-size: 16px; font-weight: 800; line-height: 1.45; }
.rc-rotate-panel .rc-pattern-status { color: #597043; font-size: 16px; font-weight: 700; }
.rc-rotate-controls { display: grid; grid-template-columns: auto minmax(120px, 1fr) auto auto; align-items: center; gap: 9px; }
.rc-rotate-controls input[type="range"] { width: 100%; accent-color: #ef9b20; }
.rc-rotate-nudge { min-width: 48px; min-height: 42px; border: 1px solid #e29a00; border-radius: 9px; background: #fff; color: #8a4d00; font-size: 24px; font-weight: 900; cursor: pointer; }
.rc-rotate-nudge:hover { background: #fff1c9; }
.rc-rotate-controls output { min-width: 56px; color: #5b3a16; font-size: 16px; font-weight: 900; text-align: right; }
.rc-message { min-height: 20px; margin: 12px 0 0; color: #597043; font-size: 16px; line-height: 1.55; }
.rc-message.error { color: #ad3d32; }
.rc-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.reference-capture-intro { margin-top: 18px; padding: 15px; border: 1px solid #f0c77a; border-radius: 14px; background: #fffaf0; }
.reference-capture-intro p { margin: 0 0 11px; color: #7b6241; font-size: 16px !important; line-height: 1.65; }
.reference-capture-intro .button { width: 100%; }
@media (max-width: 760px) {
  .rc-dialog { inset: 0; width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .rc-shell { padding: 12px 0 0; }
  .rc-heading, .rc-section:not([data-rc-step-panel="3"]), .rc-message { margin-right: 12px; margin-left: 12px; }
  .rc-section { padding: 12px; border-radius: 12px; }
  .rc-section[data-rc-step-panel="3"] { margin-top: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
  .rc-section[data-rc-step-panel="3"] .rc-instructions { margin: 0 12px 8px; }
  .rc-section[data-rc-step-panel="3"] .rc-reference-buttons { margin: 8px 12px; }
  .rc-section[data-rc-step-panel="3"] .rc-reference-layout { gap: 0; }
  .rc-section[data-rc-step-panel="3"] .rc-actions { margin-right: 12px; margin-left: 12px; }
  .rc-flow { grid-template-columns: 1fr; }
  .rc-file-grid, .rc-canvas-grid, .rc-result-grid { grid-template-columns: 1fr; }
  .rc-reference-layout { grid-template-columns: 1fr; }
  .rc-reference-preview-card { width: 100%; justify-self: stretch; }
  .rc-size-row { grid-template-columns: 1fr 1fr; }
  .rc-size-row .rc-button { grid-column: 1 / -1; }
  .rc-rotate-controls { grid-template-columns: auto minmax(80px, 1fr) auto; }
  .rc-rotate-controls output { grid-column: 1 / -1; text-align: center; }
  .rc-heading h2 { font-size: 19px; }
}
@media (max-width: 430px) {
  .rc-reference-preview-card { width: 100%; }
  .rc-reference-zoom { grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 6px; padding: 7px 8px; }
  .rc-reference-zoom input { grid-column: auto; grid-row: auto; }
  .rc-reference-colors[open] { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 6px; }
  .rc-reference-colors[open] select { width: 100%; margin-top: 0; }
  .rc-size-row { grid-template-columns: 1fr; }
  .rc-size-row .rc-button { grid-column: auto; }
}
