/* SPDX-FileCopyrightText: 2026 Tsogt Gantumur
 * SPDX-License-Identifier: MIT */
:root {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #16313a;
  background: #f2f5f4;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.45; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #d18a29; outline-offset: 2px;
}
.shell { max-width: 1020px; margin: auto; padding: 1.5rem clamp(.8rem, 3vw, 2rem) 2.5rem; }
.site-header { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: 1.5rem; }
.back-link { color: #217c75; text-decoration: none; font-weight: 700; }
h1 { margin: .35rem 0 .2rem; font-size: clamp(1.65rem, 3.8vw, 2.45rem); letter-spacing: -.04em; }
.subtitle { color: #556d73; margin: 0; }
.language-picker { display: flex; background: #e1e9e8; padding: .2rem; border-radius: 999px; }
.language-picker button { border: 0; border-radius: 999px; padding: .4rem .7rem; background: transparent; color: #42615f; }
.language-picker button.selected { color: white; background: #18766f; }
.card { border: 1px solid #e0e7e5; background: white; border-radius: 18px; box-shadow: 0 6px 25px #1d3d3d08; padding: clamp(1rem, 2.6vw, 1.6rem); margin-bottom: 1.1rem; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.eyebrow { font-size: .7rem; text-transform: uppercase; letter-spacing: .11em; font-weight: 800; color: #258378; }
h2 { font-size: 1.23rem; margin: .15rem 0; letter-spacing: -.02em; }
h3 { font-size: 1.08rem; margin: 0; }
.field-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; }
label { display: flex; flex-direction: column; gap: .35rem; font-weight: 650; font-size: .85rem; }
input, select { width: 100%; min-width: 0; padding: .65rem .7rem; border: 1px solid #bfd0cc; border-radius: 9px; background: white; color: #15323a; }
input:hover, select:hover { border-color: #7faeaa; }
input[aria-invalid="true"] { border-color: #c94836; }
.hint { font-size: .81rem; color: #60747b; margin: .75rem 0 0; }
.table-scroll { overflow-x: auto; }
.items-table { width: 100%; border-collapse: collapse; text-align: left; }
.items-table th { font-size: .8rem; color: #60747b; padding: .2rem .4rem .55rem; border-bottom: 1px solid #dde7e4; }
.items-table td { padding: .45rem .3rem; border-bottom: 1px solid #edf1f0; }
.items-table th:nth-child(1), .items-table td:nth-child(1) { width: 47%; }
.items-table th:nth-child(2), .items-table td:nth-child(2) { width: 25%; }
.items-table td:last-child { white-space: nowrap; }
.icon-button { border: 0; background: #edf3f1; color: #426b6a; padding: .35rem .55rem; border-radius: 8px; margin-right: .25rem; }
.icon-button:hover { background: #d7e8e4; }
.items-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-top: .85rem; }
button.secondary { border: 1px solid #a9c6c1; background: #f5faf8; color: #156b64; font-weight: 700; padding: .57rem .85rem; border-radius: 9px; }
button.secondary:hover { background: #e6f2ee; }
button.compact { padding: .4rem .65rem; font-size: .82rem; }
button.primary { border: 0; background: #16776f; color: white; padding: .8rem 1.4rem; border-radius: 11px; font-weight: 800; font-size: 1rem; box-shadow: 0 6px 18px #0f6f6733; }
button.primary:hover { background: #0b5e58; }
.calculate-row { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; margin: 1.2rem 0; }
#status { color: #506c72; font-size: .9rem; }
#status.error { color: #b22f28; font-weight: 700; }
.results { border-color: #cae2dd; }
.proof-badge { background: #eaf0ee; color: #47645f; border-radius: 99px; padding: .3rem .65rem; font-size: .77rem; font-weight: 800; text-align: center; }
.proof-badge.proven { color: #0a6a53; background: #d8f3e8; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
.metric { background: #f5f8f7; padding: .85rem; border-radius: 12px; min-width: 0; }
.metric .value { font-size: clamp(1.15rem, 2.8vw, 1.8rem); font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.metric .name { font-size: .78rem; color: #597077; }
.comparison { margin: 1.1rem 0; background: #eaf5f2; padding: .75rem 1rem; border-radius: 10px; font-weight: 650; color: #256c60; }
.plan-heading { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin: 1.15rem 0 .5rem; }
.view-switch { display: flex; gap: .25rem; background: #edf2f1; padding: .22rem; border-radius: 10px; }
.view-switch button { border: 0; background: transparent; color: #627473; padding: .45rem .7rem; border-radius: 8px; font-weight: 750; }
.view-switch button.selected { background: white; color: #08756b; box-shadow: 0 2px 8px #00000012; }
.patterns { margin: .9rem 0; display: grid; gap: .9rem; }
.pattern { padding: .9rem; border: 1px solid #e3ebea; border-radius: 12px; }
.pattern-header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .4rem; margin-bottom: .6rem; }
.pattern-title { font-weight: 800; }
.pattern-offcut { color: #7d6545; font-size: .83rem; }
.bar { display: flex; align-items: stretch; width: 100%; height: 36px; border-radius: 7px; overflow: hidden; background: #f2e0c1; border: 1px solid #ddd2bd; }
.piece { min-width: 0; flex: 0 0 auto; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .76rem; overflow: hidden; border-right: 1px solid #f8f8f8a6; }
.piece span { display: block; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.kerf { flex: 0 0 auto; background: #304e55; }
.offcut { flex: 1; display: grid; place-items: center; font-size: .72rem; color: #76552f; overflow: hidden; white-space: nowrap; }
.pattern-text { font-size: .82rem; color: #516972; margin: .48rem 0 0; overflow-wrap: anywhere; }
.result-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
.help { border-top: 1px solid #d9e5e1; margin: 1.6rem 0; padding: 1rem .5rem; color: #4b6267; }
.help summary { font-weight: 750; cursor: pointer; }
footer { color: #556d73; font-size: .8rem; padding-top: 1rem; }
.footer-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .5rem; margin-bottom: .45rem; }
footer a { color: #17786e; }
.dedication { max-width: 68ch; border-top: 1px solid #d9e5e1; margin-top: 1.35rem; padding-top: 1rem; font-size: .9rem; line-height: 1.65; }
.dedication p { margin: 0 0 .55rem; }
.dedication .in-memory { font-style: italic; color: #3e5b61; }
@media (max-width: 720px) {
  .field-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 430px) {
  .shell { padding: .8rem .6rem 1.5rem; }
  .site-header { align-items: center; }
  .subtitle { font-size: .9rem; }
  .card { border-radius: 12px; padding: .9rem; }
  .field-grid { gap: .5rem; }
  .items-table th:nth-child(1), .items-table td:nth-child(1) { width: 42%; }
  .items-table th:nth-child(2), .items-table td:nth-child(2) { width: 27%; }
  .icon-button { padding: .35rem .42rem; }
  .metrics { gap: .45rem; }
}
@media print {
  :root { background: white; }
  .shell { max-width: none; padding: 0; }
  .site-header .language-picker, #cut-form, .view-switch, .result-actions, .help, footer, .back-link { display: none !important; }
  .card { box-shadow: none; border: none; }
  .pattern, .metric, .piece, .kerf { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
