﻿@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@700;800;900&display=swap');

:root {
    --tg-safe-top: 0px;
    --tg-safe-bottom: 0px;
    --app-safe-top: calc(max(var(--tg-content-safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px), var(--tg-safe-top), env(safe-area-inset-top)) + 18px);
    --app-safe-bottom: max(var(--tg-content-safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px), var(--tg-safe-bottom), env(safe-area-inset-bottom));
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #fff;
    background: #0f1a13;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: stretch;
}

#app { 
    width: 100%;
    max-width: 430px;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
    background: #0f1a13;
}

@media (min-width: 712px) {
    body {
        padding: 0;
        background: #0f1a13;
    }

    #app {
        width: 100%;
        max-width: none;
        height: 100dvh;
        border-radius: 0;
        box-shadow: none;
    }
}

/* Фон на весь экран */
#bg-layer {
    position: absolute; 
    inset: 0;
    background-size: cover; 
    background-position: center;
    z-index: 1; 
    transition: background-image 0.3s ease;
}

/* UI слой поверх фона */
#ui-layer {
    position: absolute; 
    inset: 0; 
    z-index: 10;
    padding-top: var(--app-safe-top);
    padding-bottom: 90px; 
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
}

/* Элементы фермы */
.farm-ui { 
    position: relative; 
    height: 100%; 
    width: 100%;
}

.farm-element {
    position: absolute; 
    cursor: pointer;
    transition: transform 0.1s; 
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.farm-element:active { 
    transform: scale(0.95); 
}

/* Контейнер для экрана без коровы */
.no-cow-container {
    position: absolute;
    top: 58%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 400px;
    z-index: 5;
    gap: 30px; /* Увеличиваем отступ между текстом и кнопкой */
}

/* Текст под кнопкой */
.no-cow-text {
    text-align: center;
    font-family: 'Nunito', sans-serif !important;
    font-size: 22px !important;
    font-weight: 800 !important;
    line-height: 1.4;
    color: #FFEAB1 !important;
    text-shadow: 
        -3px -3px 0 #762806,
        3px -3px 0 #762806,
        -3px 3px 0 #762806,
        3px 3px 0 #762806,
        0 0 15px rgba(118, 40, 6, 0.7) !important;
    padding: 0 20px;
    max-width: 80%;
    z-index: 5;
    order: 1; /* Текст первый */
}

/* Кнопка купить корову */
#buy-cow-btn {
    position: static;
    transform: none;
    width: 70vw; 
    max-width: 300px;
    animation: floaty 3s ease-in-out infinite;
    z-index: 10;
    order: 2; /* Кнопка вторая */
}

/* Здоровье */
#health-wrap {
    pointer-events: none;
    top: 15vh;
    left: 50%; 
    transform: translateX(-50%);
    text-align: center; 
    width: 36vw;
    min-width: 126px;
    max-width: 168px;
}

#health-wrap img {
    width: 100%;
    height: auto;
    display: block;
    pointer-events: none;
}

#health-num {
    position: absolute; 
    top: 60%; 
    left: 50%; 
    transform: translate(-50%, -50%);
    font-family: 'Nunito', sans-serif !important; /* Добавлено */
    font-size: 6.2vw;
    font-weight: 800; /* Увеличили жирность */
    color: #FFEAB1;
    text-shadow: 
    -3px -3px 0 #762806,
    3px -3px 0 #762806,
    -3px 3px 0 #762806,
    3px 3px 0 #762806,
    0 0 15px rgba(118, 40, 6, 0.7);
}

.health-label {
    position: absolute;
    bottom: 3.5vw;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Nunito', sans-serif;
    font-size: 2.8vw;
    font-weight: 800;
    color: #FFEAB1;
    text-shadow: 
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
    z-index: 2; /* Поверх картинки */
    pointer-events: none;
}

/* Кнопки действий - большие, вертикальные */
#action-buttons-column {
    position: absolute;
    left: 3.8vw;
    top: 74%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 15;
}

.action-btn-large { 
    width: 21vw; 
    min-width: 72px;
    max-width: 94px;
    height: auto;
    cursor: pointer;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.5));
    transition: transform 0.15s;
    position: static !important; /* Переопределяем абсолютное позиционирование из .farm-element */
    display: block; /* Убираем строчное поведение */
    margin: 0 auto; /* Центрируем */
}

.action-btn-large:active {
    transform: scale(0.92);
}

/* Убираем старые стили кнопки действия */
.action-btn { 
    display: none; 
}

/* Молоко */
#milk-wrap {
    position: absolute;
    right: clamp(10px, 1.6vw, 24px);
    text-align: center;
    bottom: clamp(78px, 10.5vh, 150px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(6px, 1.8vw, 14px);
    z-index: 16;
}

#milk-val { 
    font-family: 'Nunito', sans-serif !important; /* Добавлено */
    font-weight: 800; /* Увеличили жирность */
    font-size: clamp(28px, 6.8vw, 44px);
    line-height: 1; 
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1, "lnum" 1;
    min-width: 5.2ch;
    letter-spacing: 0.01em;
    color: #FFEAB1;
    text-shadow: 
    -2px -2px 0 #762806,
    2px -2px 0 #762806,
    -2px 2px 0 #762806,
    2px 2px 0 #762806,
    0 0 12px rgba(118, 40, 6, 0.7);
}

/* Кнопка продажи коровы */
#sell-cow-btn {
    position: absolute;
    top: 20px;
    right: 10px;
    width: 90px;
    max-width: 90px;
    height: auto;
    cursor: pointer;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
    transition: transform 0.15s;
    z-index: 18;
}

#sell-cow-btn:active {
    transform: scale(0.92);
}

/* Кнопка продажи молока - увеличенная */
#sell-milk-btn { 
    width: 130px;
    filter: drop-shadow(0 6px 12px rgba(0,0,0,0.4));
    transition: transform 0.15s;
    cursor: pointer;
}

#sell-milk-btn:active {
    transform: scale(0.92);
}

/* Таббар - ТОЛЬКО ФОН, без рамок */
#tabbar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(100%, 430px);
    height: calc(84px + var(--app-safe-bottom));
    padding-top: 6px;
    padding-bottom: var(--app-safe-bottom);
    background: url('/img/tabbar-background.png') center center no-repeat;
    background-size: 100% 100%;
    background-color: transparent;
    display: flex;
    justify-content: space-around;
    align-items: center;
    border: none;
    border-top: none;
    z-index: 100;
    margin: 0;
    padding: 0;
    box-shadow: none;
}

/* Базовая кнопка для экранов авторизации/системных действий */
.btn-primary {
    appearance: none;
    border: 2px solid #762806;
    border-radius: 14px;
    padding: 12px 16px;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #FFEAB1;
    background: linear-gradient(180deg, #a56a2f 0%, #7b4b1f 100%);
    text-shadow:
        -1px -1px 0 #5b2f0f,
        1px -1px 0 #5b2f0f,
        -1px 1px 0 #5b2f0f,
        1px 1px 0 #5b2f0f;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    transition: transform .12s ease, filter .12s ease;
}

.btn-primary:active {
    transform: translateY(1px) scale(0.99);
    filter: brightness(0.95);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: default;
    filter: grayscale(0.1);
}

.auth-panel {
    margin-top: 28px;
}

.auth-input {
    width: 100%;
    margin-bottom: 10px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 2px solid #8a5a2b;
    background: rgba(255, 240, 210, 0.94);
    color: #3e220c;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    outline: none;
}

.auth-input::placeholder {
    color: rgba(62, 34, 12, 0.6);
}

.auth-input:focus {
    border-color: #5e2f10;
    box-shadow: 0 0 0 2px rgba(118, 40, 6, 0.25);
}

.auth-btn {
    width: 100%;
    margin-bottom: 8px;
}

.auth-link-btn {
    display: block;
    text-align: center;
    text-decoration: none;
}

.auth-link-code {
    margin-bottom: 10px;
    font-size: 22px;
    line-height: 1.2;
}

.auth-error {
    color: #ff7f67;
    text-align: center;
    margin-top: 10px;
    min-height: 24px;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 800;
    text-shadow:
        -1px -1px 0 #5b2f0f,
        1px -1px 0 #5b2f0f,
        -1px 1px 0 #5b2f0f,
        1px 1px 0 #5b2f0f;
}

.auth-hint {
    margin-bottom: 10px;
    text-align: center;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    line-height: 1.35;
    font-weight: 700;
    color: #ffeab1;
    opacity: 0.9;
    text-shadow:
        -1px -1px 0 #5b2f0f,
        1px -1px 0 #5b2f0f,
        -1px 1px 0 #5b2f0f,
        1px 1px 0 #5b2f0f;
}

.auth-legal-note {
    margin-top: 8px;
    text-align: center;
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    line-height: 1.35;
    color: #ffeab1;
    opacity: 0.92;
    text-shadow:
        -1px -1px 0 #5b2f0f,
        1px -1px 0 #5b2f0f,
        -1px 1px 0 #5b2f0f,
        1px 1px 0 #5b2f0f;
}

.auth-legal-note a {
    color: #ffd86d;
    text-decoration: none;
    font-weight: 800;
}

.auth-text-link {
    display: block;
    width: 100%;
    margin: 10px 0 0;
    color: #ffeab1;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 800;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    text-align: center;
    border-bottom: none;
    text-shadow:
        -1px -1px 0 #5b2f0f,
        1px -1px 0 #5b2f0f,
        -1px 1px 0 #5b2f0f,
        1px 1px 0 #5b2f0f;
}

.auth-mode-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.auth-tab {
    flex: 1;
    border: 1px solid rgba(118, 40, 6, 0.45);
    background: rgba(255, 234, 177, 0.12);
    color: #ffeab1;
    border-radius: 12px;
    padding: 8px 10px;
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    text-shadow:
        -1px -1px 0 #5b2f0f,
        1px -1px 0 #5b2f0f,
        -1px 1px 0 #5b2f0f,
        1px 1px 0 #5b2f0f;
}

.auth-tab-active {
    border-color: #ffeab1;
    background: rgba(255, 234, 177, 0.24);
}

#tabbar button {
    background: none;
    border: none;
    color: #FFEAB1;
    font-family: 'Nunito', sans-serif !important;
    font-size: 15px !important; /* Увеличили шрифт */
    font-weight: 800 !important;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 10px 24px;
    text-shadow: 
        -2px -2px 0 #5a4410,
        2px -2px 0 #5a4410,
        -2px 2px 0 #5a4410,
        2px 2px 0 #5a4410,
        0 0 8px rgba(90, 68, 16, 0.6); /* Добавили свечение */
    transition: transform 0.15s ease;
}

#tabbar button:active {
    transform: scale(0.95);
}

#tabbar button.active {
    color: #FFF;
    transform: translateY(-2px);
}

/* конки таббара - скругленные */
.tabbar-icon {
    width: 32px;
    height: 32px;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* Модальное окно */
#modal-overlay {
    position: fixed; 
    inset: 0; 
    background: rgba(0,0,0,0.75);
    z-index: 30; 
    display: flex; 
    align-items: center; 
    justify-content: center;
}

#modal-content {
    width: 88%; 
    max-width: 340px;
    background-image: url('/img/background_modal.png');
    background-size: 100% 100%; 
    background-repeat: no-repeat;
    min-height: 380px; 
    padding: 24px 20px 30px;
    text-align: center; 
    color: #3e2b12; 
    position: relative;
}

#modal-content.catalog-modal {
    min-height: 0;
    height: auto;
    max-height: calc(100dvh - 130px - var(--app-safe-bottom));
    padding-top: 54px;
    padding-bottom: 16px;
}

.modal-close {
    position: absolute; 
    top: 10px; 
    right: 14px;
    font-size: 22px; 
    cursor: pointer; 
    font-weight: bold; 
    color: #5c4020;
}

.modal-header { 
    width: 150px; 
    margin: 8px auto 8px; 
}

.modal-title { 
    font-size: 20px; 
    font-weight: bold; 
    margin: 0 0 6px; 
}

.modal-subtitle { 
    font-size: 13px; 
    color: #5c4020; 
    margin-bottom: 16px; 
}

.modal-action-btn { 
    width: 150px; 
    margin-top: auto; 
    cursor: pointer; 
}

/* стория и профиль */
.content-screen { 
    padding: 20px 16px; 
    color: #fff; 
}

.content-screen h2 { 
    margin-bottom: 12px; 
    font-size: 22px; 
}

.history-item {
    background: rgba(255,255,255,0.08); 
    border-radius: 14px;
    padding: 12px; 
    margin-bottom: 10px;
}

.history-item b { 
    display: block; 
    margin-bottom: 4px; 
}

.history-item small { 
    color: rgba(255,255,255,0.6); 
}

/* Профиль */
.profile-field { 
    margin-bottom: 14px; 
}

.profile-field label { 
    display: block; 
    font-size: 13px; 
    color: rgba(255,255,255,0.7); 
    margin-bottom: 6px; 
}

.profile-field input {
    width: 100%; 
    padding: 12px; 
    border-radius: 12px; 
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.3); 
    color: #fff; 
    font-size: 14px;
}

.btn-save {
    width: 100%; 
    padding: 14px; 
    border-radius: 16px; 
    font-weight: bold;
    background: linear-gradient(135deg, #ffd86d, #ffb42f); 
    color: #22170a; 
    border: none; 
    cursor: pointer;
}

/* Анимации */
@keyframes floaty { 
    0%, 100% { transform: translateY(0); } 
    50% { transform: translateY(-8px); } 
}

@media (max-width:380px) {
    .action-btn { 
        width: 52px; 
    }
    
    #tabbar { 
        height: calc(60px + var(--app-safe-bottom));
        padding-top: 6px;
    }
    
    .no-cow-text {
        font-size: 18px !important;
        padding: 0 10px;
    }

    #health-wrap {
        top: 13.8vh;
        width: 34.5vw;
        min-width: 114px;
    }

    #health-num {
        font-size: 8vw;
    }

    .health-label {
        font-size: 3.3vw;
    }

    #action-buttons-column {
        left: 2.8vw;
        top: 72.8%;
        gap: 10px;
    }

    .action-btn-large {
        width: 22vw;
        min-width: 68px;
    }

    #milk-wrap {
        right: clamp(10px, 2.2vw, 18px);
        bottom: clamp(86px, 11.5vh, 152px);
        gap: 8px;
    }

    #milk-val {
        font-size: clamp(28px, 7.2vw, 40px);
        min-width: 4.6ch;
    }
}

@media (max-width: 430px) {
    .no-cow-text {
        font-size: 18px !important;
        padding: 0 15px;
    }
    
    #tabbar {
        height: calc(60px + var(--app-safe-bottom));
        padding-top: 6px;
    }
    
    #tabbar button {
        font-size: 12px !important;
        padding: 6px 16px;
    }
    
    .tabbar-icon {
        width: 26px;
        height: 26px;
    }

    #health-num {
        font-size: 7.2vw;
    }

    #milk-val {
        font-size: 7.4vw;
    }
}

@media (min-width: 431px) {
    #health-num {
        font-size: 28px;
    }

    .health-label {
        font-size: 13px;
        bottom: 14px;
    }

    #milk-val {
        font-size: 29px;
    }
}

/* Деревянная панель для истории и профиля */
.wooden-panel {
    position: relative;
    width: 94vw;
    max-width: 440px;
    margin: 2.2vh auto;
    background-image: url('/img/background_modal.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent !important;
    border-radius: 20px;
    padding: 5.2vh 7vw 3.4vh;
    max-height: calc(100dvh - 130px - var(--app-safe-bottom));
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.public-catalog-content {
    max-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.public-catalog-item {
    padding: 10px 0;
    border-bottom: 2px solid rgba(118, 40, 6, 0.25);
}

.public-catalog-item:last-child {
    border-bottom: none;
}

.public-catalog-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.public-catalog-name {
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: #FFEAB1;
    text-shadow:
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
}

.public-catalog-price {
    font-family: 'Nunito', sans-serif;
    font-size: 20px;
    font-weight: 900;
    color: #FFEAB1;
    white-space: nowrap;
    text-shadow:
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
}

.public-catalog-desc {
    margin-top: 6px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    line-height: 1.4;
    color: #FFEAB1;
    opacity: .9;
    text-shadow:
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
}

.public-catalog-modal-wrap {
    text-align: left;
    margin-top: 0;
}

#modal-content.catalog-modal .wooden-title {
    padding-right: 44px;
}

.wooden-title {
    font-family: 'Nunito', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: #FFEAB1;
    text-align: center;
    margin: 0 0 20px 0;
    text-shadow: 
        -3px -3px 0 #762806,
        3px -3px 0 #762806,
        -3px 3px 0 #762806,
        3px 3px 0 #762806,
        0 0 15px rgba(118, 40, 6, 0.7);
    flex-shrink: 0; /* Заголовок не сжимается */
}

.wooden-subtitle {
    font-family: 'Nunito', sans-serif;
    font-size: 22px;
    font-weight: 800;
    color: #FFEAB1;
    margin: 20px 0 12px 0;
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
}

.wooden-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto; /* Добавляем скролл */
    padding-right: 5px; /* Небольшой отступ для скролла */
}

/* Стили для скроллбара */
.wooden-content::-webkit-scrollbar {
    width: 6px;
}

.wooden-content::-webkit-scrollbar-track {
    background: rgba(118, 40, 6, 0.2);
    border-radius: 10px;
}

.wooden-content::-webkit-scrollbar-thumb {
    background: rgba(118, 40, 6, 0.5);
    border-radius: 10px;
}

.wooden-content::-webkit-scrollbar-thumb:hover {
    background: rgba(118, 40, 6, 0.7);
}

.wooden-text {
    font-family: 'Nunito', sans-serif;
    font-size: 30px;
    line-height: 1;
    color: #FFEAB1;
    text-align: center;
    font-weight: 700;
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
}

/* Секции профиля */
.profile-section {
    padding: 10px 0; /* Уменьшаем отступы */
    border-bottom: 2px solid rgba(118, 40, 6, 0.3);
}

.profile-section:last-child {
    border-bottom: none;
}

/* нформация о пользователе с иконкой */
.profile-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    justify-content: center;
}

.profile-avatar-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 3px solid #762806;
    background: rgba(118, 40, 6, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.profile-user-names {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-name {
    font-family: 'Nunito', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: #FFEAB1;
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
    margin-bottom: 5px;
}

.profile-username {
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #FFEAB1;
    opacity: 0.85;
    text-shadow: 
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0; /* Уменьшаем отступы */
    font-family: 'Nunito', sans-serif;
}

.profile-label {
    font-family: 'Nunito', sans-serif;
    font-size: 30px;
    line-height: 1;
    font-weight: 700;
    color: #FFEAB1;
    opacity: 0.75; /* Делаем полупрозрачными */
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
}

.profile-value {
    font-family: 'Nunito', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: #FFEAB1;
    text-align: right;
    word-break: break-all;
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
}

.profile-value.active {
    color: #8adfa1;
    text-shadow: 
        -2px -2px 0 #2d7a3e,
        2px -2px 0 #2d7a3e,
        -2px 2px 0 #2d7a3e,
        2px 2px 0 #2d7a3e;
}

/* Кошелёк */
.wallet-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(118, 40, 6, 0.2);
    border: 3px solid #762806;
    border-radius: 20px;
    padding: 15px 18px;
    margin-top: 10px;
}

.wallet-address {
    flex: 1;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #FFEAB1;
    font-family: monospace;
    letter-spacing: 0.5px;
    text-shadow: 
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
}

.wallet-edit-btn {
    background: none;
    border: none;
    color: #FFEAB1;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.wallet-edit-btn:hover {
    transform: scale(1.15);
    color: #fff;
}

.wallet-edit-btn:active {
    transform: scale(0.95);
}

/* стория - деревянные элементы */
.history-wooden-item {
    background: rgba(118, 40, 6, 0.15);
    border: 2px solid rgba(118, 40, 6, 0.3);
    border-radius: 15px;
    padding: 18px;
    margin-bottom: 15px;
}

.history-wooden-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-type {
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #FFEAB1;
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
}

.history-status {
    font-family: 'Nunito', sans-serif;
    font-size: 10px;
    font-weight: 800;
    padding: 5px 10px;
    border-radius: 10px;
    text-transform: uppercase;
    text-shadow: 
        -1px -1px 0 rgba(0,0,0,0.4),
        1px -1px 0 rgba(0,0,0,0.4),
        -1px 1px 0 rgba(0,0,0,0.4),
        1px 1px 0 rgba(0,0,0,0.4);
}

.history-status.approved {
    background: rgba(14, 255, 78, 0.4);
    color: #fff;
}

.history-status.rejected {
    background: rgba(255, 77, 45, 0.4);
    color: #fff;
}

.history-status.pending {
    background: rgba(251, 255, 0, 0.4);
    color: #ffffff;
}

.history-wooden-amount {
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #FFEAB1;
    margin-bottom: 8px;
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
}

.history-wooden-date {
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    color: #FFEAB1;
    opacity: 0.85;
    font-weight: 700;
    text-shadow: 
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
}

.history-payment-link {
    display: inline-block;
    margin: 0 0 8px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 800;
    color: #ffd86d;
    text-decoration: none;
    text-shadow:
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
}

.history-payment-link:hover {
    text-decoration: underline;
}

/* Модальное окно кошелька */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-panel {
    margin: 0;
    width: 100%;
    max-width: 380px;
    min-height: auto;
    background-color: transparent !important; /* Убираем фон у модалки */
}

.wooden-input {
    width: 100%;
    padding: 16px;
    border: 3px solid #762806;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.95);
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #3e2b12;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.wooden-input:focus {
    outline: none;
    border-color: #5c4020;
    background: #fff;
}

.modal-buttons {
    display: flex;
    gap: 15px;
}

.btn-wooden-primary,
.btn-wooden-secondary {
    flex: 1;
    padding: 16px;
    border-radius: 15px;
    font-family: 'Nunito', sans-serif;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s;
    border: none;
}

.btn-wooden-primary {
    background: linear-gradient(135deg, #ffd86d, #ffb42f);
    color: #22170a;
    text-shadow: 1px 1px 2px rgba(255,255,255,0.4);
}

.btn-wooden-secondary {
    background: rgba(255, 255, 255, 0.7);
    color: #5c4020;
    border: 3px solid #762806;
}

.btn-wooden-primary:hover,
.btn-wooden-secondary:hover {
    transform: translateY(-3px);
}

.btn-wooden-primary:active,
.btn-wooden-secondary:active {
    transform: translateY(0);
}

/* Адаптация */
@media (max-width: 430px) {
    .wooden-panel {
        width: 95vw;
        padding: 4.8vh 6.2vw 3.2vh;
        margin: 1.8vh auto;
    }
    
    .wooden-title {
        font-size: 28px;
        margin-bottom: 16px;
    }
    
    .wooden-subtitle {
        font-size: 20px;
    }
    
    .profile-label{
        font-size: 16px;
    }

    .profile-value {
        font-size: 20px;
    }
    
    .profile-avatar-circle {
        width: 60px;
        height: 60px;
    }
    
    .profile-name {
        font-size: 20px;
    }

    .modal-overlay .wooden-panel.modal-panel {
        width: 96%;
        max-width: 360px;
        min-height: auto;
        max-height: 85vh;
        padding: 35px 25px 25px;
        overflow-y: auto;
    }
    
    .modal-overlay .wooden-panel.modal-panel .wooden-content {
        max-height: 60vh;
        overflow-y: auto;
    }
}

.wallet-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.wallet-label {
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: #FFEAB1;
    opacity: 0.85;
}

.wallet-hint,
.input-hint {
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    color: #FFEAB1;
    opacity: 0.7;
    margin: 4px 0 0 0;
    text-shadow: 
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
}

.wooden-label {
    display: block;
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #FFEAB1;
    margin-bottom: 8px;
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
}

/* Модалка покупки — деревянные стили */
#modal-content .purchase-details {
    text-align: center;
    margin: 10px 0 20px;
}

#modal-content .purchase-title {
    font-family: 'Nunito', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: #FFEAB1;
    margin-bottom: 8px;
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
}

#modal-content .purchase-price {
    font-family: 'Nunito', sans-serif;
    font-size: 24px;
    font-weight: 800;
    color: #FFEAB1;
    margin-bottom: 4px;
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
}

#modal-content .purchase-bonus {
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    color: #FFEAB1;
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
    opacity: 0.9;
}

#modal-content .purchase-disclaimer {
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    color: #FFEAB1;
    text-shadow: 
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
    opacity: 0.7;
    text-align: center;
    margin-top: 4px;
    line-height: 1.3;
    padding: 0 10px;
}

/* Кнопка buy.png в модалке */
#modal-content .modal-action-btn,
#modal-content .btn-wooden-primary img {
    width: 250px;
    max-width: 90%;
    cursor: pointer;
    transition: transform 0.15s;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
    background-color: transparent;
}

#modal-content .modal-action-btn:active,
#modal-content .btn-wooden-primary:active img {
    transform: scale(0.95);
}

/* Кнопка покупки в модалке — только изображение, без фона */
#modal-content #modal-confirm {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 15px auto !important;
    width: 250px !important;
    max-width: 90% !important;
    cursor: pointer;
    display: block;
    transition: transform 0.15s !important;
}

#modal-content #modal-confirm img {
    width: 100% !important;
    display: block !important;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3)) !important;
    pointer-events: none; /* Чтобы клики проходили на кнопку */
}

#modal-content #modal-confirm:active {
    transform: scale(0.95) !important;
}

.modal-loading-row {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 48px;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #FFEAB1;
    text-shadow:
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
}

.modal-spinner {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid rgba(255, 234, 177, 0.35);
    border-top-color: #FFEAB1;
    animation: modal-spin 0.8s linear infinite;
}

@keyframes modal-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Стартовый экран */
#start-screen {
    position: absolute;
    inset: 0;
    z-index: 1000;
    overflow: hidden;
    padding-top: var(--app-safe-top);
    padding-bottom: var(--app-safe-bottom);
}

#start-bg {
    position: absolute;
    inset: 0;
    background-image: url('/img/background_start.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

#start-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: calc(9vh + var(--app-safe-bottom));
    z-index: 10;
}

.start-logo {
    position: absolute;
    top: 13.5vh;
    left: 50%;
    transform: translateX(-50%);
    width: 62vw;
    min-width: 190px;
    max-width: 280px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

.start-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 66vw;
    min-width: 220px;
    max-width: 290px;
    height: auto;
    transition: transform 0.15s;
    filter: drop-shadow(0 6px 16px rgba(0,0,0,0.4));
}

.start-button:active {
    transform: scale(0.95);
}

.start-button img {
    width: 100%;
    height: auto;
    display: block;
}

.start-about-button {
    margin-top: 1.6vh;
    background: rgba(118, 40, 6, 0.88);
    border: 2px solid #ffeab1;
    color: #ffeab1;
    border-radius: 12px;
    padding: 10px 22px;
    font-family: 'Nunito', sans-serif;
    font-size: 16px;
    font-weight: 800;
    text-shadow:
        -1px -1px 0 #5b2f0f,
        1px -1px 0 #5b2f0f,
        -1px 1px 0 #5b2f0f,
        1px 1px 0 #5b2f0f;
    box-shadow: 0 6px 14px rgba(0,0,0,0.35);
    cursor: pointer;
}

.start-about-button:active {
    transform: translateY(1px) scale(0.99);
}

.start-disclaimer {
    margin-top: 1.8vh;
    font-family: 'Nunito', sans-serif;
    font-size: 2.9vw;
    font-weight: 700;
    color: #FFEAB1;
    text-align: center;
    text-shadow: 
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806,
        0 0 10px rgba(118, 40, 6, 0.7);
    line-height: 1.25;
    padding: 0 20px;
}

.start-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 10, 8, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 18px;
}

.start-modal-panel {
    width: 100%;
    max-width: 390px;
    max-height: 78vh;
    background-image: url('/img/background_modal.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
    background-color: transparent;
    border-radius: 18px;
    padding: 24px 24px 20px;
    position: relative;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

.start-modal-close {
    position: absolute;
    top: 8px;
    right: 10px;
    border: none;
    background: transparent;
    color: #5c4020;
    font-size: 34px;
    font-weight: 800;
    cursor: pointer;
    line-height: 1;
}

.start-modal-title {
    font-family: 'Nunito', sans-serif;
    font-size: 28px;
    font-weight: 900;
    color: #FFEAB1;
    text-align: center;
    margin: 0 0 12px;
    text-shadow:
        -2px -2px 0 #762806,
        2px -2px 0 #762806,
        -2px 2px 0 #762806,
        2px 2px 0 #762806;
}

.start-modal-content {
    overflow-y: auto;
    padding: 4px 12px 4px 10px;
}

.start-modal-content p {
    margin: 0 0 10px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    line-height: 1.42;
    color: #FFEAB1;
    text-shadow:
        -1px -1px 0 #762806,
        1px -1px 0 #762806,
        -1px 1px 0 #762806,
        1px 1px 0 #762806;
}

/* Адаптация под мобильные */
@media (max-width: 430px) {
    .start-logo {
        width: 58vw;
        top: 12vh;
    }
    
    .start-button {
        width: 60vw;
    }
    
    .start-disclaimer {
        font-size: 3.3vw;
        padding: 0 4vw;
    }
}

@media (max-width: 380px) and (max-height: 700px) {
    #start-content {
        padding-bottom: calc(7.4vh + var(--app-safe-bottom));
    }

    .start-logo {
        width: 56vw;
        min-width: 0;
        top: 11vh;
    }

    .start-button {
        width: 58vw;
        min-width: 0;
    }

    .start-about-button {
        margin-top: 1.2vh;
        padding: 8px 18px;
        font-size: 15px;
    }

    .start-disclaimer {
        margin-top: 1.2vh;
        font-size: 3.6vw;
        line-height: 1.2;
    }

    .wooden-panel {
        width: 95vw;
        margin: 1.2vh auto;
        padding: 4.2vh 5.4vw 2.8vh;
        max-height: calc(100dvh - 116px - var(--app-safe-bottom));
    }
}

@media (min-width: 431px) {
    #app {
        box-shadow: none;
    }
}

@media (min-width: 712px) {
    #start-bg {
        background-image: url('/img/background_start-desktop.png');
    }

    #ui-layer {
        padding-bottom: 36px;
    }

    #start-content {
        padding-bottom: 4.2vh;
    }

    .start-logo {
        top: 6.2vh;
        width: 22vw;
        min-width: 280px;
        max-width: 430px;
    }

    .start-button {
        width: 19vw;
        min-width: 250px;
        max-width: 360px;
    }

    .start-about-button {
        margin-top: 0.8vh;
        padding: 10px 24px;
        font-size: 18px;
        border-radius: 14px;
    }

    .start-disclaimer {
        margin-top: 1.4vh;
        font-size: 14px;
        line-height: 1.2;
        text-shadow:
            -1px -1px 0 #762806,
            1px -1px 0 #762806,
            -1px 1px 0 #762806,
            1px 1px 0 #762806,
            0 0 8px rgba(118, 40, 6, 0.55);
    }

    #main-logo {
        top: 1.6vh !important;
        left: 1.1vw !important;
        height: 126px !important;
    }

    #action-buttons-column {
        left: 50%;
        top: auto;
        bottom: calc(0.2vh + var(--app-safe-bottom));
        transform: translateX(-50%);
        flex-direction: row;
        gap: 1.1vw;
    }

    .action-btn-large {
        width: 7vw;
        min-width: 88px;
        max-width: 126px;
    }

    #sell-cow-btn {
        top: 72%;
        right: auto;
        left: 42%;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: clamp(108px, 9vw, 120px);
        max-width: 134px;
    }

    #milk-wrap {
        left: 58.5%;
        right: auto;
        bottom: 17.6vh;
        transform: translateX(-50%);
        gap: 0;
    }

    #milk-val {
        font-size: clamp(30px, 2.8vw, 43px);
        min-width: 0;
    }

    #tabbar {
        left: auto;
        right: 1.2vw;
        top: 1.8vh;
        bottom: auto;
        transform: none;
        width: 86px;
        height: auto;
        padding: 10px 8px;
        border-radius: 18px;
        background: rgba(48, 30, 13, 0.78);
        backdrop-filter: blur(3px);
        display: flex;
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
        box-shadow: 0 10px 24px rgba(0,0,0,0.35);
    }

    #tabbar button {
        padding: 9px 8px;
        border-radius: 12px;
        background: rgba(255, 234, 177, 0.08);
        font-size: 11px !important;
        gap: 4px;
    }

    #tabbar button.active {
        background: rgba(255, 234, 177, 0.22);
        transform: none;
    }

    .tabbar-icon {
        width: 28px;
        height: 28px;
    }

    .wooden-panel {
        width: min(92vw, 560px);
        max-width: 560px;
        padding: 4.8vh 2.2vw 3vh;
        max-height: calc(100dvh - 86px);
    }

    .wooden-title {
        font-size: 44px;
        margin-bottom: 22px;
    }

    .wooden-content {
        padding-right: 14px;
    }

    .history-wooden-item {
        padding: 16px 16px;
    }

    .history-wooden-title {
        font-size: 28px;
    }

    .history-wooden-amount {
        font-size: 28px;
    }

    .history-wooden-date {
        font-size: 18px;
    }

    .profile-row {
        padding: 10px 0;
    }

    .profile-label {
        font-size: 28px;
    }

    .profile-value {
        font-size: 30px;
    }
}

@media (min-width: 1024px) {
    #main-logo {
        height: 136px !important;
    }

    #tabbar {
        right: 1.6vw;
        width: 96px;
    }

    .wooden-panel {
        max-width: 560px;
    }
}

@media (min-width: 1366px) {
    .start-disclaimer {
        font-size: 18px;
    }

    #milk-val {
        font-size: 43px;
    }

    .wooden-panel {
        max-width: 540px;
    }
}

@media (min-width: 1920px) {
    .start-logo {
        max-width: 420px;
    }

    .start-button {
        max-width: 360px;
    }

    .wooden-panel {
        max-width: 560px;
    }
}

.profile-link {
    display: block;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #FFEAB1;
    text-shadow: 
    -2px -2px 0 #762806,
    2px -2px 0 #762806,
    -2px 2px 0 #762806,
    2px 2px 0 #762806,
    0 0 12px rgba(118, 40, 6, 0.7);
    padding: 10px 0;
    text-decoration: none;
    border-bottom: 1px solid rgba(118, 40, 6, 0.3);
    transition: opacity 0.2s;
}
.profile-link:last-child { border-bottom: none; }
.profile-link:hover { opacity: 0.85; }

.start-link {
    color: #ffd86d;
    text-decoration: none;
    font-weight: 700;
}
.start-link:hover { text-decoration: underline; }

#modal-content .purchase-disclaimer a {
    color: #ffd86d !important;
    text-decoration: none !important;
    font-weight: 700 !important;
    border-bottom: 1px dashed rgba(118, 40, 6, 0.5);
    transition: opacity 0.2s;
}

#modal-content .purchase-disclaimer a:hover {
    opacity: 0.8;
    border-bottom-color: #ffd86d;
}
