* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root { color-scheme: light; --ink: #262820; --olive: #373f2c; --line: #deded2; --muted: #626356; }
body { margin: 0; font-family: system-ui, "Malgun Gothic", sans-serif; color: var(--ink); background: #f6f5ee; }
.shell { width: min(100% - 40px, 1050px); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); }
.masthead-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; }
.brand { font-weight: 800; letter-spacing: -.05em; }
.brand-mark { margin-right: .35rem; color: #566142; }
.edition, .eyebrow { font-size: 11px; font-weight: 750; letter-spacing: .2em; color: #566142; }
.intro { padding: 44px 0 32px; }
.intro h1 { margin: 8px 0 10px; font-size: clamp(28px, 5vw, 46px); letter-spacing: -.075em; line-height: 1.18; font-weight: 800; }
.intro > p:last-child { color: var(--muted); font-size: 15px; margin: 0; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 24px; padding-bottom: 48px; }
.panel { border: 1px solid var(--line); border-radius: 16px; background: #fffefa; padding: 24px; min-width: 0; }
h2 { font-size: 16px; font-weight: 750; margin: 0 0 16px; }
h2 span { color: #677052; font-size: 12px; margin-right: 8px; }
label { font-size: 13px; font-weight: 650; display: block; margin-bottom: 5px; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; min-width: 0; min-height: 40px; background: #fff; border: 1px solid #d8d8cb; border-radius: 7px; padding: 7px 10px; }
.paired { margin-top: 11px; }
textarea { resize: vertical; }
:focus-visible { outline: 2px solid #576645; outline-offset: 2px; }
.preview { position: sticky; top: 18px; }
.preview-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.preview-header h2 { margin: 0; }
.badge { color: var(--olive); background: #edf0e5; padding: 4px 8px; border-radius: 5px; font-size: 11px; font-weight: 750; }
.paper { display: grid; place-items: center; min-height: 286px; background: #ecebe1; border-radius: 9px; padding: 22px; }
.paper img { width: auto; height: auto; max-width: 100%; max-height: 250px; box-shadow: 0 3px 12px #28261928; }
.paper p, .spec, .tip, #status { font-size: 13px; color: var(--muted); }
.spec { margin-top: 12px; font-variant-numeric: tabular-nums; }
#status:empty { display: none; }
button { width: 100%; display: flex; justify-content: space-between; border: 0; border-radius: 7px; padding: 12px 15px; margin-top: 14px; background: var(--olive); color: white; cursor: pointer; font-weight: 700; }
button:disabled { background: #deded2; color: #525448; cursor: default; }
.tip { margin: 10px 0 0; line-height: 1.6; }
@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
}
@media (max-width: 430px) {
  .panel { padding: 16px; }
}
a.brand { color: inherit; text-decoration: none; }
.back-link { display: inline-block; color: var(--olive); font-size: 13px; font-weight: 650; text-underline-offset: 3px; }
.format-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.format-tabs a { border: 1px solid var(--line); background: #fffefa; padding: 9px 14px; border-radius: 7px; color: var(--olive); text-decoration: none; font-size: 14px; font-weight: 650; }
.format-tabs a[aria-current="page"] { background: var(--olive); border-color: var(--olive); color: white; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding-bottom: 40px; }
.template-card { display: block; text-decoration: none; color: var(--ink); }
.template-card:hover { border-color: #657451; }
.template-caption { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.template-caption span, .section-note { color: var(--muted); font-size: 13px; }
.edit-stack { display: grid; gap: 16px; min-width: 0; }
#editor > :is(select, input:not([type="hidden"]), textarea, .paired) + label { margin-top: 11px; }
.section-note { margin: 0 0 12px; line-height: 1.5; }
.key-settings { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-size: 13px; }
.key-settings summary { font-weight: 700; cursor: pointer; }
.key-settings summary span { margin-left: 5px; color: var(--muted); font-weight: 450; }
.key-settings form { padding-top: 10px; }
.key-settings .section-note { margin: 6px 0 0; }
.key-actions { display: flex; gap: 8px; }
.secondary { background: #edf0e5; color: var(--olive); }
#import-status { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
#import-status:empty { display: none; }
.import-result { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
#import-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; font-size: 13px; margin: 0; }
#import-fields dt { font-weight: 700; }
#import-fields dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .gallery { grid-template-columns: minmax(0, 1fr); }
}