/* Eigenständige Oberfläche. Kein Website-Header und keine externen Schriftdateien. */
:root {
  --green: #82b32f;
  --green-text: #527f20;
  --orange: #f69a10;
  --text: #737373;
  --muted: #818181;
  --border: #e1e1e1;
  --card: #f6f6f6;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  color: var(--text);
  background: #fff;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button, select, summary, input[type="range"], input[type="checkbox"] { cursor: pointer; }
button, a { color: inherit; }
button { touch-action: manipulation; }
button:disabled, select:disabled { cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible {
  outline: 3px solid #3b7429;
  outline-offset: 3px;
}
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.mosaic-studio { width: 100%; max-width: 720px; padding: 40px 24px 28px; margin: 0 auto; }
.step-navigation { margin-bottom: 22px; }
.step-navigation ol { display: flex; gap: 4px; list-style: none; margin: 0; padding: 4px; border-radius: 12px; background: var(--card); }
.step-navigation li { flex: 1 1 0; min-width: 0; }
.step-navigation button { width: 100%; white-space: nowrap; min-height: 42px; border: 1px solid transparent; background: transparent; border-radius: 9px; font-size: 13px; padding: 8px 4px; }
.step-navigation button:disabled { color: #c3c3c3; }
.step-navigation button.complete { background: white; border-color: #d9d9d9; }
.step-navigation button[aria-current="step"] { color: white; background: var(--green); border-color: var(--green); font-weight: 650; }
.step-card { padding: 26px 30px; border: 1px solid #ededed; border-radius: 12px; background: white; }
.step-intro { text-align: center; margin-bottom: 20px; }
.step-intro p { font-size: 12px; margin: 0 0 4px; }
.step-intro strong { font-weight: 650; }
h2 { font-size: 26px; font-weight: 400; line-height: 1.3; margin: 0; }
h2:focus { outline: none; }
.dropzone { position: relative; min-height: 250px; padding: 20px; border: 1px dashed #d7d7d7; border-radius: 12px; background: var(--card); display: flex; align-items: center; justify-content: center; flex-direction: column; text-align: center; cursor: pointer; }
.dropzone:hover, .dropzone.dragover, .dropzone:focus-within { border-color: var(--green); background: #f3f6ed; }
.dropzone strong { font-size: 15px; margin-top: 8px; }
.dropzone > span:last-of-type { font-size: 12px; margin-top: 1px; }
.upload-symbol { display: flex; }
.upload-symbol svg { width: 28px; height: 28px; }
.file-input { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; opacity: 0; }
.upload-note { text-align: center; font-size: 11px; line-height: 1.5; margin: 17px 0 20px; }
.main-selection { margin: 0 0 12px; order: -1; width: 100%; }
.main-selection img { display: block; max-height: 220px; max-width: 100%; margin: auto; object-fit: contain; border-radius: 4px; }
.dropzone.has-image .upload-symbol { display: none; }
.wizard-actions { margin-top: 20px; }
.button { width: 100%; min-height: 44px; border: 0; padding: 10px 14px; border-radius: 10px; font-weight: 650; font-size: 16px; line-height: 1.3; display: inline-flex; justify-content: center; align-items: center; gap: 10px; text-decoration: none; }
.primary { background: var(--orange); color: #fff; }
.primary:hover:not(:disabled) { background: #eb8e00; }
.primary:disabled { background: #dedede; color: #fff; }
.primary svg { stroke-width: 2.5; }
.link-button { background: none; border: 0; padding: 10px 3px; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
select { width: 100%; min-height: 44px; background-color: #fff; border: 1px solid #d8d8d8; border-radius: 11px; padding: 10px 32px 10px 12px; color: var(--text); font-size: 16px; }
select:disabled { opacity: .55; }
.input-note { font-size: 11px; line-height: 1.5; margin: 8px 0; color: var(--muted); }
#selection-hint { text-align: center; }
.notice { border: 1px solid #cbdcb5; background: #f5f9f0; padding: 14px; border-radius: 10px; font-size: 13px; line-height: 1.5; margin: 0 0 18px; overflow-wrap: anywhere; }
.notice.error { border-color: #e6bbad; background: #fff5f1; color: #943e27; }
.progress-area { padding: 16px; border-radius: 12px; background: var(--card); margin: 0 0 20px; font-size: 12px; }
.progress-area > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.progress-area strong { font-weight: 500; }
progress { width: 100%; height: 9px; border: 0; accent-color: var(--green); display: block; margin-top: 8px; }
progress::-webkit-progress-bar { background: #dedede; border-radius: 8px; }
progress::-webkit-progress-value { background: var(--green); border-radius: 8px; }
progress::-moz-progress-bar { background: var(--green); }
/* Zuschnitt: ein gemeinsames Ausschnittfenster für Maus, Touch und Tastatur. */
.alignment-control { position: relative; margin-top: 20px; }
.crop-help-heading { position: absolute; top: 4px; right: 4px; z-index: 3; }
.alignment-preview-wrap { display: flex; justify-content: center; }
.alignment-crop-frame { position: relative; overflow: hidden; background: #ebebeb; max-width: 100%; width: 100%; }
.alignment-preview { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.alignment-preview.can-drag { cursor: grab; }
.alignment-preview.dragging { cursor: grabbing; }
.alignment-preview img { position: absolute; display: block; max-width: none; pointer-events: none; user-select: none; }
.crop-guide { position: absolute; inset: 0; pointer-events: none; border: 1px solid #ffffffb0; }
.alignment-preview.dragging .crop-guide { background: linear-gradient(to right, transparent 33.1%, #ffffff85 33.2%, #ffffff85 33.5%, transparent 33.6%, transparent 66.3%, #ffffff85 66.4%, #ffffff85 66.7%, transparent 66.8%), linear-gradient(to bottom, transparent 33.1%, #ffffff85 33.2%, #ffffff85 33.5%, transparent 33.6%, transparent 66.3%, #ffffff85 66.4%, #ffffff85 66.7%, transparent 66.8%); }
.crop-button { position: relative; width: 38px; height: 38px; border: 1px solid #d8d8d8; border-radius: 6px; background: #fffffff2; display: inline-grid; place-items: center; color: #555; padding: 8px; box-shadow: 0 1px 3px #0002; }
.crop-button:disabled { color: #b5b5b5; background: #ffffffc9; }
.crop-button svg { width: 20px; height: 20px; }
.crop-reset { position: absolute; left: 8px; bottom: 8px; }
.crop-zoom-buttons { position: absolute; bottom: 8px; right: 8px; display: flex; gap: 4px; }
.crop-slider { width: 65%; max-width: 300px; margin: 14px auto 0; }
.replace-main { display: flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; margin: 2px auto 0; }
.replace-main svg { width: 25px; height: 25px; }
/* Einzelbilder */
.thumbnail-card { margin-top: 14px; }
.image-count { text-align: center; font-size: 12px; margin: 0 0 18px; }
.image-count strong { color: var(--green-text); font-weight: 650; }
.thumbnail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.thumbnail-item { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: #f0f0f0; }
.thumbnail-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumbnail-item button { position: absolute; right: 3px; top: 3px; width: 30px; height: 30px; border: 1px solid #c4c4c4; border-radius: 6px; background: #fff; font-size: 23px; line-height: 1; padding: 0 0 2px; box-shadow: 0 1px 2px #0002; }
.image-list-footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; }
#more-thumbnails { display: block; margin: 14px auto 0; }
/* Ergebnis: Zoom verändert nur die Ansicht, nicht den Zuschnitt. */
.stage-wrap { display: flex; justify-content: center; margin: 20px 0 0; }
.preview-stage { overflow: auto; max-width: 100%; background: #f2f2f2; box-shadow: 0 2px 8px #0003; overscroll-behavior: contain; }
.artboard { position: relative; overflow: hidden; background: #fff; max-width: none; }
.artboard img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.artboard img { object-fit: fill; pointer-events: none; }
.artboard.original .tile-image { visibility: hidden; }
.preview-zoom { width: 65%; max-width: 300px; margin: 18px auto; text-align: center; }
.preview-zoom output { display: block; font-size: 12px; font-weight: 400; margin-top: 3px; color: var(--muted); }
.empty-state { padding: 35px 10px; text-align: center; font-size: 13px; }
.expert-entry { text-align: center; margin-top: 9px; }
.result-pending { margin: 18px 0; font-size: 12px; line-height: 1.5; text-align: center; }
.result-details { margin-top: 12px; font-size: 11px; line-height: 1.5; }
.result-details > summary { text-align: center; font-size: 11px; }
.result-details p { margin: 10px 0; }
.preview-toolbar { display: flex; flex-wrap: wrap; gap: 12px; }
.download-area { margin: 12px 0 0; text-align: center; }
.page-footer { text-align: center; margin-top: 18px; }
.page-footer .link-button { font-size: 11px; }
/* Einheitliche, gefüllte Regler mit markierten Stufen. */
input[type="range"] { --range-fill: 0%; appearance: none; -webkit-appearance: none; display: block; width: 100%; margin: 0; height: 30px; padding: 0; background: transparent; touch-action: pan-y; }
input[type="range"]::-webkit-slider-runnable-track { height: 5px; background: linear-gradient(to right, var(--green) var(--range-fill), #d9d9d9 var(--range-fill)); border-radius: 5px; }
input[type="range"]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 21px; height: 21px; border: 2px solid #fff; border-radius: 50%; background: var(--green); margin-top: -8px; box-shadow: 0 2px 3px #0003; }
input[type="range"]::-moz-range-track { height: 5px; background: #d9d9d9; border-radius: 5px; }
input[type="range"]::-moz-range-progress { height: 5px; background: var(--green); border-radius: 5px; }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border: 2px solid #fff; border-radius: 50%; background: var(--green); box-shadow: 0 2px 3px #0003; }
.step-ticks { display: flex; justify-content: space-between; padding: 0 10px; margin: -1px 0 7px; }
.step-ticks i { width: 6px; height: 6px; border-radius: 50%; background: #d9d9d9; }
.step-ticks i.selected { background: var(--green); }
.range-anchors { display: flex; justify-content: space-between; font-size: 12px; }
/* Nativer modaler Dialog: Hintergrund inert, kein Schließen per Backdrop/Escape. */
.expert-dialog { position: fixed; inset: 0; width: min(510px, calc(100% - 32px)); height: min(94vh, 1000px); height: min(94dvh, 1050px); max-width: none; max-height: none; padding: 0; margin: auto; border: 0; border-radius: 14px; background: white; color: var(--text); box-shadow: 0 8px 35px #0005; overflow: hidden; }
.expert-dialog::backdrop { background: rgb(0 0 0 / 72%); }
.dialog-layout { display: flex; flex-direction: column; height: 100%; }
.expert-heading { position: relative; display: flex; align-items: center; justify-content: center; padding: 30px 50px 17px; flex-shrink: 0; }
.expert-heading h2 { font-size: 25px; }
.close-button { position: absolute; right: 9px; top: 9px; width: 40px; height: 40px; border: 0; background: none; font-size: 29px; font-weight: 300; border-radius: 50%; color: #555; line-height: 1; }
.expert-body { flex: 1; overflow: auto; min-height: 0; padding: 0 26px 16px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#settings-fields { display: flex; flex-direction: column; gap: 18px; }
#settings-fields > .stepped-control, #settings-fields > .option-group, #settings-fields > .tile-size-group { position: relative; background: var(--card); border-radius: 10px; padding: 16px 20px; }
.range-heading { display: flex; justify-content: space-between; align-items: center; gap: 5px; margin: 0 0 10px; }
.heading-label, .control-heading { display: flex; align-items: center; gap: 6px; }
.control-heading { margin-bottom: 12px; }
.field-label { font-size: 13px; font-weight: 650; }
.range-heading output { color: var(--green-text); font-size: 13px; font-weight: 650; }
.info-button { border: 0; padding: 5px; background: transparent; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: #555; border-radius: 50%; }
.info-button[aria-expanded="true"] { background: #e8eedf; color: var(--green-text); }
.info-button svg { width: 22px; height: 22px; }
.info-dot { fill: currentColor; stroke: none; }
.crop-help-heading .info-button { background: #fffffff0; box-shadow: 0 1px 3px #0002; }
.info-panel { position: relative; padding: 13px 33px 13px 13px; margin: 8px 0 14px; border: 1px solid #d4dfc7; border-radius: 8px; background: #fff; color: #5d6d52; font-size: 12px; line-height: 1.55; }
.info-panel p { margin: 0 0 8px; }
.info-panel p:last-child { margin-bottom: 0; }
.info-close { position: absolute; right: 2px; top: 2px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: none; font-size: 22px; }
.tile-size-group > legend { float: left; width: 100%; padding: 0; margin-bottom: 14px; }
.tile-size-choices { clear: both; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tile-size-choices label { position: relative; cursor: pointer; }
.tile-size-choices input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tile-size-choices span { display: flex; align-items: center; justify-content: center; min-height: 46px; border: 1px solid #d6d6d6; border-radius: 10px; background: white; font-size: 13px; }
.tile-size-choices input:checked + span { border-color: var(--green); background: var(--green); color: white; font-weight: 650; }
.tile-size-choices input:focus-visible + span { outline: 3px solid #3b7429; outline-offset: 3px; }
.switch-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
input.switch-input { appearance: none; -webkit-appearance: none; position: relative; width: 55px; height: 30px; padding: 0; margin: 0; border: 1px solid #d6d6d6; border-radius: 20px; background: white; flex: 0 0 55px; }
input.switch-input::before { content: ''; position: absolute; top: 2px; left: 2px; width: 24px; height: 24px; border-radius: 50%; background: #818181; transition: transform .12s ease; }
input.switch-input:checked { background: var(--green); border-color: var(--green); }
input.switch-input:checked::before { transform: translateX(25px); background: white; }
#expert-reset { display: block; margin: 16px auto 0; }
.expert-actions { flex-shrink: 0; padding: 14px 26px max(16px, env(safe-area-inset-bottom)); background: #fff; box-shadow: 0 -8px 16px #fff; }
.pattern-example { margin-top: 12px; }
.pattern-example svg { display: block; width: 160px; height: auto; border: 1px solid var(--border); }
.pattern-example rect { stroke: white; stroke-width: .4; }
.pattern-example rect[data-kind="portrait"] { fill: #83a25b; }
.pattern-example rect[data-kind="landscape"] { fill: #c4d6ab; }
.pattern-example rect[data-kind="square"] { fill: #9bb779; }
@media (max-width: 640px) {
  .mosaic-studio { padding: 20px 20px 24px; }
  .step-navigation { margin-bottom: 20px; }
  .step-navigation button { font-size: 11.5px; min-height: 36px; }
  .step-card { padding: 22px 17px 18px; }
  .step-intro { margin-bottom: 16px; }
  h2 { font-size: 23px; }
  .dropzone { min-height: 222px; padding: 17px; }
  .upload-note { font-size: 10.5px; margin-top: 17px; margin-bottom: 18px; }
  .thumbnail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
  .thumbnail-card { padding-top: 20px; }
  .image-count { margin-bottom: 16px; }
  .expert-dialog { width: calc(100% - 16px); height: 100vh; height: 100dvh; margin: 0 auto; border-radius: 12px; }
  .expert-heading { padding-top: max(30px, env(safe-area-inset-top)); }
  .expert-body { padding: 0 18px 14px; }
  .expert-actions { padding-right: 18px; padding-left: 18px; }
  #settings-fields > .stepped-control, #settings-fields > .option-group, #settings-fields > .tile-size-group { padding: 13px 16px; }
}
@media (max-width: 359px) {
  .mosaic-studio { padding-left: 10px; padding-right: 10px; }
  .step-navigation button { font-size: 10px; padding-left: 0; padding-right: 0; }
  h2 { font-size: 21px; }
  .field-label, .range-heading output { font-size: 12px; }
  .expert-body { padding-left: 12px; padding-right: 12px; }
  .tile-size-choices { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
