:root {
  color-scheme: light;
  --bg: #faf9f7;
  --ink: #242725;
  --muted: #777a76;
  --line: #e8e8e3;
  --accent: #252b27;
  --soft: #f5f5f2;
  --radius: 15px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }

.app-shell { max-width: 1010px; margin: 0 auto; padding: 0 36px; }
.site-header { display: flex; align-items: center; justify-content: space-between; min-height: 83px; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 10px; align-items: center; font-size: 23px; font-weight: 760; letter-spacing: -1.35px; }
.brand-dot { color: #9da79e; }
.brand-mark { display: grid; place-items: center; color: #303c35; }
.privacy-label { display: flex; align-items: center; gap: 7px; color: #747b75; font-size: 12px; font-weight: 550; }

.page-intro { padding: 39px 0 29px; }
.eyebrow, .step-kicker { color: #8c928b; font-size: 10px; font-weight: 750; letter-spacing: 1.3px; }
.eyebrow { display: flex; align-items: center; gap: 10px; }
.eyebrow-line { height: 1px; width: 22px; background: #c7cdc5; }
h1, h2, p { margin: 0; }
h1 { margin-top: 13px; font-size: clamp(28px, 4vw, 38px); font-weight: 690; line-height: 1.16; letter-spacing: -1.65px; }
.page-intro p { margin-top: 10px; color: #797d78; font-size: 14px; line-height: 1.6; }

.settings-card, .preview-card { background: #fff; border: 1px solid #e8e9e4; border-radius: var(--radius); box-shadow: 0 3px 14px rgba(27, 36, 26, .025); overflow: hidden; }
.settings-card { padding: 26px 30px 25px; }
.section-heading, .preview-header { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
h2 { margin-top: 7px; font-size: 19px; font-weight: 685; line-height: 1.2; letter-spacing: -.55px; }
.section-note { font-size: 12px; color: #a0a19d; margin-bottom: 2px; }

.upload-zone { position: relative; margin-top: 22px; display: flex; align-items: center; gap: 16px; padding: 17px 20px; background: #fafbf9; border: 1.5px dashed #ccd3cb; border-radius: 11px; transition: background .15s, border-color .15s, box-shadow .15s; cursor: pointer; }
.upload-zone:hover, .upload-zone.is-dragging { background: #f2f6f0; border-color: #7e9382; }
.upload-zone:focus-within { outline: 3px solid #a7bca5; outline-offset: 2px; }
.upload-zone > input[type=file] { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-illustration, .upload-thumbnail { flex: 0 0 49px; height: 49px; width: 49px; border-radius: 9px; }
.upload-illustration { display: grid; place-items: center; background: #e8ede6; color: #6a796c; }
.upload-thumbnail { object-fit: cover; border: 1px solid #e0e2dd; }
.upload-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 5px; }
.upload-copy strong { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-browse { text-decoration: underline; text-underline-offset: 2px; }
.upload-copy small { color: #969993; font-size: 11px; }
.upload-action { color: #47544a; font-size: 12px; font-weight: 650; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.error-message { margin-top: 10px; color: #a33434; font-size: 12px; line-height: 1.5; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 22px; padding-top: 27px; }
.setting-field { min-width: 0; margin: 0; padding: 0; border: none; }
.setting-field legend { width: 100%; margin-bottom: 11px; padding: 0; font-size: 12px; font-weight: 675; }
.segments { display: flex; gap: 3px; width: 100%; padding: 4px; background: #f3f4f1; border: 1px solid #edeeeb; border-radius: 9px; }
.segment { position: relative; display: flex; flex: 1; min-width: 0; cursor: pointer; }
.segment input { position: absolute; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.segment span { display: grid; place-items: center; width: 100%; min-height: 44px; padding: 7px 4px; border-radius: 6px; color: #787d77; font-size: 11.5px; font-weight: 575; white-space: nowrap; text-align: center; transition: background .14s, color .14s, box-shadow .14s; }
.segment input:checked + span { color: #262e29; background: white; font-weight: 700; box-shadow: 0 1px 4px #1b2d1b15, 0 0 0 1px #e5e8e3; }
.segment input:focus-visible + span { outline: 2px solid #8ca78f; outline-offset: -2px; }

.fine-settings { display: grid; grid-template-columns: 1fr 1fr .8fr; align-items: start; gap: 27px; margin-top: 27px; padding-top: 25px; border-top: 1px solid #eff0eb; }
.range-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.range-heading label { font-size: 13px; font-weight: 675; }
.range-heading output { color: #536658; font-weight: 680; font-size: 12px; font-variant-numeric: tabular-nums; }
/* The range input itself occupies a full 44px touch area. The visible track
   remains thin, with a 28px draggable thumb on both WebKit and Firefox. */
input[type=range] {
  appearance: none; -webkit-appearance: none; display: block; width: 100%;
  height: 44px; padding: 0; margin: 6px 0 0;
  background: transparent; border: none; border-radius: 0;
  cursor: pointer; touch-action: pan-y; -webkit-tap-highlight-color: transparent;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, #435349 0%, #435349 var(--range-fill, 20%), #e6e9e3 var(--range-fill, 20%), #e6e9e3 100%);
}
input[type=range]::-moz-range-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(to right, #435349 0%, #435349 var(--range-fill, 20%), #e6e9e3 var(--range-fill, 20%), #e6e9e3 100%);
}
input[type=range]::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 28px; height: 28px;
  margin-top: -11px; border: 4px solid #fff; border-radius: 50%;
  background: #34443a; box-shadow: 0 0 0 1px #b7c2b7, 0 2px 6px #0003;
}
input[type=range]::-moz-range-thumb {
  width: 20px; height: 20px; border: 4px solid #fff; border-radius: 50%;
  background: #34443a; box-shadow: 0 0 0 1px #b7c2b7, 0 2px 6px #0003;
}
input[type=range]:focus-visible { outline: 2px solid #98b09d; outline-offset: 1px; border-radius: 8px; }
input[type=range]:active::-webkit-slider-thumb { box-shadow: 0 0 0 4px #c7d6c6, 0 2px 6px #0003; }
input[type=range]:active::-moz-range-thumb { box-shadow: 0 0 0 4px #c7d6c6, 0 2px 6px #0003; }
.range-ends { display: flex; justify-content: space-between; color: #90988e; font-size: 11px; }
.border-setting { padding: 0 0 0 9px; }
.check-row { display: flex; align-items: center; gap: 11px; min-height: 44px; cursor: pointer; }
.check-row input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: 0 0 23px; width: 23px; height: 23px; margin: 0; border: 1.4px solid #bac2b9; border-radius: 5px; background: white; cursor: pointer; }
.check-row input:checked { background-color: #35473b; border-color: #35473b; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='19' height='19' viewBox='0 0 19 19'%3E%3Cpath d='m4.6 9.7 3.3 3.3 6.5-6.7' fill='none' stroke='%23fff' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.check-row input:focus-visible { outline: 2px solid #98b09d; outline-offset: 3px; }
.check-label { display: flex; flex-direction: column; gap: 5px; }
.check-label strong { font-size: 12px; font-weight: 675; }
.check-label small { color: #a0a39d; font-size: 10px; }

.preview-card { margin-top: 23px; }
.preview-header { padding: 23px 30px 20px; }
.count-pill { align-self: center; border: 1px solid #e8ebe4; border-radius: 999px; padding: 7px 11px; background: #f8faf7; color: #68766c; font-size: 11px; font-weight: 620; white-space: nowrap; }
.preview-stage { min-height: 575px; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 28px 20px 22px; background: #f4f5f2; border-top: 1px solid #eff0ed; border-bottom: 1px solid #eff0ed; }
.paper-shadow { width: min(100%, 330px); box-shadow: 0 3px 7px rgba(21, 27, 21, .12), 0 15px 38px rgba(21, 27, 21, .12); background: white; }
.paper-shadow canvas { display: block; width: 100%; height: auto; }
.sheet-dimensions { margin-top: 20px; color: #878d86; font-size: 11px; letter-spacing: .05px; text-align: center; }
.dimensions-divider { padding: 0 5px; }
.export-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 20px 30px; }
.export-info { display: flex; flex-direction: column; gap: 5px; }
.export-info strong { font-size: 12px; font-weight: 690; }
.export-info span { color: #919690; font-size: 11px; }
.export-actions { display: flex; align-items: center; gap: 10px; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 9px; min-height: 48px; padding: 0 18px; border-radius: 8px; font-size: 12px; font-weight: 680; white-space: nowrap; transition: background .15s, transform .15s, border-color .15s; }
.button:not(:disabled):active { transform: translateY(1px); }
.button:focus-visible { outline: 3px solid #a7bca5; outline-offset: 2px; }
.button-secondary { color: #3d4840; border: 1px solid #dfe3dc; background: #fff; }
.button-secondary:not(:disabled):hover { background: #f7f9f6; border-color: #c6d0c5; }
.button-primary { background: #34453a; color: #fff; border: 1px solid #34453a; }
.button-primary:not(:disabled):hover { background: #26362b; }
.button:disabled { opacity: .43; }
.export-error { margin: 0 30px 12px; }
.print-note { padding: 11px 30px 14px; color: #a2a6a0; font-size: 10px; border-top: 1px solid #f2f2ef; }
.site-footer { display: flex; justify-content: space-between; gap: 16px; padding: 26px 0 35px; color: #aaa9a4; font-size: 11px; }
.footer-separator { padding: 0 3px; }

.print-note a { color: #3a5441; font-weight: 650; text-underline-offset: 3px; }
.print-note a[hidden] { display: none; }

@media (max-width: 800px) {
  .app-shell { padding: 0 24px; }
  .settings-card { padding: 24px; }
  .settings-grid { gap: 12px; }
  .fine-settings { gap: 17px; }
  .segments { padding: 3px; }
  .segment span { font-size: 11px; }
}
@media (max-width: 640px) {
  .app-shell { padding: 0 15px; }
  .site-header { min-height: 65px; }
  .privacy-label { font-size: 0; gap: 0; }
  .privacy-label svg { width: 17px; height: 17px; }
  .page-intro { padding: 29px 4px 24px; }
  h1 { letter-spacing: -1.1px; }
  .page-intro p { font-size: 13px; }
  .settings-card { padding: 21px 17px; }
  .section-note { display: none; }
  .upload-zone { gap: 11px; padding: 14px 12px; margin-top: 18px; }
  .upload-illustration, .upload-thumbnail { width: 41px; height: 41px; flex-basis: 41px; }
  .upload-action { display: none; }
  .upload-copy strong { font-size: 12px; }
  .upload-copy small { font-size: 10px; white-space: normal; }
  .settings-grid { grid-template-columns: 1fr; gap: 21px; padding-top: 24px; }
  .segment span { font-size: 12px; }
  .fine-settings { grid-template-columns: 1fr; gap: 13px; margin-top: 23px; padding-top: 21px; }
  .border-setting { padding: 4px 0 0; }
  .preview-card { margin-top: 16px; }
  .preview-header { padding: 21px 17px; }
  .count-pill { font-size: 10px; }
  .preview-stage { padding: 31px 18px 24px; min-height: 0; }
  .paper-shadow { width: min(100%, 280px); }
  .export-footer { padding: 18px 17px; flex-direction: column; align-items: stretch; gap: 16px; }
  .export-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .button { padding: 0 10px; }
  .print-note { padding: 12px 17px 14px; line-height: 1.6; }
  .mobile-print-help { display: block; margin-top: 6px; }
  .site-footer { padding: 21px 4px 28px; flex-direction: column; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

