/*
Place here your CSS
*/

:root {
  /* Базовые размеры */
  --size: 16;
  --size_sq: calc(min(88vw, 75vh, 32rem, max(100vh, 100vw) * 0.6) + 1px);
}
/*
@media (orientation: portrait) and (min-aspect-ratio: 7/11) {
  :root {
    --size_sq: calc(min(80vw, 75vh, 32rem, max(100vh, 100vw) * 0.6) + 1px);
  }
}
*/

@media (orientation: landscape) {
  :root {
    --size_sq: calc(min(45vw, 80vh, 32rem, max(100vh, 100vw) * 0.6) + 1px);
  }
}

@media (orientation: landscape) and (min-aspect-ratio: 16/9) {
  :root {
    --size_sq: calc(min(45vw, 80vh, max(100vh, 100vw) * 0.6) + 1px);
  }
}

:root { 
  --size_px: calc((var(--size_sq) - var(--size) * 1px - 1px) / var(--size));
  --size_nav_bar: var(--size_sq);  /* По умолчанию равен размеру квадрата */
  --size_nav_btn: calc(var(--size_nav_bar) / 6);  /* Базовый размер для навигационных кнопок */
  --font-size-nav: calc(var(--size_nav_btn) / 5);  /* Новая переменная для размера шрифта */
  --font-family-main: Roboto;
  
  /* Цвета */
  --color-primary: white;
  --color-secondary: silver;
  --color-accent: gold;
  --color-bg: #404040;
  --color-bg-transparent: rgba(64, 64, 64, 0.9);
}

@media (orientation: landscape) and (min-aspect-ratio: 16/10) {
  :root {
    --size_nav_bar: calc(var(--size_sq) * 1.4);  /* 120% от размера квадрата */
  }
}

@media (orientation: landscape) and (min-aspect-ratio: 3/1) {
  :root {
    --size_nav_bar: calc(var(--size_sq) * 1.6);  /* 120% от размера квадрата */
  }
}

/* Базовые стили */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  background-color: black;
  overflow-y: hidden;  /* По умолчанию скрываем прокрутку */
  touch-action: none;
  -webkit-touch-callout: none;
}

/* Тачи только на целевых элементах*/
a, button, input, textarea, select, .tap_here, .draw_here, .shovel_counter, .nav-button, .square .container {
  touch-action: auto;
  -webkit-touch-callout: auto;
}

/* Медиа-запрос для экранов с соотношением сторон от 1:1 до 3:2 */
@media screen and (min-aspect-ratio: 1/1) and (max-aspect-ratio: 3/2) {
  html {
    overflow-y: scroll;  /* Включаем вертикальную прокрутку */
    scrollbar-width: none;  /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
  }
  
  /* Скрываем полосу прокрутки для WebKit браузеров */
  html::-webkit-scrollbar {
    display: none;
  }
}

/* Для скрытия элементов */
.hide {
  display: none !important;
}
/* Общие компоненты */
.container, nav, .money, .user_info, .btc_info, .hor_legend, .ad_block, footer {
  width: var(--size_sq);
}

nav, .money {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.user_info {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;
}

/* Текстовые стили */
.text-primary {
  color: var(--color-primary);
}

.text-center {
  text-align: center;
}

.splash_screen {
    background: url('/images/uw_treasure_bg.jpg') no-repeat bottom center fixed;
    background-size: cover;
    position: absolute;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    /* justify-content: center; */
    align-items: center;
    z-index: 10;
    top: 0;
    left: 0rem;
    margin: 0px;
    opacity: 1;
    /* font-size: calc(min(100vh / 60, 100vw / 30)); */
}

/* Стили для пузырьков */
.bubble {
  position: absolute;
  bottom: 20%; /* Начальная позиция (30% от нижнего края) */
  left: var(--bubble-left); /* Случайное положение по горизонтали */
  font-size: var(--bubble-size); /* Случайный размер */
  color: rgba(173, 216, 230, 0.7); /* Цвет пузырька (светло-голубой с прозрачностью) */
  animation: rise var(--bubble-duration) linear infinite;
}

/* Анимация подъёма пузырьков */
@keyframes rise {
  0% {
    transform: translateY(0);
    opacity: 0.7;
  }
  100% {
    transform: translateY(-100vh); /* Поднимаем пузырьки на всю высоту экрана */
    opacity: 0;
  }
}

.hiding {
  transition: opacity 1s;
  opacity: 0;
}

.splash_screen .content {
    display: flex;
    height: 100vh;  /* Занимаем всю высоту экрана */
    width: calc(max(var(--size_sq) + 1.1rem, 95vw));
    font-style: italic;
    flex-direction: column;
    justify-content: space-evenly;
    align-items: flex-end;
    color: white;
    padding: 0 2rem;  /* Убираем вертикальные отступы */
    border-radius: 10px;
    text-align: right;
}

/* Медиа-запрос для горизонтальной ориентации и экранов с соотношением 1:1 - 3:2 */
@media (orientation: landscape), (min-aspect-ratio: 1/1) and (max-aspect-ratio: 3/2) {
  .splash_screen .content {
    width: 80vw;
  }
}

.splash_screen .content p {
    margin: 0;
    font-size: 1.6rem;
    text-align: right;
    margin-left: 10%;
}

.splash_screen .content p:nth-child(2) {
  font-size: 1.5rem;
  margin-left: 20%;
}

.splash_screen .content p:nth-child(3) {
  font-size: 1.2rem;
  margin-left: 30%;
}

.splash_screen .content p:nth-child(4) {
  font-size: 1.1rem;
  margin-left: 30%;
}

main {
  display: grid;
  height: 100vh;
  padding: 0 0.5rem;
}

.user_info {
  grid-area: block_user_info;
  margin-bottom: 0.3rem;
}
.money {
  grid-area: block_money;
}
.square {
  grid-area: block_square;
  width: var(--size_sq);
}
.btc_info {
  grid-area: block_btc_info;
  display: block;
  color: white;
  margin-bottom: 0.3rem;
  text-align: left;
  font-size: 0.8rem;
  font-weight: bold;
}

main.digging .btc_info {
  display: none;
}

main.digging nav.psychic, main.tap nav.psychic {
  display: none;
}

main.psychic nav.autodig, main.tap nav.autodig {
  display: none;
}

.panels_container {
  grid-area: block_panels;
}

footer {
  grid-area: block_footer;
  display: flex;
  justify-content: space-between;
  align-content: center;
  gap: 1rem;
  color: silver;
  padding: 0 0.5rem;
}

footer a {
  white-space: nowrap;
}

main.digging .panels_container {
  margin-top: 0.3rem;
}

footer a {
  color: white;
  text-decoration: none;
}

/* Вертикальная ориентация (по умолчанию) */
@media (orientation: portrait) {
  main {
      grid-template-columns: 1fr;
      grid-template-areas: 
          "block_user_info"
          "block_money"
          "block_square"
          "block_btc_info"
          "block_panels"
          "block_footer";
      grid-auto-rows: min-content;
      justify-items: center;
  }
  .btc_info {
    width: var(--size_sq);
  }
}

/* Горизонтальная ориентация */
@media (orientation: landscape), (min-aspect-ratio: 1/1) and (max-aspect-ratio: 3/2) {
  main {
    row-gap: 0;
    column-gap: 3rem;
    grid-template-columns: auto calc(var(--size_sq) + 2rem);
    grid-template-areas: 
        "block_user_info   block_square"
        "block_money       block_square"
        "block_panels      block_square"
        "block_footer      block_square"
        ".      block_square"
        ".      block_square"
        ".      block_square"
        ".      block_btc_info";
    grid-template-rows: min-content min-content min-content min-content;
    /* grid-auto-rows: 0; */
    align-content: start;
    align-items: start;
    justify-items: end;
  }

  /* Увеличиваем ширину всех блоков левой колонки на 20% */
  .user_info,
  .money,
  .panels_container,
  nav,
  footer {
    min-width: var(--size_nav_bar);  /* Фиксированная ширина вместо auto + min-width */
    width: auto;
  }

  .panels_container {
    margin: 0;
    padding: 0;
  }

  .square,
  .btc_info {
    margin-top: 0.2rem;
    justify-self: start;
  }

  .btc_info {
    align-self: start;
    width: 100%;
  }

  .panels_container {
    position: static;
    flex-direction: column;
    gap: 0.3rem;
  }
}

H1 {
  color: white;
  text-align: center;
  font-size: 1.2em;
  padding: 0.7em 0em 0.2em 0em;
}

.user_info {
  display: flex;
  justify-content: space-between;
  font-size: 1.3rem;
  align-items: center;
}
 
.user_info .person {
    color: white;
    display: flex;
    gap: 0.5rem;
    align-content: flex-start;
    justify-content: center;
    white-space: nowrap;
    font-weight: bold;
  }

.user_info .person .full_name {
    padding: 0;
    display: flex;
    align-items: center;
  }

.user_info .avatar {
  width: 2.7rem;
  height: 2.7rem;
  padding: 0;
  background-color: #404040;
  border-radius: 50%;
  display: flex;
  justify-content: center; /* Центрирование по горизонтали */
  align-items: center;     /* Центрирование по вертикали */
}


.user_info .avatar img {
  width: 2rem;
}

.user_info .login {
  color: white;
  text-align: right;
}

.user_info span.shovels {
  font-style: italic;
  color: gold;
}

.user_info span.shovels img {
  width: 1.2rem;
}

.user_info #sync_flag {
  line-height: 0;
  display: none;
}

.money {
  margin-bottom: 0.5rem;
  text-align: right;
  color: gold;
  display: flex;
  justify-content: space-between;
  font-size: 1.3rem;
  align-items: flex-start;
}

.money img {
  width: auto;
  height: 1.2rem;
}

.money .gem_counter {
  white-space: nowrap;
}

.money span.left {
  text-align: left;
  font-weight: bold;
}

.money span.left img {
  margin-right: 0.7rem;
}

nav {
    background-color: rgb(64, 64, 64);
    width: 100%;
}
/*
@font-face {
  font-family: 'Roboto Mono';
  src: url('/fonts/RobotoMono-Regular.ttf') format('truetype');
}
*/
/*
.container{
  
  background-color: rgb(0, 0, 0);
  width: 100%;
}
*/

.block, nav, .ad_block {
  margin-bottom: 0.3rem;
  padding: 0.1rem 0rem;
  border-radius: 0.3rem;
  vertical-align: top;
}

nav {
    user-select: none;
}
/*
.panels_container nav:nth-child(2) {
  padding-bottom: calc(var(--font-size-nav) * 0.7);
}
*/

nav, .ad_block{
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    width: var(--size_sq);
}

nav input {
    padding: 0;
    margin: 0;
    height: 2rem;
    padding: 0 1rem;
}

nav div {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

nav label {
  position: relative;
  margin: 0 0.5rem;
  font-size: 1rem;
  text-align: left;
  color: var(--color-primary);
  font-family: Roboto;
  white-space: nowrap;
}

.psychic_cb {
    padding: 0;
    width: 1.5rem;
    margin-right: 0.5rem;
}

.color{
    padding: 0 .25rem;
    width: 100px;
    margin: 0 1em;
}

.container {
  background-color: rgb(0, 0, 0);
    width: var(--size_sq);
    height: var(--size_sq);
    display: grid;
    grid-template-columns: repeat(var(--size), var(--size_px));
    grid-template-rows: repeat(var(--size), var(--size_px));
    gap: 1px;
    justify-content: space-evenly;
    align-content: space-evenly;
    padding: 0px;
    margin: 0px;
    border: 1px solid white;
    position: relative;
  
    user-select: none;
}

main.tap .container, main.psychic .container {
  display: grid;
  overflow: none;
}

/*
main.tap button.digging_stop, main.psychic button.digging_stop {
  display: none;
}
*/
main.tap nav.autodig, main.psychic nav.autodig  {
  display: none;
}

main.digging nav.autodig button, main.digging nav.autodig select {
  font-size: 1rem;
  padding: 0.4rem 0.3rem;
  border-radius: 0.5rem;
}

main.digging nav button.digging_stop {
  font-weight: bold;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.4rem 1rem;
}

main.digging nav.autodig select,
main.digging nav.autodig select option,
main.digging nav.autodig select option[selected]
{
  color: var(--color-primary);
  background-color: var(--color-bg);
  border: 1px solid var(--color-primary);
}

/*
main.digging nav.autodig select option, main.digging nav.autodig select option {
  background-color: black;
  color: var(--color-primary);
  
}
*/

/*
.digging-algorithm {
  padding: 0.7rem 1.2rem;
  border-radius: 1.5625rem;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  background-color: var(--color-bg);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  
  line-height: 1rem;
}
*/


main.digging .container {
  display: flex;
  flex-direction: column;
  align-content: flex-start;
  justify-content: flex-start;
  overflow: hidden;
  color: white;
  font-family: monospace, DejaVu Sans Mono, Hack;
  font-weight: normal;
  font-size: calc(var(--size_sq) / 33);
  white-space: pre;
  padding: 0.3rem;
}

main.digging .container img.welcome_digger{
  width: calc(100% - 1rem);
  margin: 0;
}

main.digging nav #quality_indicator {
  display: none;
}


/* Центрируем кнопку Stop в режиме running
main.digging.running nav {
  justify-content: center;
}*/

/* Опционально: делаем контролы неактивными (в дополнение к скрытию) */
main.digging.running #bench_btn {
  pointer-events: none;
  opacity: 0.0;
}

/* Сюда кк ребёнка подсовываем элемент с надписью */
.sq_caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: var(--size_sq);
    height: var(--size_sq);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.tap_here, .draw_here {
    color: rgb(255, 0, 0);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.7rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-0.5rem); 
    }
    100% {
        transform: translateY(0);
    }
}

.tap_here p, .draw_here p {
  animation: blink 3.5s infinite;
  background-color: transparent;
  margin: 0;
  padding: 0;
  font-size: 2rem;
  height: 2rem;
  /* width: fit-content;

  margin-left: auto;
  margin-right: auto; */
}

.sq_caption .no_luck {
  font-size: 4rem;
  color: red;
}

.tap_here img, .draw_here img {
  width: calc(min(var(--size_sq) / 2, max(var(--size_sq) / 2.5, 160px)));
  height: auto;
}

@keyframes blink {
    0% { opacity: 0.0; }
    25% { opacity: 0.5; }
    50% { opacity: 1.0; }
    75% { opacity: 0.5; }
    100% { opacity: 0.0; }
}

.pixel {
    background-color: rgb(255, 255, 255);
    border-radius: 0px;
    width: var(--size_px);
    height: var(--size_px);
}

.pixel.active {
    background-color: rgb(0, 0, 0);
}
/* 16n + 1 */
.pixel:nth-of-type(16n+2)::before {
  content: attr(data-line);
  position: absolute;
  margin: calc(var(--size_px) * 0.2) 0rem 0rem calc(-0.8 * var(--size_px));
  font-size: calc(var(--size_px) * 0.5);
  font-family: Roboto;
  text-align: right;
  color: var(--color-secondary);
  display: block;
  width:  2ch;
}

.hor_legend {
  width: var(--size_sq);
  display: flex;
  margin: 0;
  padding: 0;
  user-select: none;
  justify-content: space-evenly save;
}

main.digging .hor_legend {
  display: none;
}

.hor_legend span {
  flex: auto;
  font-size: 0.7em;
  color: var(--color-secondary);
  font-family: Roboto;
  text-align: center;
  padding: 0;
}

/* Проценты */
#quality_indicator {
  width: calc(var(--font-size-nav) * 6.5);
  margin-top: 0.0rem;
  margin-bottom: calc(var(--font-size-nav) * 1);
  padding: 0 0.3rem 0 0.25rem;
  text-align: center;
  font-size: calc(var(--font-size-nav) * 1.4);
  font-family: Courier;
  font-weight: bold;
  border-radius: 0.5rem;
}
/* Гармония */
#quality_indicator::before {
  content: attr(data-col);
  position: absolute;
  margin: calc(var(--font-size-nav) * 1.8) 0rem 0rem 0.8rem;
  font-size: calc(var(--font-size-nav) * 1.0);
  text-align: center;
  color: var(--color-primary);
  font-family: Roboto;
  font-weight: normal;
}

.btc_info #btc_address a, .btc_info #btc_privkey {
  color: var(--color-secondary);
  text-decoration: none;
  font-weight: normal;
  font-size: var(--font-size-nav);
}

.ad_block {
  background: white;
  color: black;
}
/* Должно быть последним */
.hide{
  display:none;
}

/* Переиспользуемые стили для flex-контейнеров */
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Текстовые стили */
.text-white {
  color: var(--color-primary);
}

.text-silver {
  color: var(--color-secondary);
}

/* Контейнер для панелей */
.panels_container {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: var(--size_sq);  /* Фиксированная ширина */
}

/* Общие стили для навигационных панелей */
nav {
  display: flex;
  width: 100%;
  padding: 0.3rem 0.5rem;
  border-radius: 0.5rem;
  background-color: var(--color-bg);
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.2rem;
}


/* Уникальные стили для плавающей панели */
nav.floating {
  flex-direction: row;
  gap: 0.5rem;
  background: var(--color-bg-transparent);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  padding: 0.3rem 1rem;
}

/* Медиа-запрос остается без изменений */
@media screen and (orientation: landscape) {
  .panels_container {
    height: 100%;
    flex-direction: column;
    justify-content: flex-start;
    margin: 0;
  }
}

.nav-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  color: white;
  transition: transform 0.2s;
  flex: 1;
  width: var(--nav-base-size); /* Используем переменную */
}

.nav-button:hover {
  transform: translateY(-2px);
}

.nav-button i {
  font-size: calc(var(--size_nav_btn) * 0.4);  /* Пересчитано от размера кнопки */
  margin-bottom: 0.25rem;
}

.nav-button span {
  font-size: var(--font-size-nav);
  width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Общие стили для панелей */
.panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.3s ease;
  z-index: 5;
}

.panel {
  background: white;
  width: 100%;
  max-height: 80vh;
  border-radius: 20px 20px 0 0;
  padding: 1rem;
  animation: slideUp 0.3s ease;
  overflow-y: auto;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.close-button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

/* Стили для списка товаров */
.goods-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.goods-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 1px solid #eee;
  border-radius: 0.7rem;
}

.goods-info {
  flex: 1;
}

.goods-info h3 {
  margin: 0 0 5px 0;
}

.goods-info p {
  margin: 0;
  color: #666;
}

.goods-buttons {
  display: flex;
  gap: 1rem;  /* отступ между кнопками */
}

.goods-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;  /* отступ между иконкой и текстом */
  padding: 0.3rem 0.6rem;
  border: none;
  border-radius: 0.3rem;
  cursor: pointer;
  font-weight: 500;
}

.goods-button img {
  width: 1.2rem;
}

.goods-button.stars {
  background: black;
  color: #ffffff;
}

.goods-button.shovels {
  background: black;
  color: white;
}

.boost-purchased {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0.5rem;
}

.boost-purchased i {
  color: #4CAF50;
  font-size: 1.5rem;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

button {
  border-radius: 0.5rem;
  padding: 0.4rem 0.5rem;
  border: none;
  background-color: var(--color-primary);
  color: var(--color-bg);
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover {
  opacity: 0.9;
}

.start-button, .stay-here-button {
  padding: 0.7rem 1.2rem;
  border-radius: 1.5625rem;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  vertical-align: middle;
  border: none;
}

/* Стили для кнопки Start в WebView */
.start-button {
  position: relative;
  display: block;
  margin: 1.25rem auto;
  color: #000;  
  transition: all 0.3s ease;
  background-color: #F5D76E;
  overflow: hidden;
  /* z-index: 1; */
  box-shadow: 0 0.125rem 0.3125rem rgba(0,0,0,0.2);
}

.start-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 30%; /* Более узкий блик */
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.6) 50%, /* Более яркий блик */
    rgba(255,255,255,0) 100%
  );
  transform: skewX(-20deg);
  animation: buttonShineEffect 5s linear infinite; /* Медленнее движение */
  z-index: 2;
}

.start-button:hover {
  background-color: #F7DC6F; /* Чуть светлее при наведении */
  animation: buttonPulse 1.5s ease-in-out infinite; /* Пульсация вместо подъема */
}

.start-button:hover::before {
  animation: buttonShineEffect 3s linear infinite; /* Быстрее при наведении, но всё равно медленно */
}

.start-button.registered {
  margin: 1.25rem 0.5rem;
  /* display: inline-block; */
}

@keyframes buttonShineEffect {
  0% { left: -10%; }
  100% { left: 110%; }
}

@keyframes buttonPulse {
  0% { box-shadow: 0 0 0.3125rem rgba(245,215,110,0.5); }
  50% { box-shadow: 0 0 0.625rem rgba(245,215,110,0.8); }
  100% { box-shadow: 0 0 0.3125rem rgba(245,215,110,0.5); }
}

/* Стили для кнопки Stay Here */
.splash_screen .content .stay-here-button {
  /* display: inline-block; */
  background-color: #777777;
  color: white;
}

.splash_screen .content .stay-here-button:hover {
  background-color: #666666;
  box-shadow: 0 0.125rem 0.3125rem rgba(0,0,0,0.3);
}

/* Стили для счетчика внутри кнопки Start */
.splash_screen .content .start-button span {
  display: inline-block;
  margin-left: 0.5rem;
  font-weight: bold;
  min-width: 1.5rem;
  text-align: center;
}

.splash_screen .content .buttons {
  display: none;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  width: 100%;
  /* margin: 0 auto; */
}

/* Стили для списка задач */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 0 0.625rem;
}

.task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border: 1px solid #eee;
  border-radius: 0.7rem;
}

.task-info {
  flex: 1;
}

.task-info h3 {
  margin: 0 0 0.3125rem 0;
  font-size: 1rem;
  vertical-align: middle;
}

.task-info p {
  margin: 0;
  color: #666;
}

/* Сохраняем стили для channel-link */
.task-info .channel-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: #0088cc;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.task-info .channel-link:hover {
  color: #006699;
  text-decoration: underline;
}

.task-reward {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.task-button.shovels, .task-button.invite {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  border: none;
  border-radius: 0.3rem;
  cursor: pointer;
  background: black;
  color: white;
  height: 2rem;
}

.task-item .invite .task-info div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.task-button i {
  color: white;
}

.task-button img {
  width: 1.2rem;
}

.task-button span {
  color: white;
  font-weight: 500;
}

.task-button:hover {
  transform: translateY(-2px);
  transition: transform 0.2s ease;
}

.task-info h3.completed {
  text-decoration: line-through;
  color: var(--color-secondary);
}

.task-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.no-tasks-message {
  text-align: center;
  color: var(--color-secondary);
  padding: 2rem;
}

/* Новые стили для задач типа invite */
.friend-username-input {
  height: 2.0rem;
  padding: 0 1rem;
  border: 1px solid #ccc;
  border-radius: 0.3rem;
  font-size: 1rem;
  width: 10rem;
}

.task-description {
  margin: 0.5rem 0 0 0;
  color: #666;
}

.invite-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Стили для анимации сокровищ */
.treasure-animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s;
}

.treasure-animation-container.fade-out {
    opacity: 0;
}

.firework {
    position: absolute;
    color: gold;
    font-size: 1.5rem;
    pointer-events: none;
}

/* Добавляем все направления */
.firework.top { animation: fireworkTop 1.5s ease-out forwards; }
.firework.bottom { animation: fireworkBottom 1.5s ease-out forwards; }
.firework.left { animation: fireworkLeft 1.5s ease-out forwards; }
.firework.right { animation: fireworkRight 1.5s ease-out forwards; }
.firework.top-left { animation: fireworkTopLeft 1.5s ease-out forwards; }
.firework.top-right { animation: fireworkTopRight 1.5s ease-out forwards; }
.firework.bottom-left { animation: fireworkBottomLeft 1.5s ease-out forwards; }
.firework.bottom-right { animation: fireworkBottomRight 1.5s ease-out forwards; }
.firework.top-left-far { animation: fireworkTopLeftFar 1.5s ease-out forwards; }
.firework.top-right-far { animation: fireworkTopRightFar 1.5s ease-out forwards; }
.firework.bottom-left-far { animation: fireworkBottomLeftFar 1.5s ease-out forwards; }
.firework.bottom-right-far { animation: fireworkBottomRightFar 1.5s ease-out forwards; }

/* Базовые keyframes для всех направлений */
@keyframes fireworkTop {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(0, -70vh) scale(1.5); opacity: 0; }
}

@keyframes fireworkBottom {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(0, 70vh) scale(1.5); opacity: 0; }
}

@keyframes fireworkLeft {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(-70vw, 0) scale(1.5); opacity: 0; }
}

@keyframes fireworkRight {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(70vw, 0) scale(1.5); opacity: 0; }
}

/* Диагональные направления */
@keyframes fireworkTopLeft {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(-50vw, -50vh) scale(1.5); opacity: 0; }
}

@keyframes fireworkTopRight {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(50vw, -50vh) scale(1.5); opacity: 0; }
}

@keyframes fireworkBottomLeft {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(-50vw, 50vh) scale(1.5); opacity: 0; }
}

@keyframes fireworkBottomRight {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(50vw, 50vh) scale(1.5); opacity: 0; }
}

/* Дальние диагональные направления */
@keyframes fireworkTopLeftFar {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(-70vw, -70vh) scale(1.5); opacity: 0; }
}

@keyframes fireworkTopRightFar {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(70vw, -70vh) scale(1.5); opacity: 0; }
}

@keyframes fireworkBottomLeftFar {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(-70vw, 70vh) scale(1.5); opacity: 0; }
}

@keyframes fireworkBottomRightFar {
    0% { transform: translate(0, 0) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(70vw, 70vh) scale(1.5); opacity: 0; }
}

.treasure-box {
    background: linear-gradient(145deg, #2a2a2a 0%, #1a1a1a 100%);
    border: 0.125rem solid gold;
    border-radius: 1.25rem;
    padding: 2rem;
    text-align: center;
    color: white;
    animation: treasure-appear 0.5s ease-out forwards;
    box-shadow: 0 0 1.875rem rgba(255, 215, 0, 0.3);
    max-width: 90vw;
    width: 30rem;
    margin: 0 auto;
}

.treasure-icon {
    width: 5rem;
    height: 5rem;
    margin-bottom: 1.25rem;
    animation: pulse 2s infinite;
}

.treasure-code {
    font-family: monospace;
    font-size: 1.125rem;
    background: rgba(255, 215, 0, 0.1);
    padding: 0.625rem;
    border-radius: 0.625rem;
    margin-top: 1rem;
    word-break: break-all;
}

@keyframes treasure-appear {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.treasure-button {
    margin-top: 1.25rem;
    padding: 0.625rem 1.875rem;
    background: gold;
    border: none;
    border-radius: 0.625rem;
    color: black;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.treasure-button:disabled {
    opacity: 0.5;
    cursor: default;
}

.treasure-button:hover {
    transform: scale(1.05);
    background: #ffd700;
}

/* Стили для пула */

.pool-summary {
  margin-bottom: 20px;
  padding: 15px;
  background-color: #f5f5f5;
  border-radius: 8px;
  text-align: center;
}

.total-time {
  font-size: 1.5em;
  font-weight: bold;
  color: #4a4a4a;
  margin-top: 10px;
}

.pool-history h3 {
  margin-bottom: 15px;
}

.pool-table {
  width: 100%;
  border-collapse: collapse;
}

.pool-table th, .pool-table td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.pool-table th {
  background-color: #f2f2f2;
  font-weight: bold;
}

.pool-table th:first-child,
.pool-table td:first-child {
  width: 20%;
  white-space: nowrap;
}

.pool-table th:nth-child(2),
.pool-table td:nth-child(2) {
  width: 20%;
  white-space: nowrap;
}

.pool-table th:nth-child(3),
.pool-table td:nth-child(3) {
  width: 60%;
}

.pool-table tr:hover {
  background-color: #f5f5f5;
}

/* Стили для иконок драгоценностей в таблице */
.pool-table .gems-cell {
  white-space: nowrap;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 2.5rem;
}

.pool-table .gem-item {
  white-space: nowrap;
  margin-right: 0.5em;
  display: flex;
  align-items: center;
}

.pool-table .gem-item:last-child {
  margin-right: 0;
}

.pool-table .gems-cell img {
  width: 1em;
  height: 1em;
  margin-right: 0.5em;
}

/* Стили для панели помощи */
.help-panel-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: var(--font-family-main);
}

.help-panel {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  background-color: #000;
  color: #fff;
  border-radius: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.help-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.3rem;
  border-bottom: 0.0625rem solid #333;
}

.help-panel-header h2 {
  margin: 0;
  font-size: 0.8rem; /* Уменьшено на ~30% от 1.125rem */
  color: #fff;
}

.help-panel-header .close-button {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.help-panel-header .close-button:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.help-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 0rem;
}

.help-text {
  font-size: 0.85rem; /* Уменьшено на ~30% от 0.875rem */
  line-height: 1.5;
  padding: 0 1rem;
}

.help-text h1 {
  font-size: 0.9rem; /* Уменьшено на ~30% от 1.25rem */
  margin-top: 0;
  margin-bottom: 0.9375rem;
}

.help-text h2 {
  font-size: 0.855rem; /* Уменьшено на ~30% от 1.125rem */
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.help-text h3 {
  font-size: 0.775rem; /* Уменьшено на ~30% от 1rem */
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.help-text p {
  margin-bottom: 0.5rem;
}

.help-text ul, .help-text ol {
  padding-left: 1.25rem;
  margin-bottom: 0.5rem;
}

.help-text li {
  margin-bottom: 0.2rem;
}

.help-text ol li {
  list-style-type: disc;
}

.help-text .index li {
  list-style-type: none;
}

.help-text a {
  color: #5dade2;
  text-decoration: none;
}

.help-text a:visited {
  color: #3498db; /* Оставляем текущий цвет для посещенных ссылок */
}

.help-text a:hover {
  text-decoration: underline;
}


/*
.help-text ul ul li {
  list-style-type: none;
}
*/

/* Стили для калькулятора */
.calculator-content {
  padding: 1rem 0.5rem;
  color: #fff;
}

.calculator-form {
  margin-bottom: 0.5rem;
}

.calculator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 0.5rem;
}

.form-group {
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* Прижимаем содержимое к низу */
  min-height: 4rem; /* Фиксированная минимальная высота для группы */
}

.form-group label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 500;
  font-size: 0.9rem;
  flex-shrink: 0; /* Предотвращаем сжатие метки */
}

.form-group input {
  width: 95%;
  padding: 0.2rem;
  border-radius: 0.3rem;
  border: 1px solid #555;
  background-color: #333;
  color: #fff;
  font-size: 1rem;
  flex-shrink: 0; /* Предотвращаем сжатие поля ввода */
}

.calculator-results {
  background-color: rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  padding: 0.5rem;
}

.result-group {
  margin-bottom: 1.5rem;
}

.result-group:last-child {
  margin-bottom: 0;
}

.result-group h3 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: #ddd;
}

.result-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #5dade2;
}

/* Медиа-запрос для адаптивности на очень маленьких экранах */
@media (max-width: 340px) {
  .calculator-grid {
    grid-template-columns: 1fr;
  }
  
  .form-group input {
    width: 100%;
  }
}

.pool-history .history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.pool-history .history-header h3 {
  margin: 0;
}

.pool-history .calculator-link {
  color: #5dade2;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: color 0.2s;
  font-size: 1rem;
  font-weight: 500;
}

.pool-history .calculator-link:hover {
  color: #3498db;
}

.pool-history .calculator-link i {
  font-size: 1rem;
}

.pool-history .calculator-link span {
  font-size: inherit;
}

.mode-buttons {
  display: flex;
  gap: 0.5rem;
  margin-right: 8px;
}

.mode-button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.3rem solid #ccc;
  border-radius: 0.7rem;
  background: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
}

.mode-button span {
  display: none;
}

.mode-button.active {
  border-color: #007bff;
  background: #ffffff;
}

.mode-button.active span {
  display: block;
  font-size: var(--font-size-nav);
  text-align: left;
  margin-left: 0.4rem;
}

.mode-button img {
  width: 2.5rem;
  height: 2.5rem;
}

.mode-button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  background: silver;
}

.mode-button[disabled]:hover {
  background: #fff;
}

/* Под старые более прямоугольные телефоны, про 40rem сделано, чтобы портретные мониторы не попадали */
@media (orientation: portrait) and (min-aspect-ratio: 7/11) and (max-width: 40rem) {
  nav {
    padding-bottom: 0;
    padding-top: 0;
  }

  .user_info {
    font-size: 1rem;
  }

  .user_info .avatar {
    width: 2rem;
    height: 2rem;
  }

  .money {
    font-size: 1.2rem;
    margin-bottom: 0.1rem;
  }

  main.digging button.digging_stop {
    font-size: 1rem;
    padding: 0.2rem 1rem;
  }

  main.digging nav.autodig {
    padding-bottom: 0;
    padding-top: 0;
    min-height: 4rem;
  }

  main.digging nav {
    margin-bottom: 0;
    margin-top: 0.1rem;
  }

  .mode-button {
    border: 0.2rem solid #ccc;
  }

  .mode-button img {
    width: 1.5rem;
    height: 1.5rem;
  }
}

.neuro-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.upload-neuro {
  padding: 0.3rem 0.6rem;
  border-radius: 0.3rem;
  background-color: var(--color-bg);
  color: var(--color-primary);
  border: 1px solid var(--color-secondary);
  cursor: pointer;
}

.algo-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  position: relative;
}

.algo-control select::after {
  content: attr(data-label);
  position: absolute;
  bottom: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-primary);
  font-size: 0.9rem;
  font-weight: bold;
  white-space: nowrap;
}

.cores-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  position: relative;
}
.cores-control select::after {
  content: attr(data-label);
  position: absolute;
  bottom: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--color-primary);
  font-size: 0.9rem;
  font-weight: bold;
  white-space: nowrap;
}
