/* css/style.css */

/* ===== RESET & BASE ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a2e;
  --bg-card: #16162a;
  --bg-card-hover: #1e1e3a;
  --bg-input: #1a1a30;
  --text-primary: #ffffff;
  --text-secondary: #a0a0c0;
  --text-muted: #606080;
  --accent: #ff9800;
  --accent-hover: #ffa726;
  --accent-glow: rgba(255, 152, 0, 0.3);
  --success: #4caf50;
  --error: #f44336;
  --warning: #ff9800;
  --info: #2196f3;
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.6);
  --radius: 12px;
  --radius-lg: 20px;
  --radius-full: 50px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  --rarity-common: #9e9e9e;
  --rarity-uncommon: #4caf50;
  --rarity-rare: #2196f3;
  --rarity-epic: #9c27b0;
  --rarity-legendary: #ff9800;
  --rarity-mythic: #f44336;
  --rarity-divine: #ffeb3b;
  --rarity-cosmic: #e040fb;

  --sidebar-width: 240px;
  --brand-bar-height: 36px;
  --top-bar-height: 70px;
}

html, body {
  font-size: 16px;
  height: 100%;
  overflow: hidden; /* БЛОКИРУЕМ ПРОКРУТКУ ВСЕЙ СТРАНИЦЫ */
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* Фон */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(255, 152, 0, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(156, 39, 176, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(33, 150, 243, 0.03) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.hidden { display: none !important; }
.screen {
  height: 100vh;
  overflow: hidden;
}

/* ===== LOADER ===== */
.loader {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s, visibility 0.5s;
}
.loader.fade-out {
  opacity: 0;
  visibility: hidden;
}
.loader-content { text-align: center; }
.loader-mango {
  font-size: 100px;
  animation: loaderBounce 1s ease-in-out infinite;
  filter: drop-shadow(0 10px 30px rgba(255, 152, 0, 0.5));
}
.loader-text {
  font-size: 36px;
  font-weight: 800;
  margin-top: 16px;
  background: linear-gradient(135deg, var(--accent), #ff6d00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.loader-bar {
  width: 300px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  margin: 24px auto 0;
  overflow: hidden;
}
.loader-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff6d00);
  border-radius: 3px;
  animation: loaderFill 2s ease forwards;
}
@keyframes loaderBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-20px) scale(1.1); }
}
@keyframes loaderFill {
  from { width: 0; }
  to { width: 100%; }
}

/* ===== AUTH SCREEN ===== */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #1a1a2e 0%, var(--bg-primary) 70%);
  padding: 20px;
  overflow-y: auto;
}
.auth-container {
  width: 100%;
  max-width: 460px;
  padding: 50px 40px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  text-align: center;
  backdrop-filter: blur(20px);
}
.auth-logo {
  font-size: 80px;
  margin-bottom: 12px;
  animation: loaderBounce 2s ease-in-out infinite;
  filter: drop-shadow(0 10px 30px rgba(255, 152, 0, 0.4));
}
.auth-title {
  font-size: 40px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), #ff6d00, #ffab40);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -1px;
}
.auth-subtitle {
  color: var(--text-secondary);
  margin: 12px 0 30px;
  font-size: 15px;
}
.auth-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 4px;
}
.auth-tab {
  flex: 1;
  padding: 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
  font-family: inherit;
}
.auth-tab.active {
  background: var(--accent);
  color: var(--bg-primary);
}
.input-group {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 16px;
  margin-bottom: 14px;
  transition: var(--transition);
}
.input-group:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-group .material-icons-round {
  color: var(--text-muted);
  font-size: 20px;
  margin-right: 12px;
}
.input-group input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 16px 0;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.input-group input::placeholder { color: var(--text-muted); }

.auth-error {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  color: var(--error);
  padding: 12px;
  border-radius: var(--radius);
  margin-top: 14px;
  font-size: 13px;
}

.auth-footer {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.auth-footer-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.auth-footer-text strong {
  color: var(--text-secondary);
}
.auth-footer-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.auth-footer-links span {
  color: var(--text-muted);
  font-size: 11px;
  opacity: 0.5;
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #ff6d00);
  color: #000;
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:active { transform: translateY(0) scale(0.98); }
.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-card-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #45a049; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #d32f2f; }
.btn-full { width: 100%; padding: 14px 24px; font-size: 15px; }
.btn-sm {
  padding: 8px 16px;
  font-size: 12px;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}
.btn-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  transform: translateY(-2px);
}

/* ===== ВЕРХНИЙ ФУТЕР (БРЕНДИНГ) ===== */
.brand-bar {
  grid-area: brand;
  height: var(--brand-bar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: linear-gradient(90deg, var(--bg-primary), var(--bg-secondary), var(--bg-primary));
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  position: relative;
  z-index: 110;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  font-size: 18px;
  filter: drop-shadow(0 0 6px rgba(255, 152, 0, 0.4));
}

.brand-title {
  font-size: 12px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #ff6d00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.brand-copyright {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.2;
}

.brand-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.footer-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--accent);
  background: rgba(255, 152, 0, 0.08);
}

.footer-separator {
  color: var(--text-muted);
  font-size: 10px;
  opacity: 0.4;
}

/* ===== ГЛАВНАЯ СТРУКТУРА ===== */
.game-screen {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--brand-bar-height) var(--top-bar-height) 1fr;
  grid-template-areas:
    "brand brand"
    "topbar topbar"
    "sidebar main";
  height: 100vh;
  overflow: hidden;
}

/* ===== TOP BAR ===== */
.top-bar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  backdrop-filter: blur(20px);
}
.top-bar-left, .top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-avatar {
  font-size: 32px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 12px;
}
.user-name {
  font-weight: 700;
  font-size: 15px;
  display: block;
}
.user-level {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}
.score-display {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-card));
  padding: 10px 24px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.score-icon { font-size: 24px; }
.score-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px var(--accent-glow);
}
.global-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-weight: 600;
}
.global-counter .material-icons-round { font-size: 18px; color: var(--info); }

/* ===== SIDEBAR ===== */
.sidebar {
  grid-area: sidebar;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-section-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 16px 8px;
  font-weight: 700;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 12px 16px;
  border-radius: var(--radius);
  transition: var(--transition);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  width: 100%;
  position: relative;
}
.nav-btn .material-icons-round { font-size: 22px; }
.nav-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}
.nav-btn.active {
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.15), rgba(255, 109, 0, 0.05));
  color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-btn .nav-text { flex: 1; }
.notification-dot::after {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  background: var(--error);
  border-radius: 50%;
  display: none;
  animation: pulse 2s infinite;
}
.notification-dot.has-notification::after { display: block; }

/* ===== MAIN AREA ===== */
.main-area {
  grid-area: main;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ===== STATS BAR ===== */
.stats-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}
.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.stat-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 600;
}
.stat-box-header .label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stat-box-header .value {
  color: var(--text-primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat-bar-container {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
}
.stat-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.energy-fill {
  background: linear-gradient(90deg, #ff9800, #ffeb3b);
  box-shadow: 0 0 10px rgba(255, 152, 0, 0.5);
}
.level-fill {
  background: linear-gradient(90deg, #9c27b0, #e040fb);
  box-shadow: 0 0 10px rgba(156, 39, 176, 0.4);
}

/* ===== GAME AREA ===== */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 40px;
  position: relative;
  overflow: hidden;
}
.mango-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 360px;
  height: 360px;
}
.mango-glow {
  position: absolute;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  filter: blur(40px);
  animation: glowPulse 3s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 0.8; }
}
.mango-button {
  width: 240px;
  height: 240px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: transform 0.1s ease;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  background: none;
  border: none;
}
.mango-button:hover { transform: scale(1.05); }
.mango-button:active { transform: scale(0.92); }
.mango-button.clicked {
  animation: mangoClick 0.15s ease;
}
@keyframes mangoClick {
  0% { transform: scale(1); }
  50% { transform: scale(0.85); }
  100% { transform: scale(1); }
}
.mango-emoji {
  font-size: 160px;
  filter: drop-shadow(0 15px 40px rgba(255, 152, 0, 0.4));
  transition: filter 0.3s;
}
.mango-button:hover .mango-emoji {
  filter: drop-shadow(0 15px 50px rgba(255, 152, 0, 0.6));
}

.click-particles {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}
.click-particle {
  position: absolute;
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  pointer-events: none;
  animation: particleFloat 1s ease-out forwards;
  text-shadow: 0 0 10px var(--accent-glow);
  z-index: 20;
  white-space: nowrap;
}
.click-particle.crit {
  font-size: 32px;
  color: #ff1744;
  text-shadow: 0 0 25px rgba(255, 23, 68, 0.8);
}
@keyframes particleFloat {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-150px) scale(0.5);
  }
}

.click-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 24px;
  margin-top: 20px;
  font-size: 15px;
  color: var(--text-secondary);
  flex-wrap: wrap;
  justify-content: center;
}
.click-info span {
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  font-weight: 600;
}

/* ===== ПАНЕЛИ ===== */
.panel {
  position: fixed;
  top: calc(var(--brand-bar-height) + var(--top-bar-height));
  left: var(--sidebar-width);
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 50;
  display: flex;
  flex-direction: column;
  animation: panelFadeIn 0.3s ease;
  overflow: hidden;
}
@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-header h2 {
  font-size: 24px;
  font-weight: 800;
}
.btn-close-panel {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.btn-close-panel:hover {
  background: var(--error);
  color: #fff;
  transform: rotate(90deg);
}
.panel-tabs {
  display: flex;
  gap: 8px;
  padding: 16px 32px;
  overflow-x: auto;
  overflow-y: hidden;
  flex-shrink: 0;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}
.panel-tab {
  padding: 10px 20px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  transition: var(--transition);
  white-space: nowrap;
  font-family: inherit;
}
.panel-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.panel-tab.active {
  background: var(--accent);
  color: var(--bg-primary);
  border-color: var(--accent);
}
.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
}

/* ===== ITEM CARDS ===== */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}
.item-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-light);
  box-shadow: var(--shadow);
  background: var(--bg-card-hover);
}
.item-card.owned {
  border-color: var(--success);
  background: rgba(76, 175, 80, 0.05);
}
.item-card.equipped {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
}
.item-card-rarity {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}
.item-card-emoji {
  font-size: 56px;
  text-align: center;
  margin: 12px 0;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}
.item-card-name {
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  line-height: 1.2;
}
.item-card-rarity-text {
  font-size: 10px;
  text-align: center;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.item-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 10px;
  line-height: 1.4;
  min-height: 30px;
}
.item-card-price {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  padding: 8px;
  background: rgba(255, 152, 0, 0.08);
  border-radius: 8px;
}
.item-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 6px;
  font-weight: 700;
  z-index: 2;
}
.badge-owned { background: var(--success); color: #fff; }
.badge-equipped { background: var(--accent); color: #000; }
.item-card-qty {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-tertiary);
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--text-secondary);
  z-index: 2;
}

/* ===== RARITY ===== */
.rarity-common .item-card-rarity { background: var(--rarity-common); }
.rarity-common .item-card-rarity-text { color: var(--rarity-common); }
.rarity-uncommon .item-card-rarity { background: var(--rarity-uncommon); }
.rarity-uncommon .item-card-rarity-text { color: var(--rarity-uncommon); }
.rarity-rare .item-card-rarity { background: var(--rarity-rare); }
.rarity-rare .item-card-rarity-text { color: var(--rarity-rare); }
.rarity-epic .item-card-rarity { background: var(--rarity-epic); }
.rarity-epic .item-card-rarity-text { color: var(--rarity-epic); }
.rarity-legendary .item-card-rarity {
  background: linear-gradient(90deg, #ff9800, #ffeb3b, #ff9800);
  background-size: 200% 100%;
  animation: shimmer 2s linear infinite;
}
.rarity-legendary .item-card-rarity-text { color: var(--rarity-legendary); }
.rarity-mythic .item-card-rarity {
  background: linear-gradient(90deg, #f44336, #ff1744, #f44336);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}
.rarity-mythic .item-card-rarity-text { color: var(--rarity-mythic); }
.rarity-divine .item-card-rarity {
  background: linear-gradient(90deg, #ffeb3b, #fff176, #ffeb3b);
  background-size: 200% 100%;
  animation: shimmer 1s linear infinite;
}
.rarity-divine .item-card-rarity-text { color: var(--rarity-divine); }
.rarity-cosmic .item-card-rarity {
  background: linear-gradient(90deg, #e040fb, #7c4dff, #00bcd4, #e040fb);
  background-size: 300% 100%;
  animation: shimmer 1s linear infinite;
}
.rarity-cosmic .item-card-rarity-text { color: var(--rarity-cosmic); }
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.badge-3d-indicator {
  display: inline-block;
  font-size: 10px;
  background: linear-gradient(135deg, #2196f3, #00bcd4);
  color: #fff;
  padding: 3px 7px;
  border-radius: 5px;
  font-weight: 700;
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 2;
}

/* ===== CRAFTING ===== */
.recipe-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: var(--transition);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
}
.recipe-card:hover { border-color: var(--border-light); }
.recipe-left { display: flex; flex-direction: column; gap: 12px; }
.recipe-header {
  display: flex;
  align-items: center;
  gap: 14px;
}
.recipe-result-emoji {
  font-size: 48px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}
.recipe-result-info h4 { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.recipe-ingredients {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.recipe-ingredient {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-tertiary);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}
.recipe-ingredient.has { border: 1px solid var(--success); color: var(--success); }
.recipe-ingredient.missing { border: 1px solid var(--error); color: var(--error); }
.recipe-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}
.recipe-cost {
  font-size: 14px;
  color: var(--accent);
  font-weight: 700;
}

/* ===== TRADING ===== */
.trade-listing {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transition: var(--transition);
}
.trade-listing:hover {
  border-color: var(--border-light);
  background: var(--bg-card-hover);
}
.trade-item-info {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
}
.trade-item-emoji {
  font-size: 44px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}
.trade-item-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.trade-item-seller { font-size: 12px; color: var(--text-muted); }
.trade-item-price {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
}
.trade-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

/* ===== REWARDS ===== */
.reward-section { margin-bottom: 32px; }
.reward-section h3 {
  font-size: 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}
.daily-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}
.daily-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  transition: var(--transition);
}
.daily-box.claimed {
  background: rgba(76, 175, 80, 0.1);
  border-color: var(--success);
}
.daily-box.available {
  border-color: var(--accent);
  box-shadow: 0 0 15px var(--accent-glow);
  cursor: pointer;
  animation: pulse 2s infinite;
}
.daily-box.available:hover {
  transform: translateY(-4px) scale(1.02);
}
.daily-box.locked { opacity: 0.5; }
.daily-box-day {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
}
.daily-box-emoji {
  font-size: 32px;
  margin: 8px 0;
}
.daily-box-reward {
  font-size: 12px;
  color: var(--accent);
  font-weight: 700;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 15px var(--accent-glow); }
  50% { box-shadow: 0 0 30px var(--accent-glow); }
}

.weekly-drop-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
}
.weekly-drop-timer {
  font-size: 36px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  margin: 16px 0;
  text-shadow: 0 0 20px var(--accent-glow);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease;
  padding: 20px;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}
@keyframes modalIn {
  from { transform: scale(0.9) translateY(20px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.btn-close-modal {
  width: 32px;
  height: 32px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-close-modal:hover { background: var(--error); color: #fff; }
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-footer {
  padding: 18px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ===== NOTIFICATIONS ===== */
.notifications {
  position: fixed;
  top: calc(var(--brand-bar-height) + 20px);
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  pointer-events: none;
}
.notification {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  animation: notifIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  font-size: 14px;
  pointer-events: auto;
  backdrop-filter: blur(20px);
}
.notification.success { border-left: 4px solid var(--success); }
.notification.error { border-left: 4px solid var(--error); }
.notification.info { border-left: 4px solid var(--info); }
.notification.warning { border-left: 4px solid var(--warning); }
@keyframes notifIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.notification.fade-out {
  animation: notifOut 0.3s ease forwards;
}
@keyframes notifOut {
  to { transform: translateX(120%); opacity: 0; }
}

/* ===== DROP REVEAL ===== */
.drop-reveal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(15px);
}
.drop-reveal-content {
  text-align: center;
  position: relative;
  padding: 40px;
}
.drop-reveal-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(80px);
  animation: dropGlow 2s ease-in-out infinite;
}
@keyframes dropGlow {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.3); }
}
.drop-reveal-emoji {
  font-size: 160px;
  animation: dropReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 20px 60px rgba(255, 152, 0, 0.5));
}
@keyframes dropReveal {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.drop-reveal-name {
  font-size: 32px;
  font-weight: 800;
  margin-top: 20px;
  position: relative;
  z-index: 1;
}
.drop-reveal-rarity {
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin: 12px 0 30px;
  position: relative;
  z-index: 1;
}
.drop-reveal-content .btn {
  position: relative;
  z-index: 2;
  font-size: 16px;
  padding: 16px 40px;
}

/* ===== SELL FORM ===== */
.sell-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 500px;
}
.sell-form label {
  font-size: 14px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}
.sell-form select, .sell-form input[type="number"] {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 16px;
  outline: none;
  transition: var(--transition);
}
.sell-form select:focus, .sell-form input[type="number"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.sell-form select option { background: var(--bg-secondary); }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state-emoji {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state-text { font-size: 16px; }

/* ===== 3D MANGO ===== */
.mango-3d {
  perspective: 800px;
}
.mango-3d .mango-emoji {
  animation: rotate3d 6s linear infinite;
}
@keyframes rotate3d {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-7px); }
  80% { transform: translateX(7px); }
}

/* ===== POLICY MODAL ===== */
.policy-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 600;
  backdrop-filter: blur(10px);
  animation: fadeIn 0.2s ease;
  padding: 20px;
}

.policy-modal {
  width: 100%;
  max-width: 700px;
  max-height: 85vh;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.policy-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  flex-shrink: 0;
}

.policy-modal-header h2 {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), #ff6d00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.policy-modal-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
  line-height: 1.7;
  color: var(--text-secondary);
  font-size: 14px;
}

.policy-modal-body h3 {
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.policy-modal-body h3:first-child {
  margin-top: 0;
}

.policy-modal-body p {
  margin-bottom: 12px;
}

.policy-modal-body ul {
  padding-left: 24px;
  margin-bottom: 16px;
}

.policy-modal-body li {
  margin-bottom: 8px;
}

.policy-modal-body strong {
  color: var(--text-primary);
  font-weight: 700;
}

.policy-modal-body .policy-meta {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: 13px;
}

.policy-modal-body .policy-meta strong {
  color: var(--accent);
}

.policy-modal-footer {
  padding: 18px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  background: var(--bg-tertiary);
}

/* ===== МОБИЛЬНАЯ ВЕРСИЯ ===== */
@media (max-width: 900px) {
  :root {
    --sidebar-width: 0;
    --brand-bar-height: 32px;
    --top-bar-height: 56px;
  }

  .game-screen {
    grid-template-columns: 1fr;
    grid-template-rows: var(--brand-bar-height) var(--top-bar-height) 1fr 64px;
    grid-template-areas:
      "brand"
      "topbar"
      "main"
      "sidebar";
  }

  .brand-bar {
    padding: 0 10px;
    font-size: 10px;
  }

  .brand-title { font-size: 11px; }
  .brand-copyright { font-size: 9px; }

  .brand-right {
    gap: 2px;
  }

  .footer-link {
    font-size: 10px;
    padding: 3px 6px;
  }

  .footer-link:not(#btn-trademark)::after {
    /* На мобильных скрываем длинные тексты, оставляем короткие */
  }

  /* На очень узких экранах меняем тексты ссылок */
  #btn-privacy {
    font-size: 0;
  }
  #btn-privacy::before {
    content: 'Конф.';
    font-size: 10px;
  }
  #btn-terms {
    font-size: 0;
  }
  #btn-terms::before {
    content: 'Условия';
    font-size: 10px;
  }

  .top-bar {
    padding: 0 10px;
  }

  .user-name { display: none; }
  .user-avatar { width: 36px; height: 36px; font-size: 28px; }

  .score-display {
    padding: 8px 14px;
  }
  .score-value { font-size: 15px; }

  .global-counter { display: none; }

  .sidebar {
    border-right: none;
    border-top: 1px solid var(--border);
    flex-direction: row;
    padding: 6px;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    justify-content: space-around;
  }

  .sidebar-section-title { display: none; }

  .nav-btn {
    flex-direction: column;
    padding: 4px;
    font-size: 9px;
    gap: 2px;
    flex: 1;
    min-width: 50px;
    text-align: center;
  }

  .nav-btn .material-icons-round { font-size: 20px; }
  .nav-btn.active {
    box-shadow: none;
    background: rgba(255, 152, 0, 0.15);
  }

  .stats-bar {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px;
  }

  .stat-box {
    padding: 8px 12px;
  }

  .stat-box-header {
    font-size: 11px;
  }

  .mango-container {
    width: 260px;
    height: 260px;
  }
  .mango-button {
    width: 180px;
    height: 180px;
  }
  .mango-emoji {
    font-size: 120px;
  }

  .game-area {
    padding: 10px 20px;
  }

  .click-info {
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
    font-size: 12px;
  }
  .click-info span {
    padding: 6px 12px;
  }

  .panel {
    top: calc(var(--brand-bar-height) + var(--top-bar-height));
    left: 0;
    bottom: 64px;
  }

  .panel-header {
    padding: 14px 16px;
  }
  .panel-header h2 { font-size: 18px; }

  .panel-tabs {
    padding: 10px 16px;
  }
  .panel-tab {
    padding: 8px 14px;
    font-size: 12px;
  }

  .panel-content {
    padding: 16px;
  }

  .item-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .item-card { padding: 12px; }
  .item-card-emoji { font-size: 40px; }

  .daily-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
  }

  .recipe-card {
    grid-template-columns: 1fr;
    padding: 14px;
  }
  .recipe-right { align-items: stretch; }

  .notifications {
    top: calc(var(--brand-bar-height) + var(--top-bar-height) + 10px);
    right: 8px;
    left: 8px;
    max-width: none;
  }

  .drop-reveal-emoji { font-size: 120px; }
  .drop-reveal-name { font-size: 24px; }

  .policy-modal-body {
    padding: 20px;
    font-size: 13px;
  }
  .policy-modal-body h3 { font-size: 15px; }
}

@media (max-width: 480px) {
  .brand-right {
    display: none; /* Скрываем ссылки на очень маленьких экранах */
  }

  .brand-bar {
    justify-content: center;
  }

  .item-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* На малых экранах добавляем меню для ссылок политик */
@media (max-width: 480px) {
  .brand-left {
    flex: 1;
    justify-content: center;
  }
}