:root {
  color-scheme: light;
  --ink: #1b312b;
  --muted: #52655d;
  --line: #d7dfd8;
  --accent: #a73e27;
  --surface: #fff;
  --ground: #f7f8f4;
  font: 100%/1.5 "Instrument Sans", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--ground);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden], .skip:not(:focus) { display: none !important; }
:focus-visible { outline: 3px solid #b84b2a; outline-offset: 3px; }
.skip:focus { position: fixed; z-index: 2; top: .6rem; left: .6rem; padding: .6rem 1rem; background: white; }
a { color: inherit; text-underline-offset: .22em; }
.wrap { width: min(78rem, calc(100% - 5rem)); margin-inline: auto; }
.mast { border-bottom: 1px solid var(--line); background: var(--surface); }
.mast nav, footer .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.15rem; }
.brand { display: inline-flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); font-size: 1.19rem; font-weight: 750; letter-spacing: -.045em; }
.brand-mark { display: inline-block; position: relative; width: 1.65rem; height: 1.75rem; flex: none; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; width: 1rem; height: 1.28rem; border: 1.5px solid var(--ink); border-radius: .13rem; }
.brand-mark::before { top: .3rem; left: .08rem; transform: rotate(-13deg); background: #d8e2ce; }
.brand-mark::after { top: .08rem; left: .43rem; transform: rotate(9deg); background: #d66a46; }
.guide-link, footer a { font-size: .875rem; font-weight: 600; }
.intro { margin: 2.5rem 0 1.75rem; }
h1, h2, legend, p { margin: 0; }
h1 { font-family: "DM Serif Text", Georgia, serif; font-weight: 500; font-size: clamp(2.2rem, 4.4vw, 3.9rem); letter-spacing: -.06em; line-height: 1.05; }
h1 em { font-weight: 400; color: #46654e; }
.intro p, #metodo > div:first-child p { margin-top: .65rem; color: var(--muted); }
.mobile-jump { display: none; }
.workspace { display: grid; grid-template-columns: minmax(18.5rem,.79fr) minmax(0,1.38fr); gap: 1.25rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: .95rem; overflow: hidden; min-width: 0; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .95rem 1.25rem; border-bottom: 1px solid var(--line); min-height: 3.6rem; }
h2 { font-size: 1.2rem; font-weight: 730; line-height: 1.25; letter-spacing: -.035em; }
.controls { display: grid; gap: 1.05rem; padding: 1.25rem; }
.pair { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .75rem; }
label, legend { font-size: .89rem; font-weight: 620; }
label { display: grid; gap: .36rem; min-width: 0; }
input, select, button { font: inherit; }
input, select, .number { color: var(--ink); background-color: white; border: 1px solid #aab8ae; border-radius: .42rem; }
input, select { min-width: 0; width: 100%; font-size: 1rem; line-height: 1.4; padding: .53rem .65rem; }
select { appearance: none; padding-right: 1.8rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%233d5849' stroke-width='1.4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .65rem center; }
.number { display: flex; align-items: center; overflow: hidden; }
.number input { flex: 1; border: 0; background: transparent; appearance: textfield; }
.number input:focus-visible { outline: none; }
.number:focus-within { outline: 3px solid #b84b2a; outline-offset: 2px; }
.number > span { color: var(--muted); font-size: .86rem; padding-right: .65rem; font-weight: 500; }
fieldset { padding: .52rem 0 0; margin: 0; border: 0; min-width: 0; }
legend { font-weight: 700; padding: 0; }
.unit-row, .canvas-toolbar { display: flex; gap: .45rem; align-items: center; }
.unit-row { margin: 0 0 .6rem; justify-content: space-between; }
.unit-row label, .canvas-toolbar label { color: var(--muted); font-size: .875rem; font-weight: 500; }
.unit-row select, .canvas-toolbar select { width: auto; font-weight: 600; padding-block: .3rem; font-size: .875rem; }
.upload-block { display: grid; gap: .45rem; }
.upload-block label { display: block; }
small, .hint { color: var(--muted); font-size: .84rem; font-weight: 400; line-height: 1.45; }
input[type=file] { border: 1px dashed #8c9d8f; background: #f5f8f2; padding: .55rem; font-size: .87rem; }
input::file-selector-button { font: inherit; font-weight: 650; margin-right: .6rem; padding: .45rem .56rem; border-radius: .3rem; color: var(--ink); border: 1px solid #b4c2b5; background: white; cursor: pointer; }
.art-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; font-size: .875rem; overflow-wrap: anywhere; }
.art-actions:has(#artStatus:empty):has(#removeArt[hidden]) { display: none; }
button { cursor: pointer; }
.quiet, .inline-btn { color: var(--accent); font-size: .875rem; font-weight: 650; border: none; background: transparent; padding: .25rem 0; text-decoration: underline; text-underline-offset: .2em; }
.advanced { border-top: 1px solid var(--line); padding-top: .8rem; }
.advanced + .advanced { margin-top: -.15rem; }
summary { cursor: pointer; padding-right: 1.6rem; list-style: none; position: relative; font-weight: 650; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--muted); position: absolute; right: .05rem; top: -.04em; font-size: 1.22em; font-weight: 450; }
details[open] > summary::after { content: "−"; }
.advanced summary { font-size: .94rem; }
.detail-content { margin-top: .7rem; display: grid; gap: .75rem; }
#size { color: var(--muted); font: .84rem/1.3 "IBM Plex Mono", Consolas, monospace; }
.result-body { padding: 1.15rem 1.25rem 1.25rem; }
#metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 1rem; }
#metrics > * { display: flex; flex-direction: column; gap: .08rem; padding-inline: .9rem; border-left: 1px solid var(--line); font-size: .85rem; color: var(--muted); }
#metrics > :first-child { border: 0; padding-left: 0; }
#metrics strong, #metrics b { font: 600 clamp(1.45rem,2.6vw,2.15rem)/1.1 "Instrument Sans", "Segoe UI", sans-serif; letter-spacing: -.045em; color: var(--ink); font-variant-numeric: tabular-nums; }
.canvas-toolbar { justify-content: space-between; padding: .58rem .8rem; border: 1px solid #cad4c8; border-radius: .54rem .54rem 0 0; background: #f3f6ef; }
.stage { border: 1px solid #cad4c8; border-top: 0; background-color: #e7ede3; background-image: linear-gradient(#b9c7b84d 1px,transparent 1px), linear-gradient(90deg,#b9c7b84d 1px,transparent 1px); background-size: 14px 14px; padding: 1.25rem; border-radius: 0 0 .54rem .54rem; }
#drawing { display: grid; place-items: center; min-height: 15rem; }
#drawing svg { display: block; width: auto; height: clamp(15rem, 32vw, 24rem); max-width: 100%; background-color: white; box-shadow: 0 2px 4px #32473226, 0 8px 18px #32473220; }
#summary, #comparison, #feedback { margin-top: .75rem; color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
#comparison { border-top: 1px solid var(--line); padding-top: .65rem; }
#comparison table { border-collapse: collapse; width: 100%; font-size: .85rem; }
#comparison th, #comparison td { padding: .35rem; text-align: left; border-bottom: 1px solid var(--line); }
#comparison:empty, #error:empty, #summary:empty, #feedback:empty, #metrics:empty { display: none; }
#error { margin-bottom: 1rem; border-left: 3px solid var(--accent); background: #fff0e9; color: #82351e; padding: .65rem .85rem; }
.exports, .examples { display: flex; gap: .65rem; flex-wrap: wrap; margin-top: .95rem; }
.primary, .secondary, .examples button { padding: .65rem 1.05rem; font-weight: 650; border-radius: .43rem; font-size: .95rem; }
.primary { background: var(--ink); color: white; border: 1px solid var(--ink); }
.secondary, .examples button { color: var(--ink); border: 1px solid #acbbaf; background: white; }
.primary:hover { background: #294b3d; }
.secondary:hover, .examples button:hover { background: #edf2e9; }
button:disabled { opacity: .53; cursor: default; }
#metodo { display: grid; grid-template-columns: .79fr 1.38fr; gap: 1.25rem; margin: 3rem 0; padding-top: 1.8rem; border-top: 1px solid #c5d0c4; }
#metodo h2 { font-family: "DM Serif Text", Georgia, serif; font-weight: 500; font-size: 2rem; }
.guide-content details { padding: .85rem 0; border-bottom: 1px solid var(--line); }
.guide-content details:first-child { padding-top: 0; }
.guide-content p { margin: .55rem 0; color: var(--muted); }
.examples button { font-size: .85rem; padding: .5rem .7rem; }
footer { background: #eef2eb; border-top: 1px solid var(--line); }
footer .brand { font-size: 1rem; }
.mobile-jump, #settings, #previa, #metodo { scroll-margin-top: .8rem; }
@media (min-width: 1050px) {
  .panel-title, .result-body, .controls { padding-inline: 1.5rem; }
}
@media (max-width: 760px) {
  .wrap { width: min(100% - 2rem, 44rem); }
  .mast nav { min-height: 3.65rem; }
  .intro { margin: 1.65rem 0 .75rem; }
  .workspace, #metodo { grid-template-columns: 1fr; }
  .mobile-jump { display: inline-block; margin: 0 0 1rem; color: var(--accent); font-weight: 600; font-size: .875rem; }
  .panel-title, .result-body, .controls { padding-inline: 1rem; }
  .stage { padding: 1rem; }
  #drawing svg { height: 18rem; }
  #metodo { margin-block: 2.15rem; }
}
@media (max-width: 380px) {
  .wrap { width: calc(100% - 1.25rem); }
  .brand { font-size: 1.04rem; gap: .45rem; }
  .guide-link { font-size: .8rem; }
  #metrics > * { padding-inline: .5rem; }
}
@media print {
  .mast, .intro, #settings, .mobile-jump, #metodo, footer, .exports, .canvas-toolbar { display: none; }
  .workspace { display: block; }
}
