/* «Гараж 21», сцена 3 «До винтика»: калькулятор, стальная смета, выноски холста колеса. Владелец — сессия «Сцена колеса». */

/* холст колеса под контентом: вертикальный свайп листает, горизонтальный — вращает узел */
#smeta .pin-in { touch-action: pan-y; -webkit-touch-callout: none; }
#smeta.wh-over { cursor: pointer; }
#smeta .sec-head { transition: opacity .35s var(--ease), transform .45s var(--ease); }
#calc-mount { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.cx { position: absolute; inset: 0; }

/* ---------------------------------------------------------------- управление (фаза calc) */
.cx-ctrl { position: absolute; left: var(--pad); top: calc(var(--hdr) + 196px); width: min(452px, 36vw); display: flex; flex-direction: column; gap: 16px; pointer-events: auto;
  opacity: 0; visibility: hidden; transform: translateY(18px); transition: opacity .45s var(--ease), transform .6s var(--ease), visibility 0s linear .6s; }
.cx[data-ph="live"] .cx-ctrl { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.cx-l { display: block; margin-bottom: 8px; font: 600 12px/1 var(--fd); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.cx-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 4px; background: rgba(13, 14, 17, .9); border: 1px solid var(--line2); border-radius: 4px; }
.cx-seg button { min-height: 54px; padding: 6px 4px; border: 0; border-radius: 2px; background: transparent; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: background .2s, color .2s; }
.cx-seg button b { font: 600 15px/1 var(--fd); letter-spacing: .06em; text-transform: uppercase; }
.cx-seg button small { font-size: 11px; line-height: 1.15; color: var(--dim); text-align: center; }
.cx-seg button:hover { color: var(--text); }
.cx-seg button[aria-checked="true"] { background: rgba(238, 236, 231, .1); color: var(--text); box-shadow: inset 0 -2px 0 var(--acc); }
.cx-jobs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cx-jobs button { position: relative; min-height: 46px; padding: 10px 42px 10px 12px; text-align: left; border: 1px solid var(--line2); border-radius: 3px; background: rgba(13, 14, 17, .9); color: var(--text); cursor: pointer; font: 600 14px/1.2 var(--fb); transition: border-color .2s, background .2s; }
.cx-jobs button:hover { border-color: rgba(238, 236, 231, .4); }
.cx-jobs button[aria-checked="true"] { border-color: var(--acc); background: rgba(255, 106, 19, .13); box-shadow: inset 3px 0 0 var(--acc); }
.cx-3d { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); padding: 3px 4px; border: 1px solid rgba(207, 244, 255, .4); border-radius: 2px; font: 700 10px/1 var(--fd); font-style: normal; letter-spacing: .1em; color: var(--xr); }
.cx-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-opts button { min-height: 46px; padding: 8px 12px; border: 1px solid var(--line2); border-radius: 3px; background: rgba(13, 14, 17, .9); color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; transition: border-color .2s, background .2s; }
.cx-opts button b { font: 600 14px/1.15 var(--fb); color: var(--text); }
.cx-opts button small { font-size: 12px; color: var(--dim); }
.cx-opts button[aria-pressed="true"] { border-color: rgba(255, 106, 19, .75); background: rgba(255, 106, 19, .1); }
.cx-opts button[aria-pressed="true"] b::before { content: '✓ '; color: var(--acc); }

/* ---------------------------------------------------------------- стальная смета */
.cx-bill { position: absolute; right: var(--pad); bottom: 28px; width: 364px; pointer-events: auto;
  opacity: 0; visibility: hidden; transform: translateY(26px); transition: opacity .45s var(--ease), transform .6s var(--ease), visibility 0s linear .6s; }
.cx[data-ph="story"] .cx-bill, .cx[data-ph="live"] .cx-bill { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.cx-plate { position: relative; padding: 24px 26px 18px; border-radius: 5px; color: #2b2e33; overflow: hidden;
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .4) 44%, rgba(255, 255, 255, 0) 58%) 40% 0 / 300% 100% no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='360'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0025 0.95' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.52 0 0 0 0.6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(180deg, #c6cacf 0, #a2a6ac 46%, #b8bcc1 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), inset 0 -2px 0 rgba(0, 0, 0, .28), inset 0 0 0 1px rgba(0, 0, 0, .3), 0 44px 80px -24px rgba(0, 0, 0, .85), 0 0 0 1px rgba(0, 0, 0, .5); }
.cx[data-ph="story"] .cx-plate, .cx[data-ph="live"] .cx-plate { animation: cx-sheen 1.4s var(--ease) both; }
@keyframes cx-sheen { from { background-position: 120% 0, 0 0, 0 0; } to { background-position: 40% 0, 0 0, 0 0; } }
.cx-sc { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, #f6f7f8 0, #9ca1a8 55%, #50545b 100%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35), 0 1px 0 rgba(255, 255, 255, .7); }
.cx-sc::after { content: ''; position: absolute; left: 2px; right: 2px; top: 5px; height: 2px; border-radius: 1px; background: rgba(28, 30, 34, .75); }
.cx-sc.s1 { left: 9px; top: 9px; } .cx-sc.s2 { right: 9px; top: 9px; } .cx-sc.s3 { left: 9px; bottom: 9px; } .cx-sc.s4 { right: 9px; bottom: 9px; }
.cx[data-ph="story"] .cx-sc, .cx[data-ph="live"] .cx-sc { animation: cx-screw 1s cubic-bezier(.2, .8, .2, 1) both; }
.cx-sc.s2 { animation-delay: .08s !important; } .cx-sc.s3 { animation-delay: .16s !important; } .cx-sc.s4 { animation-delay: .24s !important; }
@keyframes cx-screw { from { transform: rotate(-300deg); } to { transform: rotate(0); } }
.cx-head { display: flex; flex-direction: column; gap: 5px; padding-bottom: 12px; border-bottom: 1px solid rgba(0, 0, 0, .24); box-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
.cx-no { font: 600 12px/1 var(--fd); letter-spacing: .16em; text-transform: uppercase; color: #565a61; text-shadow: 0 1px 0 rgba(255, 255, 255, .6); }
.cx-title { font: 700 19px/1.1 var(--fd); letter-spacing: .04em; text-transform: uppercase; color: #24272c; text-shadow: 0 1px 0 rgba(255, 255, 255, .6), 0 -1px 0 rgba(0, 0, 0, .2); }
.cx-rows { margin: 10px 0 0; padding: 0; list-style: none; }
.cx-row { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; font: 600 16px/1.2 var(--fd); letter-spacing: .03em; text-transform: uppercase; color: #2a2d32; text-shadow: 0 1px 0 rgba(255, 255, 255, .6), 0 -1px 0 rgba(0, 0, 0, .22);
  opacity: .16; transform: translateX(-8px); transition: opacity .35s, transform .5s cubic-bezier(.2, .9, .25, 1.2), color .3s; }
.cx-row span { min-width: 0; }
.cx-row i { flex: 1; min-width: 12px; border-bottom: 2px dotted rgba(0, 0, 0, .28); transform: translateY(-4px); }
.cx-row b { font-weight: 700; white-space: nowrap; }
.cx-row.k-o span::before { content: '+ '; color: #6a5a4c; }
.cx-row.in { opacity: 1; transform: none; }
.cx-row.hot { color: #c4500b; }
.cx-row.hot b { animation: cx-pulse .7s ease-in-out infinite alternate; }
@keyframes cx-pulse { from { color: #c4500b; } to { color: #2a2d32; } }
.hit { animation: cx-hit .5s ease-out; }
@keyframes cx-hit { 0% { color: #c4500b; transform: scale(1.04); } 100% { transform: none; } }
.cx-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; padding-top: 12px; border-top: 2px solid rgba(0, 0, 0, .3); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45); }
.cx-total { display: flex; flex: none; white-space: nowrap; align-items: baseline; gap: 12px; font: 700 32px/1 var(--fd); text-transform: uppercase; color: #1f2226; text-shadow: 0 1px 0 rgba(255, 255, 255, .6), 0 -1px 0 rgba(0, 0, 0, .25); opacity: .16; transition: opacity .4s; transform-origin: left center; }
.cx-total span { font-size: 15px; letter-spacing: .14em; color: #4a4e55; }
.cx-total.in { opacity: 1; }
.cx-stamp { padding: 7px 9px 6px; border: 2px solid #e2590d; border-radius: 3px; color: #d2520b; font: 700 12px/1.1 var(--fd); letter-spacing: .08em; text-transform: uppercase; text-align: center; max-width: 150px; mix-blend-mode: multiply;
  opacity: 0; transform: rotate(-4deg) scale(1.8); transition: transform .35s cubic-bezier(.5, 0, .4, 1.4), opacity .2s; }
.cx-stamp.in { opacity: .92; transform: rotate(-4deg) scale(1); }
.cx-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font: 600 13px/1.3 var(--fb); color: #4a4e55; text-shadow: 0 1px 0 rgba(255, 255, 255, .5); }
.cx-cta { width: 100%; margin-top: 10px; }
.cx-more { display: none; }
.cx-note { margin: 10px 2px 0; font-size: 12px; line-height: 1.45; color: var(--dim); }
.cx[data-ph="story"] .cx-cta, .cx[data-ph="story"] .cx-note { display: none; }

/* ---------------------------------------------------------------- выноски холста колеса */
.wh-co { position: absolute; inset: 0; z-index: 2; pointer-events: none; overflow: hidden; }
.wh-co .co { position: absolute; left: 0; top: 0; opacity: 0; visibility: hidden; will-change: transform, opacity; }
.wh-co .co-dot { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px rgba(238, 236, 231, .16); }
.wh-co .co.hi .co-dot { background: var(--acc); box-shadow: 0 0 0 4px rgba(255, 106, 19, .22), 0 0 18px rgba(255, 106, 19, .9); }
.wh-co .co-line { position: absolute; display: block; }
.wh-co .co-box { position: absolute; white-space: nowrap; padding: 9px 13px 10px; background: rgba(12, 13, 16, .9); border: 1px solid rgba(238, 236, 231, .12); border-radius: 3px; transition: border-color .25s, background .25s, transform .3s cubic-bezier(.2, .9, .25, 1.2); }
.wh-co .co.hi .co-box { border-color: rgba(255, 106, 19, .45); box-shadow: inset 2px 0 0 var(--acc); }
.wh-co .co.open .co-box { background: rgba(24, 25, 29, .95); border-color: rgba(238, 236, 231, .4); transform: scale(1.06); }
.wh-co .co-name { display: block; font: 600 13px/1.15 var(--fd); letter-spacing: .09em; text-transform: uppercase; color: var(--text); }
.wh-co .co-meta { display: block; margin-top: 4px; font: 700 15px/1.2 var(--fb); color: #e2dfd8; }
.wh-co .co-chip { display: block; margin-top: 5px; font: 700 11px/1 var(--fb); font-style: normal; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.wh-co .co-chip:empty { display: none; }
.wh-co .co.hi .co-chip { color: var(--acc); }
.wh-co .co-act { pointer-events: auto; display: block; width: 100%; margin-top: 9px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 3px; background: var(--acc); color: #120802; font: 600 14px/1 var(--fd); letter-spacing: .09em; text-transform: uppercase; cursor: pointer; box-shadow: 0 10px 26px -10px rgba(255, 106, 19, .9); }
.wh-co .co.up .co-line { left: 0; bottom: 4px; width: 1px; height: var(--ll, 52px); background: linear-gradient(to top, rgba(238, 236, 231, .75), rgba(238, 236, 231, .1)); }
.wh-co .co.up .co-box { left: calc(-14px + var(--bx, 0px)); bottom: calc(var(--ll, 52px) + 4px); }
.wh-co .co.down .co-line { left: 0; top: 4px; width: 1px; height: var(--ll, 52px); background: linear-gradient(to bottom, rgba(238, 236, 231, .75), rgba(238, 236, 231, .1)); }
.wh-co .co.down .co-box { left: calc(-14px + var(--bx, 0px)); top: calc(var(--ll, 52px) + 4px); }
.wh-co .co.right .co-line { top: 0; left: 4px; width: var(--ll, 30px); height: 1px; background: linear-gradient(to right, rgba(238, 236, 231, .75), rgba(238, 236, 231, .15)); }
.wh-co .co.right .co-box { left: calc(var(--ll, 30px) + 6px + var(--bx, 0px)); top: -24px; }
.wh-co .co.left .co-line { top: 0; right: 4px; width: var(--ll, 30px); height: 1px; background: linear-gradient(to left, rgba(238, 236, 231, .75), rgba(238, 236, 231, .15)); }
.wh-co .co.left .co-box { right: calc(var(--ll, 30px) + 6px - var(--bx, 0px)); top: -24px; text-align: right; }
.wh-co .co.hi.up .co-line { background: linear-gradient(to top, rgba(255, 106, 19, .9), rgba(255, 106, 19, .15)); }
.wh-co .co.hi.down .co-line { background: linear-gradient(to bottom, rgba(255, 106, 19, .9), rgba(255, 106, 19, .15)); }
.wh-co .co.hi.right .co-line { background: linear-gradient(to right, rgba(255, 106, 19, .9), rgba(255, 106, 19, .15)); }
.wh-co .co.hi.left .co-line { background: linear-gradient(to left, rgba(255, 106, 19, .9), rgba(255, 106, 19, .15)); }
.wh-co .co.down.flip .co-line { top: auto; bottom: 4px; background: linear-gradient(to top, rgba(255, 106, 19, .9), rgba(255, 106, 19, .15)); }
.wh-co .co.down.flip .co-box { top: auto; bottom: calc(var(--ll, 52px) + 4px); }

/* ---------------------------------------------------------------- телефон: смета — нижняя панель, управление компактное */
@media (max-width: 760px) {
  .cx { display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 0 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .cx-ctrl, .cx-bill { position: relative; left: auto; right: auto; top: auto; bottom: auto; width: auto; }
  .cx-ctrl { gap: 8px; display: none; }
  .cx[data-ph="live"] .cx-ctrl { display: flex; }
  .cx-l, .cx-seg small, .cx-opts small, .cx-note { display: none; }
  .cx-seg button { min-height: 44px; }
  .cx-seg button b { font-size: 15px; }
  .cx-jobs, .cx-opts { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; margin: 0 -10px; padding: 0 10px; }
  .cx-jobs::-webkit-scrollbar, .cx-opts::-webkit-scrollbar { display: none; }
  .cx-jobs button, .cx-opts button { flex: none; min-height: 44px; white-space: nowrap; scroll-snap-align: start; }
  .cx-jobs button { padding: 0 38px 0 14px; font-size: 15px; display: flex; align-items: center; }
  .cx-opts button { padding: 0 14px; justify-content: center; }
  .cx-opts button b { font-size: 15px; }
  .cx-plate { padding: 12px 16px 12px; }
  .cx-sc { width: 9px; height: 9px; } .cx-sc::after { top: 3.5px; height: 1.5px; }
  .cx-head { flex-direction: row; justify-content: space-between; align-items: baseline; padding-bottom: 7px; }
  .cx-no { display: none; }
  .cx-title { font-size: 16px; }
  .cx-rows { margin-top: 4px; }
  .cx-row { padding: 3px 0; font-size: 15px; }
  .cx-foot { margin-top: 6px; padding-top: 7px; }
  .cx-total { font-size: 26px; }
  .cx-stamp { font-size: 15px; letter-spacing: .04em; max-width: none; padding: 5px 8px 4px; }
  .cx-meta { font-size: 15px; flex-wrap: wrap; gap: 2px 10px; margin-top: 6px; }
  .cx[data-ph="story"] .cx-meta { display: none; }
  /* в смете строки свёрнуты: на экране — итог и кнопка, строки по касанию */
  .cx[data-ph="live"] .cx-more { display: inline-flex; align-items: center; min-height: 44px; margin: -12px -6px -12px auto; padding: 0 6px; border: 0; background: none; color: #3a3e44; font: 600 15px/1 var(--fd); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
  .cx[data-ph="live"] .cx-more::after { content: '▾'; margin-left: 6px; transition: transform .2s; }
  .cx[data-ph="live"] .cx-plate.open .cx-more::after { transform: rotate(180deg); }
  .cx[data-ph="live"] .cx-plate:not(.open) .cx-rows, .cx[data-ph="live"] .cx-plate:not(.open) .cx-meta { display: none; }
  .cx[data-ph="live"] .cx-head { align-items: center; }
  .cx-cta { min-height: 48px; margin-top: 8px; }
  /* выноски в разборке и у резца доходят до заголовка — убираем его, пока они на экране */
  #smeta[data-phase="explode"] .sec-head, #smeta[data-phase="resurface"] .sec-head { opacity: 0; transform: translateY(-12px); pointer-events: none; }
  .wh-co .co.right .co-box, .wh-co .co.left .co-box { top: calc(-24px + var(--by, 0px)); }
  .wh-co .co.right .co-line { width: var(--lw, var(--ll, 30px)); transform-origin: 0 50%; transform: rotate(var(--la, 0rad)); }
  .wh-co .co.left .co-line { width: var(--lw, var(--ll, 30px)); transform-origin: 100% 50%; transform: rotate(var(--la, 0rad)); }
  .wh-co .co-name, .wh-co .co-meta { font-size: 15px; }
  .wh-co .co-name { letter-spacing: .05em; }
  .wh-co .co-chip { display: none; }
  .wh-co .co-box { padding: 7px 10px 8px; }
  .wh-co[data-ph="calc"] .co-act { display: none; }
  .wh-co .co.down .co-box { left: calc(-90px + var(--bx, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
  .cx-ctrl, .cx-bill, .cx-row, .cx-total, .cx-stamp { transition: none; }
  .cx-plate, .cx-sc, .cx-row.hot b, .hit { animation: none !important; }
}

@media (max-width:760px){.cx-3d{font-size:15px;padding:2px 4px;right:6px}}
