/* Боксёрская афиша: жёлтая бумага, чёрная краска деревянных литер, красная вторая краска */
:root { --paper: #f2b430; --ink: #17120e; --red: #c01420; --soft: #cdb98c; --line: rgba(242, 180, 48, .26); --text: "Sofia Sans", system-ui, "Segoe UI", sans-serif; --wood: "Sofia Sans Extra Condensed", Impact, sans-serif; }
html { scrollbar-color: rgba(242, 180, 48, .4) transparent; }
html, * { scrollbar-width: thin; box-sizing: border-box; }
body { margin: 0; overflow: hidden; color: var(--ink); background: var(--paper); font: 400 16px/1.35 var(--text); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.app { display: grid; grid-template-columns: minmax(0, 1fr) clamp(420px, 28vw, 520px); height: 100svh; }
.poster { position: relative; overflow: hidden; container-type: size; min-height: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .16 0 0 0 0 0 0 0 0 .5 -.17'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)'/%3E%3C/svg%3E"), var(--paper); }
.top { position: absolute; z-index: 2; left: 28px; right: 28px; top: 20px; display: flex; justify-content: space-between; gap: 16px; padding-bottom: 8px; border-bottom: 4px solid var(--ink); font-weight: 700; font-size: 17px; line-height: 1.2; }
.concept { font-weight: 400; text-align: right; }
/* слово во всю ширину афиши: литеры вытянуты, как деревянный шрифт */
h1 { position: absolute; inset: 70px 28px 88px; user-select: none; color: var(--ink); font: 1000 200px/1 var(--wood); }
h1 span { position: absolute; left: 50%; top: 50%; display: flex; white-space: nowrap; transform: translate(-50%, -50%); line-height: 1; }
h1 b { display: block; font-weight: 1000; will-change: transform;
  -webkit-mask: var(--worn); mask: var(--worn); }
:root { --worn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='500' height='500'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.35' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -9 7.4'/%3E%3C/filter%3E%3Crect width='500' height='500' filter='url(%23n)'/%3E%3C/svg%3E"); }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; transition: opacity .4s; }
.wait #cv { opacity: 0; }
#cv:focus-visible { outline-offset: -6px; }
.ringside { position: absolute; z-index: 2; left: 28px; right: 28px; bottom: 18px; display: flex; align-items: center; gap: 8px; pointer-events: none; }
.ringside > * { pointer-events: auto; }
.ringside button { min-height: 48px; border: 0; background: var(--ink); color: var(--paper); font-weight: 700; }
#punch { padding: 0 22px; background: var(--red); color: #fff; }
#punch:hover { background: #a00f19; } .ringside button:active { transform: translateY(1px); }
#sound, .lang { width: 48px; padding: 0; }
#sound { display: grid; place-items: center; }
#sound svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#sound .spk { fill: currentColor; } #sound .mute, #sound[aria-pressed="false"] .wave { display: none; } #sound[aria-pressed="false"] .mute { display: inline; }
#hits { flex: 1; padding-left: 8px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }

.card { display: flex; flex-direction: column; gap: 16px; min-height: 0; overflow: auto; padding: 22px 26px 20px; background: var(--ink); color: var(--paper); }
.card :focus-visible, .card label:has(:focus-visible) { outline-color: #fff; }
.card h2 { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font: 700 15px/1.2 var(--text); }
.card h2 b { font-weight: 400; color: var(--soft); }
.hint { margin-top: 4px; font-size: 14px; color: var(--soft); }
.parts, .pick { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border: 2px solid var(--paper); }
.parts label, .pick label { position: relative; display: grid; place-items: center; align-content: center; gap: 5px; min-height: 46px; cursor: pointer; font-size: 15px; border-left: 2px solid var(--paper); }
.parts label { min-height: 58px; }
.parts label:first-child, .pick label:first-child { border-left: 0; }
.parts label:has(:checked), .pick label:has(:checked) { background: var(--paper); color: var(--ink); font-weight: 700; }
.parts i { width: 20px; height: 20px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255, 255, 255, .55); }
.parts input, .pick input, .colors input { position: absolute; opacity: 0; pointer-events: none; }
.colors { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
.colors label { aspect-ratio: 1; min-height: 34px; cursor: pointer; }
.colors i { display: block; width: 100%; height: 100%; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .28); }
.colors :checked + i { box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--paper); }
.duo { display: grid; grid-template-columns: 1.15fr 1fr; gap: 14px; }
.field { display: grid; gap: 8px; font-weight: 700; font-size: 15px; }
.field input { min-height: 46px; padding: 0 14px; border: 2px solid var(--paper); border-radius: 0; background: none; color: #fff; font-size: 18px; font-weight: 400; min-width: 0; }
.field input::placeholder { color: #97875f; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; margin: 0; background: none; cursor: grab; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--paper); }
input[type="range"]::-moz-range-track { height: 4px; background: var(--paper); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 34px; margin-top: -15px; border: 0; background: var(--red); }
input[type="range"]::-moz-range-thumb { width: 24px; height: 34px; border: 0; border-radius: 0; background: var(--red); }

/* Размах: две руки от середины, правая короче ровно на скидку */
.tape { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; row-gap: 6px; margin-top: auto; padding-top: 14px; border-top: 4px solid var(--paper); }
.side span { display: block; font-size: 14px; color: var(--soft); } .side b { font: 900 34px/1 var(--wood); white-space: nowrap; } .side.r { text-align: right; } .side.r b { color: #fff; }
.arms { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 18px 1fr; align-items: center; height: 30px; }
.arms i { display: flex; height: 16px; } .arms .a { justify-content: flex-end; }
.arms u { display: block; position: relative; height: 100%; width: 100%; background: var(--soft); transition: width .35s cubic-bezier(.2, .8, .2, 1); } .arms .b u { background: var(--red); }
.arms u::after { content: ""; position: absolute; top: 50%; width: 26px; height: 26px; margin-top: -13px; border-radius: 50%; background: inherit; } .arms .a u::after { left: -4px; } .arms .b u::after { right: -4px; }
.arms em { width: 18px; height: 30px; background: var(--paper); }
.save { grid-column: 1 / -1; text-align: right; font-size: 14px; color: var(--soft); }
.sum { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.sum span { display: block; font-size: 14px; color: var(--soft); }
.sum strong { font: 1000 46px/1 var(--wood); color: #fff; white-space: nowrap; }
.sum button, .go { min-height: 54px; padding: 0 30px; border: 0; background: var(--paper); color: var(--ink); font-weight: 700; font-size: 18px; }
.sum button:hover, .go:hover { background: #ffc64d; }

dialog { width: min(860px, calc(100vw - 28px)); max-height: calc(100svh - 28px); padding: 24px; border: 0; background: #fff6e0; color: var(--ink); overflow: auto; }
dialog::backdrop { background: rgba(23, 18, 14, .82); }
.dlg-grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 26px; }
#card { width: 100%; height: auto; display: block; }
dialog h2 { margin: 0 46px 14px 0; font: 700 23px/1.15 var(--text); }
pre { margin: 0 0 14px; padding: 14px 16px; background: rgba(23, 18, 14, .08); font: 400 15px/1.45 var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.dlg-btns { display: flex; flex-wrap: wrap; gap: 8px; } .dlg-btns button { flex: 1 1 auto; padding: 0 16px; font-size: 16px; }
.dlg-btns .go { background: var(--ink); color: var(--paper); } .dlg-btns .go:hover { background: #2c231b; }
.plain { min-height: 54px; border: 2px solid var(--ink); background: none; font-weight: 700; } .plain:hover { background: rgba(23, 18, 14, .08); }
dialog .hint { color: #5d5037; } #copied { min-height: 20px; margin: 8px 0; font-size: 14px; }
.x { position: absolute; right: 14px; top: 14px; width: 44px; height: 44px; border: 0; background: none; font-size: 18px; }

/* Загрузка: перчатка бьёт */
#boot { position: absolute; left: 50%; top: 50%; width: 110px; margin: -55px; fill: var(--red); opacity: 0; pointer-events: none; }
.wait #boot { animation: jab 1s cubic-bezier(.3, 0, .2, 1) .3s infinite both; }
@keyframes jab { 0%, 100% { opacity: 1; transform: scale(.82); } 35% { opacity: 1; transform: scale(.74) rotate(-6deg); } 50% { opacity: 1; transform: scale(1.12) rotate(4deg); } }
#fail { position: absolute; z-index: 3; left: 50%; top: 50%; width: min(320px, 84%); transform: translate(-50%, -50%); padding: 20px; background: var(--ink); color: var(--paper); text-align: center; }
#fail[hidden] { display: none; } #fail p { margin-bottom: 12px; } #fail button { min-height: 44px; padding: 0 20px; border: 0; background: var(--paper); color: var(--ink); font-weight: 700; }
.nojs { position: fixed; inset: auto 16px 16px; padding: 16px; background: var(--ink); color: var(--paper); }

@media (max-height: 760px) and (min-width: 861px) { .card { gap: 11px; padding-block: 16px; } .parts label { min-height: 50px; } .side b { font-size: 30px; } .sum strong { font-size: 40px; } }
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: min(46svh, 520px) auto; height: auto; }
  .poster { position: sticky; top: 0; z-index: 3; } /* перчатки видны, пока листаешь настройки */
  .card { position: relative; z-index: 1; overflow: visible; padding: 18px 16px calc(16px + env(safe-area-inset-bottom)); gap: 18px; }
  .top { left: 16px; right: 16px; top: 12px; font-size: 14px; border-bottom-width: 3px; padding-bottom: 5px; } h1 { inset: 48px 14px 70px; } .ringside { left: 16px; right: 16px; bottom: 10px; } .ringside button { min-height: 44px; } #sound, .lang { width: 44px; } #punch { padding: 0 16px; }
  .sum { position: sticky; z-index: 2; bottom: 0; margin: 0 -16px calc(-16px - env(safe-area-inset-bottom)); padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--ink); border-top: 2px solid var(--line); } .tape { margin-top: 0; }
  .dlg-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; } dialog { padding: 16px; } #card { max-width: 300px; margin: 0 auto; } .dlg-btns button { flex: 1 1 100%; }
}
@media (max-width: 420px) { .concept { font-size: 0; } .concept::after { content: "Концепт"; font-size: 14px; } :lang(en) .concept::after { content: "Concept"; } }
@media (max-width: 380px) { .duo { grid-template-columns: 1fr; } .colors { grid-template-columns: repeat(5, 40px); justify-content: space-between; row-gap: 10px; } .colors label { min-height: 40px; } .side b { font-size: 28px; } .sum strong { font-size: 36px; } .sum button { padding: 0 20px; } .parts label { font-size: 14px; } }
@media (max-height: 520px) and (orientation: landscape) {
  body { overflow: hidden; } .app { grid-template-columns: minmax(0, 1fr) 350px; grid-template-rows: minmax(0, 1fr); height: 100svh; }
  .poster { position: relative; } .card { overflow: auto; padding: 12px 14px 0; gap: 12px; } .top { top: 8px; font-size: 13px; } h1 { inset: 36px 14px 58px; } .sum { margin: 0 -14px; padding: 8px 14px; } .sum strong { font-size: 34px; } .duo { grid-template-columns: 1fr; } .colors { grid-template-columns: repeat(5, 44px); justify-content: space-between; row-gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .wait #boot { animation: none; opacity: 1; } }
