@font-face {
  font-family: 'TerrarumSansBitmap';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/2606-1@1.1/TerrarumSansBitmap.woff2') format('woff2');
  font-style: normal;
  font-weight: normal;
  font-display: swap;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  color-scheme: light;
  --page: #f3f4ef; --surface: #fffefb; --input: #ffffff; --ink: #252b20; --muted: #626b59;
  --olive: #3c4e2b; --on-accent: #ffffff; --line: #d8ddcf; --line-strong: #c1c9b6;
  --subtle: #ecefe7; --selected: #e0e8d4; --stage: #e8ebe2; --focus: #526a3b;
  --disabled-bg: #e2e6dc; --disabled-ink: #727a69; --print-shadow: #252b2029; --menu-shadow: #1b251826;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #151a13; --surface: #20251e; --input: #181d16; --ink: #edf1e7; --muted: #aebaa3;
  --olive: #b5c995; --on-accent: #1a2411; --line: #3c4537; --line-strong: #505c47;
  --subtle: #2c3426; --selected: #3b492d; --stage: #10150e; --focus: #c1d7a0;
  --disabled-bg: #2d3428; --disabled-ink: #85937a; --print-shadow: #00000066; --menu-shadow: #00000055;
}
body { margin: 0; font-size: 20px; font-family: 'TerrarumSansBitmap', system-ui, "Malgun Gothic", sans-serif; color: var(--ink); background: var(--page); }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.site-footer { margin-top: auto; padding: 30px 20px 26px; text-align: center; color: var(--muted); }
.site-footer::before { content: ""; display: block; width: 28px; height: 1px; margin: 0 auto 15px; background: var(--line-strong); }
.footer-credit { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 5px 8px; margin: 0; font-size: 16px; line-height: 1.7; }
.footer-made { font-size: 14px; letter-spacing: .08em; color: var(--muted); }
.footer-credit strong { margin-left: 3px; font-weight: 650; color: var(--olive); }
.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; }
.masthead { background: var(--surface); }
.theme-toggle { width: 40px; height: 40px; flex: none; margin: 0; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 3px; color: var(--ink); background: transparent; }
.theme-toggle:hover { background: var(--subtle); border-color: var(--line-strong); }
.theme-toggle svg { flex: none; }
.theme-icon-sun { display: none; }
[data-theme="dark"] .theme-icon-sun { display: block; }
[data-theme="dark"] .theme-icon-moon { display: none; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.05em; }
.brand-icon { display: block; width: 24px; height: 24px; object-fit: contain; flex: none; }
.eyebrow { font-size: 15px; font-weight: 750; letter-spacing: .2em; color: var(--muted); }
.template-filters { margin-bottom: 20px; padding: 16px 20px; }
.field-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.field-chips label { display: flex; align-items: center; gap: 6px; margin: 0; padding: 7px 10px; background: var(--subtle); border-radius: 3px; cursor: pointer; font-weight: 500; }
.field-chips input { width: 14px; min-height: auto; accent-color: var(--olive); }
.field-chips label:has(input:checked) { background: var(--selected); color: var(--ink); }
.filter-actions { display: flex; align-items: center; gap: 18px; margin-top: 10px; font-size: 17px; }
.filter-actions button { width: auto; margin: 0; padding: 8px 14px; }
.template-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
.template-tags span { font-size: 14px; color: var(--muted); background: var(--subtle); border-radius: 2px; padding: 3px 6px; }
.design-shell { width: min(100% - 32px, 1320px); padding-bottom: 40px; }
.design-upload-fields { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 14px; }
#template-upload-progress { width: 100%; accent-color: var(--olive); margin-top: 12px; }
.template-list-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; font-size: 17px; }
.template-list-actions button { width: auto; padding: 7px 12px; margin: 0; }
.design-topbar { display: flex; align-items: end; flex-wrap: wrap; gap: 14px; }
.design-topbar > div:first-child { flex: 1; min-width: 190px; }
.design-topbar button { width: auto; margin: 0; }
.design-workspace { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(260px, 1fr); gap: 20px; margin-block: 20px; align-items: start; }
.design-toolbar { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 12px; }
.design-toolbar h2 { margin: 0; }
.design-toolbar button { width: auto; margin: 0; white-space: nowrap; }
.design-canvas { position: relative; width: 100%; border: 1px solid var(--line); background: white; overflow: hidden; }
.design-canvas > img { width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
#design-boxes { position: absolute; inset: 0; pointer-events: none; }
.design-box { position: absolute; border: 1px dashed #6a784f; background: #71864c12; cursor: move; touch-action: none; pointer-events: auto; }
.design-box[aria-pressed="true"] { border: 2px solid #44651f; background: #819b5725; z-index: 1; }
.design-box-label { position: absolute; top: 0; left: 0; max-width: 100%; background: #40572c; color: white; padding: 1px 4px; font-size: 14px; line-height: 1.5; white-space: nowrap; pointer-events: none; }
.design-resize { position: absolute; width: 13px; height: 13px; right: -2px; bottom: -2px; background: #40572c; border: 2px solid white; cursor: se-resize; }
.region-list { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 14px; }
.region-list button { width: auto; padding: 6px 10px; margin: 0; font-size: 16px; background: var(--subtle); color: var(--olive); }
.region-list button[aria-pressed="true"] { background: var(--olive); color: var(--on-accent); }
#region-inspector { border: 0; padding: 0; min-width: 0; }
#region-inspector > label { margin-top: 12px; }
.design-properties { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.design-background-settings { margin-top: 18px; font-size: 17px; }
.design-background-settings summary { cursor: pointer; }
.design-background-settings input { margin-top: 10px; }
.design-preview-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.design-busy > :not(#design-status) { pointer-events: none; opacity: .7; }
.font-library { margin-block: 28px 40px; }
.font-upload-fields { display: grid; grid-template-columns: 1fr 1.5fr; gap: 16px; }
.font-list { display: grid; gap: 18px; margin-top: 16px; }
.font-card-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.font-title, .font-card-heading .tip { overflow-wrap: anywhere; }
.font-preview { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: 3px; margin-block: 14px; background: white; }
.font-sample-form button { width: auto; }
.font-management { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.font-actions { display: flex; gap: 10px; }
.font-actions button { width: auto; }
#font-upload-progress { width: 100%; margin-top: 12px; accent-color: var(--olive); }
@media (max-width: 760px) { .font-upload-fields { grid-template-columns: minmax(0, 1fr); } .font-card-heading { flex-wrap: wrap; } }
@media (max-width: 760px) {
  .design-workspace, .design-upload-fields, .design-preview-layout { grid-template-columns: minmax(0, 1fr); }
  .design-topbar { align-items: center; }
}
.intro { padding: 44px 0 32px; }
.intro h1 { margin: 8px 0 10px; font-size: clamp(32px, calc(5vw + 4px), 50px); letter-spacing: -.075em; line-height: 1.18; font-weight: 800; }
.intro > p:last-child { color: var(--muted); font-size: 19px; 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: 6px; background: var(--surface); padding: 24px; min-width: 0; }
button, input, select, textarea, .template-card { transition: border-color .15s ease, background-color .15s ease; }
input[type="checkbox"], progress { accent-color: var(--olive); }
button:not(:disabled):active { opacity: .85; }
h2 { font-size: 20px; font-weight: 750; margin: 0 0 16px; }
h2 span { color: var(--muted); font-size: 16px; margin-right: 8px; }
label { font-size: 17px; font-weight: 650; display: block; margin-bottom: 5px; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; min-width: 0; min-height: 44px; background: var(--input); border: 1px solid var(--line-strong); border-radius: 4px; padding: 7px 10px; }
.paired { margin-top: 11px; }
textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--focus); 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: var(--subtle); padding: 4px 8px; border-radius: 2px; font-size: 15px; font-weight: 750; }
.paper { display: grid; place-items: center; min-height: 286px; background: var(--stage); border-radius: 3px; padding: 22px; }
.paper img { width: auto; height: auto; max-width: 100%; max-height: 250px; box-shadow: 0 3px 12px var(--print-shadow); }
.paper p, .spec, .tip, #status { font-size: 17px; 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: 4px; padding: 12px 15px; margin-top: 14px; background: var(--olive); color: var(--on-accent); cursor: pointer; font-weight: 700; }
button:disabled { background: var(--disabled-bg); color: var(--disabled-ink); 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: 17px; font-weight: 650; text-underline-offset: 3px; }
.format-tabs { display: flex; flex-wrap: wrap; gap: 0; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.gallery-main { padding-top: 24px; }
.format-tabs a { border: 0; border-bottom: 2px solid transparent; padding: 12px 16px; margin-bottom: -1px; color: var(--muted); text-decoration: none; font-size: 18px; font-weight: 650; }
.format-tabs a[aria-current="page"] { border-bottom-color: var(--olive); color: var(--ink); }
.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: var(--olive); }
.template-caption { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.template-caption span, .section-note { color: var(--muted); font-size: 17px; }
.edit-stack { display: grid; gap: 16px; min-width: 0; }
#editor > :is(select, input:not([type="hidden"]), textarea, .paired, .roaster-picker) + label { margin-top: 11px; }
.roaster-picker { position: relative; }
.roaster-picker summary { border: 1px solid var(--line); border-radius: 4px; background: var(--input); padding: 8px 11px; cursor: pointer; }
.roaster-picker summary span { margin-left: 5px; }
.roaster-menu { position: absolute; z-index: 2; inset: calc(100% + 4px) 0 auto; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); padding: 8px; box-shadow: 0 6px 16px var(--menu-shadow); }
.roaster-options { max-height: 220px; overflow: auto; margin-top: 6px; }
.roaster-option { justify-content: flex-start; align-items: center; gap: 10px; margin: 0; min-height: 40px; padding: 6px 9px; background: var(--surface); color: var(--ink); font-weight: 500; }
.roaster-option:hover, .roaster-option[aria-pressed="true"] { background: var(--subtle); }
.roaster-option img { flex: 0 0 48px; width: 48px; height: 24px; object-fit: contain; }
.roaster-option img, .admin-roasters img { background: #ffffff; padding: 2px; border-radius: 2px; }
.admin-form { max-width: 440px; }
.admin-form > input + label { margin-top: 11px; }
.admin-checkbox { display: flex; align-items: center; gap: 8px; }
.admin-checkbox input { width: auto; min-height: auto; }
.admin-roasters { display: grid; gap: 10px; padding: 0; }
.admin-roasters li { display: flex; align-items: center; gap: 10px; }
.admin-roasters img { width: 48px; height: 24px; object-fit: contain; }
#roaster-progress { margin-top: 12px; }
#upload-progress { width: 100%; accent-color: var(--olive); }
.roaster-name-field { flex: 1; min-width: 0; }
.roaster-row-actions { display: flex; gap: 5px; }
.roaster-row-actions button { width: auto; margin: 0; padding: 7px 9px; font-size: 17px; white-space: nowrap; }
#upload-errors { margin-top: 10px; padding-left: 18px; list-style: disc; overflow-wrap: anywhere; }
.section-note { margin: 0 0 12px; line-height: 1.5; }
.key-settings { border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; margin-bottom: 14px; font-size: 17px; }
.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: var(--subtle); color: var(--olive); }
#import-status { color: var(--muted); font-size: 17px; margin: 10px 0 0; }
#import-status:empty { display: none; }
.import-result { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.usage-shell { width: min(100% - 32px, 1320px); padding-bottom: 40px; }
.usage-filters { display: grid; grid-template-columns: 1fr 1fr 2fr 1.3fr auto; gap: 12px; align-items: end; }
.usage-filters button { margin: 0; }
.usage-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-block: 18px; }
.usage-summary .panel { border-radius: 4px; }
.usage-summary span, .usage-summary small { display: block; color: var(--muted); font-size: 17px; }
.usage-summary strong { display: block; margin-block: 8px; font-size: 29px; }
.usage-table-wrap { padding: 16px; overflow-x: auto; }
.usage-table { width: 100%; min-width: 880px; border-collapse: collapse; text-align: left; font-size: 17px; }
.usage-table caption { text-align: left; }
.usage-table th, .usage-table td { padding: 14px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.usage-table small, .usage-table strong { display: block; margin-bottom: 5px; }
.usage-table small { color: var(--muted); font-size: 15px; }
.usage-table details { margin-top: 6px; max-width: 220px; }
.usage-table summary { cursor: pointer; }
.usage-id { display: block; max-width: 240px; overflow-wrap: anywhere; font-size: 15px; margin-top: 6px; }
.usage-pagination { display: flex; gap: 20px; justify-content: center; margin-top: 20px; font-size: 18px; }
@media (max-width: 760px) {
  .usage-filters { grid-template-columns: 1fr 1fr; }
  .usage-summary { grid-template-columns: 1fr; }
}
#import-fields { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; font-size: 17px; 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); }
}
