/* Card Workshop: carta no centro sobre a base de corte, gaveta embaixo, coleção à direita. */
.ws-head { padding: 1rem 0 1.1rem; border-bottom: 3px solid var(--night); }
.ws-head h1 { margin-bottom: .15rem; font-size: clamp(1.8rem, 1.4rem + 1.4vw, 2.5rem); text-shadow: 0 3px 0 var(--purple-deep); }
.ws-head p { margin: 0; }
.ws-head .crumbs ol { margin-bottom: .35rem; }
.ws-head .ws-limits { margin-top: .6rem; display: inline-block; max-width: 96ch; font-size: .98rem; line-height: 1.45; background: rgba(20,18,43,.34); border-left: 5px solid var(--spark); border-radius: 8px; padding: .4rem .8rem; }
@media (min-width: 900px) {
  .ws-head .wrap-wide { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px); column-gap: 2rem; align-content: center; }
  .ws-head .crumbs { grid-column: 1 / -1; }
  .ws-head h1, .ws-head p { grid-column: 1; }
  .ws-head .ws-limits { grid-column: 2; grid-row: 2 / span 2; align-self: center; margin-top: 0; }
}
@media (max-width: 640px) {
  .ws-head .crumbs, .ws-head p:not(.ws-limits) { display: none; }
  .ws-head h1 { font-size: 1.6rem; }
  .ws-head .ws-limits { font-size: .9rem; line-height: 1.36; margin-top: .35rem; }
}
.ws { padding-top: 1.1rem; font-size: 1.02rem; }
.ws h2 { font-size: 1.12rem; margin: 0 0 .65rem; }
.ws h3 { font-size: 1.05rem; margin: 0 0 .5rem; }

.ws-grid { display: grid; gap: 1.1rem; grid-template-columns: minmax(0, 1fr); grid-template-areas: "center" "drawer" "left" "right"; align-items: start; }
.ws-center { grid-area: center; }
.ws-drawer { grid-area: drawer; min-width: 0; }
.ws-left { grid-area: left; display: grid; gap: 1rem; min-width: 0; }
.ws-right { grid-area: right; min-width: 0; }
@media (min-width: 760px) {
  .ws-grid { grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto auto 1fr; grid-template-areas: "center right" "drawer right" "left right"; }
}
@media (min-width: 1160px) {
  .ws-grid { grid-template-columns: 300px minmax(0, 1fr) 290px; grid-template-rows: auto 1fr; grid-template-areas: "left center right" "left drawer right"; }
}

.panel { background: var(--white); border: 1px solid #D6D0F7; border-radius: 20px; padding: 1rem; box-shadow: var(--lift); }
.ws label { font-weight: 700; font-size: 1rem; }
.ws input[type="text"], .ws input[type="search"], .ws input[type="number"], .ws select, .ws textarea { width: 100%; border: 2px solid #8E89B5; border-radius: 10px; padding: .32rem .6rem; background: var(--white); font-weight: 400; min-height: 2.5rem; }
.ws input:hover, .ws select:hover, .ws textarea:hover { border-color: var(--night); }
.ws input[type="checkbox"], .ws input[type="radio"] { width: 1.15rem; height: 1.15rem; accent-color: var(--purple); vertical-align: -2px; }
.ws input[type="range"] { width: 100%; accent-color: var(--purple); min-height: 2rem; }

.tool-btn { background: var(--white); border: 2px solid var(--night); border-radius: 12px; padding: .35rem .8rem; min-height: 2.75rem; font-weight: 800; font-size: 1rem; cursor: pointer; box-shadow: 0 3px 0 var(--night); transition: transform .1s, box-shadow .1s; }
.tool-btn:hover:not(:disabled) { background: var(--spark); }
.tool-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
.tool-btn:disabled { opacity: .35; cursor: not-allowed; box-shadow: none; }
.tool-btn.danger:hover:not(:disabled) { background: #FFC9CB; }
.link-btn { background: none; border: 0; padding: .2rem 0; color: var(--purple); text-decoration: underline; cursor: pointer; font-weight: 800; font-size: .98rem; }

/* Mesa: base de corte com régua em cima e à esquerda */
.stage-bar, .piece-bar { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; justify-content: center; }
.stage-bar .check { margin-left: .4rem; }
.seg { display: inline-flex; background: var(--white); border: 2px solid var(--night); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: .25rem 1.15rem; min-height: 2.35rem; border-radius: 999px; font-weight: 800; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--night); color: var(--white); }
.bench {
  position: relative; margin: .75rem 0 .9rem; display: flex; justify-content: center; padding: .9rem .6rem .7rem; border-radius: 24px; overflow: hidden; background-color: #2A2159; box-shadow: var(--lift-high), inset 0 0 0 5px #3B2F7C;
  background-image:
    linear-gradient(rgba(255,255,255,.15) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.15) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 30px 30px, 30px 30px;
}
.bench::before, .bench::after { content: ""; position: absolute; pointer-events: none; opacity: .6; }
.bench::before { left: 5px; right: 5px; top: 5px; height: 9px; background: repeating-linear-gradient(90deg, #FFD23F 0 1.5px, transparent 1.5px 7.5px); }
.bench::after { left: 5px; top: 5px; bottom: 5px; width: 9px; background: repeating-linear-gradient(0deg, #FFD23F 0 1.5px, transparent 1.5px 7.5px); }
.stage-wrap { position: relative; width: min(100%, 450px, 52vh + 40px); min-width: min(100%, 280px); padding: 38px 20px 20px; }
.stage-wrap canvas { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: 0 22px 40px -8px rgba(0,0,0,.65), 0 3px 8px rgba(0,0,0,.35); touch-action: manipulation; cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.stage-wrap canvas:focus-visible { outline: 4px solid var(--spark); outline-offset: 5px; }
.save-state { text-align: center; font-size: .96rem; color: var(--muted); margin: .6rem 0 0; }

.start { position: relative; background: var(--white); border-radius: 20px; padding: 1.3rem 1.4rem; margin: .6rem 0 .4rem; max-width: 540px; box-shadow: 0 20px 40px rgba(0,0,0,.35); }
.start-steps { padding-left: 1.3rem; }
.start-steps li::marker { color: var(--purple); font-weight: 800; }
.start-models { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; margin-bottom: 1.2rem; }
.start-models button { display: flex; flex-direction: column; align-items: center; gap: .35rem; background: var(--paper); border: 2px solid transparent; border-radius: 16px; padding: .5rem; font-weight: 800; font-size: 1rem; cursor: pointer; transition: transform .18s; }
.start-models button:hover { border-color: var(--night); background: var(--spark); transform: translateY(-4px) rotate(-1.5deg); }
.start-models img { width: 100%; }

/* Gaveta, com puxador */
.ws-drawer { position: relative; background: #ECE8FF; padding-top: 1.5rem; }
.ws-drawer::before { content: ""; position: absolute; top: .55rem; left: 50%; width: 74px; height: 8px; margin-left: -37px; border-radius: 999px; background: var(--night); opacity: .28; }
.tabs { display: flex; gap: .35rem; overflow-x: auto; padding: 2px 2px .6rem; margin-bottom: .7rem; }
.tabs button { flex: 0 0 auto; border: 2px solid transparent; border-radius: 999px; background: var(--white); padding: .35rem .9rem; min-height: 2.7rem; font-weight: 800; font-size: 1rem; cursor: pointer; }
.tabs button:hover { border-color: var(--night); }
.tabs button[aria-selected="true"] { background: var(--night); color: var(--white); text-decoration: underline; text-decoration-color: var(--spark); text-decoration-thickness: 3px; text-underline-offset: .3em; }
[data-drawer] { max-height: 300px; overflow-y: auto; padding: 4px 2px; }
[data-drawer] .button { margin-right: .8rem; margin-bottom: .5rem; }
.swatches { display: flex; flex-wrap: wrap; gap: .6rem; }
.swatch { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: .25rem; width: 104px; min-height: 108px; padding: .45rem; background: var(--white); border: 2px solid transparent; border-radius: 16px; cursor: pointer; font-size: .9rem; line-height: 1.2; font-weight: 700; box-shadow: 0 2px 6px rgba(48,28,130,.14); transition: transform .15s; }
.swatch:hover { border-color: var(--night); transform: translateY(-3px) rotate(-2deg); }
.swatch.art { width: 92px; min-height: 92px; justify-content: center; }
.swatch.art img { border-radius: 10px; }
.swatch.word { width: 164px; min-height: 66px; justify-content: center; }
.swatch.word.heading span { font-family: var(--title); font-size: 1.3rem; }
.swatch.word.body span { font-weight: 400; font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .7rem; }
.chip-btn { border: 2px solid #8E89B5; border-radius: 999px; background: var(--white); padding: .2rem .85rem; min-height: 2.4rem; font-size: .98rem; cursor: pointer; }
.chip-btn[aria-pressed="true"] { background: var(--purple); border-color: var(--night); color: var(--white); font-weight: 800; }

/* Dicas e peça escolhida */
.tips ul { list-style: none; padding: 0; margin: 0; }
.tips .tip { display: flex; flex-direction: column; align-items: flex-start; background: #FFF1BF; border-radius: 4px 14px 4px 14px; padding: .55rem .75rem; margin-bottom: .55rem; font-size: .98rem; line-height: 1.42; box-shadow: 0 2px 6px rgba(120,90,0,.2); }
.tips p { margin: 0; }
.piece-title { font-weight: 800; margin-bottom: .6rem; overflow-wrap: anywhere; }
[data-inspector] .control { display: block; margin-bottom: .75rem; }
.control-label { display: block; font-weight: 700; font-size: 1rem; }
[data-inspector] .check { display: block; margin-bottom: .75rem; }
.colors { display: flex; flex-wrap: wrap; gap: 6px; }
.color-dot { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--night); cursor: pointer; padding: 0; }
.color-dot[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--white), 0 0 0 6px var(--night); transform: scale(.9); }
.colors input[type="color"] { width: 44px; height: 32px; padding: 0; border: 2px solid var(--night); border-radius: 8px; background: var(--white); cursor: pointer; }
@media (pointer: coarse), (max-width: 759px) {
  .color-dot { width: 40px; height: 40px; }
  .colors input[type="color"] { width: 52px; height: 40px; }
  .colors { gap: 8px; }
}
.numbers { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .6rem; border-top: 2px dashed var(--soft); padding-top: .7rem; }
.attrs { display: grid; gap: .4rem; margin-bottom: .6rem; }
.attr { display: grid; grid-template-columns: minmax(0, 1fr) 4rem 2.75rem; gap: .35rem; }
.row { display: flex; flex-wrap: wrap; gap: .45rem; }
.piece-list { padding-left: 1.5rem; margin: 0; max-height: 270px; overflow-y: auto; }
.piece-list li { margin-bottom: .3rem; }
.piece-list li::marker { color: var(--muted); font-weight: 700; }
.piece-list button { width: 100%; text-align: left; background: var(--paper); border: 2px solid transparent; border-radius: 10px; padding: .3rem .6rem; min-height: 2.4rem; font-size: .98rem; cursor: pointer; overflow-wrap: anywhere; }
.piece-list button:hover { border-color: #8E89B5; }
.piece-list button[aria-pressed="true"] { border-color: var(--night); background: var(--spark); font-weight: 800; }
.piece-list li.muted { list-style: none; margin-left: -1.5rem; }
.keys summary { font-weight: 800; cursor: pointer; min-height: 2rem; }
.keys { font-size: .98rem; }
kbd { border: 1px solid var(--night); border-bottom-width: 3px; border-radius: 6px; padding: 0 .38rem; background: var(--paper); font-family: var(--body); font-weight: 800; }

/* Coleção */
.card-fields, .card-filters { display: grid; gap: .55rem; margin-bottom: .85rem; }
.card-filters { grid-template-columns: 1fr 1fr; border-top: 2px dashed var(--soft); padding-top: .7rem; }
.card-list { list-style: none; margin: 0 0 .85rem; padding: .6rem; max-height: 540px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: .6rem; background: var(--paper); border-radius: 14px; }
.card-list:empty { display: none; }
.card-item { display: flex; flex-direction: column; align-items: center; width: 100%; gap: .35rem; padding: .45rem; background: var(--white); border: 2px solid transparent; border-radius: 14px; cursor: pointer; text-align: center; box-shadow: 0 2px 6px rgba(48,28,130,.12); }
.card-item:hover { border-color: #8E89B5; }
.card-item[aria-current="true"] { border-color: var(--night); background: var(--spark); }
.thumb-holder canvas { display: block; width: 88px; height: auto; border-radius: 7px; box-shadow: 0 4px 10px rgba(20,18,43,.32); }
.card-label { display: flex; flex-direction: column; line-height: 1.22; overflow-wrap: anywhere; font-size: .93rem; }
.card-number { font-weight: 800; }
.card-group { color: var(--muted); }
.card-item[aria-current="true"] .card-group { color: var(--night); }
.card-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.count { font-family: var(--body); font-weight: 800; }

/* Impressão e cópia */
.print-panel, .keep-panel { margin-top: 1.2rem; padding: 1.4rem; }
.print-panel h2, .keep-panel h2 { font-size: 1.45rem; }
.print-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 1.8rem; }
.print-grid > * { min-width: 0; }
.print-grid fieldset { border: 0; background: var(--paper); border-radius: 14px; margin: 0 0 .8rem; padding: .5rem 1rem .7rem; }
.print-grid legend { float: left; width: 100%; font-weight: 800; padding: .1rem 0 .2rem; }
.print-grid legend + * { clear: both; }
.print-grid fieldset .check { display: block; padding: .2rem 0; }
.print-grid .inline { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .45rem; }
.print-grid .inline input { width: 5rem; }
.keep-panel { background: #FFF6D1; border-color: #E8C64A; }
.keep-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin: 0; padding-bottom: .4rem; }
@media (max-width: 480px) { .print-panel, .keep-panel { padding: 1rem .85rem; } .print-grid fieldset { padding-inline: .7rem; } }
.ws-more { margin-top: 2.4rem; }
.sheet-picture { display: block; width: min(100%, 460px); margin-top: .8rem; }

.confirm { border: 3px solid var(--night); border-radius: 20px; max-width: min(440px, 92vw); padding: 1.3rem 1.4rem; box-shadow: 0 30px 60px rgba(0,0,0,.4); }
.confirm::backdrop { background: rgba(20,18,43,.65); }
.confirm h2 { margin-top: 0; font-size: 1.3rem; }
.confirm-actions { display: flex; justify-content: flex-end; gap: .9rem; margin: 0; padding-bottom: .4rem; }

#print-root { display: none; }
@media print {
  @page { size: letter; margin: 0; }
  body.printing { margin: 0; background: #fff; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { display: block; }
  .sheet { width: 8.5in; height: 11in; overflow: hidden; break-after: page; }
  .sheet:last-child { break-after: auto; }
  .sheet img { display: block; width: 8.5in; height: 11in; max-width: none; }
}
