:root {
  color-scheme: light;
  --bg: #f5f6f1;
  --white: #fff;
  --ink: #222a24;
  --muted: #58635b;
  --line: #dce1d8;
  --light: #edf0e9;
  --lime: #e8f28e;
  --teal: #d4e9e6;
  --green: #324437;
  --content: 76rem;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); font-size: 1rem; line-height: 1.55; }
a { color: inherit; text-underline-offset: .2em; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
input, select { min-width: 0; }
h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { line-height: 1.175; text-wrap: pretty; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid #45705a; outline-offset: 3px; }

.skip {
  position: fixed; top: .75rem; left: 1rem; z-index: 2; transform: translateY(-200%);
  padding: .6rem 1rem; border-radius: .375rem; background: var(--ink); color: white;
}
.skip:focus { transform: none; }

.site-header { border-bottom: 1px solid var(--line); background: var(--white); }
.header-inner, .container, .footer-inner { width: min(calc(100% - 4rem), var(--content)); margin-inline: auto; }
.header-inner { min-height: 4.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1.25rem; }
.brand { display: inline-flex; align-items: center; gap: .58rem; font-size: 1.26rem; font-weight: 780; letter-spacing: -.052em; text-decoration: none; white-space: nowrap; }
.brand-mark { width: 1.84rem; height: 1.84rem; display: grid; place-items: center; position: relative; border-radius: .49rem; background: var(--lime); }
.brand-mark::before { content: ""; width: .64rem; height: .82rem; border: 1.5px solid var(--ink); transform: translate(-2px, 2px); border-radius: 1.5px; }
.brand-mark::after { content: ""; position: absolute; width: .64rem; height: .82rem; border: 1.5px solid var(--ink); transform: translate(2px, -2px); border-radius: 1.5px; background: var(--lime); }
.site-header nav { display: flex; align-items: center; gap: .3rem; }
.site-header nav a, .language-link {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 2.5rem;
  padding: .45rem .84rem; border-radius: .55rem; color: var(--muted);
  font-size: .9rem; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.site-header nav a:hover, .site-header nav a.nav-active { color: var(--ink); background: var(--light); }
.language-link { border: 1px solid var(--line); color: var(--ink); }
.language-link:hover { background: var(--light); }

.container { min-height: 61vh; padding-bottom: 4.25rem; }
.hero { padding-block: 3.15rem 1.85rem; }
.hero-photo { display: grid; grid-template-columns: 1.22fr 1fr; gap: 2.2rem; align-items: center; padding-block: 2.35rem 1.65rem; }
.hero h1 { font-size: clamp(2.35rem, 5vw, 4.24rem); font-weight: 770; letter-spacing: -.066em; }
.hero p { margin-top: .88rem; color: var(--muted); font-size: clamp(1.02rem, 1.45vw, 1.144rem); max-width: 37rem; line-height: 1.62; }
[lang="ko"] .hero h1 { font-size: clamp(2.1rem, 4.35vw, 3.66rem); letter-spacing: -.064em; word-break: keep-all; }
[lang="ko"] .hero p { word-break: keep-all; }
.hero-image { aspect-ratio: 2.35; overflow: hidden; border-radius: .88rem; background: #273c31; }
.hero-image img { width: 100%; height: 100%; object-fit: cover; object-position: center 49%; }

.workspace { display: grid; grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); align-items: stretch; gap: 1.25rem; }
.panel { min-width: 0; background: var(--white); border: 1px solid var(--line); border-radius: .9rem; overflow: hidden; box-shadow: 0 2px 5px #25312306; }
.panel-heading { min-height: 4rem; display: flex; justify-content: space-between; align-items: center; gap: .65rem; border-bottom: 1px solid var(--line); padding: .9rem 1.25rem; }
.panel-heading h2 { font-size: 1.11rem; font-weight: 740; letter-spacing: -.025em; }
.text-button { padding: .35rem .15rem; border: 0; background: transparent; color: var(--muted); font-weight: 650; font-size: .86rem; }
.text-button:hover { color: var(--ink); text-decoration: underline; }
.form-body { padding: 1.15rem 1.25rem 1.25rem; }
.presets { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.pill { display: inline-flex; align-items: center; align-content: center; gap: .4rem; min-height: 2.14rem; padding: .25rem .64rem; color: var(--ink); background: #f7f8f4; border: 1px solid var(--line); border-radius: .42rem; white-space: nowrap; font-size: .875rem; font-weight: 560; }
.pill:hover { background: #edf1de; border-color: #b8c58e; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.field-row-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.paper-row { grid-template-columns: 1.2fr 1fr .59fr; }
#custom-paper { margin-top: .7rem; }
.field { min-width: 0; display: flex; flex-direction: column; gap: .32rem; }
.field-label, .arrangement > span:first-child { font-size: .875rem; font-weight: 650; color: #48534b; }
.number-field, .select { position: relative; min-width: 0; display: flex; width: 100%; align-items: center; }
.number-field input, .select select, #copy-value {
  width: 100%; height: 2.6rem; border: 1px solid #cdd6cb; border-radius: .45rem; background: #fff;
  padding: .42rem .66rem; font-weight: 550; font-variant-numeric: tabular-nums;
}
.number-field:has(.unit) input { padding-right: 2.55rem; }
.number-field input[type="number"] { appearance: textfield; }
.number-field input::-webkit-inner-spin-button, .number-field input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.unit { position: absolute; right: .66rem; color: var(--muted); font-size: .82rem; pointer-events: none; }
.select select { appearance: none; padding-right: 1.4rem; font-size: .93rem; cursor: pointer; text-overflow: ellipsis; }
.select::after { content: ""; position: absolute; right: .68rem; top: 44%; width: .4rem; height: .4rem; border-bottom: 1.4px solid #46574b; border-right: 1.4px solid #46574b; transform: rotate(45deg); pointer-events: none; }
.form-section { border-top: 1px solid var(--line); padding-top: .91rem; margin-top: .94rem; }
.form-section h3 { font-size: 1rem; font-weight: 720; margin-bottom: .65rem; letter-spacing: -.017em; }
.piece-heading { display: flex; align-items: center; justify-content: space-between; gap: .4rem; margin-bottom: .55rem; }
.piece-heading h3 { margin-bottom: 0; }
.radio-field { padding: 0; border: 0; margin: 0; min-width: 0; }
.radio-field legend {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
.segmented { display: inline-flex; gap: .16rem; padding: .14rem; border-radius: .45rem; background: var(--light); }
.segmented label { display: inline-flex; position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; pointer-events: none; }
.segmented span { display: inline-block; padding: .25rem .52rem; border-radius: .34rem; font-size: .875rem; color: var(--muted); font-weight: 640; }
.segmented input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px #25312320; }
.segmented input:focus-visible + span { outline: 2px solid #45705a; outline-offset: 2px; }
.field-help { color: var(--muted); margin-top: .5rem; font-size: .845rem; line-height: 1.5; }
.run-settings { border-top: 1px solid var(--line); margin-top: .97rem; padding-top: .72rem; }
.run-settings summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; font-weight: 670; }
.run-settings summary::-webkit-details-marker { display: none; }
.run-settings summary::after { content: ""; width: .42rem; height: .42rem; border-bottom: 1.5px solid; border-right: 1.5px solid; transform: rotate(45deg); margin: -.25rem .25rem 0; }
.run-settings[open] summary::after { transform: rotate(225deg); margin-top: .25rem; }
.run-settings .field-row { margin-top: .65rem; }
.form-error { margin-top: .75rem; color: #811d1d; border-radius: .4rem; background: #f9eeee; padding: .55rem .7rem; font-size: .91rem; }

.paper-tag { display: flex; align-items: center; gap: .45rem .55rem; flex-wrap: wrap; justify-content: flex-end; font-size: .83rem; color: var(--muted); text-align: right; }
.paper-tag strong { background: #eff2e9; color: var(--ink); padding: .14rem .45rem; border-radius: .33rem; font-size: .81rem; }
.preview-stage { padding: .35rem .9rem .72rem; background-color: #eef1ed; background-image: radial-gradient(#c8d1c7 1px, transparent 1px); background-size: 15px 15px; border-bottom: 1px solid var(--line); }
.preview-stage canvas { display: block; width: min(100%, 24rem); height: auto; margin-inline: auto; }
.preview-meta { display: flex; align-items: center; gap: .35rem .82rem; justify-content: flex-end; flex-wrap: wrap; color: var(--muted); font-size: .78rem; }
#preview-caption { margin-right: auto; font-weight: 575; }
.legend-item { display: inline-flex; align-items: center; gap: .31rem; white-space: nowrap; }
.legend-item i { width: .73rem; height: .73rem; border-radius: .12rem; display: inline-block; }
.legend-trim { background: var(--lime); border: 1px solid #87934b; }
.legend-rotated { background: var(--teal); border: 1px solid #56877d; }
.legend-bleed { border: 1px dashed #6d7e4e; background: #fdfdf7; }
.result-body { padding: .88rem 1.25rem 1.05rem; }
.arrangement { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .7rem; }
.arrangement .select { width: min(64%, 14.5rem); }
.arrangement select { height: 2.12rem; font-size: .875rem; }
.result-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: .54rem; overflow: hidden; }
.result-metrics > div { min-width: 0; display: grid; align-content: center; gap: .13rem; padding: .59rem .65rem .53rem; background: #fbfcfa; }
.result-metrics > div:first-child { background: #f1f6d7; }
.result-metrics > div + div { border-left: 1px solid var(--line); }
.result-metrics span { font-size: .835rem; color: var(--muted); }
.result-metrics strong { font-size: clamp(1.05rem, 2.4vw, 1.64rem); font-weight: 760; font-variant-numeric: tabular-nums; line-height: 1.2; letter-spacing: -.034em; overflow-wrap: anywhere; }
.result-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }
.button {
  display: inline-flex; justify-content: center; align-items: center; gap: .55rem;
  min-height: 2.65rem; padding: .42rem .88rem; border: 1px solid transparent; border-radius: .5rem;
  font-size: .9rem; font-weight: 660; text-decoration: none;
}
.button-dark { background: #263a2d; color: #fff; border-color: #263a2d; }
.button-dark:hover:not(:disabled) { background: #3a5240; border-color: #3a5240; }
.button-outline { background: #fff; border-color: #cbd6cc; color: var(--ink); }
.button-outline:hover:not(:disabled) { background: #f0f3eb; border-color: #b0bdab; }
.mobile-result-link { display: none; }
.notice { font-size: .875rem; color: #42604a; margin-top: .48rem; }
.notice:empty { display: none; }

.secondary-workspace { max-width: 65rem; }
.secondary-workspace .presets { margin: 1rem 0 0; }
.output-panel .panel-heading .icon { color: #54725b; }
.dimension-list { margin: 0 0 .9rem; }
.dimension-list > div { display: flex; justify-content: space-between; align-items: baseline; gap: .7rem; padding: .53rem 0; border-bottom: 1px solid var(--line); }
.dimension-list dt { color: var(--muted); font-weight: 580; font-size: .925rem; }
.dimension-list dd { margin: 0; font-weight: 690; font-variant-numeric: tabular-nums; text-align: right; }
.dimension-list .major-result { display: grid; gap: .2rem; padding: .65rem .8rem; margin-bottom: .35rem; color: var(--green); background: #f0f5d9; border: 0; border-radius: .55rem; }
.dimension-list .major-result dd { font-size: clamp(1.35rem, 3vw, 2rem); text-align: left; letter-spacing: -.04em; }
.bleed-preview { display: flex; align-items: center; gap: 1rem; min-height: 8rem; margin: .35rem 0 .8rem; padding: .7rem .85rem; background: var(--light); border-radius: .48rem; }
.diagram {
  position: relative; height: 6.75rem; width: min(48%, calc(6.75rem * var(--page-shape, .7129)));
  border: 1px dashed #6d7e4e; background: #fcfdf5;
}
.trim-box { position: absolute; inset: var(--bleed-y, 1%) var(--bleed-x, 1.4%); border: 1.5px solid #87934b; background: var(--lime); }
.safe-box { position: absolute; inset: var(--safe-y, 2.65%) var(--safe-x, 3.7%); border: 1px solid #56877d; background: var(--teal); }
.bleed-legend { display: grid; gap: .25rem; color: var(--muted); font-size: .86rem; }

.comparison, .reading-grid, .link-section { margin-top: 2.45rem; }
.section-heading { display: grid; gap: .4rem; margin-bottom: .85rem; }
.section-heading h2, .link-section h2, .prose h2 { font-size: 1.48rem; font-weight: 750; letter-spacing: -.036em; }
.section-heading p { color: var(--muted); font-size: .96rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: .72rem; background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; font-variant-numeric: tabular-nums; }
th, td { padding: .71rem .95rem; text-align: left; white-space: nowrap; }
thead th { color: #475749; background: #eff2ea; font-weight: 690; }
tbody th { font-weight: 620; }
tbody tr + tr { border-top: 1px solid #e7ece5; }
tbody td { color: var(--muted); }
.selected-row { background: #f6f8ea; }
.selected-row td, .selected-row th { color: var(--ink); }
.reading-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 1.7rem; align-items: start; }
.prose { max-width: 46rem; color: #445149; line-height: 1.68; overflow-wrap: anywhere; }
.prose h2, .prose h3 { color: var(--ink); }
.prose p { margin-top: .7rem; }
.prose section + section { margin-top: 1.55rem; }
.prose a:not(.button), .related-guide a { text-decoration-color: #748d75; }
.prose .button { margin-top: 1.35rem; }
.related-guide { padding: 1.05rem 1.15rem; border: 1px solid #d6e0ce; border-radius: .65rem; background: #edf2e7; }
.section-label { font-size: .82rem; color: var(--muted); font-weight: 660; }
.related-guide h3 { font-size: 1.18rem; margin: .45rem 0; font-weight: 720; }
.related-guide > p:last-child { color: var(--muted); font-size: .93rem; }
.link-grid, .guide-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.link-grid { margin-top: .75rem; }
.guide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.link-card { background: #fff; border: 1px solid var(--line); border-radius: .72rem; padding: 1rem 1.1rem; text-decoration: none; }
.link-card:hover { border-color: #91a68e; background: #fbfcf6; }
.link-card > .icon { margin-bottom: .45rem; color: #527358; font-size: 1.18rem; }
.link-card h2, .link-card h3 { font-size: 1.15rem; letter-spacing: -.021em; }
.link-card p { margin-top: .42rem; color: var(--muted); font-size: .93rem; }
.article { max-width: 51rem; margin-inline: auto; }
.article .hero h1 { font-size: clamp(2rem, 4.8vw, 3.64rem); }
.article .hero p { max-width: 45rem; }
.breadcrumb { display: inline-block; color: var(--muted); margin-top: 2rem; font-size: .9rem; font-weight: 640; }
.breadcrumb + .hero { padding-top: .68rem; }
.references { margin-top: 1.35rem; }
.references h2 { font-size: 1.05rem; }
.references ul { font-size: .9rem; margin: .45rem 0 0; padding-left: 1.25rem; }

.site-footer { border-top: 1px solid var(--line); background: #edf0e9; padding-block: 1.45rem; }
.footer-inner { display: flex; justify-content: space-between; gap: .8rem 2rem; align-items: center; flex-wrap: wrap; }
.footer-inner p { color: var(--muted); font-size: .86rem; margin-top: .25rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .89rem; font-weight: 630; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }

dialog { width: min(28rem, calc(100% - 2rem)); padding: 1.15rem; border-radius: .7rem; border: 1px solid var(--line); box-shadow: 0 10px 30px #142d2630; }
dialog::backdrop { background: #1c292170; }
dialog input, dialog button { margin-top: .65rem; }

.icon { width: 1em; height: 1em; display: inline-block; flex: none; position: relative; vertical-align: -.12em; }
.icon::before, .icon::after { position: absolute; display: block; }
.icon-layout::before, .icon-paper::before, .icon-bleed::before {
  content: ""; border: 1.4px solid currentColor; border-radius: .11em; inset: .05em .12em;
}
.icon-layout::after, .icon-bleed::after { content: ""; border: 1px dashed currentColor; inset: .23em .28em; }
.icon-paper::after { content: ""; left: .31em; width: .38em; top: .37em; height: .25em; border-block: 1px solid currentColor; }
.icon-label::before, .icon-card::before { content: ""; border: 1.3px solid currentColor; border-radius: .16em; inset: .22em .04em; opacity: .73; }
.icon-card::after { content: ""; left: .22em; right: .22em; top: .49em; border-top: 1px solid currentColor; }
.icon-circle::before { content: ""; border: 1.3px solid currentColor; border-radius: 50%; inset: .09em; opacity: .73; }
.icon-globe::before { content: ""; border: 1px solid currentColor; border-radius: 50%; inset: .04em; }
.icon-globe::after { content: ""; border: 1px solid currentColor; border-radius: 50%; inset: .04em .31em; }
.icon-download::before { content: ""; border-left: 1.4px solid currentColor; height: .6em; left: .49em; top: .02em; }
.icon-download::after { content: ""; border: 1.3px solid currentColor; border-top: 0; border-radius: 0 0 .15em .15em; inset: .54em .07em .05em; }
.icon-link::before, .icon-link::after { content: ""; width: .64em; height: .36em; border: 1px solid currentColor; border-radius: .3em; transform: rotate(-40deg); }
.icon-link::before { left: .01em; top: .52em; }
.icon-link::after { right: .01em; top: .15em; }

@media (max-width: 65rem) {
  .hero-photo { grid-template-columns: 1.35fr 1fr; gap: 1.25rem; }
  .hero h1 { font-size: clamp(2.2rem, 5.25vw, 3.5rem); }
  .form-body, .panel-heading, .result-body { padding-inline: .95rem; }
  .paper-row { grid-template-columns: minmax(0, 1.16fr) minmax(0, 1fr) minmax(0, .65fr); }
}
@media (max-width: 49rem) {
  .header-inner, .container, .footer-inner { width: min(calc(100% - 2rem), var(--content)); }
  .header-inner { gap: .55rem; }
  .site-header nav { gap: .06rem; }
  .site-header nav a { padding-inline: .45rem; font-size: .85rem; }
  .hero { padding-block: 2.15rem 1.35rem; }
  .hero-photo { grid-template-columns: 1.2fr 1fr; gap: 1rem; }
  .workspace, .reading-grid { grid-template-columns: minmax(0, 1fr); }
  .mobile-result-link { display: inline-flex; margin-bottom: .85rem; }
  .guide-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-stage canvas { width: min(100%, 24rem); }
}
@media (max-width: 33rem) {
  .header-inner { display: grid; grid-template-columns: 1fr auto; padding-top: .55rem; }
  .header-inner .language-link { grid-area: 1 / 2; }
  .site-header nav { grid-column: 1 / -1; gap: .17rem; padding-bottom: .42rem; overflow-x: auto; }
  .site-header nav a { min-height: 2.16rem; padding-inline: .56rem; }
  .hero-photo { display: flex; flex-direction: column; align-items: stretch; gap: 1rem; }
  .hero-photo .hero-image { aspect-ratio: 3.3; }
  .hero h1 { font-size: clamp(2.05rem, 9vw, 2.95rem); }
  .hero p { margin-top: .62rem; }
  .workspace { gap: .85rem; }
  .link-grid { grid-template-columns: minmax(0, 1fr); }
  th, td { padding: .65rem .68rem; }
  .result-metrics strong { font-size: 1.42rem; }
}
@media (max-width: 22rem) {
  .paper-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-actions .button { width: 100%; }
  .panel-heading { flex-wrap: wrap; }
  .paper-tag { justify-content: flex-start; }
}
