:root {
  color-scheme: light;
  --ink: #202e29;
  --muted: #5b6660;
  --forest: #213d33;
  --forest-dark: #172e26;
  --paper: #f5f2eb;
  --line: #dedfd6;
  --green-wash: #ebf0e8;
  --cedar: #e6aa79;
  --error: #8a3523;
  font: 16px/1.5 system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid #a05b30; outline-offset: 3px; }
h1, h2, h3, p, dl, figure { margin: 0; }
fieldset { min-width: 0; padding: 0; border: 0; margin: 0; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.shell { width: min(100% - 48px, 1120px); margin-inline: auto; }
.site-header { color: #f8f4e8; background: var(--forest-dark); }
.header-inner { min-height: 63px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand, .header-link { display: inline-flex; align-items: center; min-height: 44px; }
.brand { gap: 10px; text-decoration: none; font-weight: 720; }
.brand-mark {
  width: 26px;
  height: 22px;
  display: flex;
  justify-content: space-evenly;
  padding: 3px 1px;
  color: var(--cedar);
  border: 1px solid currentColor;
  border-radius: 3px;
}
.brand-mark i { width: 2px; height: 100%; background: currentColor; }
.header-link { color: #e6eade; text-underline-offset: 4px; font-size: .9rem; }

.hero { background: var(--forest); color: #fbf5e8; }
.hero-inner {
  min-height: 224px;
  padding-block: 42px 44px;
  display: grid;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) 27%;
  gap: clamp(24px, 5vw, 68px);
}
h1 {
  max-width: 760px;
  font: 500 clamp(2.5rem, 5.6vw, 4.35rem)/1.02 Georgia, serif;
  letter-spacing: -.055em;
}
.hero p { margin-top: 14px; max-width: 55ch; color: #e0e6da; font-size: clamp(1rem, 2vw, 1.11rem); }
.wall-study {
  position: relative;
  height: 116px;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  padding: 5px;
  margin: 2px 4px 0 0;
  border-block: 1px solid #e3d3b67a;
  background: repeating-linear-gradient(0deg, #d6dcc609 0 1px, transparent 1px 18px);
}
.wall-study i { width: 9px; background: #e7ae7a; opacity: .83; border-radius: 1px; }
.wall-study span {
  position: absolute;
  inset: 57% 47% auto auto;
  width: 18px;
  height: 13px;
  border: 1px dashed #f3ceaa;
  border-radius: 2px;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 20px;
  align-items: start;
  margin-block: 26px 38px;
}
.panel { padding: clamp(17px, 2.4vw, 28px); background: #fffefa; border: 1px solid var(--line); border-radius: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 15px; flex-wrap: wrap; }
h2 { font-size: clamp(1.23rem, 2.25vw, 1.55rem); letter-spacing: -.03em; line-height: 1.2; }
h3 { font-size: 1.03rem; font-weight: 720; }

.mode-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 3px;
  margin-bottom: 17px;
  background: #f2f2ec;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.mode-picker label { position: relative; }
.mode-picker input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.mode-picker span {
  display: grid;
  min-height: 44px;
  place-items: center;
  text-align: center;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: .9rem;
  font-weight: 650;
  color: #4b5650;
}
.mode-picker input:hover + span { background: #e5eae0; }
.mode-picker input:checked + span { color: #fff; background: var(--forest); }
.mode-picker input:focus-visible + span { outline: 3px solid #a05b30; outline-offset: 1px; }

.fields, .outlet-row { display: grid; gap: 12px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields + .fields { margin-top: 12px; }
.fields label, .outlet-row label, #copy-fallback label { display: grid; gap: 5px; min-width: 0; font-size: .9rem; font-weight: 650; }
.measure { display: block; position: relative; }
.measure input, textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #adb8ad;
  border-radius: 7px;
  font: 400 1rem/1.4 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.measure input { padding-right: 38px; }
.measure > span { position: absolute; top: 50%; right: 11px; transform: translateY(-50%); color: var(--muted); font-weight: 500; pointer-events: none; }
input[aria-invalid="true"] { border-color: var(--error); }
.field-note, .result-message { color: var(--muted); font-size: .88rem; }
.field-note { margin-top: 6px; }
.outlet-settings { display: grid; gap: 9px; padding-top: 16px; margin-top: 15px; border-top: 1px solid var(--line); }
.outlet-settings > .field-note { margin-top: -7px; }
.outlet-row {
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 9px;
  padding: 6px 0 1px;
}
.outlet-row + .outlet-row { margin-top: 8px; }
.outlet-row legend { color: var(--muted); font-size: .81rem; font-weight: 700; }

.text-button, .secondary, .primary, .remove-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding: 5px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: .89rem;
  font-weight: 700;
  transition: background-color .15s, border-color .15s;
}
.text-button { background: transparent; color: var(--forest); padding-inline: 8px; }
.text-button:hover { background: var(--green-wash); }
.add-button { justify-self: start; }
.secondary, .remove-button { color: var(--forest); background: #fffefa; border-color: #b6c1b6; }
.secondary:not(:disabled):hover, .remove-button:hover { background: var(--green-wash); border-color: var(--forest); }
.remove-button { width: 44px; padding: 3px; font-size: 1.35rem; font-weight: 500; }
.primary { width: 100%; margin-top: 16px; background: var(--forest); color: white; border-color: var(--forest); }
.primary:hover { background: var(--forest-dark); }
.form-error { color: var(--error); font-size: .88rem; margin-top: 12px; font-weight: 600; }

.summary {
  display: grid;
  grid-template-columns: minmax(0, .66fr) minmax(0, 1fr);
  border: 1px solid #d0d9cc;
  border-radius: 9px;
  background: var(--green-wash);
}
.summary div { min-width: 0; padding: 13px clamp(10px, 2vw, 17px); }
.summary div + div { border-left: 1px solid #d0d9cc; }
.summary dt { color: #4b5c51; font-size: .86rem; font-weight: 650; }
.summary dd {
  margin: 1px 0 0;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-weight: 730;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.summary small { font-size: .92rem; font-weight: 550; }
.layout-figure { margin: 17px 0 15px; }
.layout-art {
  height: 89px;
  position: relative;
  border: 1px solid #9cae9f;
  background:
    repeating-linear-gradient(0deg, #e7eae0 0 1px, transparent 1px 17px),
    #f7f8f3;
  overflow: hidden;
}
.layout-art span { position: absolute; inset-block: 0; }
.layout-art .strip { background: #506d5b; }
.layout-art .outlet-zone {
  background: repeating-linear-gradient(135deg, #b87333 0 1px, #f3dbbc 1px 4px);
  opacity: .86;
}
.layout-caption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin-top: 5px; font-size: .8rem; color: #4d5952; }
.outlet-key { display: inline-flex; align-items: center; gap: 5px; }
.outlet-key::before { content: ""; width: 9px; height: 9px; border: 1px solid #a35e2b; background: #f3dbbc; }
.marks { border-top: 1px solid var(--line); padding-top: 12px; }
.marks h3 + p { margin-top: 3px; }
.mark-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px 13px;
  padding: 0;
  margin: 8px 0 5px;
  list-style: none;
}
.mark-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1px 6px;
  min-width: 0;
  padding: 5px 0;
  border-bottom: 1px solid #eeede6;
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
}
.mark-list li span { color: var(--muted); }
.mark-list li strong { overflow-wrap: anywhere; }
.result-message.is-empty { padding: 12px; color: #6e3a28; background: #fcf1e9; border: 1px solid #e9cdb9; border-radius: 7px; }
.copy-status, #copy-fallback { margin-top: 10px; }
.copy-status { font-size: .88rem; font-weight: 650; }
#copy-fallback textarea { margin-top: 6px; resize: vertical; }

.guide { padding-bottom: 38px; }
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 25px; margin-top: 14px; }
.guide-grid p { margin-top: 4px; color: var(--muted); font-size: .93rem; }
footer { background: #eceee5; border-top: 1px solid #d7dcd1; }
.footer-inner { min-height: 54px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; padding-block: 10px; font-size: .85rem; color: var(--muted); }
.footer-inner span:first-child { color: var(--forest); font-weight: 700; }

@media (max-width: 760px) {
  .shell { width: min(100% - 32px, 560px); }
  .hero-inner { min-height: auto; grid-template-columns: 1fr; padding-block: 32px; }
  .wall-study { display: none; }
  .workbench, .guide-grid { grid-template-columns: 1fr; }
  .workbench { gap: 14px; margin-top: 16px; }
}

@media (max-width: 410px) {
  .mark-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
