/* =========================
   RageFight
   ========================= */

/* Переменные */
:root {
  --bg-dark: #0c0c0c;
  --panel-dark: #121212;
  --muted: rgba(255,255,255,0.06);
  --accent: #ff5400;
  --accent-soft: #ffb366;
  --gold: #ffd966;
  --glass: rgba(255,255,255,0.03);
  --radius: 12px;
  --max-width: 1100px;
  --gap: 18px;
}

/* Сброс */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  height: 100%;
}

body {
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg-dark);
  color: #fff;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Фон и затемнение */
.back {
  position: fixed;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(6px) saturate(0.95);
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: rgba(6, 6, 6, 0.55);
}

/* Шапка */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(18,18,18,0.98), rgba(12,12,12,0.95));
  border-bottom: 1px solid var(--glass);
  height: 90px;
  position: relative;
  z-index: 20;
}

header .avatar {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.04);
}

header p {
  color: var(--gold);
  font-size: 1.4rem;
  font-weight: 700;
}

/* Универсальные кнопки */
.button,
.button_f {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #373737;
  color: var(--accent);
  text-decoration: none;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 1rem;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
  box-shadow: 0 8px 22px rgba(0,0,0,0.45);
  border: 1px solid var(--glass);
  user-select: none;
  cursor: pointer;
}

.button:hover,
.button_f:hover {
  background: #4f4f4f;
  transform: translateY(-3px);
}

/* Основной контейнер */
main {
  min-height: calc(100vh - 90px);
  padding: 32px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  position: relative;
  z-index: 10;
}

/* Панель (общая для main и gym) */
.panel,
.gym-panel {
  width: min(var(--max-width), 96%);
  background: linear-gradient(180deg, rgba(18,18,18,0.88), rgba(12,12,12,0.78));
  border-radius: var(--radius);
  padding: 22px;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: var(--gap);
  align-items: center;
  box-shadow: 0 30px 60px rgba(0,0,0,0.6);
  border: 1px solid var(--glass);
  position: relative;
}

/* Герой — изображение (исправлено: убраны background-свойства, добавлен display:block) */
.hero {
  width: 100%;
  height: 100%;
  max-width: 360px;
  border-radius: 12px;
  object-fit: cover;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.35), 0 12px 30px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.04);
}

/* Правая колонка — действия */
.actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

/* Кнопки действий */
.action-btn {
  width: 260px;
  padding: 14px 16px;
  font-size: 1.05rem;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
}

.action-btn.secondary {
  width: 320px;
  background: rgba(55,55,55,0.9);
  color: var(--gold);
}

/* main_text */
.main_text {
  position: relative;
  color: var(--accent);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 700;
}

/* Мелкий текст */
.small {
  color: rgba(255,255,255,0.75);
  font-size: 0.95rem;
}

/* Рейтинг */
.rank-container {
  width: 80%;
  max-width: 900px;
  margin: 36px auto;
  background: rgba(18,18,18,0.85);
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.45);
}

.rank-title {
  text-align: center;
  font-size: 1.8rem;
  color: var(--accent);
  margin-bottom: 12px;
}

.rank-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  margin-bottom: 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  font-size: 1.05rem;
  color: #fff;
  transition: transform .12s ease, background .12s ease;
}

.rank-item:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,0.08);
}

.rank-item:nth-child(1) {
  background: rgba(255,215,0,0.18);
  border-left: 4px solid gold;
}

.rank-item:nth-child(2) {
  background: rgba(192,192,192,0.14);
  border-left: 4px solid silver;
}

.rank-item:nth-child(3) {
  background: rgba(205,127,50,0.14);
  border-left: 4px solid #cd7f32;
}

/* Gym: кнопка, GIF, счётчик */
#actionButton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 340px;
  padding: 16px 18px;
  font-size: 1.15rem;
  border-radius: 12px;
  background: linear-gradient(180deg,#2b2b2b,#1f1f1f);
  color: var(--accent-soft);
  border: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,0.45);
  user-select: none;
}

#actionButton:active {
  transform: translateY(1px) scale(0.997);
}

#actionButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.strength-display {
  font-size: 1.25rem;
  color: var(--gold);
  margin-top: 8px;
  font-weight: 800;
}

/* GIF overlay и анимация */
.train-overlay {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
}

.train-overlay.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.train-animation {
  width: min(420px, 90%);
  border-radius: 12px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.7);
  display: block;
}

/* Utility */
.disabled-button {
  pointer-events: none;
  opacity: 0.7;
  filter: grayscale(0.2);
  transform: scale(0.97);
  transition: all 0.1s ease;
}

/* Footer */
footer {
  display: flex;
  justify-content: center;
  padding: 28px 0;
  background: transparent;
  z-index: 10;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* Адаптация под телефоны и планшеты */
@media (max-width: 900px) {
  .panel,
  .gym-panel {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 12px;
  }

  header {
    height: 76px;
    padding: 10px 12px;
  }

  header .avatar {
    width: 44px;
    height: 44px;
  }

  header p {
    font-size: 1.05rem;
  }

  .hero {
    height: auto;
  }

  .actions {
    align-items: stretch;
  }

  .action-btn,
  .action-btn.secondary {
    width: 100%;
  }

  .button,
  .button_f {
    padding: 10px 12px;
    font-size: 0.95rem;
  }

  #actionButton {
    width: 100%;
    padding: 14px;
    font-size: 1.05rem;
  }

  .rank-container {
    width: 94%;
    margin: 20px auto;
    padding: 14px;
  }
}

/* Очень маленькие экраны */
@media (max-width: 420px) {
  header {
    height: 64px;
    padding: 8px 10px;
  }

  header .avatar {
    width: 40px;
    height: 40px;
  }

  header p {
    font-size: 0.95rem;
  }

  .hero {
    height: auto;
  }

  .strength-display {
    font-size: 1rem;
  }

  .train-animation {
    width: 320px;
  }

  .rank-item {
    font-size: 0.95rem;
    padding: 10px;
  }
}

/* Landscape phones: компактный вид */
@media (orientation: landscape) and (max-width: 900px) {
  .panel,
  .gym-panel {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .hero {
    height: 180px;
  }
}

/* Focus styles for accessibility */
:focus {
  outline: 3px solid rgba(255,84,0,0.18);
  outline-offset: 3px;
}
