/* ===== Star Catcher: сыртқы келбет =====
   Барлық өлшем "em" бірлігімен жазылған: 1em = 10 ойын-пиксель.
   Сондықтан ойын кез келген экранға сәйкес масштабталады. */

:root {
  --u: calc(min(100vw, 177.78vh) / 960);   /* 1 ойын-пикселдің нақты өлшемі */
  --cyan: #3ff2ff;
  --gold: #ffd34d;
  --navy: #0d1240;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  overscroll-behavior: none;
  background: #05021a; color: #fff;
  font-family: "Trebuchet MS", "Segoe UI", "Hiragino Sans", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  user-select: none; -webkit-user-select: none;
}
body { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
@supports (height: 100dvh) {   /* телефондағы "динамикалық" биіктік: адрес жолағын ескереді */
  :root { --u: calc(min(100vw, 177.78dvh) / 960); }
  body { height: 100dvh; }
}
.hidden { display: none !important; }

#stage {
  position: relative; overflow: hidden;
  font-size: calc(var(--u) * 10);
  width: calc(var(--u) * 960); height: calc(var(--u) * 540);
  border-radius: 1.6em;
  box-shadow: 0 0 4em rgba(63, 242, 255, .25);
  touch-action: none;
}
#game { width: 100%; height: 100%; display: block; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
#topBar { position: absolute; top: 1em; left: 0; right: 0; display: flex; justify-content: center; align-items: center; }
#scoreBox { display: flex; align-items: center; gap: 1.2em; font-weight: 900; }
#score { font-size: 4.4em; line-height: 1; text-shadow: 0 0 .35em rgba(255, 211, 77, .9), 0 .05em 0 rgba(0,0,0,.4); }
#combo {
  font-size: 2em; color: #3a1f00; background: linear-gradient(#ffe27a, #ffb703);
  padding: .15em .7em; border-radius: 999px; box-shadow: 0 0 .8em rgba(255, 211, 77, .8);
}
#pauseBtn {
  pointer-events: auto; position: absolute; right: 1.2em; top: 0;
  width: 3.6em; height: 3.6em; border-radius: 50%; border: .15em solid var(--cyan);
  background: rgba(13, 18, 64, .85); color: #fff; font-size: 1.8em; cursor: pointer;
}
#powers { position: absolute; top: 7.2em; left: 0; right: 0; text-align: center; font-size: 1.8em; font-weight: 800; text-shadow: 0 0 .4em #b388ff; }
#bottomBar { position: absolute; left: 1em; right: 1em; bottom: .8em; display: flex; justify-content: space-between; align-items: flex-end; }
.panel {
  background: rgba(13, 18, 64, .85); border: .2em solid var(--cyan); border-radius: 1.4em;
  padding: .5em 1.1em; box-shadow: 0 0 1.2em rgba(63, 242, 255, .35); font-size: 1.6em;
}
#profile { display: flex; align-items: center; gap: .6em; }
.avatar { font-size: 1.8em; }
.who { display: flex; flex-direction: column; line-height: 1.15; }
.who small { color: #9fe9ff; font-size: .7em; }
#timer { font-size: 2.4em; font-weight: 900; color: var(--gold); padding: .15em .8em; }
#timer.low { color: #ff6b6b; animation: blink .5s infinite alternate; }
@keyframes blink { to { opacity: .55; } }
#currency { display: flex; gap: .9em; align-items: center; font-weight: 800; }

/* ---------- Экрандар ---------- */
.screen {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2em;
  background: radial-gradient(rgba(10, 4, 40, .55), rgba(5, 2, 26, .88));
}
.screen.menu { background: linear-gradient(rgba(5, 2, 26, .55), rgba(5, 2, 26, .15) 60%, rgba(5, 2, 26, .45)); gap: .9em; }
.logo {
  margin: 0; text-align: center; font-size: 7em; line-height: .95; font-weight: 900; letter-spacing: .04em;
  color: var(--gold); text-shadow: 0 .05em 0 #b8741a, 0 .1em 0 #7a4a0c, 0 0 .5em rgba(255, 211, 77, .75);
}
.tagline { margin: 0; font-size: 2em; color: #bfeaff; }
.row { display: flex; gap: 1em; }
.btn {
  font: inherit; font-size: 2.6em; font-weight: 900; border: 0; cursor: pointer;
  padding: .35em 1.6em; border-radius: 999px; color: #3a1f00;
  background: linear-gradient(#ffe27a, #ffb703);
  box-shadow: 0 .12em 0 #b8741a, 0 0 .5em rgba(255, 211, 77, .7);
}
.btn:active { transform: translateY(.06em); }
.btn.ghost {
  font-size: 1.7em; padding: .35em 1em; color: #fff; background: rgba(13, 18, 64, .88);
  border: .1em solid var(--cyan); box-shadow: 0 0 .6em rgba(63, 242, 255, .4);
}
.menuStats { display: flex; gap: 1.4em; font-size: 1.4em; margin-top: .3em; }
.card {
  background: var(--navy); border: .25em solid var(--cyan); border-radius: 2em; box-shadow: 0 0 3em rgba(63, 242, 255, .4);
  padding: 1.6em 3em; min-width: 40em; display: flex; flex-direction: column; align-items: center; gap: 1em;
}
.card.wide { min-width: 62em; }
.card h2 { margin: 0; font-size: 3.4em; color: var(--gold); }
.card label { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 2em; font-size: 2em; }
.card input[type=range] { width: 14em; accent-color: var(--gold); }
.hint { font-size: 1.4em; color: #9fb4e0; text-align: center; margin: 0; line-height: 1.4; }
.bigScore { font-size: 8em; font-weight: 900; line-height: 1; text-shadow: 0 0 .3em rgba(255, 211, 77, .9); }
.record { font-size: 2.4em; font-weight: 900; color: var(--gold); }
.rewards { display: flex; gap: 1.6em; font-size: 2em; font-weight: 800; }
.skinList { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1em; width: 100%; }
.skin {
  font: inherit; color: #fff; cursor: pointer; background: rgba(255, 255, 255, .06);
  border: .15em solid rgba(63, 242, 255, .4); border-radius: 1.2em; padding: .8em .4em;
  display: flex; flex-direction: column; align-items: center; gap: .4em; font-size: 1.5em;
}
.skin.equipped { border-color: var(--gold); background: rgba(255, 211, 77, .15); }
.skin small { color: #9fe9ff; font-size: .8em; }
.swatch { width: 2.4em; height: 2.4em; border-radius: 50%; }
.boardList { font-size: 2em; margin: 0; padding-left: 1.4em; line-height: 1.5; text-align: left; }
#toast {
  position: absolute; z-index: 50; left: 50%; bottom: 7em; transform: translateX(-50%);
  background: rgba(13, 18, 64, .95); border: .15em solid var(--gold); border-radius: 999px;
  padding: .5em 1.4em; font-size: 2em; font-weight: 800; white-space: nowrap;
}

/* ---------- Телефон тігінен тұрса ---------- */
#rotate {
  display: none; position: fixed; inset: 0; z-index: 100; background: #05021a;
  align-items: center; justify-content: center; text-align: center; font-size: 6vw; line-height: 1.5;
}
@media (orientation: portrait) and (max-width: 900px) { #rotate { display: flex; } }

/* ---------- Карта таңдау батырмалары ---------- */
.maps { gap: .8em; margin-bottom: .2em; }
.mapBtn {
  font: inherit; font-size: 1.7em; font-weight: 900; color: #fff; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .1em;
  padding: .35em 1em; border-radius: 1em; background: rgba(13, 18, 64, .88);
  border: .12em solid rgba(63, 242, 255, .45);
}
.mapBtn small { font-size: .62em; font-weight: 700; color: #9fe9ff; }
.mapBtn.active { border-color: var(--gold); background: rgba(255, 211, 77, .2); box-shadow: 0 0 .8em rgba(255, 211, 77, .6); }

/* ---------- Тіл және өмір көрсеткіші ---------- */
.hint, #rotate { white-space: pre-line; }
#lives { position: absolute; top: 1.2em; left: 1.4em; font-size: 2.6em; letter-spacing: .05em; }
#langRow { display: flex; gap: .5em; flex-wrap: wrap; justify-content: flex-end; }
.langBtn {
  font: inherit; font-size: .7em; font-weight: 800; color: #fff; cursor: pointer;
  padding: .3em .8em; border-radius: 999px; background: rgba(13, 18, 64, .88);
  border: .12em solid rgba(63, 242, 255, .45);
}
.langBtn.active { border-color: var(--gold); background: rgba(255, 211, 77, .2); }

/* ---------- Онлайн сайыс және есім енгізу ---------- */
.textInput {
  font: inherit; font-size: 2.2em; font-weight: 800; color: #fff; text-align: center;
  width: 9em; padding: .25em .5em; border-radius: .6em; border: .12em solid var(--cyan);
  background: #070b2e; outline: none; user-select: text; -webkit-user-select: text;
}
.textInput:focus { border-color: var(--gold); }
#duelCodeInput { width: 4.4em; letter-spacing: .12em; text-transform: uppercase; }
.codeBig { font-size: 6em; font-weight: 900; letter-spacing: .15em; color: var(--gold); text-shadow: 0 0 .4em rgba(255, 211, 77, .8); text-align: center; }
.errText { color: #ff9aa2; min-height: 1.4em; }
#duelHud {
  position: absolute; top: 6.6em; left: 1.4em; font-size: 1.8em; font-weight: 800;
  background: rgba(13, 18, 64, .85); border: .12em solid #ff7ad9; border-radius: 1em; padding: .25em .8em;
}
#duelHud .lead { color: #7dffb0; } #duelHud .behind { color: #ff9aa2; }
.duelBox { font-size: 2em; font-weight: 800; text-align: center; line-height: 1.4; }
#countdown {
  position: absolute; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center;
  font-size: 18em; font-weight: 900; color: var(--gold); text-shadow: 0 0 .3em rgba(255, 211, 77, .9), 0 .04em 0 #7a4a0c;
  background: rgba(5, 2, 26, .45); pointer-events: none;
}
.boardList li.me { color: var(--gold); font-weight: 900; }

/* ---------- Қолданба режимі: толық экран / орнату батырмалары ---------- */
body { -webkit-touch-callout: none; touch-action: manipulation; }
#menuTools { position: absolute; top: 1em; right: 1em; display: flex; gap: .6em; z-index: 25; }
.toolBtn {
  font: inherit; font-size: 2.2em; width: 2.2em; height: 2.2em; border-radius: 50%; cursor: pointer; color: #fff;
  background: rgba(13, 18, 64, .88); border: .1em solid var(--cyan); box-shadow: 0 0 .6em rgba(63, 242, 255, .4);
}
