/* Крупный интерфейс: кнопки под палец, минимум цифр, всё подписано словами. */
html, body { height: 100%; margin: 0; overflow: hidden; background: #8fd4e8; }
#scene { display: block; width: 100vw; height: 100vh; touch-action: none; }

#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding: 14px 16px; pointer-events: none; font-family: var(--font);
}
#hud > div { display: flex; gap: 8px; align-items: center; }
.hud-right { pointer-events: auto; }

.stat {
  padding: 8px 16px; border-radius: 999px;
  background: #06192bcc; color: var(--foam); border: 1px solid #ffffff2e;
  font-size: 20px; font-weight: 700; backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px #0a253a55;
}
.stat.big { font-size: 26px; letter-spacing: 2px; padding: 6px 18px; }
.stat.small { font-size: 15px; }
.stat b { color: var(--mimosa); }

.wave-chip {
  padding: 8px 18px; border-radius: 999px; font-size: 17px; font-weight: 700;
  background: #06192bcc; color: var(--foam); border: 1px solid #ffffff2e; backdrop-filter: blur(8px);
}
.wave-chip b { color: var(--mimosa); font-size: 21px; }
.wave-chip span { color: #bcd9e8; font-weight: 500; }

.round {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid #ffffff2e;
  background: #06192bcc; color: #fff; font-size: 20px; line-height: 44px; text-align: center;
  text-decoration: none; display: inline-block; backdrop-filter: blur(8px);
}
.round:hover { background: #0a3450dd; }

/* большие кнопки внизу */
#big-buttons {
  position: fixed; right: 18px; bottom: 22px; z-index: 6;
  display: flex; flex-direction: column; gap: 12px;
}
.huge {
  padding: 16px 26px; border: 0; border-radius: 20px;
  font-size: 21px; font-weight: 800; font-family: var(--font);
  background: linear-gradient(180deg, #ffe07a, var(--mimosa)); color: #3a2a00;
  box-shadow: 0 10px 24px #0a253a66, inset 0 -3px 0 #d9a900;
  transition: transform .1s, filter .1s;
}
.huge:hover { filter: brightness(1.06); }
.huge:active { transform: translateY(2px); }
.huge:disabled { filter: grayscale(.6) brightness(.8); box-shadow: none; }
.huge.rose { background: linear-gradient(180deg, #ff9dbb, var(--oleander)); color: #4a0c1e; box-shadow: 0 10px 24px #0a253a66, inset 0 -3px 0 #d64a70; }
.huge.ghost { background: #ffffff1a; color: #fff; box-shadow: none; border: 1px solid #ffffff33; text-decoration: none; }

/* карточки подружек */
#build {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(18px);
  z-index: 7; display: flex; gap: 12px; padding: 12px;
  background: #06192bdd; border: 1px solid #ffffff26; border-radius: 22px;
  box-shadow: 0 18px 44px #04121ea8; backdrop-filter: blur(12px);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
#build.show { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.friend {
  display: grid; justify-items: center; gap: 2px; width: 108px; padding: 12px 8px;
  border: 1px solid #ffffff22; border-radius: 16px; background: #ffffff12; color: #fff;
  font-family: var(--font);
}
.friend:hover { background: #ffd4471f; border-color: var(--mimosa); }
.friend:disabled { opacity: .38; }
.friend .face { font-size: 34px; line-height: 1.1; }
.friend b { font-size: 16px; }
.friend .price { font-size: 14px; color: var(--mimosa); font-weight: 700; }
.friend .perk { display: block; font-size: 11.5px; color: #fff3a0; font-weight: 600; line-height: 1.2; }

/* подсказка */
#toast {
  position: fixed; left: 50%; top: 76px; bottom: auto;   /* в style.css задан bottom — иначе плашка растянется */
  transform: translateX(-50%) translateY(-8px);
  max-width: min(620px, 90vw); text-align: center;
  z-index: 8; padding: 12px 22px; max-width: 90vw;
  background: #06192be6; color: #fff; border: 1px solid #ffffff26; border-left: 4px solid var(--mimosa);
  border-radius: 14px; font-size: 17px; font-weight: 600; font-family: var(--font);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

/* конец игры */
#overlay {
  position: fixed; inset: 0; z-index: 20; display: none;
  place-content: center; justify-items: center; gap: 16px; text-align: center; padding: 24px;
  background: #04121ee0; backdrop-filter: blur(6px); font-family: var(--font); color: #fff;
}
#overlay.show { display: grid; }
#overlay h2 { margin: 0; font-size: clamp(28px, 7vw, 48px); }
#overlay p { margin: 0; max-width: 460px; font-size: 17px; line-height: 1.6; color: #cfe6f0; }
#overlay .row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* загрузка */
#loading {
  position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; justify-items: center; gap: 14px;
  background: #0a2740; color: #fff; font-family: var(--font); transition: opacity .4s;
}
#loading.done { opacity: 0; pointer-events: none; }
.tail-spin { font-size: 44px; animation: swing 1.1s ease-in-out infinite; }
@keyframes swing { 0%,100% { transform: rotate(-16deg); } 50% { transform: rotate(16deg); } }
#loading .bar { width: 240px; height: 5px; border-radius: 5px; background: #ffffff22; overflow: hidden; }
#loading .bar i { display: block; height: 100%; width: 0; background: var(--mimosa); transition: width .2s; }

/* тряска, когда утащили хвостик */
@keyframes shake { 0%,100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
body.shake { animation: shake .5s; }

@media (max-width: 720px) {
  .huge { font-size: 18px; padding: 14px 20px; }
  .friend { width: 88px; }
  .stat.big { font-size: 21px; }
}

/* ── командная игра: список игроков ── */
#team { position: fixed; left: 14px; top: 76px; z-index: 5; display: none; flex-direction: column; gap: 6px;
        font-family: var(--font); pointer-events: none; }
body.team #team { display: flex; }
#team .code { padding: 4px 12px; border-radius: 999px; background: #06192bcc; color: #cfe6f0; font-size: 14px; width: max-content; }
#team .code b { color: var(--mimosa); letter-spacing: 3px; font-size: 17px; }
#team .pl { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 14px; background: #06192bcc;
            color: #fff; border: 2px solid transparent; font-size: 15px; }
#team .pl.me { border-color: var(--c); }
#team .pl.off { opacity: .5; }
#team .pl .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
#team .pl i { font-style: normal; }
#team .pl .sh { color: var(--mimosa); font-weight: 700; margin-left: auto; padding-left: 8px; }

/* ── персонаж: экранный джойстик и кнопки ── */
#joy { position: fixed; left: 22px; bottom: 26px; z-index: 6; width: 132px; height: 132px; border-radius: 50%;
       background: #06192b66; border: 2px solid #ffffff44; display: none; touch-action: none; }
#joy.show { display: block; }
body:not(.runner-on) #joy { display: none; }
#joy i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%;
         background: linear-gradient(180deg, #ffe07a, var(--mimosa)); box-shadow: 0 6px 16px #0006; }
#big-buttons .huge.ghost { backdrop-filter: blur(8px); background: #06192bbb; }
.friend.info { cursor: default; }

#ov-stars { font-size: 44px; letter-spacing: 6px; min-height: 1px; }

#wait-host { position: fixed; inset: 0; z-index: 15; display: none; place-content: center; justify-items: center; gap: 8px;
             background: #04121e99; color: #fff; font-family: var(--font); font-size: 20px; }
#wait-host.show { display: grid; }

@media (max-width: 720px) {
  #team { top: 64px; font-size: 13px; }
  #big-buttons .huge.ghost { padding: 10px 14px; font-size: 15px; }
}

/* style.css задаёт #hud во всю высоту колонкой (от старой версии) — тут HUD одной строкой сверху */
#hud { flex-direction: row; bottom: auto; inset: 0 0 auto 0; }
[hidden] { display: none !important; }
@media (max-width: 1000px) {
  .stat.big { font-size: 17px; letter-spacing: 0; padding: 6px 10px; }
  .wave-chip { font-size: 14px; padding: 6px 12px; }
  .wave-chip span { display: none; }
  .stat { font-size: 16px; padding: 6px 12px; }
}

/* ── бой персонажа и удобные кнопки ── */
.huge.fight { background: linear-gradient(180deg, #ff8a6b, #e0472e); color: #fff; box-shadow: 0 10px 24px #0a253a66, inset 0 -3px 0 #a92c17; }
#lives-box.low { background: #a92c17cc; animation: livesPulse .9s infinite; }
@keyframes livesPulse { 50% { filter: brightness(1.5); } }
body.hurt::after { content: ''; position: fixed; inset: 0; z-index: 8; pointer-events: none; box-shadow: inset 0 0 90px 30px #ff2d2dcc; }
#hop { position: fixed; left: 50%; top: 58px; transform: translateX(-50%); z-index: 6; padding: 4px 14px; border-radius: 999px; font-weight: 900; font-size: 18px; color: #3a2a00;
       background: linear-gradient(180deg, #ffe07a, var(--mimosa)); pointer-events: none; }
body.runner-on #big-buttons { display: grid; grid-template-columns: auto auto; gap: 10px; align-items: stretch; }
body.runner-on #big-buttons .huge { padding: 12px 18px; font-size: 18px; white-space: nowrap; }
body.runner-on #btn-wave { grid-column: 1 / -1; }
body.runner-on #btn-grow:not([hidden]) ~ #btn-wave { grid-column: auto; }
/* телефон лёжа: всё в один экран, кнопки меньше, карточки подружек не налезают на кнопки */
@media (max-height: 520px) {
  body.runner-on #big-buttons { right: 10px; bottom: 10px; gap: 6px; }
  body.runner-on #big-buttons .huge, #big-buttons .huge { padding: 8px 12px; font-size: 15px; border-radius: 14px; }
  #big-buttons { right: 10px; bottom: 10px; gap: 6px; }
  #joy { left: 12px; bottom: 12px; width: 108px; height: 108px; }
  #joy i { width: 48px; height: 48px; margin: -24px 0 0 -24px; }
  #build { top: 54px; bottom: auto; left: 50%; gap: 6px; padding: 6px; max-width: 96vw; transform: translateX(-50%) translateY(-10px); }
  #build.show { transform: translateX(-50%); }
  #build .friend { padding: 6px 8px; min-width: 62px; font-size: 12px; }
  #build .friend .face { font-size: 22px; }
  #toast { font-size: 14px; padding: 6px 14px; top: 56px; max-width: 70vw; }
  #overlay h2 { font-size: 26px; margin: 0; }
  #ov-stars { font-size: 28px; }
  #overlay p { margin: 4px 0; font-size: 14px; }
  #overlay .huge { padding: 8px 14px; font-size: 15px; }
}

/* вращение сцены кнопками: крупно под палец, справа сбоку, не мешает жестам */
#spin { position: fixed; right: 14px; top: 50%; transform: translateY(-120%); z-index: 6; display: flex; gap: 8px; }
#spin button { width: 58px; height: 58px; border-radius: 50%; border: 2px solid #ffffff44; background: #06192bbb; color: #fff; font-size: 30px; line-height: 1; padding: 0;
               backdrop-filter: blur(8px); touch-action: none; user-select: none; -webkit-user-select: none; }
#spin button:active { background: var(--mimosa); color: #3a2a00; }
@media (pointer: fine) and (min-height: 521px) { #spin button { width: 46px; height: 46px; font-size: 24px; } }
@media (max-height: 520px) { #spin { top: 58px; transform: none; right: 10px; } #spin button { width: 42px; height: 42px; font-size: 22px; } }

/* ── сочность ── */
#combo { position: fixed; left: 50%; top: 96px; transform: translateX(-50%); z-index: 6; padding: 6px 18px; border-radius: 999px; font-weight: 900; font-size: 24px; color: #fff; white-space: nowrap;
         background: linear-gradient(180deg, #ff8a6b, #e0472e); box-shadow: 0 8px 22px #0a253a88; pointer-events: none; }
#combo.bump { animation: bump .28s; }
@keyframes bump { 40% { transform: translateX(-50%) scale(1.3); } }
@keyframes punch { 30% { transform: scale(1.012) translateY(2px); } }
body.punch #scene { animation: punch .14s; }
#ov-stars { display: inline-block; animation: starsIn .7s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes starsIn { from { transform: scale(.2) rotate(-14deg); opacity: 0; } }
@media (max-height: 520px) { #combo { top: 92px; font-size: 18px; padding: 3px 12px; } }

.friend.sell.confirm { background: linear-gradient(180deg, #ff8a6b, #e0472e); color: #fff; border-color: #fff; animation: bump2 .22s; }
.friend.sell.confirm .price { color: #fff; }
@keyframes bump2 { 40% { transform: scale(1.1); } }

/* кнопки под палец: долгое нажатие не выделяет текст и не открывает меню */
#big-buttons button, #build button { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* 1.15: магазин пушек и вещей */
.shop-btn { pointer-events: auto; cursor: pointer; border: 0; font: inherit; background: linear-gradient(135deg, #ffd447, #ff9ac2); color: #3a2400; font-weight: 800; }
#shop, #secret-box { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(20, 16, 40, .55); z-index: 50; padding: 16px; }
#shop.show, #secret-box.show { display: flex; }
#secret-box { z-index: 60; background: rgba(20, 16, 40, .6); }
.shop-card { width: min(520px, 100%); max-height: 90vh; overflow: auto; background: #fffaf0; color: #3a2f4a; border-radius: 24px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.shop-head { display: flex; align-items: center; gap: 10px; }
.shop-head h2 { margin: 0; flex: 1; font-size: 26px; }
.shop-have { font-size: 22px; font-weight: 800; }
.shop-tabs { display: flex; gap: 8px; margin-top: 10px; }
.shop-tab { flex: 1; min-height: 48px; border: 0; border-radius: 16px; font: 800 17px system-ui, sans-serif; background: #ece6f7; color: #4b3d66; cursor: pointer; }
.shop-tab.on { background: #7c5cff; color: #fff; }
.shop-hint { margin: 8px 0 12px; font-size: 15px; opacity: .8; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 18px; background: #fff; margin-bottom: 10px; box-shadow: 0 2px 8px rgba(80,60,120,.12); }
.shop-item .face { font-size: 40px; }
.shop-item .info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.shop-item .info b { font-size: 19px; } .shop-item small { font-size: 13.5px; opacity: .8; }
.shop-item .buy { min-width: 92px; min-height: 52px; border: 0; border-radius: 16px; font: 800 20px system-ui, sans-serif; background: #7c5cff; color: #fff; cursor: pointer; }
.shop-item .buy:disabled { background: #d8d2e6; color: #8a8199; cursor: default; }
.shop-item.have { background: #eafbea; } .shop-item.have .buy { background: #3fbf6a; color: #fff; }
.shop-item.secret { background: linear-gradient(135deg, #fff3c4, #ffd6ea); }
.shop-item.secret .buy:not(:disabled) { background: linear-gradient(135deg, #ff9f1c, #ff4d8d); }
.secret-card { width: min(420px, 100%); text-align: center; background: linear-gradient(160deg, #fffaf0, #ffe3f1); border-radius: 28px; padding: 26px 20px; color: #3a2f4a;
  box-shadow: 0 24px 70px rgba(0,0,0,.4); animation: secret-pop .5s cubic-bezier(.2,1.6,.4,1) both; }
.secret-card h2 { margin: 6px 0; font-size: 34px; }
.secret-burst { font-size: 64px; animation: secret-wiggle 1s ease-in-out infinite; }
.secret-gift { font-size: 30px; font-weight: 900; margin: 14px 0 18px; color: #b8860b; }
@keyframes secret-pop { from { transform: scale(.4); opacity: 0; } }
@keyframes secret-wiggle { 50% { transform: rotate(-6deg) scale(1.08); } }
