/* ===== «Виселица»: закатный Дикий Запад ===== */
.theme-hang {
  --gold: #e0b072; --gold-2: #f7e2bd; --line: rgba(224, 176, 114, .25);
  --toxic: #ffb85c; --blood-2: #d9532e; --panel: rgba(22, 12, 6, .92);
  background: #0f0805;
}
.theme-hang .btn-gold { background: linear-gradient(180deg, #e9a95a, #8c4f1c); color: #1b0d03; border-color: #ffd29a; box-shadow: 0 6px 24px rgba(230, 140, 60, .3), inset 0 1px 0 rgba(255, 255, 255, .4); }
.theme-hang .btn-gold:hover { background: linear-gradient(180deg, #f4b86a, #9c5a22); }
.theme-hang .logo h1 { font-size: 3.4rem; background: linear-gradient(180deg, #fff1d6, #e8a75a 55%, #7a3f12); -webkit-background-clip: text; background-clip: text; }
.theme-hang .logo-rule::after { content: '★'; color: var(--gold); }
.theme-hang .ava-current { border-color: var(--gold); } .theme-hang .ava-current::after { background: var(--gold); color: #1b0d03; }
.theme-hang #scene .h-bg { background: url(/sprites/hg-bg.webp) center 60% / cover, linear-gradient(180deg, #5a2410, #2a1006 60%, #120804); filter: brightness(.62); }
body.theme-hang.in-game #scene .h-bg { filter: brightness(.42) saturate(.95) blur(1.5px); }
.theme-hang .h-lamp { background: radial-gradient(circle, rgba(255, 180, 90, .14), transparent 60%); }
.theme-hang .tr-fg { stroke: var(--gold); }
.theme-hang .tring circle { stroke: #ffb85c; filter: drop-shadow(0 0 6px rgba(255, 184, 92, .8)); }
.theme-hang .seat.turn .ava { border-color: #ffb85c; box-shadow: 0 0 0 4px rgba(255, 184, 92, .25), 0 0 28px 6px rgba(255, 184, 92, .45); }
.theme-hang .seat.turn::before { content: '★'; color: #ffb85c; }
.theme-hang .seat.setter .ava { border-color: #7fb3ff; }
.theme-hang .seats { pointer-events: none; } .theme-hang .seat { pointer-events: auto; }
.g-badge { position: absolute; right: -10px; bottom: -4px; z-index: 3; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: #2a4a7a; color: #fff; font-size: .85rem; box-shadow: 0 0 0 2px #0f0805, 0 0 10px rgba(127, 179, 255, .6); }
.g-score { font-size: .78rem; color: #ffd9a0; margin-top: 2px; }

/* ----- центр: сцена, слово, промахи ----- */
.g-center { position: absolute; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; padding: .3rem 0; min-height: 0; }
.g-scene { position: relative; flex: 1 1 0; min-height: 0; height: auto; aspect-ratio: 100 / 118; max-width: 100%; }
.g-scene .gp { position: absolute; display: block; background: center / 100% 100% no-repeat; pointer-events: none; opacity: 0; transition: opacity .25s; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .55)); }
.g-scene .gp.on { opacity: 1; }
.g-scene .gp.cactus { opacity: .95; }
/* координаты — в процентах сцены 100×118 */
.gp.cactus { left: 0%; top: 79.7%; width: 12%; height: 18.6%; background-image: url(/sprites/hg-cactus.webp); z-index: 1; }
.gp.platform { left: 4%; top: 57.3%; width: 90%; height: 41%; background-image: url(/sprites/hg-platform.webp); transform: scaleX(-1); z-index: 3; }
.gp.frame { left: 20%; top: 1.7%; width: 72%; height: 64.4%; background-image: url(/sprites/hg-frame.webp); z-index: 4; }
.gp.trap { left: 29%; top: 63.6%; width: 22%; height: 4.2%; z-index: 5; background: none; filter: none; perspective: 300px; }
.gp.trap::before { content: ''; position: absolute; inset: 0; border-radius: 2px; background: radial-gradient(ellipse, #000 40%, #1a0c04); box-shadow: inset 0 3px 6px #000; }
.gp.trap::after { content: ''; position: absolute; inset: 0; background: url(/sprites/hg-trap.webp) center / 100% 100% no-repeat; transform-origin: 50% 0; transition: transform .45s cubic-bezier(.6, 0, .9, .5); filter: brightness(.95) drop-shadow(0 2px 2px rgba(0, 0, 0, .6)); }
.gp.trap.open::after { transform: scaleY(.08) translateY(30%); filter: brightness(.35); transition-timing-function: cubic-bezier(.5, 0, .7, 1.4); }
.gp.trap::before { opacity: 0; transition: opacity .2s; border-radius: 40%; filter: blur(.5px); }
.gp.trap.open::before { opacity: 1; }
.g-plus { position: absolute; left: 50%; top: 8%; z-index: 20; transform: translateX(-50%); pointer-events: none; white-space: nowrap; font-family: var(--serif); font-weight: 900; font-size: 1.35rem; color: #ffd9a0; text-shadow: 0 2px 8px #000, 0 0 14px rgba(255, 120, 40, .6); animation: gplus 1.6s ease-out forwards; }
@keyframes gplus { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 20% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -14px); } }
.g-rig { position: absolute; inset: 0; z-index: 6; }
.g-man { position: absolute; inset: 0; }
.gp.rope { left: 37.6%; top: 5%; width: 4.7%; height: 17%; background-image: url(/sprites/hg-rope.webp); transform-origin: 50% 0; z-index: 2; }
.gp.hat { left: 29%; top: 18.6%; width: 22%; height: 12%; background-image: url(/sprites/hg-hat.webp); transform-origin: 50% 10%; z-index: 9; }
.gp.head { left: 35%; top: 23.7%; width: 10%; height: 15.2%; background-image: url(/sprites/hg-head.webp); z-index: 8; }
.gp.torso { left: 33%; top: 37.3%; width: 14%; height: 16.5%; background-image: url(/sprites/hg-torso.webp); z-index: 7; }
/* руки: левая на экране — спрайт с кистью слева, плечо справа */
.gp.armL { left: 12%; top: 39%; width: 24%; height: 4.2%; background-image: url(/sprites/hg-armR.webp); transform-origin: 100% 50%; rotate: -22deg; z-index: 6; }
.gp.armR { left: 44%; top: 39%; width: 24%; height: 4.2%; background-image: url(/sprites/hg-armL.webp); transform-origin: 0 50%; rotate: 22deg; z-index: 6; }
.gp.legL { left: 34.2%; top: 51.6%; width: 6%; height: 15.4%; background-image: url(/sprites/hg-legL.webp); z-index: 5; }
.gp.legR { left: 39.8%; top: 51.6%; width: 6%; height: 15.4%; background-image: url(/sprites/hg-legR.webp); z-index: 5; }
/* деталь появляется: падает сверху и пружинит */
.gp.drop { animation: gdrop .55s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes gdrop { 0% { translate: 0 -30%; opacity: 0; } 60% { opacity: 1; } 100% { translate: 0 0; opacity: 1; } }
.gp.platform.drop, .gp.frame.drop { animation-name: gdropBig; }
@keyframes gdropBig { 0% { translate: 0 -12%; opacity: 0; } 70% { opacity: 1; } 100% { translate: 0 0; opacity: 1; } }
.g-man .gp.on { animation: sway 4s ease-in-out infinite; }
.g-man .gp.on.drop { animation: gdrop .55s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes sway { 50% { translate: .15% 0; } }
/* упавшая фигурка (если зашли после обрушения) */
.g-rig.fallen .g-man .gp.head { transform: translate(-60%, 330%) rotate(-100deg); }
.g-rig.fallen .g-man .gp.torso { transform: translate(15%, 150%) rotate(80deg); }
.g-rig.fallen .g-man .gp.armL { transform: translate(-10%, 900%) rotate(30deg); }
.g-rig.fallen .g-man .gp.armR { transform: translate(20%, 800%) rotate(-40deg); }
.g-rig.fallen .g-man .gp.legL { transform: translate(-150%, 150%) rotate(-80deg); }
.g-rig.fallen .g-man .gp.legR { transform: translate(260%, 140%) rotate(100deg); }
.g-scene.lost .g-man .gp { animation: none; z-index: 10; }
.g-scene.shake { animation: gshake .4s; }
@keyframes gshake { 20% { translate: -4px 2px; } 40% { translate: 4px -1px; } 60% { translate: -2px 1px; } 80% { translate: 1px 0; } }
.g-scene.won .g-man { animation: cheer .5s ease-in-out 4 alternate; }
@keyframes cheer { to { translate: 0 -4%; } }
.g-scene.won .gp.hat { animation: hatToss 1.6s cubic-bezier(.3, .7, .4, 1); }
@keyframes hatToss { 40% { transform: translateY(-120%) rotate(200deg); } 100% { transform: none; } }
.g-lives { position: absolute; right: 2%; bottom: 1%; display: flex; gap: 3px; z-index: 12; }
.g-lives i { width: .7rem; height: .7rem; border-radius: 50%; background: #ffb85c; box-shadow: 0 0 6px rgba(255, 184, 92, .8); }
.g-lives i.gone { background: #3a2210; box-shadow: inset 0 0 0 1px rgba(255, 184, 92, .3); }

.g-word { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; padding: .7rem 1rem; border-radius: 10px; max-width: 100%;
  background: linear-gradient(180deg, #6b3f1d, #4a2a12); box-shadow: inset 0 0 0 2px #2a1608, inset 0 2px 0 rgba(255, 220, 160, .2), 0 10px 26px rgba(0, 0, 0, .6); }
.g-word .t { display: grid; place-items: center; width: 2.6rem; height: 3.1rem; border-radius: 5px; font-family: var(--serif); font-size: 1.9rem; font-weight: 900; text-transform: uppercase; color: #2a1406;
  background: linear-gradient(180deg, #f6e5c3, #e2c896); box-shadow: inset 0 -3px 0 rgba(120, 70, 20, .35), 0 3px 6px rgba(0, 0, 0, .5); }
.g-word .t:empty { background: linear-gradient(180deg, #3a2412, #2a180b); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .7), 0 1px 0 rgba(255, 220, 160, .15); }
.g-word .t.peek { color: rgba(42, 20, 6, .35); background: linear-gradient(180deg, #8a6a46, #6a4e30); }
.g-word .t.rvl { color: #8a1a0a; background: linear-gradient(180deg, #f0c9a8, #d9a37a); animation: tflip .5s both; }
.g-word .t.flip { animation: tflip .5s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes tflip { from { transform: rotateX(90deg) scale(1.3); } }
.g-word .gap { width: 1.2rem; } .g-word .dash { color: #f6e5c3; font-size: 1.8rem; font-weight: 900; align-self: center; }
.g-word.long .t { width: 2rem; height: 2.5rem; font-size: 1.45rem; }
.g-wait { color: #f6e5c3; font-size: .95rem; padding: .4rem .6rem; text-align: center; }
.g-hint { color: #f2d6a6; font-size: .9rem; min-height: 1.1rem; } .g-hint b { color: #fff; }
.g-wrong { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; justify-content: center; min-height: 1.4rem; color: var(--muted); font-size: .8rem; }
.g-wrong s { color: #ff9a7a; font-weight: 800; font-size: 1rem; text-decoration-thickness: 2px; } .g-wrong s.w { font-size: .85rem; }

/* ----- док: клавиатура, загадывание ----- */
.g-dock { position: relative; z-index: 25; }
.g-keys { display: flex; flex-direction: column; gap: .3rem; align-items: center; margin: .2rem 0 .4rem; }
.g-keys .kr { display: flex; gap: .3rem; }
.g-keys button { width: 2.5rem; height: 2.6rem; border-radius: 7px; border: 0; cursor: pointer; font-weight: 800; font-size: 1.05rem; color: #2a1406; background: linear-gradient(180deg, #f6e5c3, #dcc08c); box-shadow: inset 0 -3px 0 rgba(120, 70, 20, .4), 0 3px 6px rgba(0, 0, 0, .5); transition: transform .1s; }
.g-keys button:hover:not(:disabled) { transform: translateY(-2px); background: linear-gradient(180deg, #fff1d6, #e8cd98); }
.g-keys button:active:not(:disabled) { transform: translateY(1px); }
.g-keys button.hit { background: linear-gradient(180deg, #8fd08a, #4e9a4a); color: #0a2208; }
.g-keys button.miss { background: linear-gradient(180deg, #6a3a2a, #4a2418); color: rgba(255, 200, 180, .5); text-decoration: line-through; }
.g-keys button:disabled { cursor: default; }
.g-keys.wait button:not(.hit):not(.miss) { opacity: .55; }
.g-guess, .g-setword { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin: .2rem 0 .4rem; }
.g-guess input, .g-setword input { width: 14rem; }
.g-setword input#swHint { width: 16rem; }
.g-lv { display: grid; gap: .35rem; }
.g-lv button { cursor: pointer; text-align: left; padding: .45rem .6rem; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); color: inherit; }
.g-lv button.on { border-color: var(--gold); background: rgba(224, 176, 114, .14); box-shadow: 0 0 14px rgba(224, 176, 114, .25); }
.g-lv b { display: block; } .g-lv small { color: var(--muted); font-size: .72rem; }
.emo-bubble.g-hitb { font-family: var(--serif); font-weight: 900; font-size: 1.6rem; color: #b8ffb0; text-shadow: 0 0 10px #2a8a20; white-space: nowrap; }
.emo-bubble.g-missb { font-family: var(--serif); font-weight: 900; font-size: 1.6rem; color: #ff9a7a; text-decoration: line-through; white-space: nowrap; }

@media (max-width: 760px) {
  .g-scene { max-height: 46vh; }
  .g-word .t { width: 1.75rem; height: 2.2rem; font-size: 1.3rem; } .g-word.long .t { width: 1.4rem; height: 1.9rem; font-size: 1.05rem; }
  .g-keys button { width: 1.85rem; height: 2.3rem; font-size: .9rem; } .g-keys .kr { gap: .2rem; }
  .g-guess input, .g-setword input, .g-setword input#swHint { width: 100%; }
}
@media (max-width: 760px) {
  .g-keys .kr { gap: 3px; }
  .g-keys button { width: calc((100vw - 1.2rem) / 12 - 3px); height: 2.4rem; padding: 0; font-size: .88rem; }
  .g-guess { flex-wrap: nowrap; } .g-guess input { min-width: 0; } .g-guess .btn { white-space: nowrap; }
}
