/* Box Studio v2 — consola de diseño (tema oscuro tecnológico) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #05080c;
  --bg2: #090e14;
  --panel: rgba(10, 15, 21, .88);
  --panel-solid: #0b1017;
  --raised: #111922;
  --line: rgba(150, 195, 225, .12);
  --line-strong: rgba(150, 195, 225, .24);
  --text: #e4eef4;
  --muted: #8a9cab;
  --dim: #5d6e7c;
  --accent: #5df2a8;
  --accent-ink: #04160e;
  --accent-soft: rgba(93,242,168, .13);
  --accent-glow: rgba(93,242,168, .35);
  --ember: #ff7a45;
  --ok: #5df2a8;
  --danger: #ff6674;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-io: cubic-bezier(.77, 0, .175, 1);
  --font-ui: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --font-prose: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --topbar-h: 54px;
  --side-w: 356px;
}

html { color-scheme: dark; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.app-shell { height: 100vh; height: 100dvh; display: flex; flex-direction: column; flex-shrink: 0; }

/* ── TOPBAR ───────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); flex-shrink: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 1.1rem;
  background: linear-gradient(180deg, #0a1017, #070b10);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.topbar::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 50%, transparent);
  opacity: .5;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand-mark { width: 28px; height: 28px; flex-shrink: 0; }
.brand-name { font-size: 1.15rem; font-weight: 600; letter-spacing: .02em; }
.brand-name b { color: var(--accent); font-weight: 600; }
.brand-tag {
  font-family: var(--font-mono); font-size: .58rem; letter-spacing: .1em;
  padding: .12rem .4rem; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted);
}
.topnav { display: flex; gap: .2rem; margin-left: 1.2rem; flex: 1; }
.topnav a {
  color: var(--muted); text-decoration: none; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase;
  padding: .4rem .7rem; border-radius: 6px; transition: color 150ms ease, background-color 150ms ease;
}
.top-right { display: flex; align-items: center; gap: .6rem; }

.seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.02); }
.seg button, .seg a {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; text-decoration: none;
  padding: .28rem .6rem; border-radius: 6px; border: none; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.seg button.active, .seg a.active { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg button:active { transform: scale(.96); }

.kofi-btn-top {
  display: inline-flex; align-items: center; gap: .4rem; background: #ff5e5b; color: #fff; padding: .34rem .8rem;
  border-radius: 7px; font-size: .74rem; font-weight: 700; text-decoration: none; letter-spacing: .03em;
  transition: transform 160ms var(--ease-out), filter 160ms ease;
}
.kofi-btn-top:active { transform: scale(.97); }

@media (hover: hover) and (pointer: fine) {
  .topnav a:hover { color: var(--text); background: rgba(255,255,255,.05); }
  .seg button:not(.active):hover, .seg a:not(.active):hover { color: var(--text); background: rgba(255,255,255,.06); }
  .kofi-btn-top:hover { filter: brightness(1.08); }
}

/* ── LAYOUT ───────────────────────────────────────────── */
.main { display: flex; flex: 1; min-height: 0; overflow: hidden; }

/* ── SIDEBAR ──────────────────────────────────────────── */
.sidebar {
  width: var(--side-w); flex-shrink: 0; overflow-y: auto; overflow-x: hidden;
  background: var(--panel-solid); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.section { border-bottom: 1px solid var(--line); animation: rise 420ms var(--ease-out) both; }
.section:nth-of-type(1) { animation-delay: 30ms; }
.section:nth-of-type(2) { animation-delay: 70ms; }
.section:nth-of-type(3) { animation-delay: 110ms; }
.section:nth-of-type(4) { animation-delay: 150ms; }
.section:nth-of-type(5) { animation-delay: 190ms; }
.section:nth-of-type(6) { animation-delay: 230ms; }
.section:nth-of-type(7) { animation-delay: 270ms; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.sec-hdr {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .85rem 1.1rem; background: transparent; border: none; cursor: pointer; text-align: left;
  transition: background-color 160ms ease;
}
.sec-title { display: flex; align-items: center; gap: .55rem; font-size: .74rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--text); }
.sec-num { font-family: var(--font-mono); font-size: .62rem; color: var(--accent); letter-spacing: .05em; }
.chevron { width: 10px; height: 10px; color: var(--muted); transition: transform 240ms var(--ease-out); flex-shrink: 0; }
.section.open .chevron { transform: rotate(180deg); }
.sec-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 280ms var(--ease-out); }
.section.open .sec-body { grid-template-rows: 1fr; }
.sec-clip { overflow: hidden; min-height: 0; }
.sec-inner { padding: .2rem 1.1rem 1.15rem; display: flex; flex-direction: column; gap: .95rem; }

.hint { font-size: .68rem; color: var(--muted); letter-spacing: .03em; line-height: 1.5; }
.mono { font-family: var(--font-mono); }

/* Presets */
.preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.preset-btn-item {
  position: relative; text-align: left; padding: .55rem .65rem; border-radius: 8px; cursor: pointer;
  background: rgba(255,255,255,.025); border: 1px solid var(--line); color: var(--text);
  font-size: .74rem; line-height: 1.3; width: 100%; overflow: hidden;
  transition: border-color 180ms ease, background-color 180ms ease, transform 160ms var(--ease-out);
}
.preset-btn-item strong { display: block; font-weight: 600; font-size: .76rem; margin-bottom: .12rem; }
.preset-btn-item span { font-family: var(--font-mono); font-size: .62rem; color: var(--muted); }
.preset-btn-item:active { transform: scale(.97); }
.preset-btn-item.on { border-color: var(--accent); background: var(--accent-soft); }

/* Materiales */
.mat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.mat-chip {
  display: flex; flex-direction: column; align-items: center; gap: .32rem; padding: .35rem .2rem .4rem;
  background: transparent; border: 1px solid transparent; border-radius: 10px; cursor: pointer;
  font-size: .6rem; letter-spacing: .04em; color: var(--muted);
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, transform 160ms var(--ease-out);
}
.mat-chip i {
  display: block; width: 100%; aspect-ratio: 1; border-radius: 8px; background-size: cover; background-position: center;
  border: 1px solid var(--line-strong); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
}
.mat-chip:active { transform: scale(.96); }
.mat-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* Controles */
.ctrl { display: flex; flex-direction: column; gap: .35rem; }
.ctrl-lbl { display: flex; justify-content: space-between; align-items: baseline; font-size: .72rem; color: var(--muted); }
.ctrl-lbl strong { font-weight: 500; color: var(--text); font-size: .76rem; letter-spacing: .02em; }
.ctrl-val { font-family: var(--font-mono); color: var(--accent); font-size: .74rem; min-width: 4rem; text-align: right; }

input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; --p: 50%;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--p), rgba(150,195,225,.16) var(--p));
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(150,195,225,.16); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--accent); }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5.5px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent); box-shadow: 0 0 0 0 var(--accent-soft);
  transition: transform 160ms var(--ease-out), box-shadow 180ms ease;
}
input[type=range]::-moz-range-thumb {
  width: 11px; height: 11px; border-radius: 50%; background: var(--bg); border: 2px solid var(--accent);
}
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.15); box-shadow: 0 0 0 7px var(--accent-soft); }
@media (hover: hover) and (pointer: fine) {
  input[type=range]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 5px var(--accent-soft); }
}

.dim-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .5rem; }
.dim-grp { display: flex; flex-direction: column; gap: .25rem; }
.dim-grp label { font-size: .6rem; color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.dim-inp {
  width: 100%; padding: .48rem .55rem; background: rgba(255,255,255,.03); border: 1px solid var(--line-strong);
  border-radius: 7px; font-family: var(--font-mono); font-size: .82rem; color: var(--text); outline: none;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}
.dim-inp:focus { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.dim-inp::-webkit-inner-spin-button { opacity: .35; }

.btn-grp { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(255,255,255,.02); }
.btn-grp button {
  flex: 1 1 auto; min-width: 4.2rem; padding: .48rem .5rem; border: none; border-radius: 7px; cursor: pointer;
  font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; background: transparent; color: var(--muted); font-weight: 500;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.btn-grp button.active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn-grp button:active { transform: scale(.96); }
@media (hover: hover) and (pointer: fine) { .btn-grp button:not(.active):hover { background: rgba(255,255,255,.06); color: var(--text); } }

.tog-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; }
.tog-lbl { font-size: .76rem; color: var(--text); }
.tog { position: relative; width: 38px; height: 21px; flex-shrink: 0; cursor: pointer; display: block; }
.tog input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.tog-track { position: absolute; inset: 0; background: rgba(150,195,225,.16); border-radius: 11px; transition: background-color 200ms ease, box-shadow 200ms ease; }
.tog-thumb { position: absolute; top: 2.5px; left: 2.5px; width: 16px; height: 16px; background: #dbe7ee; border-radius: 50%; transition: transform 220ms var(--ease-out), background-color 200ms ease; }
.tog input:checked + .tog-track { background: var(--accent); box-shadow: 0 0 12px -2px var(--accent-glow); }
.tog input:checked ~ .tog-thumb { transform: translateX(17px); background: var(--accent-ink); }
.tog input:focus-visible ~ .tog-track { outline: 2px solid var(--accent); outline-offset: 2px; }

select {
  width: 100%; padding: .5rem .7rem; background-color: rgba(255,255,255,.03); border: 1px solid var(--line-strong); border-radius: 7px;
  font-family: var(--font-ui); font-size: .8rem; color: var(--text); outline: none; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a9cab'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7rem center;
  transition: border-color 160ms ease;
}
select:focus { border-color: var(--accent); }
select option { background: #0b1017; color: var(--text); }

.info-box {
  display: grid; grid-template-columns: 1fr 1fr; gap: .55rem .8rem; padding: .75rem .8rem; border-radius: 9px;
  background: linear-gradient(180deg, rgba(93,242,168,.05), rgba(93,242,168,.015)); border: 1px solid var(--line);
}
.info-item { display: flex; flex-direction: column; gap: .12rem; }
.info-lbl { font-size: .58rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.info-val { font-family: var(--font-mono); font-size: .8rem; font-weight: 500; color: var(--text); }

.finger-row { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; align-items: center; }
.finger-end { font-family: var(--font-mono); font-size: .64rem; color: var(--muted); }

.div-group-title { font-size: .62rem; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; margin: .3rem 0 .1rem; }
.div-item { display: flex; flex-direction: column; gap: .1rem; }
.div-item-head { display: flex; justify-content: space-between; align-items: baseline; font-size: .72rem; color: var(--muted); }
.div-item-head b { font-family: var(--font-mono); font-weight: 500; color: var(--accent); font-size: .72rem; }
.div-h-head { margin-top: .3rem; font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; }
.div-h-head b { text-transform: none; letter-spacing: 0; }
.div-item + .div-item, .div-item + .div-group-title { margin-top: .35rem; }

/* Forma de la caja: lo que solo aplica a una u otra */
body:not(.is-round) .only-round { display: none !important; }
body.is-round .only-rect { display: none !important; }
body:not(.is-poly) .only-poly { display: none !important; }
body.is-integrated #s-div, body.is-integrated .cells-badge { display: none !important; }
body.is-poly .only-circle, body.is-custom .only-circle { display: none !important; }
body:not(.is-custom) .only-custom { display: none !important; }
body:not(.is-star) .only-star { display: none !important; }
body:not(.is-heart) .only-heart { display: none !important; }

/* ── Apoyo (Ko-fi) ─────────────────────────────────── */
.kofi-btn-top { animation: kofiPulse 3.2s ease-in-out infinite; }
@keyframes kofiPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255,94,91,.45); } 55% { box-shadow: 0 0 0 7px rgba(255,94,91,0); } }

.kofi-card {
  display: flex; gap: .8rem; align-items: flex-start; margin: 1rem 1.1rem 0; padding: .95rem 1rem;
  border-radius: 12px; border: 1px solid rgba(255,94,91,.35);
  background: linear-gradient(135deg, rgba(255,94,91,.13), rgba(255,94,91,.03));
}
.kofi-card-cup { font-size: 1.7rem; line-height: 1; flex-shrink: 0; }
.kofi-card-body { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.kofi-card-body strong { font-size: .82rem; font-weight: 600; line-height: 1.3; color: var(--text); }
.kofi-card-body p { font-size: .72rem; color: var(--muted); line-height: 1.5; margin: 0; }
.kofi-card-body small { font-size: .62rem; color: var(--dim); letter-spacing: .04em; }
.kofi-card-btn {
  display: inline-flex; align-items: center; justify-content: center; align-self: flex-start; gap: .4rem;
  padding: .5rem 1rem; border-radius: 8px; background: #ff5e5b; color: #fff !important; text-decoration: none;
  font-size: .76rem; font-weight: 700; letter-spacing: .03em; white-space: nowrap;
  transition: transform 160ms var(--ease-out), filter 160ms ease, box-shadow 200ms ease;
}
.kofi-card-btn:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .kofi-card-btn:hover { filter: brightness(1.08); box-shadow: 0 0 20px -4px rgba(255,94,91,.6); } }

.modal-kofi {
  display: flex; align-items: center; gap: .8rem; padding: .8rem 1.3rem; border-top: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(255,94,91,.12), rgba(255,94,91,.02));
}
.modal-kofi-cup { font-size: 1.4rem; flex-shrink: 0; }
.modal-kofi-text { flex: 1; font-size: .78rem; color: var(--text); line-height: 1.4; }

.kofi-nudge {
  position: fixed; left: 1.5rem; bottom: 1.5rem; z-index: 9998; max-width: 340px; display: flex; gap: .8rem; align-items: flex-start;
  padding: 1rem 2rem 1rem 1rem; border-radius: 14px; background: var(--panel-solid);
  border: 1px solid rgba(255,94,91,.45); box-shadow: 0 16px 48px rgba(0,0,0,.55), 0 0 0 1px rgba(255,94,91,.1);
  transform: translateY(24px) scale(.97); opacity: 0; pointer-events: none;
  transition: transform 340ms var(--ease-out), opacity 220ms ease;
}
.kofi-nudge.show { transform: none; opacity: 1; pointer-events: auto; }
.kofi-nudge-cup { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.kofi-nudge-body p { font-size: .8rem; color: var(--text); line-height: 1.45; margin: 0 0 .6rem; }
.kofi-nudge-row { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; }
.kofi-nudge-later { background: none; border: none; color: var(--muted); font-size: .72rem; cursor: pointer; padding: .3rem .2rem; text-decoration: underline; text-underline-offset: 3px; }
.kofi-nudge .kofi-close { position: absolute; top: .4rem; right: .5rem; background: none; border: none; color: var(--dim); cursor: pointer; font-size: .9rem; padding: .25rem; }
@media (max-width: 768px) { .kofi-nudge { left: .7rem; right: .7rem; bottom: 4.6rem; max-width: none; } .kofi-card { margin: .8rem 1.1rem 0; } .modal-kofi { flex-wrap: wrap; } }

/* Acciones */
.actions { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .5rem; margin-top: auto; border-top: 1px solid var(--line); background: linear-gradient(180deg, transparent, rgba(93,242,168,.03)); }
.btn {
  padding: .68rem 1rem; border: 1px solid transparent; border-radius: 9px; cursor: pointer;
  font-size: .76rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center; gap: .55rem;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms var(--ease-out), box-shadow 200ms ease, opacity 160ms ease;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn-primary, .btn-download { background: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 0 var(--accent-glow); }
.btn-ghost { background: rgba(255,255,255,.05); color: var(--text); border-color: var(--line-strong); }
.btn-secondary { background: transparent; color: var(--muted); border-color: var(--line-strong); }
.btn-sm { padding: .42rem .7rem; font-size: .64rem; }
@media (hover: hover) and (pointer: fine) {
  .btn-download:hover, .btn-primary:hover { box-shadow: 0 0 22px -2px var(--accent-glow); }
  .btn-ghost:hover { background: rgba(255,255,255,.09); }
  .btn-secondary:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }
  .preset-btn-item:hover { border-color: var(--line-strong); background: rgba(255,255,255,.05); }
  .mat-chip:hover { background: rgba(255,255,255,.04); color: var(--text); }
  .sec-hdr:hover { background: rgba(255,255,255,.03); }
}
.row-btns { display: flex; gap: .45rem; flex-wrap: wrap; }

/* drawer mobile */
.drawer-handle { display: none; align-items: center; justify-content: center; gap: .6rem; padding: .7rem; cursor: pointer; flex-shrink: 0; background: var(--panel-solid); border-bottom: 1px solid var(--line); }
.drawer-handle-bar { width: 38px; height: 4px; border-radius: 2px; background: var(--line-strong); }
.drawer-handle-lbl { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.mobile-action-bar { display: none; padding: .6rem; background: var(--panel-solid); border-top: 1px solid var(--line); flex-shrink: 0; }
.mobile-action-bar .btn { width: 100%; }

/* ── CANVAS ───────────────────────────────────────────── */
.canvas-area {
  flex: 1; position: relative; overflow: hidden; min-width: 0;
  container-type: inline-size; container-name: cv;
  background: radial-gradient(1100px 680px at 50% 40%, #12242f 0%, #0a1620 45%, #05090d 100%);
}
.canvas-area::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(93,242,168,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(93,242,168,.055) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 62% at 50% 46%, #000 0%, transparent 100%);
  mask-image: radial-gradient(ellipse 70% 62% at 50% 46%, #000 0%, transparent 100%);
}
#threeCanvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; touch-action: none; z-index: 1; outline: none; }

.hud-frame {
  position: absolute; inset: 12px; pointer-events: none; z-index: 2; --c: rgba(93,242,168,.5);
  background:
    linear-gradient(var(--c), var(--c)) top left / 16px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top left / 1px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 16px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) top right / 1px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 16px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom left / 1px 16px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 16px 1px no-repeat,
    linear-gradient(var(--c), var(--c)) bottom right / 1px 16px no-repeat;
}

.glass {
  background: rgba(8, 13, 19, .72); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--line-strong); border-radius: 12px;
}
.hud-tl { position: absolute; top: 1.4rem; left: 1.4rem; z-index: 3; padding: .7rem .95rem; }
.hud-k { font-size: .56rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: .2rem; }
.hud-v { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 500; color: var(--text); letter-spacing: -.02em; line-height: 1.1; }
.vol-unit { font-size: .62rem; color: var(--muted); letter-spacing: .05em; }
.cells-badge { position: absolute; top: 1.4rem; left: 50%; transform: translateX(-50%); z-index: 3; padding: .4rem 1.1rem; border-radius: 100px; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.cells-badge strong { font-family: var(--font-mono); color: var(--accent); font-weight: 500; }

.hud-tr { position: absolute; top: 1.4rem; right: 1.4rem; z-index: 3; padding: .7rem .95rem; display: grid; gap: .5rem; min-width: 148px; }
.stat-row { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.stat-k { font-size: .56rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.stat-v { font-family: var(--font-mono); font-size: .86rem; color: var(--text); }

.canvas-hint { position: absolute; bottom: 1.4rem; left: 1.5rem; z-index: 3; font-size: .6rem; color: rgba(190, 215, 230, .4); letter-spacing: .08em; line-height: 1.9; text-transform: uppercase; pointer-events: none; }

/* Dock inferior */
.dock {
  position: absolute; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: .3rem; padding: .35rem; border-radius: 14px; max-width: calc(100% - 1.6rem);
}
.dock-grp { display: flex; align-items: center; gap: 2px; }
.dock-sep { width: 1px; height: 22px; background: var(--line-strong); margin: 0 .3rem; flex-shrink: 0; }
.vbtn, .tbtn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; white-space: nowrap;
  padding: .45rem .75rem; border: none; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
  font-size: .68rem; letter-spacing: .07em; text-transform: uppercase; font-weight: 500;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.tbtn svg { width: 16px; height: 16px; flex-shrink: 0; }
.vbtn:active, .tbtn:active { transform: scale(.95); }
.vbtn.active { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.tbtn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.tbtn:disabled { opacity: .3; cursor: not-allowed; }
@media (hover: hover) and (pointer: fine) {
  .vbtn:not(.active):hover, .tbtn:not(:disabled):hover { background: rgba(255,255,255,.08); color: var(--text); }
  .tbtn[aria-pressed="true"]:hover { background: rgba(93,242,168,.2); color: var(--accent); }
}
/* tooltip del dock */
.tbtn[data-tip]::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translate(-50%, 4px) scale(.97);
  transform-origin: bottom center; padding: .3rem .55rem; border-radius: 6px; background: #0b1218; border: 1px solid var(--line-strong);
  color: var(--text); font-size: .62rem; letter-spacing: .05em; text-transform: none; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 120ms ease, transform 140ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .tbtn[data-tip]:hover::after { opacity: 1; transform: translate(-50%, 0) scale(1); transition-delay: 350ms; }
  .dock:has(.tbtn:hover) .tbtn[data-tip]:hover::after { transition-delay: 0ms; }
}

@container cv (max-width: 1040px) { .tbtn span { display: none; } .tbtn { padding: .5rem .62rem; } }
@container cv (max-width: 1000px) { .canvas-hint { display: none; } }
@container cv (max-width: 620px) { .hud-tr { display: none; } }
@container cv (max-width: 700px) { .vbtn { padding: .45rem .55rem; font-size: .62rem; letter-spacing: .04em; } .dock-sep { margin: 0 .15rem; } }
#divPosContainer { display: flex; flex-direction: column; gap: .55rem; }
#divPosContainer:empty { display: none; }

/* Etiquetas de cotas */
.dim-label {
  position: absolute; z-index: 3; left: 0; top: 0; pointer-events: none; padding: .18rem .45rem; border-radius: 5px;
  font-family: var(--font-mono); font-size: .68rem; color: var(--accent); background: rgba(5, 12, 18, .82);
  border: 1px solid rgba(93,242,168,.4); white-space: nowrap; opacity: 0; transition: opacity 220ms ease; will-change: transform;
}
.dim-label.on { opacity: 1; }

/* toast del divisor */
.div-hint-toast {
  position: absolute; bottom: 5.2rem; left: 50%; transform: translateX(-50%) translateY(8px); z-index: 6;
  padding: .6rem 1rem; font-size: .72rem; line-height: 1.6; color: var(--text); text-align: center; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity 220ms ease, transform 260ms var(--ease-out);
}
.div-hint-toast.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.div-hint-toast strong { color: var(--accent); font-weight: 600; }
.div-hint-close { margin-left: .7rem; background: none; border: none; color: var(--muted); cursor: pointer; font-size: .8rem; vertical-align: middle; }

/* ── MODAL SVG ────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(2, 6, 10, .82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity 180ms ease, visibility 0s linear 180ms;
}
.modal-overlay.show { opacity: 1; visibility: visible; transition-delay: 0s; }
.modal {
  width: 92vw; max-width: 940px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 16px; box-shadow: 0 30px 90px rgba(0,0,0,.6), 0 0 0 1px rgba(93,242,168,.06);
  transform: translateY(10px) scale(.97); transition: transform 260ms var(--ease-out);
}
.modal-overlay.show .modal { transform: none; }
.modal-hdr { display: flex; align-items: center; justify-content: space-between; padding: .95rem 1.3rem; border-bottom: 1px solid var(--line); }
.modal-title { font-size: .9rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.modal-close { background: transparent; border: 1px solid var(--line); color: var(--muted); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; font-size: .9rem; transition: transform 160ms var(--ease-out), color 160ms ease; }
.modal-close:active { transform: scale(.94); }
.modal-body {
  flex: 1; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 1.5rem; background-color: #eef3f6;
  background-image: linear-gradient(rgba(10,30,45,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(10,30,45,.06) 1px, transparent 1px);
  background-size: 20px 20px;
}
.modal-body svg { max-width: 100%; height: auto; margin: auto; }
.modal-body { min-height: 38vh; }
.modal { overflow-y: auto; }
.modal-footer { padding: .9rem 1.3rem; border-top: 1px solid var(--line); display: flex; gap: .5rem; justify-content: flex-end; }
.modal-opts { padding: .7rem 1.3rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem; font-size: .78rem; color: var(--text); }
.opt-chk { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.opt-chk input { accent-color: var(--accent); width: 1rem; height: 1rem; }
.opt-extra { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.2rem; }
.opt-num { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); }
.opt-num input { width: 4.6rem; padding: .25rem .4rem; background: var(--raised); color: var(--text); border: 1px solid var(--line-strong); border-radius: 6px; font-size: .78rem; }
.opt-info { margin-left: auto; color: var(--accent); font-weight: 600; }

/* ── TOASTS ───────────────────────────────────────────── */
.kofi-toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; max-width: 320px; padding: 1rem 1.2rem 1rem 1.1rem;
  display: flex; align-items: center; gap: .9rem; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.5); transform: translateY(24px) scale(.97); opacity: 0; pointer-events: none;
  transition: transform 320ms var(--ease-out), opacity 220ms ease;
}
.kofi-toast.show { transform: none; opacity: 1; pointer-events: auto; }
.kofi-toast .kofi-icon { font-size: 1.5rem; flex-shrink: 0; }
.kofi-toast .kofi-text p { font-size: .8rem; color: var(--muted); margin: 0 0 .5rem; line-height: 1.4; }
.kofi-toast .kofi-btn { display: inline-block; background: #ff5e5b; color: #fff; padding: .38rem .85rem; border-radius: 7px; font-size: .78rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.kofi-toast .kofi-close { position: absolute; top: .4rem; right: .5rem; background: none; border: none; color: var(--dim); cursor: pointer; font-size: .9rem; padding: .25rem; }

.val-toast {
  position: fixed; bottom: 1.5rem; left: 50%; z-index: 9999; max-width: 340px; padding: .7rem 1rem; font-size: .76rem; line-height: 1.45;
  color: #ffe1e4; background: #2a1116; border: 1px solid rgba(255,102,116,.4); border-radius: 10px; box-shadow: 0 12px 40px rgba(0,0,0,.5);
  transform: translate(-50%, 24px); opacity: 0; pointer-events: none; transition: transform 300ms var(--ease-out), opacity 200ms ease;
}
.val-toast.ok { color: #d9fff0; background: #0d2119; border-color: rgba(93,242,168,.4); }
.val-toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ── RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 1100px) { .topnav { display: none; } }
@media (max-width: 860px) {
  .tbtn span { display: none; }
  .tbtn { padding: .55rem .6rem; }
  .canvas-hint { display: none; }
}
@media (max-width: 768px) {
  :root { --topbar-h: 50px; }
  .topbar { padding: 0 .7rem; gap: .5rem; }
  .top-right { gap: .35rem; }
  .seg button, .seg a { padding: .26rem .42rem; font-size: .62rem; }
  .kofi-btn-top { padding: .32rem .5rem; }
  .brand-name { font-size: 1.02rem; }
  .brand-mark { width: 24px; height: 24px; }
  .brand-tag { display: none; }
  .kofi-btn-top span { display: none; }
  .main { flex-direction: column; }
  .canvas-area { flex: 1 1 auto; min-height: 0; order: 1; }
  .sidebar { width: 100%; flex: 0 0 auto; order: 2; max-height: 50px; overflow: hidden; transition: max-height 320ms var(--ease-out); border-right: none; border-top: 1px solid var(--line); }
  .sidebar.mobile-expanded { max-height: 46vh; overflow-y: auto; }
  .drawer-handle { display: flex; }
  .mobile-action-bar { display: flex; order: 3; }
  .sec-hdr { padding: 1rem 1.1rem; }
  .btn-grp button { padding: .7rem .5rem; }
  .tog { width: 48px; height: 26px; }
  .tog-thumb { width: 21px; height: 21px; top: 2.5px; }
  .tog input:checked ~ .tog-thumb { transform: translateX(22px); }
  input[type=range] { height: 32px; }
  input[type=range]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -9px; }
  .btn { padding: .8rem 1rem; }
  .hud-tl { top: .8rem; left: .8rem; padding: .5rem .7rem; }
  .hud-v { font-size: 1.05rem; }
  .cells-badge { top: auto; bottom: 4.4rem; }
  .dock { bottom: .7rem; overflow-x: auto; scrollbar-width: none; }
  .dock::-webkit-scrollbar { display: none; }
  .vbtn { padding: .5rem .55rem; font-size: .62rem; }
  .hud-frame { inset: 6px; }
}

@media (max-width: 360px) { .brand-name { display: none; } body { overflow-x: hidden; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
}

/* ── CONTENIDO SEO (debajo de la herramienta) ─────────── */
#contentSection { background: linear-gradient(180deg, var(--bg), #070c12); border-top: 1px solid var(--line); }
.content-wrap { max-width: 980px; margin: 0 auto; padding: 4.5rem 1.5rem 5rem; font-family: var(--font-prose); }
.content-wrap h2 { font-family: var(--font-ui); font-size: 1.6rem; font-weight: 600; letter-spacing: .01em; margin-bottom: 1rem; color: var(--text); }
.content-wrap h3 { font-family: var(--font-ui); font-size: 1.05rem; font-weight: 600; margin: 1.9rem 0 .5rem; color: var(--text); }
.content-wrap p { color: #b6c5d0; font-size: .98rem; line-height: 1.8; margin-bottom: .9rem; }
.content-wrap ul { padding-left: 1.4rem; margin-bottom: 1rem; }
.content-wrap li { color: #b6c5d0; font-size: .98rem; line-height: 1.7; margin-bottom: .3rem; }
.content-wrap strong { color: var(--text); }
.content-section { margin-bottom: 3.2rem; padding-bottom: 3.2rem; border-bottom: 1px solid var(--line); }
.content-section:last-child { border-bottom: none; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin: 1.4rem 0; }
.step-card { position: relative; background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 12px; padding: 1.3rem; overflow: hidden; }
.step-card::before { content: ''; position: absolute; left: 0; top: 0; width: 100%; height: 2px; background: linear-gradient(90deg, var(--accent), transparent); opacity: .7; }
.step-num { font-size: 1.7rem; font-weight: 600; color: var(--accent); font-family: var(--font-mono); margin-bottom: .4rem; }
.step-card h4 { font-family: var(--font-ui); font-size: .95rem; font-weight: 600; margin-bottom: .35rem; }
.step-card p { font-size: .86rem; color: var(--muted); margin: 0; }
.faq-item { margin-bottom: 1.3rem; padding-bottom: 1.3rem; border-bottom: 1px solid var(--line); }
.faq-item:last-child { border-bottom: none; }
.faq-q { font-family: var(--font-ui); font-weight: 600; font-size: 1rem; color: var(--text) !important; margin-bottom: .35rem !important; }
.faq-a { color: #b6c5d0; font-size: .94rem; line-height: 1.7; }
.compat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .7rem; margin: 1rem 0; }
.compat-tag { background: rgba(255,255,255,.025); border: 1px solid var(--line); border-radius: 9px; padding: .65rem .9rem; font-size: .84rem; font-weight: 500; text-align: center; color: var(--text); }
.content-footer { background: #04070a; border-top: 1px solid var(--line); color: var(--muted); padding: 2.2rem 1rem; text-align: center; font-size: .82rem; }
.content-footer a { color: var(--muted); text-decoration: none; transition: color 150ms ease; }
.content-footer ul { list-style: none; display: flex; gap: 1.5rem; justify-content: center; margin-top: .7rem; flex-wrap: wrap; }
@media (hover: hover) and (pointer: fine) { .content-footer a:hover { color: var(--accent); } }
body.is-flex .mode-hide { display: none !important; }
body.is-flex #inD[readonly] { opacity: .55; }
body.is-letter .mode-hide, body.is-letter .dim-hide { display: none !important; }

/* galería de cajas reales */
.content-section .gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:.8rem;margin-top:1rem}
.content-section .gallery figure{margin:0}
.content-section .gallery img{width:100%;height:160px;object-fit:cover;border-radius:8px;display:block}
.content-section .gallery figcaption{font-size:.78rem;opacity:.7;margin-top:.4rem;line-height:1.4}

/* baúl: medidas exteriores y sin divisores */
body.is-trunk #s-div, body.is-trunk .cells-badge, body.is-trunk .mode-hide, body.is-crate .mode-hide { display: none !important; }

/* escalera: el largo es el ancho del exhibidor; alto y fondo salen de los escalones */
body.is-stairs .mode-hide, body.is-stairs .dim-row .dim-grp:nth-child(2), body.is-stairs .dim-row .dim-grp:nth-child(3) { display: none !important; }
