:root {
  color-scheme: light;
  --paper: #f4efe3;
  --panel: #fffcf3;
  --ink: #343e35;
  --muted: #7b7d6b;
  --line: #d9d5c4;
  --green: #365b4c;
  --orange: #b76a43;
  --serif: ui-serif, "Songti SC", "STSong", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 14px/1.7 var(--sans); }
button, select, input { font: inherit; }
button { cursor: pointer; border: 1px solid transparent; min-height: 44px; border-radius: 6px; padding: 10px 16px; font-weight: 600; line-height: 1.4; }
button:disabled { opacity: .4; cursor: default; }
button:not(:disabled):hover { filter: brightness(.96); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, [tabindex="-1"]:focus-visible { outline: 3px solid #b96d3c; outline-offset: 4px; }
h1, h2, h3, p { margin: 0; }
h2 { font-size: 20px; line-height: 1.4; letter-spacing: -.4px; }
h3 { font-size: 14px; }
a { color: inherit; }
.site-header, main, footer { width: min(1176px, calc(100% - 64px)); margin-inline: auto; }
.site-header { display: flex; justify-content: space-between; gap: 20px; padding: 24px 0 20px; border-bottom: 1px solid var(--line); font-size: 11px; }
.back { font-weight: 650; text-decoration: none; }
.back:hover { text-decoration: underline; }
.site-header > span { color: var(--muted); }
.site-header i { padding: 0 10px; font-style: normal; color: #a3a48e; }
.intro { display: flex; justify-content: space-between; align-items: flex-end; gap: 36px; padding: 37px 0 31px; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 1.8px; color: var(--muted); margin-bottom: 8px; line-height: 1.5; }
h1 { font-family: var(--serif); font-size: clamp(38px, 4.4vw, 53px); line-height: 1.24; font-weight: 650; letter-spacing: 1px; }
.intro-copy { max-width: 430px; font-size: 14px; line-height: 1.95; padding-bottom: 3px; color: #626954; }
.session-note { margin-top: 13px; font-size: 11px; color: var(--muted); }
.notice { margin: 0 0 18px; border: 1px solid #c3ceb6; background: #e9efdd; border-radius: 7px; padding: 12px 16px; font-size: 12px; }
.confirmation { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 20px; padding: 22px 25px; background: #fff0d4; border: 1px solid #d4b17d; border-radius: 10px; }
.confirmation .eyebrow { color: #9a7044; }
.confirmation p:not(.eyebrow) { margin-top: 7px; font-size: 12px; max-width: 650px; color: #7a6247; }
.confirmation-actions { display: flex; gap: 10px; flex-shrink: 0; }
.primary { color: #fffaf0; background: var(--green); border-color: var(--green); }
.secondary { color: var(--green); background: var(--panel); border-color: #b7c0a8; }
.text-button { padding: 8px 0; min-height: 36px; border: 0; background: transparent; color: #6e795d; font-size: 11px; font-weight: 500; text-decoration: underline; text-underline-offset: 4px; }
.studio-grid { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr); gap: 23px; }
.sample-panel, .controls-panel, .structure-panel, .share-panel { min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.sample-panel { padding: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sample-size { font-size: 11px; color: var(--muted); white-space: nowrap; }
.preset-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 20px; }
.preset { display: flex; align-items: center; justify-content: flex-start; gap: 9px; min-width: 0; padding: 9px 10px; background: #f5f2e6; border-color: #dedfcb; text-align: left; color: #788064; font-size: 12px; }
.preset small { display: block; font-size: 9px; font-weight: 400; margin-top: 4px; white-space: nowrap; }
.preset[aria-pressed="true"] { color: var(--green); border-color: #81977a; background: #e8eddb; }
.mini-weave { display: block; width: 29px; height: 29px; flex-shrink: 0; border: 1px solid #9caa8c; background-color: #e5dbb9; }
.mini-square { background-image: repeating-linear-gradient(90deg, transparent 0 7px, #718367 7px 14px); }
.mini-diagonal { background-image: repeating-linear-gradient(135deg, transparent 0 5px, #718367 5px 10px); }
.mini-fine { background-image: repeating-linear-gradient(135deg, transparent 0 7px, #718367 7px 10px); }
.sample-mat { position: relative; padding: 28px; margin-top: 19px; background: #d9cdb1; border: 1px solid #cec1a5; border-radius: 5px; }
.sample-mat::before { content: ""; position: absolute; inset: 10px; border: 1px solid #9c8e732b; pointer-events: none; }
.sample-frame { position: relative; border: 7px solid #eae1ca; box-shadow: 0 5px 14px #574f3929; background: #eae1ca; }
#swatch { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.mat-corner { position: absolute; color: #998d70; font: 10px var(--serif); }
.corner-top { top: 10px; left: 13px; }
.corner-bottom { bottom: 10px; right: 13px; }
.sample-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 20px; }
.sample-footer > span { color: var(--muted); font-size: 10px; text-align: right; }
.mode-switch { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid #d8dcc9; border-radius: 7px; background: #efefe2; }
.mode-switch button { color: #7b8369; min-height: 35px; font-size: 10px; padding: 8px 12px; border-radius: 4px; background: transparent; font-weight: 500; }
.mode-switch [aria-pressed="true"] { background: var(--panel); color: var(--green); box-shadow: 0 1px 4px #3b4b2821; }
.controls-panel { padding: 25px 27px; display: flex; flex-direction: column; }
.decorative-cross { color: #d2b99b; font-size: 35px; font-weight: 200; line-height: 1; }
.parameter { border: 0; margin: 24px 0 0; padding: 0; min-width: 0; }
.parameter legend { padding: 0; font-size: 12px; font-weight: 600; width: 100%; display: flex; justify-content: space-between; gap: 10px; }
.parameter legend span { font-size: 10px; color: var(--muted); font-weight: 400; }
.segmented { display: flex; gap: 8px; margin-top: 11px; }
.segmented button { flex: 1; min-width: 0; background: #f7f5e9; border-color: #d9dccb; color: #83886f; font-size: 12px; }
.segmented button[aria-pressed="true"] { color: var(--green); background: #e8eddb; border-color: #81977a; box-shadow: inset 0 -2px #81977a; }
.parameter > p { font-size: 10px; color: var(--muted); margin-top: 7px; }
.color-section { border-top: 1px dashed var(--line); margin-top: 25px; padding-top: 21px; }
.color-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.color-heading h3 { font-size: 12px; }
.color-heading > span { color: var(--muted); font-size: 10px; }
.color-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 13px; margin-top: 15px; }
.color-grid label { min-width: 0; font-size: 11px; color: #69765d; }
.color-grid label > span { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
.color-chip { display: inline-block; width: 12px; height: 12px; border: 1px solid #445d3b26; border-radius: 2px; }
select { display: block; width: 100%; min-height: 43px; padding: 8px 10px; border: 1px solid #cbd1bc; border-radius: 6px; color: #3b5142; background: #fffef7; font-size: 12px; }
.design-summary { padding: 13px 14px; margin-top: 23px; background: #f0efdf; border-radius: 7px; border: 1px solid #e4e2d0; }
.design-summary p { display: flex; justify-content: space-between; gap: 12px; color: #8a8b72; font-size: 10px; }
.design-summary p + p { margin-top: 5px; }
.design-summary strong { color: #5a6d51; font-weight: 550; text-align: right; }
.history-actions { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding-top: 23px; margin-top: auto; }
.history-actions .secondary { font-size: 12px; }
.history-note { color: var(--muted); font-size: 9px; margin-top: 10px; line-height: 1.8; }
.history-note strong { font-weight: 600; color: #718060; }
.bottom-grid { display: grid; grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr); gap: 23px; margin-top: 23px; }
.structure-panel, .share-panel { padding: 25px; background: #fffcf377; }
.structure-badge { border: 1px solid #d2d5be; border-radius: 50%; width: 39px; height: 39px; display: grid; place-items: center; color: #8a9376; font: 12px var(--serif); }
.structure-layout { display: flex; align-items: center; gap: 28px; margin-top: 19px; }
#structure-table { border-collapse: separate; border-spacing: 4px; font-size: 10px; table-layout: fixed; width: 211px; flex-shrink: 0; }
#structure-table caption { caption-side: bottom; font-size: 9px; color: var(--muted); padding-top: 7px; text-align: right; }
#structure-table thead th, #structure-table tbody th { font-size: 9px; font-weight: 400; color: #9a9c83; }
#structure-table thead th { padding-bottom: 2px; }
#structure-table th:first-child, #structure-table thead td { width: 14px; }
#structure-table td { text-align: center; height: 34px; border-radius: 4px; border: 1px solid transparent; }
#structure-table td[data-top="weft"] { background: #e8d6bd; border-color: #d9bc95; color: #815e37; }
#structure-table td[data-top="warp"] { background: #e4ead8; border-color: #c9d5b5; color: #567044; }
.structure-copy { min-width: 0; font-size: 11px; color: #758164; line-height: 1.9; }
.structure-counts { display: flex; gap: 18px; margin: 13px 0; }
.structure-counts > span { display: block; font-size: 9px; color: #8f9278; white-space: nowrap; }
.structure-counts strong { display: block; font: 26px/1.4 var(--serif); color: #60784e; }
.structure-counts small { font-size: 9px; }
#structure-note { font-size: 9px; color: #94977d; }
.share-panel h2 { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.share-panel > p:not(.eyebrow) { margin-top: 13px; color: #768167; font-size: 12px; line-height: 1.95; }
.share-panel .share-scope { font-size: 10px !important; color: #979c83 !important; margin-top: 9px !important; }
.full { width: 100%; display: flex; justify-content: space-between; margin-top: 24px; font-size: 12px; }
#share-result { margin-top: 17px; }
#share-result label { display: block; font-size: 10px; margin-bottom: 7px; color: #778367; }
#share-link { width: 100%; min-width: 0; padding: 11px; min-height: 43px; border: 1px solid #b8c6a6; border-radius: 6px; background: #fffef8; color: #3d5b42; font-size: 10px; }
#select-share { display: block; }
.copy-hint { font-size: 9px; color: #91997d; line-height: 1.8; }
.model-note { text-align: center; color: #939781; font-size: 10px; margin-top: 23px; line-height: 1.8; }
footer { display: flex; justify-content: center; align-items: center; gap: 10px; color: #8f967a; font-size: 10px; text-align: center; padding: 25px 0 33px; }
footer > span { color: #ba9973; font-size: 22px; line-height: 1; }
[hidden] { display: none !important; }
@media (max-width: 1040px) {
  .site-header, main, footer { width: calc(100% - 44px); }
  .studio-grid, .bottom-grid { gap: 17px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
  .sample-panel { padding: 20px; }
  .controls-panel { padding: 22px; }
  .sample-mat { padding: 21px; }
  .preset { padding: 9px 7px; gap: 6px; font-size: 11px; }
  .preset small { font-size: 8px; }
  .mini-weave { width: 24px; height: 24px; }
  .sample-footer { gap: 6px; }
  .sample-footer > span { font-size: 9px; max-width: 70px; }
  .mode-switch button { padding-inline: 9px; }
  .structure-panel, .share-panel { padding: 22px; }
  .structure-layout { gap: 16px; align-items: flex-start; flex-wrap: wrap; }
  #structure-table { width: 190px; }
  .structure-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
  .structure-counts { margin: 0; }
  #structure-note { width: 100%; }
  .confirmation { flex-direction: column; align-items: flex-start; gap: 17px; }
}
@media (max-width: 720px) {
  .site-header, main, footer { width: calc(100% - 32px); }
  .site-header { font-size: 10px; padding: 18px 0 16px; align-items: center; }
  .site-header > span { max-width: 130px; font-size: 9px; text-align: right; line-height: 1.7; }
  .site-header i { padding-inline: 4px; }
  .intro { display: block; padding: 28px 0 24px; }
  h1 { font-size: 42px; }
  .intro .eyebrow { font-size: 9px; }
  .intro-copy { margin-top: 16px; font-size: 12px; max-width: none; }
  .intro-copy br { display: none; }
  .session-note { font-size: 10px; margin-top: 10px; }
  .studio-grid, .bottom-grid { grid-template-columns: 1fr; gap: 17px; }
  .sample-panel { padding: 20px; }
  h2 { font-size: 19px; }
  .eyebrow { font-size: 9px; letter-spacing: 1.4px; }
  .sample-size { font-size: 10px; }
  .preset-row { gap: 7px; margin-top: 17px; }
  .preset { gap: 7px; padding: 9px 7px; }
  .preset small { font-size: 8px; }
  .sample-mat { padding: 21px; margin-top: 16px; }
  .sample-footer { margin-top: 16px; }
  .mode-switch button { font-size: 10px; }
  .sample-footer > span { max-width: none; font-size: 9px; }
  .controls-panel { padding: 23px 22px; }
  .parameter { margin-top: 23px; }
  .parameter legend { font-size: 12px; }
  .segmented button { font-size: 12px; min-height: 44px; }
  .color-grid { gap: 15px 13px; }
  select { min-height: 45px; }
  .design-summary { margin-top: 22px; }
  .history-actions { padding-top: 21px; }
  .history-note { font-size: 9px; }
  .bottom-grid { margin-top: 17px; }
  .structure-panel, .share-panel { padding: 23px 22px; }
  .structure-layout { gap: 18px; flex-wrap: nowrap; align-items: center; }
  #structure-table { width: 168px; border-spacing: 3px; }
  #structure-table td { height: 29px; }
  #structure-table th:first-child, #structure-table thead td { width: 11px; }
  #structure-table caption { font-size: 8px; padding-top: 5px; }
  .structure-copy { display: block; font-size: 10px; }
  .structure-counts { gap: 13px; margin: 11px 0; }
  .structure-counts strong { font-size: 23px; }
  .structure-counts > span, .structure-counts small { font-size: 8px; }
  #structure-note { font-size: 8px; }
  .share-panel h2 { font-size: 25px; }
  .share-panel > p:not(.eyebrow) { font-size: 12px; }
  .confirmation { padding: 20px; }
  .confirmation p:not(.eyebrow) { font-size: 11px; }
  .confirmation-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .confirmation-actions button { font-size: 12px; padding-inline: 9px; }
  .notice { font-size: 11px; }
  .model-note { padding-inline: 6px; font-size: 9px; margin-top: 19px; }
}
@media (max-width: 385px) {
  h1 { font-size: 39px; }
  .sample-panel, .controls-panel, .structure-panel, .share-panel { padding-inline: 18px; }
  .mini-weave { width: 20px; height: 24px; }
  .preset { gap: 5px; padding-inline: 6px; font-size: 10px; }
  .preset small { font-size: 7px; }
  .sample-mat { padding: 19px; }
  .sample-footer > span { max-width: 65px; font-size: 8px; }
  .mode-switch button { padding-inline: 9px; font-size: 9px; }
  .structure-layout { gap: 11px; }
  #structure-table { width: 159px; }
  .structure-copy { font-size: 9px; }
  .structure-counts { gap: 10px; }
  .color-heading > span { font-size: 9px; }
  .design-summary p { gap: 8px; font-size: 9px; }
}
