:root {
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
}

:root {
  --bg: #0b1220;
  --card: #121c33;
  --accent: #2da5ff;
  --text: #ffffff;
  --muted: #8fa3bf;
}

* {
  box-sizing: border-box;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #0b1c2d; /* базовый синий */
  background-image: radial-gradient(
    circle at top,
    #132040,
    #0b1c2d 70%
  );
  background-attachment: fixed;
  color: var(--text);
  overflow: hidden;
}




/* TOP BAR */
.top {
   position: sticky;
  top: env(safe-area-inset-top, 0px); /* iOS + Android */
  z-index: 100;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  display: flex;
  justify-content: stretch;
  padding-top: calc(8px + var(--safe-top));
  padding: 10px 14px;
    box-shadow: 0 2px 4px #0000001a, 0 8px 16px #0000001a;


  
    gap: 12px;
}
.btn {
  background: linear-gradient(145deg, #1c2d55, #0f1b36);
  border: 1px solid #243b6b;
  border-radius: 14px;
padding: 10px 12px;
min-width: 38px;
white-space: nowrap;
   flex: 1 1 auto; 
  color: white;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,.4);
  display: flex;
  align-items: center;
  justify-content: center;
 
}

.btn:hover{
transform: scale(0.99);
box-shadow:
    0 0 12px rgba(45,165,255,0.4),
    0 6px 18px rgba(0,0,0,.4);
}
.center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}


#effects {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
}

.plus {
  position: absolute;
  font-size: 18px;
  font-weight: 700;
  color: #ffd700;
  pointer-events: none;
  transition:
    transform 0.8s cubic-bezier(0.25, 1, 0.5, 1),
    opacity 0.8s ease;
  text-shadow: 0 4px 10px rgba(255, 215, 0, 0.7);
}

.magnate {
  position: absolute;
  width: 180px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  filter:
    drop-shadow(0 0 12px rgba(0, 255, 255, 0.35))
    drop-shadow(0 0 30px rgba(0, 180, 255, 0.25));
}
.magnate:active {
  transform: translate(-50%, -50%) scale(0.97);
}


/* BOTTOM */
.bottom {
  text-align: center;
  padding-bottom: calc(12px + var(--safe-bottom));
}

.score {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
}

.sub {
  color: var(--muted);
  font-size: 14px;
}

.top-bar {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}

.ui-button {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 8px 14px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn.tasks {
  box-shadow:
    0 0 0 rgba(45,165,255,0),
    0 6px 18px rgba(0,0,0,.4);
}

.btn.tasks:hover {
  box-shadow:
    0 0 12px rgba(45,165,255,0.4),
    0 6px 18px rgba(0,0,0,.4);
}


.user-level {
  opacity: 0.9;
}

.magnate-wrapper {
  position: relative;
  width: 260px;
  height: 260px;
}
#magnate {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}




.progress-ring {
  position: absolute;
  top: 0;
  left: 0;
}
.progress-ring-bg {
  fill: rgba(11,28,45,0.85); /* ТОЧНО такой же как body */
  stroke: rgba(255,255,255,0.08);
  stroke-width: 14;
}


.progress-ring-fill {
  fill: none;
  stroke: #60f542;
  stroke-width: 14;
  stroke-linecap: round;
  stroke-dasharray: 691;
  stroke-dashoffset: 691;
  transition: stroke-dashoffset 0.4s ease;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}
.level-text {
  position: absolute;
  bottom: -28px;
  width: 100%;
  text-align: center;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  opacity: 0.9;
}

.user-level.under {
  position: absolute;
  bottom: -43px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
}
.settings-modal.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.settings-btn svg {
  margin-right: 5px;
}

.close-btn svg {
  display: block;
  color: #8fa3bf;
}



.vip-badge {
  font-size: 16px;
  filter: drop-shadow(0 0 6px rgba(255,215,0,0.6));
}

.energy-ring {
  position: absolute;
  top: -20px;
  left: -20px;
  width: 300px;
  height: 300px;
  transform: rotate(-90deg);
  pointer-events: none;
}


.energy-bg {
  fill: rgba(11,28,45,0.75);
  stroke: rgba(255,255,255,0.08);
  stroke-width: 5;
}

.energy-fill {
  fill: none;
  stroke: #2de2ff;
  stroke-width: 5;
  stroke-linecap: round;

  stroke-dasharray: 816;
  stroke-dashoffset: 816;

  transition: stroke-dashoffset 0.3s linear, stroke 0.3s;
  filter: drop-shadow(0 0 10px rgba(45,226,255,0.6));
}

/* SETTINGS BUTTON */
.settings-btn {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: linear-gradient(145deg, #1c2d55, #0f1b36);
  border: 1px solid #243b6b;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8fa3bf;
  cursor: pointer;
  z-index: 50;
  box-shadow: 0 10px 25px rgba(0,0,0,.5);
}
.settings-btn:hover {
  transform: rotate(25deg) scale(1.05);
  color: #2da5ff;
}

/* MODAL */
.settings-modal {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #132040, #0b1220);
  z-index: 100;
  display: flex;
  flex-direction: column;
  opacity: 1;
  transition: opacity .25s ease;
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px;
  font-weight: 700;
  font-size: 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.close-btn {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 10px;
  cursor: pointer;
  color: #8fa3bf;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}

.close-btn svg {
  display: block;
}

.close-btn:hover {
  color: #ff4d4d;
  background: rgba(255, 77, 77, 0.12);
  transform: rotate(90deg);
}


.settings-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(8px);
}

.settings-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.settings-card p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.level-boost {
  position: fixed;
  top: 45%;
  left: 50%;
  transform: translate(-50%, 20px) scale(0.9);
  background: linear-gradient(145deg, #2de2ff, #1a9fff);
  color: #0b1220;
  font-weight: 800;
  font-size: 18px;
  padding: 14px 22px;
  border-radius: 18px;
  box-shadow: 0 15px 40px rgba(45,226,255,0.6);
  opacity: 0;
  z-index: 999;
  transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.level-boost.show {
  opacity: 1;
  transform: translate(-50%, -10px) scale(1);
}

.level-boost.hide {
  opacity: 0;
  transform: translate(-50%, -40px) scale(0.95);
}

#balance {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
 flex: 1 1 auto;
  min-width: max-content;
  pointer-events: none;
}
#balance .exchange-icon {
  flex-shrink: 0;
}
.balance-value {
  min-width: 0;
  max-width: 100%;
  flex: 0 0 auto;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}





/* 🔁 ИКОНКА */
.exchange-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
 margin-left: auto;
  border-radius: 50%;
  color: #0b1220;

  font-size: 15px;
  font-weight: 900;
  cursor: pointer;

 

  transition:
    transform .12s ease,
    box-shadow .2s ease,
    filter .2s ease;
}

/* hover — glow */
.exchange-icon:hover {
  filter: brightness(1.1);
  box-shadow:
    0 0 14px rgba(45,226,255,.9);
}

/* НАЖАТИЕ */
.exchange-icon:active {
  transform: scale(0.88) rotate(-15deg);
  box-shadow:
    0 0 18px rgba(45,226,255,1),
    inset 0 4px 8px rgba(0,0,0,.35);
}

/* ===== EXCHANGE MINI MODAL ===== */

.exchange-modal {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 120;
}

.exchange-modal.show {
  pointer-events: auto;
}

.exchange-sheet {
  position: absolute;
  top: 64px; /* сразу под top bar */
  left: 12px;
  right: 12px;

  background: linear-gradient(180deg, #162449, #0e1730);
  border-radius: 18px;
  padding: 14px 16px 18px;

  box-shadow:
    0 20px 50px rgba(0,0,0,.65),
    inset 0 1px 0 rgba(255,255,255,.08);

  transform: translateY(-12px) scale(.96);
  opacity: 0;

  transition:
    transform .28s cubic-bezier(.25,1,.4,1),
    opacity .25s ease;
}

.exchange-modal.show .exchange-sheet {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* маленькая ручка */
.exchange-handle {
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,.25);
  border-radius: 4px;
  margin: 0 auto 12px;
}

/* текст */
.exchange-text {
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #e6eeff;
  margin-bottom: 14px;
}

/* кнопка */
.exchange-action {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  border: none;

  background: linear-gradient(145deg, #2de2ff, #1a9fff);
  color: #0b1220;

  font-size: 15px;
  font-weight: 800;
  cursor: pointer;

  box-shadow:
    0 10px 25px rgba(45,226,255,.55),
    inset 0 1px 0 rgba(255,255,255,.4);

  transition: transform .15s ease, box-shadow .2s ease;
}

.exchange-action:active {
  transform: scale(.96);
  box-shadow:
    0 6px 18px rgba(45,226,255,.8);
}

.top-action {
  padding: 10px 14px;        /* 🔥 нормальный паддинг */
  overflow: hidden;
}
