:root {
  color-scheme: light;
  font-family: "Segoe UI", "Noto Sans", sans-serif;
  color: #202b36;
  background: #edf2f0;
}

* { box-sizing: border-box; }

body { margin: 0; padding: 20px; }
.tool-header, main, .site-footer { max-width: 1160px; margin-inline: auto; }
.tool-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.tool-home-link { color: #276b67; font-weight: 650; text-decoration: none; }
.tool-home-link:hover, .site-footer a:hover { text-decoration: underline; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.local-badge { color: #276b67; font-size: .85rem; font-weight: 650; }
#languageSwitcher { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.lang-btn { border: 1px solid #c8d2cf; border-radius: 5px; background: #fff; color: #263a3a; cursor: pointer; font: inherit; font-size: .82rem; padding: 7px 9px; }
.lang-btn.selected { border-color: #276b67; background: #276b67; color: #fff; }
main { padding: 28px; background: #fff; border: 1px solid #d7e0dd; border-radius: 8px; }
.intro { margin-bottom: 20px; }
.eyebrow { margin: 0 0 7px; color: #b45136; font-size: .8rem; font-weight: 750; text-transform: uppercase; }
h1 { margin: 0 0 8px; font-size: 1.9rem; }
.intro > p:last-child { margin: 0; color: #586770; line-height: 1.55; }
.privacy-note { margin-bottom: 22px; padding: 12px 14px; border-left: 3px solid #38877d; background: #eef7f3; color: #315c54; font-size: .92rem; line-height: 1.5; }
.workspace { display: grid; grid-template-columns: minmax(300px, 390px) minmax(0, 1fr); border-top: 1px solid #e1e7e5; }
.controls-panel { padding: 22px 24px 0 0; border-right: 1px solid #e1e7e5; }
.control-section { padding: 0 0 19px; margin-bottom: 18px; border-bottom: 1px solid #e8edeb; }
h2 { margin: 0 0 14px; font-size: 1rem; }
input[type=file] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.file-button, .primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border: 1px solid transparent; border-radius: 5px; cursor: pointer; font: inherit; font-weight: 650; padding: 9px 13px; }
.file-button { background: #276b67; color: #fff; }
.file-button:hover, .primary-button:hover:not(:disabled) { background: #1e5753; }
.file-name { display: block; overflow: hidden; margin-top: 8px; color: #64727a; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.control-label { display: block; margin: 13px 0 7px; color: #3c4b54; font-size: .88rem; font-weight: 650; }
.standard-note { margin: 8px 0 0; color: #69767e; font-size: .8rem; line-height: 1.45; }
select { width: 100%; min-height: 40px; border: 1px solid #c9d3d0; border-radius: 4px; background: #fff; color: inherit; font: inherit; padding: 8px; }
.slider-label { display: flex; justify-content: space-between; }
output { color: #276b67; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; margin: 5px 0; accent-color: #276b67; }
.help-text { margin: 7px 0 0; color: #69767e; font-size: .83rem; line-height: 1.45; }
.color-options { display: flex; align-items: center; gap: 10px; }
.color-swatch, .custom-color { width: 32px; height: 32px; border: 1px solid #b9c5c1; border-radius: 50%; cursor: pointer; }
.color-swatch { background: var(--swatch); }
.color-swatch[data-color="#ffffff"] { --swatch: #fff; }
.color-swatch[data-color="#dceeff"] { --swatch: #dceeff; }
.color-swatch[data-color="#e4f0df"] { --swatch: #e4f0df; }
.color-swatch.selected { outline: 2px solid #276b67; outline-offset: 2px; }
.custom-color { position: relative; overflow: hidden; background: conic-gradient(#e26969, #e5d765, #62ae75, #5983c5, #b56db2, #e26969); }
.custom-color input { position: absolute; inset: 0; width: 100%; height: 100%; cursor: pointer; opacity: 0; }
.secondary-button { border-color: #b8cbc6; background: #f6faf8; color: #275b56; }
.secondary-button:hover:not(:disabled) { background: #e8f2ee; }
#sampleButton { width: 100%; margin-top: 14px; }
#sampleButton[aria-pressed="true"] { border-color: #b45136; background: #fff1eb; color: #8e3d2c; }
.text-button { border: 0; background: transparent; color: #356c68; cursor: pointer; font: inherit; font-size: .86rem; padding: 8px 0; text-align: left; }
.text-button:disabled { color: #9aa5a2; cursor: default; }
.actions { display: grid; gap: 9px; }
.primary-button { background: #276b67; color: white; }
.primary-button:disabled, .secondary-button:disabled { cursor: not-allowed; opacity: .5; }
.status { min-height: 20px; margin: 12px 0 0; color: #68767d; font-size: .85rem; line-height: 1.4; }
.preview-panel { min-width: 0; padding: 22px 0 0 24px; }
.preview-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.preview-heading h2 { margin: 0; }
.preview-heading span { color: #738087; font-size: .82rem; }
.canvas-wrap { position: relative; display: flex; min-height: 330px; align-items: center; justify-content: center; overflow: hidden; background-color: #f2f5f4; background-image: linear-gradient(45deg, #e6ebea 25%, transparent 25%), linear-gradient(-45deg, #e6ebea 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e6ebea 75%), linear-gradient(-45deg, transparent 75%, #e6ebea 75%); background-position: 0 0, 0 8px, 8px -8px, -8px 0; background-size: 16px 16px; }
#photoCanvas { display: block; max-width: min(100%, 420px); max-height: 560px; width: auto; height: auto; object-fit: contain; box-shadow: 0 4px 18px #1b2a3026; touch-action: none; cursor: grab; }
#photoCanvas.dragging { cursor: grabbing; }
#photoCanvas.picking { cursor: crosshair; }
.placeholder { position: absolute; color: #78868c; font-size: .9rem; pointer-events: none; }
.sheet-section { margin-top: 32px; border-top: 1px solid #e1e7e5; padding-top: 20px; }
#sheetCanvas { display: block; width: min(100%, 420px); height: auto; border: 1px solid #d9e0de; box-shadow: 0 4px 16px #1b2a3018; }
.sheet-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 10px; }
.site-footer { padding: 18px 0; text-align: center; font-size: .88rem; }
.site-footer a { color: #536b68; }

@media (max-width: 760px) {
  body { padding: 12px; }
  .tool-header { align-items: flex-start; flex-direction: column; gap: 10px; }
  .header-actions { align-items: flex-start; flex-direction: column; gap: 8px; width: 100%; }
  #languageSwitcher { justify-content: flex-start; }
  main { padding: 20px 16px; }
  .workspace { grid-template-columns: 1fr; }
  .controls-panel { padding: 20px 0 0; border-right: 0; }
  .preview-panel { padding: 22px 0 0; border-top: 1px solid #e1e7e5; }
  .canvas-wrap { min-height: 300px; }
  #photoCanvas { max-height: 480px; }
  h1 { font-size: 1.6rem; }
}

@media print {
  body { padding: 0; background: #fff; }
  .tool-header, main > :not(.workspace), .controls-panel, .preview-heading, #photoCanvas, #previewHint, .site-footer, .sheet-actions, .privacy-note, .intro { display: none !important; }
  main, .workspace, .preview-panel, .sheet-section { display: block !important; width: 100%; max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; }
  #sheetCanvas { display: block; width: 100%; max-width: none; height: auto; border: 0; box-shadow: none; }
  @page { size: A4 portrait; margin: 0; }
}