:root {
  color-scheme: light;
  --paper: #f9f6ef;
  --surface: #fffdf8;
  --ink: #172d29;
  --muted: #465d55;
  --line: #dedbd0;
  --green: #155244;
  --accent: #a94032;
  --pale: #e7efe5;
  --cream: #faf3df;
  --focus: #a94032;
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: inherit; }
input, button, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.wrap { width: min(1160px, calc(100% - 72px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 66px; gap: 18px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-size: .95rem; font-weight: 750; text-decoration: none; }
.brand-mark {
  display: block;
  width: 27px;
  height: 27px;
  flex: none;
  border: 1px solid #1c5144;
  border-radius: 7px;
  background: conic-gradient(#2e6b59 0 25%, #ca8267 0 50%, #7d9a69 0 75%, #e5c582 0);
  box-shadow: inset 0 0 0 2px var(--paper);
}
.jump-to-results { display: none; }
.header-link { font-size: .85rem; font-weight: 650; color: var(--green); text-underline-offset: 4px; }
.intro { padding: 44px 0 28px; }
h1, h2, h3, p { margin: 0; }
h1 {
  font-family: "Instrument Serif", "Bitstream Charter", Georgia, serif;
  font-size: clamp(2.4rem, 4.75vw, 4rem);
  font-weight: 500;
  letter-spacing: -.045em;
  line-height: 1.07;
}
.intro p { max-width: 670px; margin-top: 13px; line-height: 1.55; color: var(--muted); font-size: 1.04rem; }
.workspace { display: grid; grid-template-columns: minmax(0, .83fr) minmax(0, 1.17fr); gap: 22px; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 17px; min-width: 0; }
.controls { padding: 0 23px; }
.control-section { padding: 19px 0 21px; }
.control-section + .control-section { border-top: 1px solid var(--line); }
h2 { font-size: 1.13rem; font-weight: 760; letter-spacing: -.024em; }
.hint { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.control-section > .hint { margin-top: 5px; }
.piece-fields { display: grid; grid-template-columns: 1fr 1fr .84fr; gap: 9px; margin-top: 14px; }
label { position: relative; display: block; min-width: 0; font-size: .82rem; font-weight: 650; }
label > input, label > select, label > .input-unit { margin-top: 5px; }
input[type="number"], select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #cacdc2;
  background: white;
  color: var(--ink);
  border-radius: 8px;
  min-height: 39px;
  padding: 7px 10px;
  line-height: 1.3;
  font-size: .96rem;
  font-weight: 550;
  font-variant-numeric: tabular-nums;
}
input[type="number"] { appearance: textfield; }
input::-webkit-inner-spin-button, input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.input-unit { position: relative; display: block; }
.input-unit > span { pointer-events: none; position: absolute; top: 50%; right: 10px; transform: translateY(-50%); color: var(--muted); font-weight: 500; }
.input-unit > input { padding-right: 29px; }
.price-input > span { right: auto; left: 10px; }
.price-input > input { padding: 7px 10px 7px 24px; }
.check { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; }
.check input { accent-color: var(--green); margin: 3px 0 0; width: 16px; height: 16px; flex: none; }
.check small { display: block; margin-top: 3px; font-size: .78rem; line-height: 1.35; color: var(--muted); font-weight: 500; }
.section-title, .settings-title { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; }
.text-button {
  border: 0;
  background: transparent;
  color: var(--green);
  border-radius: 5px;
  font-weight: 720;
  font-size: .81rem;
  line-height: 1.25;
  padding: 5px 0;
}
.text-button:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 4px; }
.text-button:disabled { opacity: .5; }
.muted-button { color: var(--muted); }
.bolt-input { padding: 0; border: 0; margin: 12px 0 0; min-width: 0; }
.bolt-input legend { font-size: .82rem; font-weight: 780; padding: 0; margin-bottom: 3px; }
.bolt-fields { display: grid; grid-template-columns: 1fr 1fr 35px; align-items: end; gap: 9px; }
.bolt-fields label { font-size: .76rem; font-weight: 570; color: var(--muted); }
.bolt-fields label > .input-unit { margin-top: 3px; }
.remove-bolt {
  border: 1px solid #cacdc2;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  width: 35px;
  height: 39px;
  padding: 0;
  font-size: 1.22rem;
  line-height: 1;
}
.remove-bolt:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.remove-bolt:disabled { visibility: hidden; }
.settings-title { margin-bottom: 11px; }
.shrink-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 11px; }
.results { display: grid; gap: 16px; min-width: 0; }
.recommendation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px 18px;
  padding: 24px 25px;
  border-radius: 17px;
  background: #174738;
  color: #fffdf3;
}
.recommendation-label { font-size: .79rem; font-weight: 650; color: #e3eecf; }
.recommendation h2 { font-size: clamp(1.25rem, 2.7vw, 1.87rem); letter-spacing: -.035em; margin-top: 5px; line-height: 1.17; }
#winner-detail { margin-top: 7px; color: #e3eecf; font-size: .81rem; line-height: 1.4; }
#winner-detail:empty, .recommendation-price:empty { display: none; }
.recommendation-price { font-weight: 700; font-size: clamp(1.95rem, 4.2vw, 3.18rem); font-variant-numeric: tabular-nums; line-height: 1.1; letter-spacing: -.065em; white-space: nowrap; }
.comparison { padding: 17px 20px 12px; }
.comparison table { border-collapse: collapse; width: 100%; margin-top: 6px; font-size: .86rem; font-variant-numeric: tabular-nums; }
th { text-align: left; color: var(--muted); font-size: .72rem; font-weight: 650; }
th, td { padding: 8px 9px; }
tbody th, tbody td { border-top: 1px solid #e8e4d9; font-size: .86rem; }
tbody th { color: var(--ink); font-weight: 750; }
tr.selected { background: #edf3e9; }
.row-meta { display: block; font-weight: 520; color: var(--muted); font-size: .72rem; line-height: 1.4; margin-top: 2px; }
.row-price, .row-buy { white-space: nowrap; }
.row-layout { text-align: right; }
.layout-picker {
  border: 1px solid transparent;
  background: transparent;
  color: var(--green);
  font-size: .76rem;
  font-weight: 700;
  padding: 5px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.layout-picker:hover { border-color: #89a794; }
.layout-picker[aria-pressed="true"] { background: #d4e6d6; }
.layout { padding: 17px 20px 15px; }
.layout-title { flex-wrap: wrap; margin-bottom: 4px; }
.button { min-height: 33px; border: 1px solid #bdcec2; background: var(--surface); border-radius: 7px; padding: 5px 9px; color: var(--green); font-size: .76rem; font-weight: 720; }
.button:hover:not(:disabled) { background: var(--pale); }
.button:disabled { opacity: .54; }
.layout-preview { margin-top: 10px; }
.bolt-edge {
  border-top: 1px solid #9ea99a;
  position: relative;
  padding-top: 4px;
  color: var(--muted);
  text-align: center;
  min-height: 24px;
  font-size: .74rem;
  line-height: 1.4;
}
.bolt-edge::before, .bolt-edge::after { position: absolute; top: -4px; width: 1px; height: 7px; background: #9ea99a; content: ""; }
.bolt-edge::before { left: 0; }
.bolt-edge::after { right: 0; }
.fabric-layout {
  display: grid;
  overflow: hidden;
  border-radius: 7px;
  border: 1px solid #c9c6b6;
  background: repeating-linear-gradient(135deg, #f2ecdc 0 8px, #ebe4d3 8px 13px);
}
.fabric-row { display: flex; align-items: stretch; min-height: 19px; }
.fabric-row + .fabric-row { border-top: 1px dashed #b3b19f; }
.fabric-piece {
  display: grid;
  place-items: center;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid #4d7967;
  background: #cfdfcf;
  color: #173f33;
  font-size: .72rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.fabric-piece.rotated { background: #edce9c; border-right-color: #a97837; color: #633f18; }
.layout-footer { margin-top: 9px; }
.copy-status:empty, .layout-footer:empty { display: none; }
.copy-status { margin-top: 6px; }
#manual-copy { margin-top: 8px; }
.method { margin: 39px 0 43px; padding: 22px 0 0; border-top: 1px solid var(--line); }
.method-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 22px; margin-top: 12px; }
.method h3 { font-size: .85rem; letter-spacing: -.009em; }
.method p { margin-top: 4px; color: var(--muted); line-height: 1.55; font-size: .84rem; }
.worked-examples { margin-top: 0; }
.example-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.example { padding: 17px; }
.example dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  margin: 12px 0 9px;
  padding-block: 9px;
  border-block: 1px solid var(--line);
  font-size: .79rem;
  font-variant-numeric: tabular-nums;
}
.example dt { color: var(--muted); }
.example dd { margin: 0; text-align: right; font-weight: 720; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 840px) {
  .wrap { width: min(690px, calc(100% - 40px)); }
  .workspace { grid-template-columns: 1fr; gap: 17px; }
  .example-grid { grid-template-columns: 1fr; }
  .intro { padding-top: 34px; }
  .jump-to-results {
    display: inline-block;
    margin-top: 12px;
    color: var(--green);
    font-size: .83rem;
    font-weight: 720;
    text-underline-offset: 3px;
  }
}
@media (max-width: 490px) {
  .wrap { width: calc(100% - 30px); }
  .header-inner { min-height: 55px; }
  .brand { font-size: .85rem; }
  .brand-mark { width: 23px; height: 23px; }
  .header-link { font-size: .76rem; }
  .intro { padding: 26px 0 19px; }
  .intro p { font-size: .92rem; }
  .controls { padding-inline: 15px; }
  .recommendation { padding: 17px 14px; }
  .recommendation-price { font-size: 1.85rem; }
  .comparison, .layout { padding-inline: 11px; }
  th, td { padding-inline: 4px; }
  .method-grid { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 357px) {
  .recommendation { flex-wrap: wrap; }
  .row-meta { font-size: .67rem; }
}
