/* Осенняя тема для игры 2048 - Версия 69 */

/* ПРИНУДИТЕЛЬНЫЕ СТИЛИ ДЛЯ ПК ВЕРСИИ */
@media (min-width: 769px) {
  #board {
    width: 520px !important;
    max-width: 520px !important;
    min-height: 480px !important;
    height: 480px !important;
  }
  
  #board .grid-container {
    width: 100% !important;
    height: 100% !important;
    min-width: 480px !important;
    min-height: 480px !important;
  }
  
  #board .cell {
    min-width: 55px !important;
    min-height: 55px !important;
  }
  
  .tile {
    font-size: clamp(12px, 3vw, 24px) !important;
  }
}

:root {
  --autumn-orange: #d2691e;
  --autumn-red: #8b4513;
  --autumn-yellow: #daa520;
  --autumn-brown: #654321;
  --autumn-gold: #ffd700;
  --autumn-leaves: #228b22;
  --text-dark: #2c1810;
  --text-light: #f5f5dc;
  --shadow-color: rgba(139, 69, 19, 0.3);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
  touch-action: none;
  -webkit-overflow-scrolling: touch;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, 
    #8b4513 0%, 
    #daa520 25%, 
    #d2691e 50%, 
    #ffd700 75%, 
    #228b22 100%);
  background-attachment: fixed;
  min-height: 100vh;
  color: var(--text-dark);
  overflow-x: hidden;
  position: fixed;
  width: 100%;
}

/* Осенние листья на фоне */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(255, 215, 0, 0.1) 2px, transparent 2px),
    radial-gradient(circle at 80% 70%, rgba(210, 105, 30, 0.1) 3px, transparent 3px),
    radial-gradient(circle at 40% 80%, rgba(139, 69, 19, 0.1) 2px, transparent 2px),
    radial-gradient(circle at 90% 20%, rgba(34, 139, 34, 0.1) 2px, transparent 2px);
  background-size: 100px 100px, 150px 150px, 80px 80px, 120px 120px;
  pointer-events: none;
  z-index: -1;
}

.wrap {
  max-width: 800px;
  max-height: 100vh;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  justify-content: flex-start;
  align-items: center;
  padding-bottom: 80px; /* Место для баннера */
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  background: #FDF8ED;
  padding: 6px;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(139, 69, 19, 0.15);
  border: 2px solid rgba(249, 200, 80, 0.3);
  flex-shrink: 0;
  gap: 10px;
  width: 100%;
  max-width: 100%;
}

.game-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.logo {
  width: 30px;
  height: 30px;
  background: linear-gradient(45deg, var(--autumn-orange), var(--autumn-gold));
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: white;
  box-shadow: 0 4px 15px var(--shadow-color);
  flex-shrink: 0;
  min-width: 30px;
  min-height: 30px;
}

.title h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(45deg, #8b4513, #daa520);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  white-space: nowrap;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.title p {
  margin: 4px 0 0 0;
  font-size: 12px;
  color: #2C2C2C;
  opacity: 0.9;
  line-height: 1.3;
  white-space: normal;
  font-weight: 500;
}

.controls-hint {
  margin-top: 4px;
  padding: 3px 8px;
  background: linear-gradient(135deg, rgba(249, 200, 80, 0.15), rgba(230, 138, 0, 0.1));
  border-radius: 6px;
  border: 1px solid rgba(249, 200, 80, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}

.controls-hint p {
  margin: 0;
  font-size: 10px;
  color: #2C2C2C;
  opacity: 0.8;
  font-weight: 500;
}

.game-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  min-width: 120px;
}

.game-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.game-stats-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  flex-shrink: 0;
  min-width: 120px;
}

.stats-row {
  display: flex;
  flex-direction: row;
  gap: 4px;
  align-items: center;
}

.buttons-row {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
}

.difficulty-section {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}

.difficulty-info {
  display: none;
}

.difficulty-label {
  font-size: 10px;
  font-weight: 600;
  color: #2C2C2C;
  text-align: center;
  white-space: nowrap;
  opacity: 0.8;
}



.difficulty-select {
  padding: 6px 10px;
  border: 2px solid rgba(249, 200, 80, 0.4);
  border-radius: 8px;
  background: #FDF8ED;
  color: #2C2C2C;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  width: 100%;
  max-width: 80px;
  text-align: center;
}

.difficulty-select:hover {
  border-color: #E68A00;
  box-shadow: 0 2px 8px rgba(139, 69, 19, 0.2);
  background: rgba(249, 200, 80, 0.1);
}

.difficulty-select:focus {
  outline: none;
  border-color: #E68A00;
  box-shadow: 0 0 0 3px rgba(249, 200, 80, 0.3);
}

.badge {
  background: linear-gradient(135deg, #F9C850, #E68A00);
  padding: 4px 8px;
  border-radius: 6px;
  text-align: center;
  min-width: 60px;
  box-shadow: 0 4px 15px rgba(139, 69, 19, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.badge .label {
  display: block;
  font-size: 8px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 1px;
}

.badge .value {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: white;
  margin-top: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.btn {
  background: linear-gradient(135deg, #F9C850, #E68A00);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px var(--shadow-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  touch-action: manipulation;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.btn.sticker-btn {
  background: linear-gradient(135deg, #ff6b6b, #ff8e53);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 10px;
  margin-bottom: 4px;
}
.btn.sticker-btn:hover {
  background: linear-gradient(135deg, #ff5252, #ff7043);
  box-shadow: 0 6px 20px rgba(255, 107, 107, 0.3);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 69, 19, 0.3);
  background: linear-gradient(135deg, #E68A00, #F9C850);
  border-color: rgba(255, 255, 255, 0.4);
}

.btn:active {
  transform: translateY(0);
}

.btn-ghost {
  background: transparent;
  border: 2px solid var(--autumn-orange);
  color: var(--autumn-orange);
}

.btn-ghost:hover {
  background: var(--autumn-orange);
  color: white;
}

.board {
  background: linear-gradient(135deg, 
    rgba(139, 69, 19, 0.1) 0%, 
    rgba(210, 105, 30, 0.1) 25%, 
    rgba(255, 215, 0, 0.1) 50%, 
    rgba(34, 139, 34, 0.1) 100%);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 8px 32px var(--shadow-color);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(210, 105, 30, 0.3);
  margin-bottom: 8px;
  width: 100%;
  max-width: 380px;
  margin-left: auto;
  margin-right: auto;
  position: relative;
  overflow: hidden;
  flex: 1;
  min-height: 320px;
  max-height: 380px;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.grid-container {
  width: 100% !important;
  height: 100% !important;
  display: grid !important;
  gap: 2px;
  touch-action: none;
  padding: 4px;
  box-sizing: border-box;
  min-width: 280px !important;
  min-height: 280px !important;
  max-width: 100% !important;
  max-height: 100% !important;
}

.cell {
  background: rgba(210, 105, 30, 0.2);
  border: 1px solid rgba(210, 105, 30, 0.4);
  border-radius: 4px;
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden;
  min-width: 25px !important;
  min-height: 25px !important;
}

.tile {
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  background: linear-gradient(135deg, 
    rgba(255, 140, 0, 0.9) 0%, 
    rgba(255, 165, 0, 0.9) 100%);
  border: 1px solid rgba(210, 105, 30, 0.6);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: clamp(8px, 2vw, 18px);
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  box-shadow: 0 4px 12px rgba(210, 105, 30, 0.3);
  transition: all 0.15s ease;
  touch-action: none;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  box-sizing: border-box;
  max-width: calc(100% - 4px);
  max-height: calc(100% - 4px);
}



.tile[data-v="3"] { background: linear-gradient(45deg, #8b4513, #daa520); }
.tile[data-v="6"] { background: linear-gradient(45deg, #daa520, #ffd700); }
.tile[data-v="12"] { background: linear-gradient(45deg, #ffd700, #ff8c00); }
.tile[data-v="24"] { background: linear-gradient(45deg, #ff8c00, #ff6347); }
.tile[data-v="48"] { background: linear-gradient(45deg, #ff6347, #dc143c); }
.tile[data-v="96"] { background: linear-gradient(45deg, #dc143c, #8b0000); }
.tile[data-v="192"] { background: linear-gradient(45deg, #8b0000, #4b0082); }
.tile[data-v="384"] { background: linear-gradient(45deg, #4b0082, #9400d3); }
.tile[data-v="768"] { background: linear-gradient(45deg, #9400d3, #ff1493); }
.tile[data-v="1536"] { background: linear-gradient(45deg, #ff1493, #00ced1); }
.tile[data-v="3072"] { background: linear-gradient(45deg, #00ced1, #00ff00); }

.controls-hint {
  text-align: center;
  margin: 6px 0 10px 0;
  padding: 8px 12px;
  background: rgba(249, 200, 80, 0.1);
  border-radius: 10px;
  font-size: 12px;
  color: #2C2C2C;
  opacity: 0.8;
  border: 1px solid rgba(249, 200, 80, 0.2);
  flex-shrink: 0;
  width: 100%;
  max-width: 500px;
}

/* Стили для вкладки приложения */
.app-tab-btn {
  background: linear-gradient(135deg, #F9C850, #E68A00);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 4px 8px;
  color: white;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(139, 69, 19, 0.2);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  min-width: 60px;
  justify-content: center;
  white-space: nowrap;
}

.app-tab-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 69, 19, 0.3);
  background: linear-gradient(135deg, #E68A00, #F9C850);
  border-color: rgba(255, 255, 255, 0.5);
}

.app-tab-btn:active {
  transform: translateY(0);
}

.app-tab-icon {
  font-size: 16px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.app-tab-text {
  white-space: nowrap;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.overlay.hidden {
  display: none;
}

.dialog {
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  border-radius: 15px;
  text-align: center;
  max-width: 90vw;
  box-shadow: 0 20px 60px var(--shadow-color);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dialog h2 {
  margin: 0 0 15px 0;
  color: var(--autumn-brown);
  font-size: 20px;
}

.dialog p {
  margin: 0 0 20px 0;
  color: var(--autumn-red);
  font-size: 14px;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ПК версия */
@media (min-width: 769px) {
  .wrap {
    max-width: 800px !important;
    padding: 20px !important;
    justify-content: flex-start !important;
    padding-bottom: 80px !important;
  }
  
  .topbar {
    flex-direction: row !important;
    gap: 10px !important;
    padding: 6px !important;
    max-width: 100% !important;
    margin-bottom: 6px !important;
  }
  
  .game-info {
    flex-direction: row !important;
    gap: 20px !important;
  }
  
  .game-controls {
    flex-direction: row !important;
    gap: 20px !important;
  }
  
  .game-stats {
    flex-direction: row !important;
    gap: 20px !important;
  }
  
  .board {
    max-width: 400px !important;
    min-height: 350px !important;
    padding: 12px !important;
    border-radius: 16px !important;
  }
  
  .board.size-5 {
    max-width: 500px !important;
    min-height: 400px !important;
  }
  
  .board.size-10 {
    max-width: 600px !important;
    min-height: 450px !important;
  }
  
  .grid-container {
    gap: 12px !important;
  }
  
  .board.size-5 .grid-container {
    gap: 10px !important;
  }
  
  .board.size-10 .grid-container {
    gap: 6px !important;
  }
  
  .tile {
    font-size: 28px !important;
  }
  
  .board.size-5 .tile {
    font-size: 24px !important;
  }
  
  .board.size-10 .tile {
    font-size: 18px !important;
  }
  
  .logo {
    width: 30px !important;
    height: 30px !important;
    font-size: 16px !important;
  }
  
  .title h1 {
    font-size: 20px !important;
    background: linear-gradient(45deg, #8b4513, #daa520) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
  }
  
  .title p {
    font-size: 12px !important;
  }
  
  .badge {
    min-width: 60px !important;
    padding: 4px 8px !important;
  }
  
  .badge .label {
    font-size: 8px !important;
  }
  
  .badge .value {
    font-size: 14px !important;
  }
  
  .btn {
    padding: 4px 8px !important;
    font-size: 10px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  
  .game-logo {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  
  .game-stats-right {
    min-width: 140px !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: flex-end !important;
  }
}

/* Мобильные стили */
@media (max-width: 768px) {
  .wrap {
    padding: 6px;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }
  
  .topbar {
    flex-direction: row;
    gap: 15px;
    text-align: left;
    padding: 15px;
    margin-bottom: 10px;
    width: 100%;
    max-width: 95vw;
    flex-shrink: 0;
    justify-content: space-between;
    align-items: flex-start;
  }
  
  .game-info {
    flex-direction: row;
    gap: 8px;
    flex: 1;
  }
  
  .game-controls {
    flex-direction: column;
    gap: 8px;
    align-items: center;
  }
  
  .game-stats {
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
  }
  
  .title h1 {
    font-size: 20px;
    margin: 0;
  }
  
  .title p {
    font-size: 12px;
    margin: 2px 0 0 0;
    white-space: normal;
  }
  
  .scores {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3px;
  }
  
  .difficulty-selector {
    order: -1;
    margin-bottom: 0;
    font-size: 10px;
  }
  
  .difficulty-select {
    font-size: 10px;
    padding: 2px 4px;
  }
  
  .badge {
    padding: 4px 6px;
    font-size: 10px;
    min-width: 50px;
  }
  
  .badge .label {
    font-size: 8px;
  }
  
  .badge .value {
    font-size: 12px;
  }
  
  .btn {
    padding: 6px 12px;
    font-size: 10px;
  }
  
  .board {
    padding: 6px;
    margin-bottom: 6px;
    min-height: 180px;
    max-height: 50vh;
    max-width: 85vw;
    width: 85vw;
    height: 50vh;
    margin: 0 auto;
    flex: 1;
  }
  
  .grid-container {
    gap: 3px;
    padding: 4px;
  }
  
  .board.size-5 {
    max-width: 90vw;
    min-height: 280px;
  }
  
  .board.size-10 {
    max-width: 95vw;
    min-height: 350px;
  }
  
  .board.size-5 .grid-container {
    gap: 1px;
  }
  
  .board.size-10 .grid-container {
    gap: 1px;
  }
  
  .cell {
    border-radius: 4px;
    border-width: 1px;
  }
  
  .tile {
    font-size: 14px;
    border-radius: 3px;
    border-width: 1px;
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    box-sizing: border-box;
    max-width: calc(100% - 6px);
    max-height: calc(100% - 6px);
  }
  
  .board.size-5 .tile {
    font-size: 12px;
  }
  
  .board.size-10 .tile {
    font-size: 10px;
  }
  
  .dialog {
    margin: 5px;
    padding: 10px;
  }
  
  .dialog-actions {
    flex-direction: column;
  }
  
  .hint {
    font-size: 8px;
    padding: 2px 0;
    margin: 0;
    text-align: center;
    width: 100%;
    flex-shrink: 0;
    margin: 0;
    text-align: center;
    width: 100%;
  }
  
  .logo {
    width: 35px;
    height: 35px;
    font-size: 18px;
    min-width: 35px;
    min-height: 35px;
  }
  

}

/* Очень маленькие экраны */
@media (max-width: 480px) {
  .wrap {
    padding: 1px;
    justify-content: center;
    align-items: center;
  }
  
  .topbar {
    padding: 5px;
    gap: 3px;
    width: 100%;
    max-width: 98vw;
  }
  
  .title h1 {
    font-size: 16px;
  }
  
  .title p {
    font-size: 9px;
  }
  
  .scores {
    gap: 2px;
  }
  
  .badge {
    padding: 8px 10px;
    min-width: 60px;
  }
  
  .badge .label {
    font-size: 8px;
  }
  
  .badge .value {
    font-size: 14px;
  }
  
  .btn {
    padding: 4px 8px;
    font-size: 9px;
  }
  
  .board {
    padding: 3px;
    max-width: 95vw;
    width: 95vw;
    min-height: 160px;
    max-height: 40vh;
    height: 40vh;
    margin: 0 auto;
  }
  
  .grid-container {
    top: 3px;
    left: 3px;
    right: 3px;
    bottom: 3px;
    gap: 2px;
    height: calc(100% - 6px);
  }
  
  .tile {
    font-size: clamp(5px, 1.5vw, 12px);
  }
  
  .logo {
    width: 25px;
    height: 25px;
    font-size: 14px;
    min-width: 25px;
    min-height: 25px;
  }
  
  .hint {
    font-size: 7px;
    text-align: center;
    width: 100%;
  }
  
  /* Мобильные стили для вкладки приложения */
  .app-tab-btn {
    padding: 8px 12px;
    font-size: 11px;
    border-radius: 14px;
    margin-left: 0;
    gap: 4px;
    min-width: 80px;
  }
  
  .app-tab-icon {
    font-size: 12px;
  }
  
  .difficulty-info {
    padding: 4px 8px;
    gap: 1px;
  }
  
  .difficulty-label {
    font-size: 9px;
  }
  

  
  .difficulty-select {
    padding: 4px 8px;
    font-size: 9px;
    max-width: 60px;
  }
  
  .controls-hint {
    font-size: 10px;
    padding: 6px 8px;
    margin: 6px 0 8px 0;
    max-width: 95vw;
  }
  

}







/* Анимации */
@keyframes tileAppear {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes tileMerge {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.tile.merging {
  animation: tileMerge 0.3s ease;
}

