:root {
  color-scheme: light;
  --paper: #f8f6ef;
  --surface: #fffef9;
  --ink: #20372b;
  --muted: #526256;
  --line: #d5d8ca;
  --edge: #b6bdac;
  --pine: #244b36;
  --hover: #edf1e7;
  --heading: "Bricolage Grotesque", "Inter", Arial, sans-serif;
  --body: "DM Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font: 100%/1.45 var(--body);
  color: var(--ink);
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
h1, h2, p { margin: 0; }
button, input, output { font: inherit; color: inherit; }
button, a, input, label, summary { -webkit-tap-highlight-color: transparent; }
button, summary, .upload { cursor: pointer; }
button { appearance: none; }
button:disabled { opacity: .46; cursor: default; }
a { color: inherit; }
[hidden], .hidden { display: none !important; }
.visually-hidden, .icon-library { position: absolute; width: 1px; height: 1px; overflow: hidden; padding: 0; margin: -1px; border: 0; clip-path: inset(50%); white-space: nowrap; }
:focus-visible, #photo-file:focus-visible + label { outline: 3px solid #99711c; outline-offset: 3px; }
.skip { position: fixed; z-index: 4; padding: .6rem .85rem; background: var(--ink); color: white; top: 6px; left: 10px; transform: translateY(-145%); }
.skip:focus { transform: none; }
.shell { width: min(1400px, 100%); padding-inline: clamp(16px, 4.2vw, 64px); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--edge); }
.nav-bar { min-height: 65px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font: 850 1.82rem/1 var(--heading); letter-spacing: -.055em; }
.brand svg { width: 37px; height: 30px; }
.icon { width: 18px; height: 18px; display: block; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.all-tools, .btn { display: inline-flex; align-items: center; justify-content: center; gap: .52rem; border: 1px solid var(--edge); border-radius: 8px; text-decoration: none; font-weight: 650; line-height: 1.15; background: var(--surface); color: var(--ink); }
.all-tools { min-height: 40px; padding: 0 13px; font-size: .925rem; background: transparent; }
.all-tools .icon { width: 15px; height: 15px; }
.all-tools:hover, .btn:not(:disabled):hover, .tool-btn:not(:disabled):hover, .surface:hover, .scheme:hover { background-color: var(--hover); }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: clamp(24px, 3.4vw, 54px) 0 clamp(20px, 2.45vw, 34px); }
h1, h2 { font-family: var(--heading); }
h1 { font-size: clamp(2.05rem, 4.1vw, 3.7rem); letter-spacing: -.064em; line-height: 1.015; font-weight: 760; text-wrap: balance; }
.intro p { margin-top: .7rem; font-size: clamp(1rem, 1.45vw, 1.15rem); color: var(--muted); letter-spacing: -.014em; }
.btn { min-height: 44px; padding: .6rem .95rem; }
.btn.primary { background: var(--pine); border-color: var(--pine); color: #fffef5; }
.btn.primary:hover { background: #163d28; border-color: #163d28; }
.upload { min-height: 48px; padding-inline: 1.15rem; white-space: nowrap; }
.upload-action { flex: 0 0 auto; }
.studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, .439fr); gap: clamp(14px, 1.65vw, 24px); align-items: start; outline: none; }
.panel { background: var(--surface); border: 1px solid var(--edge); border-radius: 15px; min-width: 0; box-shadow: 0 4px 12px -10px #233e30; }
.preview-panel { overflow: clip; }
.panel-head, .photo-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-head { min-height: 61px; padding: 9px clamp(14px, 1.55vw, 24px); }
h2 { font-size: 1.17rem; font-weight: 730; line-height: 1.15; letter-spacing: -.034em; }
.btn.small { min-height: 36px; padding: .42rem .7rem; font-size: .875rem; }
.btn.small .icon { width: 16px; height: 16px; }
#compare[aria-pressed="false"] .when-original, #compare[aria-pressed="true"] .when-painted { display: none; }
#compare[aria-pressed="true"] { background: var(--ink); color: white; border-color: var(--ink); }
.stage { display: flex; align-items: center; justify-content: center; width: 100%; background: #e1e4da; overflow: hidden; }
#paint-canvas { display: block; width: auto; height: auto; max-width: 100%; max-height: min(72vh, 650px); min-width: 0; touch-action: pan-y pinch-zoom; cursor: pointer; }
#paint-canvas[data-editing="true"] { cursor: crosshair; }
#paint-canvas[data-editing="true"][data-mode="brush"], #paint-canvas[data-editing="true"][data-mode="erase"] { touch-action: none; }
#paint-canvas:focus-visible { outline-offset: -4px; }
#paint-canvas.is-original { cursor: default; }
.photo-bar { padding: 8px clamp(14px, 1.55vw, 24px); min-height: 44px; background: #f7f7ef; }
.photo-title { display: flex; gap: 8px; align-items: center; min-width: 0; font-size: .875rem; color: var(--muted); }
.photo-title .icon { width: 16px; height: 16px; }
#photo-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-btn { border: 0; padding: .35rem 0; background: transparent; font-size: .875rem; font-weight: 650; text-decoration: underline; text-decoration-color: #909d90; text-underline-offset: 3px; }
.text-btn:hover { color: #326d49; }
.photo-bar .text-btn { flex-shrink: 0; }
.area-editor { border-top: 1px solid var(--line); }
summary { list-style: none; }
summary::-webkit-details-marker { display: none; }
.area-editor summary, .tips summary { display: flex; align-items: center; gap: 8px; font-weight: 650; }
.area-editor summary { min-height: 48px; padding: .6rem clamp(14px, 1.55vw, 24px); }
.area-editor summary:hover, .tips summary:hover { background: #f3f5ed; }
.chevron { margin-left: auto; flex-shrink: 0; }
details[open] > summary .chevron { transform: rotate(180deg); }
.editor-content { padding: .1rem clamp(14px, 1.55vw, 24px) .8rem; }
.editor-content p { font-size: .925rem; color: var(--muted); }
.tool-row, .edit-modes, .range-control { display: flex; gap: 8px; align-items: center; }
.tool-row { justify-content: space-between; flex-wrap: wrap; margin-block: 13px 8px; }
.edit-modes { padding: 3px; gap: 3px; border-radius: 8px; background: #eeefe7; }
.tool-btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px; border: 1px solid transparent; border-radius: 6px; padding: .35rem .58rem; background: none; font-size: .875rem; font-weight: 650; }
.tool-btn[aria-pressed="true"] { border-color: var(--edge); background-color: var(--surface); }
.tool-btn .icon { width: 15px; height: 15px; }
.range-control { flex-wrap: wrap; padding-block: 5px; font-size: .875rem; }
.range-control label { font-weight: 650; }
.range-control input { width: min(28vw, 180px); min-height: 30px; accent-color: var(--pine); }
.range-control output { min-width: 2.3em; font-variant-numeric: tabular-nums; }
.status { margin: 0; padding: .7rem clamp(14px, 1.55vw, 24px); background: #f3f5eb; color: var(--ink); border-top: 1px solid var(--line); font-size: .9rem; }
.status:empty { display: none; }
.paint-panel { padding: clamp(17px, 1.75vw, 25px); }
.paint-section + .paint-section, .export { margin-top: clamp(16px, 1.7vw, 25px); padding-top: clamp(16px, 1.7vw, 25px); border-top: 1px solid var(--line); }
.surface-tabs, .schemes-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.surface { min-width: 0; min-height: 45px; padding: 6px 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: .875rem; font-weight: 620; display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.surface-chip { width: 13px; height: 13px; border: 1px solid #29372930; border-radius: 50%; flex: 0 0 auto; }
.surface[aria-pressed="true"] { background-color: #e8eee2; border-color: #465f49; box-shadow: inset 0 0 0 .5px #465f49; }
.section-title, .custom-line { display: flex; gap: 9px; align-items: center; justify-content: space-between; }
.color-name { font-size: .875rem; font-weight: 630; color: var(--muted); }
.swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.swatch { display: grid; place-content: center; padding: 0; width: 100%; min-height: 39px; aspect-ratio: 1.22; position: relative; border: 1px solid #23362824; border-radius: 6px; background: var(--swatch); }
.swatch:hover { outline: 1px solid var(--edge); outline-offset: 1px; }
.swatch:focus-visible { outline: 3px solid #99711c; }
.swatch .icon { display: none; width: 20px; height: 20px; padding: 2px; background: #fffef9; color: var(--ink); border-radius: 50%; stroke-width: 2.1; }
.swatch[aria-pressed="true"]::before { content: ""; position: absolute; inset: 2px; border: 1px solid #fffef980; border-radius: 4px; }
.swatch[aria-pressed="true"] .icon { display: block; }
.custom-line { margin-top: 15px; font-size: .9rem; }
.custom-line > label { font-weight: 620; }
.hex-field { display: flex; align-items: center; height: 38px; padding: 3px 5px; gap: 5px; background: var(--surface); border: 1px solid var(--edge); border-radius: 6px; min-width: 0; }
.native-color { display: block; position: relative; width: 25px; height: 25px; border: 1px solid #2e392935; border-radius: 4px; cursor: pointer; overflow: hidden; }
#current-color-chip, .native-color input { position: absolute; inset: 0; width: 100%; height: 100%; }
.native-color input { appearance: none; opacity: 0; cursor: pointer; }
.hex-field:focus-within { outline: 2px solid #99711c; outline-offset: 2px; }
#hex { border: 0; width: 8ch; min-width: 0; outline: none; background: transparent; font: 500 .875rem/1.1 "IBM Plex Mono", ui-monospace, monospace; }
.scheme { min-width: 0; display: grid; gap: 5px; text-align: start; border: 1px solid var(--line); border-radius: 7px; padding: 5px; background: var(--surface); }
.scheme[aria-pressed="true"] { border-color: #53674e; box-shadow: inset 0 0 0 .5px #53674e; }
.scheme-strip { display: grid; grid-template-columns: 1.8fr 1fr 1fr; width: 100%; height: 23px; border-radius: 4px; overflow: hidden; }
.scheme > span:last-child { font-size: .83rem; font-weight: 650; margin-left: 2px; }
.export .btn { width: 100%; min-height: 45px; }
.export p { text-align: center; font-size: .81rem; color: var(--muted); margin-top: 8px; }
.tips { margin: clamp(25px, 3.3vw, 46px) 0 42px; border-bottom: 1px solid var(--edge); }
.tips details { border-top: 1px solid var(--edge); }
.tips summary { padding: 14px 2px; font-size: .96rem; }
.tips p { max-width: 79ch; margin: 0 0 18px; padding-right: .5rem; font-size: .95rem; color: var(--muted); }
.notice { padding: 1rem; margin-bottom: 1rem; border: 1px solid var(--edge); background: var(--surface); }
@media(max-width: 940px) {
  .shell { padding-inline: clamp(14px, 2.6vw, 25px); }
  .studio { grid-template-columns: minmax(0, 1fr) 303px; gap: 12px; }
  .paint-panel { padding: 15px; }
  .surface { font-size: .835rem; }
}
@media(max-width: 740px) {
  .nav-bar { min-height: 55px; }
  .brand { font-size: 1.6rem; }
  .brand svg { width: 32px; height: 27px; }
  .all-tools { min-height: 36px; font-size: .875rem; }
  .intro { flex-wrap: wrap; gap: 14px; margin-block: 22px 16px; }
  .intro p { margin-top: 8px; }
  .upload { min-height: 43px; font-size: .94rem; }
  .studio { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .panel { border-radius: 12px; }
  .panel-head { min-height: 53px; }
  .paint-panel { padding: 18px; }
  .surface-tabs, .schemes-grid, .swatches { gap: 8px; }
  .surface { font-size: .9rem; }
  .swatch { max-height: 58px; }
  .paint-section + .paint-section, .export { padding-top: 16px; margin-top: 16px; }
  #paint-canvas { max-height: 65svh; }
  .area-editor summary { min-height: 44px; }
}
@media(max-width: 350px) {
  .shell { padding-inline: 10px; }
  .paint-panel, .panel-head { padding-inline: 12px; }
  .surface-tabs, .schemes-grid, .swatches { gap: 5px; }
  .surface { font-size: .84rem; }
  .tool-row { gap: 4px; }
  .tool-btn { padding-inline: 5px; font-size: .815rem; }
  h2 { font-size: 1.1rem; }
}
@media(prefers-reduced-motion:no-preference) {
  .all-tools, .btn, .surface, .scheme, .tool-btn { transition: background-color .12s, border-color .12s; }
  .chevron { transition: transform .15s; }
}
