:root {
  color-scheme: light;
  --ink: #2d382f;
  --muted: #62695e;
  --paper: #d96d51;
  --accent: #a63c2c;
  --cream: #f5efe4;
  --surface: #fffcf5;
  --line: #dbd8c8;
  --green: #364e41;
  --highlight: #263c64
}

* {
  box-sizing: border-box
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  font-size: 15px;
  line-height: 1.55
}

button,select,input {
  font: inherit;
  color: inherit
}

button,select,input,.home-link {
  min-height: 44px
}

button {
  border: 1px solid #c5c8b9;
  background: #fffcf5;
  border-radius: 9px;
  padding: 10px 13px;
  font-weight: 650;
  cursor: pointer;
  line-height: 1.3;
  transition: none
}

button:hover:not(:disabled) {
  background: #eeeade;
  border-color: #8c9988
}

button:active:not(:disabled) {
  background: #e4e6d9
}

button:disabled {
  cursor: default;
  background: #eeeae0;
  color: #787b70;
  border-color: #dedbce
}

button:focus-visible,select:focus-visible,input:focus-visible,a:focus-visible {
  outline: 3px solid var(--highlight);
  outline-offset: 3px
}

.page-shell {
  width: min(1240px,100% - 64px);
  margin: 0 auto
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 35px
}

.brand {
  display: flex;
  align-items: center;
  gap: 17px
}

.brand-mark {
  height: 52px;
  width: 52px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  transform: rotate(-7deg)
}

.brand-mark i {
  background: var(--accent);
  border-radius: 2px
}

.brand-mark i:nth-child(2) {
  border-radius: 2px 14px 2px 2px
}

.brand-mark i:nth-child(3) {
  border-radius: 2px 2px 2px 14px
}

.brand-mark i:nth-child(4) {
  background: #d88b60
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .15em
}

h1 {
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: .07em;
  margin: 4px 0 0;
  font-weight: 780
}

.title-dot {
  color: var(--accent)
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 15px;
  color: var(--green);
  font-size: 13px;
  text-decoration: none;
  padding: 10px 0 10px 12px;
  white-space: nowrap
}

.home-link:hover {
  text-decoration: underline
}

.intro {
  margin: 20px 0 26px;
  font-size: 17px
}

.intro span {
  margin-left: 8px;
  color: var(--muted);
  font-size: 14px
}

h2,h3,p,figure {
  margin-top: 0
}

h2 {
  font-size: 19px;
  line-height: 1.45;
  margin-bottom: 0
}

h3 {
  font-size: 16px;
  line-height: 1.4;
  margin: 0
}

.workbench {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 25px;
  display: grid;
  grid-template-columns: minmax(0,1.5fr) minmax(310px,1fr);
  column-gap: 30px;
  row-gap: 23px;
  box-shadow: 0 8px 0 #e6e2d4
}

.workbench-heading {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px
}

.workbench-heading .eyebrow {
  margin-bottom: 5px
}

.design-badge {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  background: #e7eddf;
  border: 1px solid #d2ddc7;
  padding: 7px 12px;
  border-radius: 20px
}

.edit-controls {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  min-width: 0
}

.section-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 15px
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e9ede0;
  border-radius: 50%;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  font-size: 12px;
  font-weight: 750;
  color: var(--green)
}

.coordinate-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px
}

.coordinate-controls label {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px
}

.coordinate-controls select {
  width: 100%;
  min-width: 0;
  border: 1px solid #b9c1b2;
  border-radius: 8px;
  background: #fffef9;
  padding: 8px 12px;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px
}

.navigation-row {
  margin-top: 10px
}

.navigation-row button {
  font-weight: 550;
  color: #465344
}

.cut-row {
  margin-top: 16px
}

.cut-row button {
  min-height: 49px
}

.button-primary {
  background: var(--green);
  border-color: var(--green);
  color: #fffdf4
}

.button-primary:hover:not(:disabled) {
  background: #294333;
  border-color: #294333
}

.button-primary:active:not(:disabled) {
  background: #1f3528
}

.editing-note {
  font-size: 12px;
  color: var(--muted);
  margin: 7px 0 13px
}

.metrics {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 13px 0 11px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line)
}

.metrics div {
  text-align: center;
  border-right: 1px solid var(--line)
}

.metrics div:last-child {
  border: 0
}

.metrics span {
  display: block;
  font-size: 12px;
  color: var(--muted)
}

.metrics strong {
  display: block;
  font-size: 26px;
  line-height: 1.25;
  margin-top: 4px;
  font-weight: 750;
  font-variant-numeric: tabular-nums
}

.status {
  font-size: 13px;
  color: #46513f;
  line-height: 1.6;
  margin: 12px 0 0;
  min-height: 42px
}

.preview-group {
  grid-column: 1;
  grid-row: 2;
  min-width: 0
}

.paper-previews {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px
}

.paper-preview {
  margin: 0;
  min-width: 0
}

.paper-preview figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 3px 8px;
  margin-bottom: 11px
}

.paper-preview figcaption>span {
  font-size: 16px;
  font-weight: 700
}

.paper-preview small {
  font-size: 12px;
  color: var(--muted);
  align-self: center
}

.paper-mat {
  aspect-ratio: 1;
  padding: 19px;
  border: 1px solid #e1dccb;
  border-radius: 12px;
  background: #eee8da;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 5px #f7f2e8
}

.unfolded-mat {
  background: #ebe9d9
}

svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none
}

.cell-paper {
  fill: var(--paper);
  stroke: #f9d4b9;
  stroke-width: 1.5
}

.cell-hole {
  fill: #fff9f0;
  stroke: #9c5b46;
  stroke-width: 1.5;
  stroke-dasharray: 4 3
}

.hole-cross {
  stroke: #a26e58;
  stroke-width: 1.6;
  fill: none
}

.cell-footprint {
  fill: none;
  stroke: var(--highlight);
  stroke-width: 3.5;
  stroke-linejoin: round
}

.preview-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 15px;
  font-size: 12px;
  color: #4b5448
}

.preview-legend>span {
  display: inline-flex;
  align-items: center;
  gap: 6px
}

.preview-legend i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  font-style: normal;
  font-size: 12px;
  line-height: 1
}

.legend-paper {
  background: var(--paper);
  border: 1px solid #b9543e
}

.legend-hole {
  background: #fff9f0;
  border: 1px dashed #9c5b46;
  color: #9c5b46
}

.legend-selected {
  border: 2px solid var(--highlight);
  background: transparent
}

.selection-summary {
  margin: 11px 0 0;
  font-size: 13px;
  line-height: 1.7;
  color: #39473b
}

.preview-note {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0
}

.empty-paper-note {
  font-size: 13px;
  font-weight: 650;
  color: #82402c;
  margin: 8px 0 0
}

.lower-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 30px
}

.card {
  background: #fbf8ef;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 24px;
  min-width: 0
}

.card h2 {
  font-size: 17px
}

.fold-summary {
  font-size: 14px;
  line-height: 1.8;
  min-height: 51px;
  margin-bottom: 13px
}

.fold-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr .72fr;
  gap: 8px
}

.fold-buttons button {
  font-size: 13px;
  padding: 10px 8px
}

.help-text {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  margin: 10px 0 0
}

.divider {
  border-top: 1px solid var(--line);
  margin: 20px 0 17px
}

.history-row button {
  font-size: 14px
}

.inspiration-card>.help-text {
  margin-top: -4px
}

.preset-buttons {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
  margin-top: 16px
}

.preset-buttons button {
  padding: 13px 6px 10px;
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 5px;
  font-size: 14px
}

.preset-buttons small {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted)
}

.preset-art {
  display: block;
  width: 46px;
  height: 46px;
  background-color: var(--paper);
  border: 1px solid #ba5b44;
  position: relative;
  border-radius: 2px;
  margin-bottom: 4px
}

.art-points {
  background: linear-gradient(#fff7e9,#fff7e9) 10px 10px/6px 6px,linear-gradient(#fff7e9,#fff7e9) 30px 10px/6px 6px,linear-gradient(#fff7e9,#fff7e9) 10px 30px/6px 6px,linear-gradient(#fff7e9,#fff7e9) 30px 30px/6px 6px,var(--paper);
  background-repeat: no-repeat
}

.art-windows {
  background: linear-gradient(#fff7e9,#fff7e9) 7px 7px/12px 12px,linear-gradient(#fff7e9,#fff7e9) 27px 7px/12px 12px,linear-gradient(#fff7e9,#fff7e9) 7px 27px/12px 12px,linear-gradient(#fff7e9,#fff7e9) 27px 27px/12px 12px,var(--paper);
  background-repeat: no-repeat
}

.art-stripes {
  background: linear-gradient(to bottom,#fff7e9 0 12.5%,var(--paper) 12.5% 37.5%,#fff7e9 37.5% 50%,var(--paper) 50% 100%)
}

.button-share {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 18px;
  padding: 12px 15px;
  border-color: #8c9a7a;
  background: #e9eddf;
  color: #344c38
}

.invitation {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 15px
}

.invitation label {
  display: block;
  font-size: 13px;
  font-weight: 650;
  margin-bottom: 7px
}

.invitation input {
  display: block;
  width: 100%;
  min-width: 0;
  border: 1px solid #b2bca7;
  background: #fffef9;
  border-radius: 7px;
  padding: 10px;
  font-size: 13px
}

.invitation button {
  margin-top: 8px;
  width: 100%
}

[hidden] {
  display: none!important
}

footer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 28px 4px 35px;
  color: var(--muted);
  font-size: 12px
}

footer p {
  margin: 0
}

.footer-mark {
  font-size: 31px;
  color: #aa543c
}

.footer-caption {
  margin-left: auto;
  letter-spacing: .1em
}

@media(min-width:1300px) {
  .paper-mat {
    padding: 24px
  }
  .workbench {
    column-gap: 38px;
    padding: 30px
  }
  .paper-previews {
    gap: 20px
  }
}

@media(max-width:1023px) {
  .page-shell {
    width: calc(100% - 40px)
  }
  .workbench {
    column-gap: 22px;
    grid-template-columns: minmax(0,1.25fr) minmax(280px,1fr);
    padding: 21px
  }
  .paper-previews {
    gap: 10px
  }
  .paper-mat {
    padding: 12px
  }
  .paper-preview figcaption {
    display: block
  }
  .paper-preview small {
    display: block;
    margin-top: 2px
  }
  .card {
    padding: 20px
  }
  .fold-buttons {
    grid-template-columns: 1fr 1fr
  }
  .fold-buttons button:last-child {
    grid-column: 1/-1
  }
  .lower-grid {
    gap: 18px
  }
  .preset-buttons {
    gap: 6px
  }
  .preset-buttons button {
    font-size: 13px
  }
  .preset-buttons small {
    font-size: 12px
  }
}

@media(max-width:767px) {
  .page-shell {
    width: calc(100% - 28px)
  }
  .page-header {
    padding-top: 21px;
    gap: 10px
  }
  .brand {
    gap: 10px
  }
  .brand-mark {
    width: 37px;
    height: 37px;
    gap: 3px
  }
  .eyebrow {
    font-size: 12px;
    letter-spacing: .08em
  }
  h1 {
    font-size: 27px;
    margin-top: 3px;
    letter-spacing: .04em
  }
  .home-link {
    font-size: 12px;
    gap: 6px;
    padding-left: 6px
  }
  .intro {
    font-size: 14px;
    margin: 15px 0 18px;
    line-height: 1.65
  }
  .intro span {
    display: block;
    margin-left: 0;
    font-size: 12px
  }
  .workbench {
    display: flex;
    flex-direction: column;
    gap: 17px;
    padding: 16px;
    border-radius: 14px;
    box-shadow: 0 5px 0 #e6e2d4
  }
  .workbench-heading {
    align-items: flex-start;
    gap: 10px
  }
  .workbench-heading .eyebrow {
    display: none
  }
  .workbench-heading h2 {
    font-size: 16px;
    line-height: 1.5
  }
  .design-badge {
    font-size: 12px;
    padding: 4px 9px
  }
  .edit-controls {
    order: 1;
    align-self: stretch
  }
  .preview-group {
    order: 2
  }
  .section-label {
    gap: 8px;
    margin-bottom: 11px
  }
  .section-label h3 {
    font-size: 14px
  }
  .step-number {
    width: 25px;
    height: 25px;
    flex-basis: 25px
  }
  .coordinate-controls {
    gap: 10px
  }
  .coordinate-controls label {
    gap: 8px;
    font-size: 12px
  }
  .coordinate-controls select {
    padding: 8px 9px;
    font-size: 14px
  }
  .navigation-row {
    margin-top: 8px
  }
  .navigation-row button {
    font-size: 13px
  }
  .cut-row {
    margin-top: 10px
  }
  .cut-row button {
    min-height: 46px;
    font-size: 14px
  }
  .editing-note {
    font-size: 12px;
    margin: 5px 0 9px
  }
  .metrics {
    padding: 8px 0
  }
  .metrics strong {
    font-size: 23px;
    margin-top: 2px
  }
  .metrics span {
    font-size: 12px
  }
  .status {
    font-size: 12px;
    margin-top: 8px;
    min-height: 38px;
    line-height: 1.6
  }
  .paper-previews {
    gap: 10px
  }
  .paper-preview figcaption {
    display: block;
    margin-bottom: 7px
  }
  .paper-preview figcaption>span {
    font-size: 14px
  }
  .paper-preview small {
    font-size: 12px;
    white-space: normal
  }
  .paper-mat {
    border-radius: 8px;
    padding: 10px;
    box-shadow: inset 0 0 0 3px #f7f2e8
  }
  .preview-legend {
    gap: 6px 11px;
    margin-top: 11px;
    font-size: 12px
  }
  .preview-legend i {
    width: 12px;
    height: 12px
  }
  .selection-summary {
    font-size: 12px;
    margin-top: 8px;
    line-height: 1.7
  }
  .preview-note {
    font-size: 12px;
    margin-top: 6px
  }
  .lower-grid {
    grid-template-columns: 1fr;
    gap: 17px;
    margin-top: 23px
  }
  .card {
    padding: 18px 16px;
    border-radius: 13px
  }
  .card h2 {
    font-size: 15px
  }
  .fold-summary {
    min-height: 0;
    font-size: 13px;
    margin-bottom: 12px
  }
  .fold-buttons {
    grid-template-columns: 1fr 1fr
  }
  .fold-buttons button:last-child {
    grid-column: 1/-1
  }
  .fold-buttons button {
    font-size: 13px
  }
  .preset-buttons {
    gap: 8px
  }
  .preset-buttons button {
    font-size: 14px
  }
  .preset-buttons small {
    font-size: 12px
  }
  .footer-caption {
    display: none
  }
  footer {
    padding: 22px 3px 28px
  }
}

@media(prefers-reduced-motion:reduce) {
  html {
    scroll-behavior: auto
  }
}
