/* ============ TITANS-СТИЛЬ ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; margin: 0; padding: 0; }

body {
  font-family: 'Fredoka', 'Arial Black', Arial, sans-serif;
  background: linear-gradient(180deg, #6a2a8a 0%, #8a4a2a 50%, #d4762a 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 12px;
  max-width: 500px;
  margin: 0 auto;
  position: relative;
  overflow-x: hidden;
}

/* Декоративные звёзды на фоне */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.4), transparent),
    radial-gradient(2px 2px at 60% 70%, rgba(255,255,255,0.3), transparent),
    radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,0.5), transparent),
    radial-gradient(2px 2px at 40% 80%, rgba(255,255,255,0.3), transparent);
  pointer-events: none;
  z-index: 0;
}

/* ============ ВЕРХНЯЯ ПАНЕЛЬ ============ */
.top-panel {
  width: 100%;
  max-width: 500px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  position: relative;
  z-index: 2;
}

.back-btn {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  border: 3px solid #0f4a2a;
  color: #fff;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 0 #0f4a2a, 0 6px 12px rgba(0,0,0,0.4);
  transition: all 0.1s;
}
.back-btn.show { display: flex; }
.back-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #0f4a2a; }

h1 {
  font-size: 16px;
  flex: 1;
  text-align: center;
  color: #ffe14d;
  letter-spacing: 1px;
  text-shadow: 2px 2px 0 #8a4a00, 0 0 15px rgba(255,225,77,0.5);
  font-weight: 900;
}

/* Кошелёк */
.wallet-titans {
  display: flex;
  gap: 6px;
}
.coin-box {
  display: flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(180deg, #4a2a8a, #2a1a5a);
  border: 3px solid #8a6aff;
  border-radius: 20px;
  padding: 4px 10px 4px 4px;
  font-size: 13px;
  font-weight: 900;
  color: #ffe14d;
  box-shadow: 0 3px 0 #1a0a3a, 0 5px 15px rgba(0,0,0,0.4);
  min-width: 90px;
  justify-content: flex-end;
}
.coin-icon {
  font-size: 18px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.5));
}

/* ============ ЭКРАНЫ ============ */
.screen {
  display: none;
  width: 100%;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 1;
}
.screen.active { display: flex; }

/* ============ МЕНЮ ============ */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
  max-width: 500px;
}
.menu-card {
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 4px solid #8a4a00;
  border-radius: 18px;
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.1s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  box-shadow: 0 5px 0 #5a2a00, 0 8px 20px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}
.menu-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.4), transparent);
  pointer-events: none;
}
.menu-card:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #5a2a00;
}
.menu-icon { font-size: 40px; margin-bottom: 6px; filter: drop-shadow(0 3px 0 rgba(0,0,0,0.3)); }
.menu-name {
  font-size: 13px;
  font-weight: 900;
  color: #4a1a00;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
.menu-sub {
  font-size: 10px;
  color: #6a3a10;
  margin-top: 3px;
  font-weight: bold;
}

/* ============ КАРТОЧКА МАШИНЫ ============ */
.car-card {
  width: 100%;
  max-width: 500px;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 4px solid #8a4a00;
  border-radius: 22px;
  padding: 16px;
  margin-bottom: 14px;
  text-align: center;
  box-shadow: 0 6px 0 #5a2a00, 0 10px 25px rgba(0,0,0,0.5);
  transition: all 0.4s;
  min-height: 340px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}
.car-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent);
  pointer-events: none;
}
.car-card.common { border-color: #6a6a6a; }
.car-card.common::before { background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent); }
.car-card.rare { border-color: #1a5a8a; }
.car-card.epic { border-color: #6a1a8a; }
.car-card.legendary {
  border-color: #8a4a00;
  animation: legendShine 1s infinite alternate;
}
@keyframes legendShine {
  from { box-shadow: 0 6px 0 #5a2a00, 0 0 25px rgba(255,200,50,0.6); }
  to { box-shadow: 0 6px 0 #5a2a00, 0 0 45px rgba(255,100,50,0.9); }
}

.car-image-box {
  width: 100%;
  height: 180px;
  margin-bottom: 10px;
  background: #2a1a0a;
  border: 3px solid #5a2a00;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.car-image { width: 100%; height: 100%; object-fit: cover; }
.car-fallback {
  position: absolute; inset: 0;
  display: none; align-items: center; justify-content: center;
  font-size: 70px; color: #5a2a00;
}
.car-fallback.show { display: flex; }

.rarity-label {
  font-size: 12px;
  letter-spacing: 3px;
  font-weight: 900;
  margin-bottom: 6px;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(0,0,0,0.3);
}
.car-card.common .rarity-label { color: #4a4a4a; }
.car-card.rare .rarity-label { color: #0a3a6a; }
.car-card.epic .rarity-label { color: #6a1a8a; }
.car-card.legendary .rarity-label { color: #8a2a00; }

.car-name {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 10px;
  color: #2a1a00;
  text-shadow: 0 2px 0 rgba(255,255,255,0.5);
  word-break: break-word;
}
.car-card.legendary .car-name {
  background: linear-gradient(90deg, #d40000, #ff9800, #d40000);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 0 rgba(255,255,255,0.5));
}

.car-price {
  font-size: 18px;
  font-weight: 900;
  color: #0a5a1a;
  padding: 6px 18px;
  background: linear-gradient(180deg, #a8e6a8, #6ac86a);
  border: 3px solid #0a4a1a;
  border-radius: 14px;
  display: inline-block;
  box-shadow: 0 3px 0 #0a4a1a;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}

/* ============ КНОПКИ TITANS ============ */
button {
  width: 100%;
  max-width: 500px;
  padding: 16px;
  font-size: 18px;
  font-weight: 900;
  font-family: inherit;
  border: 4px solid;
  border-radius: 16px;
  cursor: pointer;
  color: #fff;
  margin-bottom: 12px;
  transition: all 0.1s;
  text-shadow: 0 2px 0 rgba(0,0,0,0.4);
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}
button::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 45%;
  background: linear-gradient(180deg, rgba(255,255,255,0.35), transparent);
  border-radius: 12px 12px 50% 50%;
  pointer-events: none;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
button:active:not(:disabled) { transform: translateY(4px); }

.btn-gen {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  border-color: #0a4a1a;
  box-shadow: 0 5px 0 #0a4a1a, 0 8px 20px rgba(0,0,0,0.4);
  font-size: 20px;
  padding: 20px;
}
.btn-gen:active:not(:disabled) { box-shadow: 0 1px 0 #0a4a1a; }

.btn-keep {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  border-color: #0a4a1a;
  box-shadow: 0 5px 0 #0a4a1a;
  font-size: 14px;
  padding: 14px 8px;
}
.btn-keep:active:not(:disabled) { box-shadow: 0 1px 0 #0a4a1a; }

.btn-sell {
  background: linear-gradient(180deg, #ff6b6b, #c62828);
  border-color: #5a0a0a;
  box-shadow: 0 5px 0 #5a0a0a;
  font-size: 14px;
  padding: 14px 8px;
}
.btn-sell:active:not(:disabled) { box-shadow: 0 1px 0 #5a0a0a; }

.btn-row {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 500px;
}
.btn-row button { flex: 1; margin-bottom: 10px; }

/* ============ КЕЙСЫ (СВИТОК) ============ */
.case-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 500px;
}
.case-card {
  padding: 20px 18px;
  border-radius: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.1s;
  border: 4px solid;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  box-shadow: 0 5px 0 #5a2a00, 0 8px 20px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
}
.case-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.4), transparent);
  pointer-events: none;
}
.case-card:active { transform: translateY(4px); box-shadow: 0 1px 0 #5a2a00; }
.case-card.disabled { opacity: 0.5; cursor: not-allowed; }
.case-card.common-case { border-color: #6a6a6a; }
.case-card.rare-case { border-color: #1a5a8a; box-shadow: 0 5px 0 #0a3a5a, 0 0 20px rgba(77,208,255,0.5); }
.case-card.epic-case { border-color: #6a1a8a; box-shadow: 0 5px 0 #4a0a6a, 0 0 20px rgba(192,125,255,0.5); }
.case-card.legendary-case {
  border-color: #8a4a00;
  animation: legendShine 1.2s infinite alternate;
}
.case-emoji { font-size: 46px; margin-bottom: 6px; filter: drop-shadow(0 3px 0 rgba(0,0,0,0.3)); }
.case-name { font-size: 17px; font-weight: 900; color: #2a1a00; margin-bottom: 4px; letter-spacing: 1px; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
.case-desc { font-size: 12px; color: #4a2a10; margin-bottom: 8px; font-weight: bold; }
.case-price {
  font-size: 16px;
  font-weight: 900;
  color: #0a5a1a;
  padding: 4px 14px;
  background: linear-gradient(180deg, #a8e6a8, #6ac86a);
  border: 3px solid #0a4a1a;
  border-radius: 12px;
  display: inline-block;
  box-shadow: 0 3px 0 #0a4a1a;
}

/* ============ АНИМАЦИЯ КЕЙСА ============ */
.case-opening {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.case-opening.show { display: flex; }
.opening-box {
  font-size: 110px;
  animation: shake 0.3s infinite;
  margin-bottom: 20px;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.4));
}
@keyframes shake {
  0%,100% { transform: rotate(-10deg) scale(1); }
  50% { transform: rotate(10deg) scale(1.1); }
}
.opening-text {
  font-size: 24px;
  font-weight: 900;
  color: #ffe14d;
  margin-bottom: 20px;
  text-align: center;
  text-shadow: 2px 2px 0 #8a4a00, 0 0 20px rgba(255,225,77,0.6);
}
.opening-reveal {
  display: none;
  width: 100%;
  max-width: 500px;
  animation: popIn 0.5s;
}
.opening-reveal.show { display: block; }
@keyframes popIn {
  from { transform: scale(0.3); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ============ КОЛЛЕКЦИЯ ============ */
.collection-header {
  width: 100%;
  max-width: 500px;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 4px solid #8a4a00;
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 12px;
  text-align: center;
  box-shadow: 0 4px 0 #5a2a00;
}
.collection-progress { font-size: 18px; font-weight: 900; color: #2a1a00; margin-bottom: 4px; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
.collection-sub { font-size: 12px; color: #4a2a10; font-weight: bold; }

.filter-row {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 500px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  background: linear-gradient(180deg, #a86a3a, #6a3a1a);
  border: 3px solid #3a1a00;
  color: #ffdd8a;
  border-radius: 14px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.1s;
  box-shadow: 0 3px 0 #1a0a00;
}
.filter-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #1a0a00; }
.filter-btn.active {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  border-color: #0a4a1a;
  color: #fff;
  box-shadow: 0 3px 0 #0a4a1a;
}

.collection-list {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 20px;
}
.col-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 3px solid;
  border-radius: 14px;
  padding: 8px 12px;
  cursor: pointer;
  transition: all 0.1s;
  box-shadow: 0 3px 0 #5a2a00;
}
.col-item:active { transform: translateY(2px); box-shadow: 0 1px 0 #5a2a00; }
.col-item.common { border-color: #6a6a6a; }
.col-item.rare { border-color: #1a5a8a; }
.col-item.epic { border-color: #6a1a8a; }
.col-item.legendary { border-color: #8a4a00; animation: legendShine 1.5s infinite alternate; }
.col-item.missing { opacity: 0.5; cursor: not-allowed; }
.col-item.missing .col-name { color: #6a4a2a; }
.col-thumb {
  width: 50px;
  height: 40px;
  background: #2a1a0a;
  border-radius: 8px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 24px;
  border: 2px solid #5a2a00;
}
.col-thumb img { width: 100%; height: 100%; object-fit: cover; }
.col-info { flex: 1; text-align: left; min-width: 0; }
.col-name {
  font-size: 14px;
  font-weight: 900;
  color: #2a1a00;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
.col-rarity { font-size: 10px; letter-spacing: 2px; font-weight: 900; text-transform: uppercase; }
.col-item.common .col-rarity { color: #4a4a4a; }
.col-item.rare .col-rarity { color: #0a3a6a; }
.col-item.epic .col-rarity { color: #6a1a8a; }
.col-item.legendary .col-rarity { color: #8a2a00; }
.col-price {
  font-size: 13px;
  font-weight: 900;
  color: #0a5a1a;
  text-align: right;
  flex-shrink: 0;
}

/* ============ СТАТИСТИКА ============ */
.stats-block {
  width: 100%;
  max-width: 500px;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 4px solid #8a4a00;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: 0 4px 0 #5a2a00;
}
.stats-block h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #2a1a00;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 900;
  text-shadow: 0 1px 0 rgba(255,255,255,0.5);
}
.stats-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 2px solid rgba(90,42,0,0.2);
  font-size: 14px;
  font-weight: bold;
}
.stats-row:last-child { border-bottom: none; }
.stats-row span { color: #4a2a10; }
.stats-row b { color: #0a5a1a; font-weight: 900; }

/* ============ НАСТРОЙКИ ============ */
.settings-block {
  width: 100%;
  max-width: 500px;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 4px solid #8a4a00;
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 12px;
  box-shadow: 0 4px 0 #5a2a00;
}
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 2px solid rgba(90,42,0,0.2);
  font-size: 15px;
  color: #2a1a00;
  font-weight: 900;
}
.settings-row:last-child { border-bottom: none; }
.toggle {
  width: 56px;
  height: 32px;
  background: linear-gradient(180deg, #6a3a1a, #3a1a00);
  border: 3px solid #1a0a00;
  border-radius: 18px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 0 #1a0a00;
}
.toggle::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 2px solid #8a4a00;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.toggle.on { background: linear-gradient(180deg, #4ade80, #16a34a); border-color: #0a4a1a; }
.toggle.on::after { left: 26px; }

/* ============ УЛУЧШЕНИЯ ============ */
.upgrade-item {
  width: 100%;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 4px solid #8a4a00;
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: 0 4px 0 #5a2a00;
}
.upgrade-item.maxed { border-color: #d40000; box-shadow: 0 4px 0 #5a0000, 0 0 20px rgba(255,180,0,0.6); }
.upgrade-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.upgrade-icon { font-size: 32px; filter: drop-shadow(0 3px 0 rgba(0,0,0,0.3)); }
.upgrade-info { flex: 1; text-align: left; }
.upgrade-name { font-size: 15px; font-weight: 900; color: #2a1a00; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
.upgrade-desc { font-size: 11px; color: #4a2a10; margin-top: 2px; font-weight: bold; }
.upgrade-level {
  font-size: 12px;
  font-weight: 900;
  color: #fff;
  padding: 4px 10px;
  background: linear-gradient(180deg, #8a4a00, #5a2a00);
  border: 2px solid #3a1a00;
  border-radius: 10px;
  box-shadow: 0 2px 0 #1a0a00;
}
.upgrade-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(180deg, #4ade80, #16a34a);
  border: 3px solid #0a4a1a;
  border-radius: 12px;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 3px 0 #0a4a1a;
  text-shadow: 0 1px 0 rgba(0,0,0,0.4);
}
.upgrade-btn:disabled { background: #8a6a4a; border-color: #5a3a1a; box-shadow: 0 3px 0 #3a1a00; opacity: 0.6; }
.upgrade-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 #0a4a1a; }

/* ============ ДОСТИЖЕНИЯ ============ */
.ach-item {
  width: 100%;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 4px solid #8a4a00;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 0 #5a2a00;
}
.ach-item.done { border-color: #0a5a1a; box-shadow: 0 4px 0 #0a4a1a, 0 0 20px rgba(74,222,128,0.5); }
.ach-icon { font-size: 34px; flex-shrink: 0; filter: drop-shadow(0 3px 0 rgba(0,0,0,0.3)); }
.ach-info { flex: 1; text-align: left; }
.ach-name { font-size: 14px; font-weight: 900; color: #2a1a00; margin-bottom: 2px; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
.ach-desc { font-size: 11px; color: #4a2a10; font-weight: bold; }
.ach-reward { font-size: 13px; font-weight: 900; color: #8a2a00; flex-shrink: 0; }
.ach-done-mark { font-size: 22px; color: #0a5a1a; }

/* ============ ЗАДАНИЯ ============ */
.quest-item {
  width: 100%;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 4px solid #8a4a00;
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: 0 4px 0 #5a2a00;
}
.quest-item.done { border-color: #0a5a1a; box-shadow: 0 4px 0 #0a4a1a, 0 0 20px rgba(74,222,128,0.5); }
.quest-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.quest-name { font-size: 14px; font-weight: 900; color: #2a1a00; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
.quest-progress { font-size: 13px; color: #0a3a6a; font-weight: 900; }
.quest-desc { font-size: 12px; color: #4a2a10; margin-bottom: 8px; font-weight: bold; }
.quest-reward { font-size: 13px; font-weight: 900; color: #8a2a00; }
.quest-bar {
  width: 100%;
  height: 12px;
  background: #2a1a00;
  border: 2px solid #1a0a00;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}
.quest-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #a8e6a8);
  border-radius: 4px;
  transition: width 0.3s;
  box-shadow: 0 0 10px rgba(74,222,128,0.8);
}
.quest-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(180deg, #4ade80, #16a34a);
  border: 3px solid #0a4a1a;
  border-radius: 12px;
  color: #fff;
  font-weight: 900;
  font-size: 14px;
  cursor: pointer;
  margin-top: 4px;
  box-shadow: 0 3px 0 #0a4a1a;
  text-shadow: 0 1px 0 rgba(0,0,0,0.4);
}
.quest-btn:disabled { background: #8a6a4a; border-color: #5a3a1a; box-shadow: 0 3px 0 #3a1a00; opacity: 0.6; }
.quest-btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 #0a4a1a; }

/* ============ РЕЙТИНГ ============ */
.leader-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 3px solid #8a4a00;
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 8px;
  box-shadow: 0 3px 0 #5a2a00;
}
.leader-row.me { border-color: #d40000; box-shadow: 0 3px 0 #5a0000, 0 0 20px rgba(255,180,0,0.6); }
.leader-rank { font-size: 20px; font-weight: 900; width: 42px; text-align: center; color: #8a2a00; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
.leader-info { flex: 1; text-align: left; min-width: 0; }
.leader-name { font-size: 15px; font-weight: 900; color: #2a1a00; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
.leader-cars { font-size: 11px; color: #4a2a10; font-weight: bold; }
.leader-money { font-size: 15px; font-weight: 900; color: #0a5a1a; text-align: right; }

/* ============ ДУЭЛЬ ============ */
.duel-timer {
  text-align: center;
  font-size: 28px;
  font-weight: 900;
  color: #ffe14d;
  padding: 10px;
  background: linear-gradient(180deg, #4a2a8a, #2a1a5a);
  border: 4px solid #8a6aff;
  border-radius: 14px;
  margin-bottom: 10px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 4px 0 #1a0a3a, 0 0 20px rgba(138,106,255,0.5);
  text-shadow: 2px 2px 0 #1a0a3a;
}
.duel-screen {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 500px;
  gap: 10px;
  margin-bottom: 10px;
}
.duel-player {
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.1s;
  min-height: 170px;
  border: 4px solid;
  box-shadow: 0 5px 0;
  position: relative;
  overflow: hidden;
}
.duel-player::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.3), transparent);
  pointer-events: none;
}
.duel-player:active { transform: translateY(4px); }
.duel-player.p1 { background: linear-gradient(180deg, #4a8aff, #1a3a8a); border-color: #0a1a4a; box-shadow: 0 5px 0 #0a1a4a; }
.duel-player.p2 { background: linear-gradient(180deg, #ff6b6b, #8a1a1a); border-color: #5a0a0a; box-shadow: 0 5px 0 #5a0a0a; }
.duel-player.p1:active { box-shadow: 0 1px 0 #0a1a4a; }
.duel-player-name { font-size: 16px; font-weight: 900; margin-bottom: 6px; text-shadow: 0 2px 0 rgba(0,0,0,0.4); }
.duel-player-score {
  font-size: 28px;
  font-weight: 900;
  color: #ffe14d;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5), 0 0 20px rgba(255,225,77,0.6);
}
.duel-cars-row {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  margin: 6px 0;
  min-height: 60px;
}
.duel-car-mini {
  width: 80px;
  height: 55px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  background: rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.3);
  transition: transform 0.1s;
}
.duel-result {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.95);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 600;
  padding: 20px;
}
.duel-result.show { display: flex; }
.duel-result h1 {
  font-size: 36px;
  margin-bottom: 20px;
  text-align: center;
  text-shadow: 3px 3px 0 #8a4a00, 0 0 30px rgba(255,225,77,0.6);
}
.duel-result p {
  font-size: 22px;
  margin-bottom: 10px;
  color: #ffe14d;
  font-weight: 900;
  text-shadow: 2px 2px 0 #8a4a00;
}

/* ============ ВВОД КОДА ============ */
.online-input {
  width: 100%;
  max-width: 340px;
  padding: 16px;
  background: linear-gradient(180deg, #2a1a4a, #1a0a2a);
  border: 4px solid #8a6aff;
  border-radius: 14px;
  color: #ffe14d;
  font-size: 24px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 6px;
  margin-bottom: 14px;
  outline: none;
  box-shadow: 0 4px 0 #1a0a3a, inset 0 2px 6px rgba(0,0,0,0.5);
  font-family: inherit;
}
.online-code {
  font-size: 48px;
  font-weight: 900;
  color: #ffe14d;
  letter-spacing: 10px;
  text-align: center;
  margin: 16px 0;
  text-shadow: 3px 3px 0 #8a4a00, 0 0 30px rgba(255,225,77,0.8);
  animation: pulseCode 1s infinite alternate;
}
@keyframes pulseCode {
  from { transform: scale(1); }
  to { transform: scale(1.05); }
}
.loader-text {
  text-align: center;
  color: #ffe14d;
  font-size: 16px;
  margin: 12px 0;
  font-weight: 900;
  text-shadow: 2px 2px 0 #8a4a00;
}

/* ============ МЕНЮ ДЕЙСТВИЙ ============ */
.action-menu {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 400;
  padding: 20px;
}
.action-menu.show { display: flex; }
.action-card {
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 4px solid #8a4a00;
  border-radius: 20px;
  padding: 22px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 6px 0 #5a2a00, 0 10px 30px rgba(0,0,0,0.6);
}
.action-card h3 { margin: 0 0 8px; font-size: 20px; color: #2a1a00; font-weight: 900; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
.action-card .price { color: #0a5a1a; font-size: 18px; margin-bottom: 16px; font-weight: 900; }

/* ============ ЛОГ ============ */
#log {
  margin-top: 10px;
  max-width: 500px;
  width: 100%;
  font-size: 14px;
  color: #ffe14d;
  text-align: center;
  min-height: 22px;
  font-weight: 900;
  text-shadow: 2px 2px 0 #8a4a00;
}
</style>

/* ============ БОНУС ДНЯ ============ */
.daily-bonus-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.9);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 700;
  padding: 20px;
}
.daily-bonus-modal.show { display: flex; }
.bonus-card {
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 5px solid #8a4a00;
  border-radius: 24px;
  padding: 30px 24px;
  width: 100%; max-width: 340px;
  text-align: center;
  box-shadow: 0 8px 0 #5a2a00, 0 0 60px rgba(255,225,77,0.6);
  animation: bonusPop 0.4s;
}
@keyframes bonusPop {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.bonus-emoji { font-size: 90px; margin-bottom: 12px; animation: bonusBounce 1s infinite alternate; }
@keyframes bonusBounce {
  from { transform: translateY(0) rotate(-5deg); }
  to { transform: translateY(-15px) rotate(5deg); }
}
.bonus-title {
  font-size: 24px;
  font-weight: 900;
  color: #2a1a00;
  margin-bottom: 8px;
  text-shadow: 0 2px 0 rgba(255,255,255,0.5);
}
.bonus-text { font-size: 16px; color: #4a2a10; font-weight: 900; margin-bottom: 16px; }
.bonus-amount { font-size: 28px; color: #0a5a1a; font-weight: 900; margin: 12px 0; }
.bonus-close {
  width: 100%;
  padding: 14px;
  background: linear-gradient(180deg, #4ade80, #16a34a);
  border: 3px solid #0a4a1a;
  border-radius: 14px;
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 0 #0a4a1a;
  font-family: inherit;
}
.bonus-close:active { transform: translateY(4px); box-shadow: 0 0 0 #0a4a1a; }

/* ============ ВСПЫШКА ЛЕГЕНДАРКИ ============ */
.legendary-flash {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0;
  background: radial-gradient(circle at center, #fff 0%, #ffd93d 30%, #ff5252 60%, transparent 100%);
}
.legendary-flash.flash {
  animation: flashAnim 0.8s;
}
@keyframes flashAnim {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}

/* ============ СКИНЫ ============ */
.skin-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 3px solid #5a2a00;
  cursor: pointer;
  transition: all 0.15s;
}
.skin-btn.active { border-color: #ffd93d; box-shadow: 0 0 15px rgba(255,217,61,0.8); }
.skin-btn:active { transform: scale(0.9); }
.skin-gold { background: linear-gradient(135deg, #ffd700, #b8860b); }
.skin-neon { background: linear-gradient(135deg, #00ffff, #ff00ff); }
.skin-rainbow { background: linear-gradient(135deg, #ff0000, #ffa500, #ffff00, #00ff00, #0000ff, #8b00ff); }

/* ============ КАТАЛОГ ============ */
.catalog-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #ffdd8a, #d4a04a);
  border: 3px solid #8a4a00;
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 8px;
  box-shadow: 0 3px 0 #5a2a00;
}
.catalog-img {
  width: 60px; height: 45px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #5a2a00;
}
.catalog-info { flex: 1; text-align: left; }
.catalog-name { font-size: 14px; font-weight: 900; color: #2a1a00; text-shadow: 0 1px 0 rgba(255,255,255,0.5); }
.catalog-rarity { font-size: 11px; font-weight: 900; }
.catalog-chance { font-size: 14px; font-weight: 900; color: #0a5a1a; }

/* ============ ТИР ============ */
.mini-game-area {
  position: relative;
  width: 100%;
  max-width: 500px;
  height: 400px;
  background: linear-gradient(180deg, #1a3a5a, #0a1a2a);
  border: 4px solid #8a4a00;
  border-radius: 16px;
  overflow: hidden;
  cursor: crosshair;
}
.target {
  position: absolute;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffd93d, #ff5252);
  border: 3px solid #fff;
  cursor: pointer;
  animation: targetPop 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}
@keyframes targetPop {
  from { transform: scale(0); }
  to { transform: scale(1); }
}