/* «Хвосты» — палитра Герцег-Нови: море Боки, известняк Старого города, мимоза и олеандр. */
:root {
  --sea:       #0a2740;
  --sea-2:     #103c5c;
  --deep:      #061a2b;
  --foam:      #e8f3f7;
  --stone:     #f4ece0;
  --mimosa:    #ffd447;
  --oleander:  #ff6f91;
  --terracotta:#d9663f;
  --pine:      #2f6f5a;
  --line:      #ffffff22;
  --radius:    16px;
  --shadow:    0 18px 44px #04121ea8;
  --font: "Segoe UI", "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--foam);
  background: radial-gradient(120% 90% at 50% 0%, #1b5b7e 0%, var(--sea) 45%, var(--deep) 100%);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--mimosa); }

/* волны у нижнего края — общий фон меню */
.waves {
  position: fixed; left: 0; right: 0; bottom: 0; height: 38vh; pointer-events: none;
  background:
    radial-gradient(60% 100% at 20% 100%, #12557799 0%, transparent 70%),
    radial-gradient(50% 100% at 80% 100%, #0e6b8a77 0%, transparent 70%);
}

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border: 0; border-radius: 999px;
  background: linear-gradient(180deg, #ffe07a, var(--mimosa));
  color: #3a2a00; font-weight: 700; font-size: 15px;
  box-shadow: 0 8px 20px #ffd44733, inset 0 -2px 0 #d9a900;
  transition: transform .12s, box-shadow .12s, filter .12s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  background: #ffffff14; color: var(--foam); font-weight: 600;
  border: 1px solid var(--line); box-shadow: none; backdrop-filter: blur(8px);
}
.btn.ghost:hover { background: #ffffff22; }
.btn.rose { background: linear-gradient(180deg, #ff8fab, var(--oleander)); color: #4a0c1e; box-shadow: inset 0 -2px 0 #d64a70; }

/* ---------- главное меню ---------- */
#menu {
  position: relative; z-index: 2;
  min-height: 100%; display: grid; place-content: center; justify-items: center;
  gap: 18px; padding: 32px 20px; text-align: center;
}
.brand-tail { font-size: 46px; line-height: 1; filter: drop-shadow(0 6px 14px #0006); }
h1.title {
  margin: 0; font-size: clamp(40px, 9vw, 78px); letter-spacing: -0.03em; font-weight: 800;
  background: linear-gradient(180deg, #fff, var(--mimosa) 120%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.subtitle { margin: 0; font-size: clamp(15px, 2.4vw, 19px); color: #cfe6f0; }
.pitch { max-width: 560px; margin: 0; font-size: 14.5px; line-height: 1.6; color: #a9c6d6; }

.panel {
  width: min(880px, 94vw); padding: 22px;
  background: #0c2c44b8; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(10px);
}
.panel h2 { margin: 0 0 4px; font-size: 15px; letter-spacing: .08em; text-transform: uppercase; color: #9fc4d6; }
.panel p.hint { margin: 0 0 14px; font-size: 12.5px; color: #86a9bd; }

/* карточки героев и боссов */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.card {
  text-align: left; padding: 14px; border-radius: 12px;
  background: #ffffff0f; border: 1px solid var(--line);
  transition: border-color .15s, background .15s, transform .15s;
}
.card:hover { background: #ffffff1a; transform: translateY(-2px); }
.card[aria-pressed="true"] { border-color: var(--mimosa); background: #ffd4471f; }
.card .who { display: flex; align-items: baseline; gap: 8px; }
.card .name { font-size: 16px; font-weight: 700; }
.card .home { font-size: 11px; color: var(--mimosa); text-transform: uppercase; letter-spacing: .06em; }
.card .about { margin-top: 6px; font-size: 12.5px; line-height: 1.45; color: #b8d2e0; }
.card .swatch { width: 100%; height: 4px; border-radius: 4px; margin-top: 10px; }

.tips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 720px; }
.tips span {
  font-size: 12px; color: #a9c6d6;
  padding: 6px 12px; border-radius: 999px; background: #ffffff0e; border: 1px solid var(--line);
}
.footer-note { font-size: 12px; color: #7d9fb3; }

/* ---------- игра ---------- */
#game-container { position: fixed; inset: 0; }
#game-container canvas { display: block; }

#hud {
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  padding: 16px 18px; display: flex; flex-direction: column; justify-content: space-between;
}
.hud-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pill {
  padding: 8px 14px; border-radius: 999px;
  background: #06192bb3; border: 1px solid var(--line); backdrop-filter: blur(8px);
  font-size: 13px; font-weight: 600; letter-spacing: .01em;
}
#lives .tail { filter: drop-shadow(0 2px 4px #0008); }
#place { text-align: center; }
#place b { color: var(--mimosa); }
#place small { display: block; font-weight: 400; color: #a9c6d6; font-size: 11.5px; margin-top: 2px; }

#boss-bar { align-self: center; text-align: center; min-width: 240px; }
#boss-bar .bar { height: 8px; margin-top: 6px; border-radius: 8px; background: #ffffff1f; overflow: hidden; }
#boss-bar .bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--oleander), var(--terracotta)); transition: width .25s; }

#tails { display: flex; gap: 6px; }
#tails .slot { font-size: 20px; opacity: .25; transition: opacity .3s, transform .3s; }
#tails .slot.on { opacity: 1; transform: translateY(-2px) rotate(-8deg); }

#toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(12px);
  z-index: 8; max-width: min(560px, 90vw); padding: 12px 18px;
  background: #06192bdd; border: 1px solid var(--line); border-left: 3px solid var(--mimosa);
  border-radius: 12px; box-shadow: var(--shadow);
  font-size: 14px; line-height: 1.45; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast b { color: var(--mimosa); }

/* ---------- контекстное меню (правая кнопка) ---------- */
#ctx {
  position: fixed; z-index: 50; min-width: 232px; padding: 6px;
  background: #08243af2;
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); backdrop-filter: blur(14px);
  opacity: 0; transform: scale(.96) translateY(-4px); transform-origin: top left;
  pointer-events: none; transition: opacity .12s, transform .12s;
}
#ctx.show { opacity: 1; transform: none; pointer-events: auto; }
#ctx .ctx-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
}
#ctx .ctx-head b { font-size: 13.5px; }
#ctx .ctx-head span { font-size: 11.5px; color: #9fc4d6; }
#ctx button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 9px; background: none;
  font-size: 13.5px; text-align: left;
}
#ctx button:hover { background: #ffffff16; }
#ctx button .ico { width: 20px; text-align: center; font-size: 15px; }
#ctx button .key { margin-left: auto; font-size: 11px; color: #7fa3b8; }
#ctx button[aria-pressed="true"] .key { color: var(--mimosa); }
#ctx hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }

/* ---------- модалки: пауза, победа, поражение ---------- */
#overlay {
  position: fixed; inset: 0; z-index: 40; display: none;
  place-content: center; justify-items: center; gap: 14px; text-align: center;
  padding: 24px; background: #04121ecc; backdrop-filter: blur(6px);
}
#overlay.show { display: grid; }
#overlay h2 { margin: 0; font-size: clamp(28px, 6vw, 44px); }
#overlay p { margin: 0; color: #b8d2e0; max-width: 460px; line-height: 1.6; }
#overlay .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

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

/* ---------- мобильные кнопки ---------- */
#touch { position: fixed; inset: 0; z-index: 6; pointer-events: none; display: none; }
#joystick {
  position: absolute; left: 28px; bottom: 32px; width: 124px; height: 124px;
  border-radius: 50%; background: #ffffff1c; border: 2px solid #ffffff33;
  pointer-events: auto; touch-action: none;
}
#knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: #ffffffcc;
}
#actions { position: absolute; right: 28px; bottom: 32px; display: flex; flex-direction: column; gap: 16px; pointer-events: auto; }
#actions button {
  width: 72px; height: 72px; border-radius: 50%; border: 1px solid #ffffff33;
  background: #ffffffcc; color: #06192b; font-size: 26px;
}
@media (hover: none) and (pointer: coarse) { #touch { display: block; } #hud { padding: 12px; } }
