:root {
  --text: #e9f1ff;
  --muted: #8492b5;
  --line: rgba(150, 195, 255, 0.12);
  --panel: rgba(255, 255, 255, 0.045);
  --aqua: #6fe3ff;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(120% 70% at 50% -12%, #1a2742 0%, #0a0f1c 52%, #05070d 100%),
    radial-gradient(80% 50% at 50% 110%, rgba(70, 190, 235, 0.12), rgba(5, 7, 13, 0) 70%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100%;
  height: 100dvh;
  padding: calc(8px + env(safe-area-inset-top)) 10px calc(10px + env(safe-area-inset-bottom));
  gap: 9px;
}

/* ---------- верхняя панель ---------- */

#hud {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.012) 55%, rgba(255, 255, 255, 0.02)),
    radial-gradient(110% 130% at 50% 0%, rgba(110, 170, 255, 0.14), rgba(10, 16, 30, 0) 70%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 10px 24px rgba(0, 0, 0, 0.3);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 44px;
}

.stat span {
  font-size: 8.5px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--muted);
}

.stat b {
  font-size: 18px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 14px rgba(130, 200, 255, 0.25);
}

#nextBox {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

#nextBox span {
  font-size: 8.5px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--muted);
}

#next {
  display: block;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* ---------- иконки ---------- */

#pause svg,
#pad svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.45));
}

#pause {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid var(--line);
  color: #cfe0ff;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.02));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 4px 12px rgba(0, 0, 0, 0.28);
  transition: transform 0.09s ease, background 0.16s ease;
}

#pause svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.4;
}

#pause:active {
  transform: scale(0.94);
  background: rgba(120, 210, 255, 0.18);
}

/* ---------- поле ---------- */

#stage {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
  touch-action: none;
}

#game {
  display: block;
  margin: auto;
}

/* ---------- кнопки ---------- */

#pad {
  display: flex;
  gap: 8px;
  height: 64px;
  flex: 0 0 auto;
}

#pad button {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  border: 1px solid rgba(150, 195, 255, 0.14);
  color: #d7e6ff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.035) 48%, rgba(255, 255, 255, 0.012)),
    radial-gradient(120% 100% at 50% 0%, rgba(120, 180, 255, 0.16), rgba(10, 16, 30, 0) 72%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4),
    inset 0 -14px 22px -14px rgba(0, 0, 0, 0.75),
    0 7px 18px rgba(0, 0, 0, 0.32);
  transition: transform 0.09s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

#pad button:active {
  transform: translateY(1px) scale(0.965);
  border-color: rgba(140, 235, 255, 0.42);
  color: #f0fbff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 10px 20px -8px rgba(0, 0, 0, 0.55),
    0 0 24px rgba(90, 220, 255, 0.22);
}

#pad button[data-act="drop"] {
  flex: 1.4 1 0;
  color: #06222e;
  border-color: rgba(150, 242, 255, 0.42);
  background:
    radial-gradient(125% 140% at 50% -15%, rgba(196, 250, 255, 0.8), rgba(104, 222, 246, 0.46) 42%, rgba(44, 156, 196, 0.34) 76%, rgba(22, 96, 130, 0.36)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.04));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -12px 20px -8px rgba(6, 66, 96, 0.75),
    0 8px 26px rgba(70, 196, 232, 0.3);
}

#pad button[data-act="drop"] svg {
  width: 24px;
  height: 24px;
  stroke-width: 2.1;
}

#pad button[data-act="drop"]:active {
  transform: translateY(1px) scale(0.965);
  color: #041a24;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 10px 22px -8px rgba(4, 52, 78, 0.85),
    0 0 30px rgba(110, 235, 255, 0.4);
}

@media (hover: hover) {
  #pad button:hover {
    border-color: rgba(160, 215, 255, 0.3);
    color: #f2f8ff;
  }
}

/* ---------- окно поверх ---------- */

#overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background: rgba(4, 7, 14, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#overlay.hidden {
  display: none;
}

.card {
  width: 100%;
  max-width: 320px;
  padding: 24px 22px 20px;
  text-align: center;
  border-radius: 26px;
  border: 1px solid rgba(160, 200, 255, 0.16);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(96, 148, 226, 0.22), rgba(10, 16, 30, 0) 66%),
    linear-gradient(180deg, rgba(27, 38, 64, 0.95), rgba(11, 16, 28, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 26px 70px rgba(0, 0, 0, 0.65);
}

.card h1 {
  margin: 0 0 10px;
  font-size: 23px;
  letter-spacing: -0.01em;
}

.card p {
  margin: 0 0 20px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #aab9d9;
  white-space: pre-line;
}

.card button {
  width: 100%;
  padding: 15px;
  border-radius: 16px;
  border: 1px solid rgba(160, 245, 255, 0.42);
  font-size: 16px;
  font-weight: 700;
  color: #06222e;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  background:
    radial-gradient(125% 150% at 50% -20%, rgba(198, 250, 255, 0.85), rgba(104, 222, 246, 0.5) 45%, rgba(42, 152, 192, 0.38) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -12px 20px -8px rgba(6, 66, 96, 0.7),
    0 10px 28px rgba(70, 196, 232, 0.3);
  transition: transform 0.09s ease, box-shadow 0.16s ease;
}

.card button:active {
  transform: translateY(1px) scale(0.97);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    inset 0 10px 22px -8px rgba(4, 52, 78, 0.85),
    0 0 30px rgba(110, 235, 255, 0.35);
}
