/* ================================================================
   ADAPTSTYLES — СТИЛИ ДЛЯ МОДАЛЬНЫХ ОКОН И СПИСКА
   Цвета: #f5d76e, rgba(205, 127, 50, 0.3), #9b4a3a
   Устройства: desktop / mobile
   ================================================================ */

/* ================================================================
   1. БАЗОВЫЕ СТИЛИ (общие для всех устройств)
   ================================================================ */
body {background-image: url("tableTile50.png"); background-color:limegreen; }
/* ----- МОДАЛЬНОЕ ОКНО #modalOverlay (статичное) ----- */
#modalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#modalOverlay.active {
    opacity: 1;
    visibility: visible;
}

#modalOverlay .modal-window {
    background: linear-gradient(145deg, #003d20, #01572c 50%, #004d26);
    border-radius: 28px;
    border: 2px solid rgba(205, 127, 50, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), inset 0 0 60px rgba(205, 127, 50, 0.03);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

#modalOverlay.active .modal-window {
    transform: scale(1);
}

#modalOverlay .modal-header {
    padding: 20px 20px 10px;
    border-bottom: 2px solid rgba(205, 127, 50, 0.3);
}

#modalOverlay .modal-header h4 {
    color: #f5d76e;
    font-weight: 700;
    text-align: center;
    text-shadow: 0 2px 15px rgba(205, 127, 50, 0.15);
    letter-spacing: 1px;
}

#modalOverlay .modal-body {
    color: #f5d76e;
    text-align: center;
    line-height: 1.5;
}

#modalOverlay .modal-footer {
    display: flex;
    justify-content: center;
    gap: 12px;
}

#modalOverlay .modal-btn {
    border-radius: 40px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    border: 1px solid rgba(205, 127, 50, 0.3);
    text-align: center;
}

#modalOverlay .modal-btn-confirm {
    background: linear-gradient(135deg, #f5d76e, #d4a04a 40%, #9b4a3a);
    color: #1a0f0a;
    border: none;
    box-shadow: 0 4px 20px rgba(205, 127, 50, 0.2);
}

#modalOverlay .modal-btn-confirm:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #d4a04a, #b8822a 40%, #7a3a2a);
}

#modalOverlay .modal-btn-cancel {
    background: rgba(205, 127, 50, 0.1);
    color: #f5d76e;
}

#modalOverlay .modal-btn-cancel:active {
    transform: scale(0.95);
    background: rgba(205, 127, 50, 0.05);
}

/* ----- CUSTOM-MODAL (динамическое окно из JS) ----- */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.custom-modal-window {
    background: linear-gradient(145deg, #003d20, #01572c 50%, #004d26);
    border-radius: 28px;
    border: 2px solid rgba(205, 127, 50, 0.3);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 0 60px rgba(205, 127, 50, 0.03);
    text-align: center;
    animation: scaleIn 0.3s ease;
}

.custom-modal-title {
    color: #f5d76e;
    font-weight: 700;
    text-shadow: 0 2px 15px rgba(205, 127, 50, 0.15);
}

.custom-modal-body {
    color: #f5d76e;
    line-height: 1.5;
}

.custom-modal-btn {
    background: linear-gradient(135deg, #f5d76e, #d4a04a 40%, #9b4a3a);
    border: none;
    color: #1a0f0a;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(205, 127, 50, 0.3);
    touch-action: manipulation;
    box-shadow: 0 4px 20px rgba(205, 127, 50, 0.15);
}

.custom-modal-btn:active {
    transform: scale(0.95);
}

/* ----- СПИСОК (list-overlay) ----- */
.list-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.list-overlay .aspect-container {
    display: flex;
    flex-direction: column;
    background: linear-gradient(145deg, #003d20, #01572c 30%, #006633 70%, #004d26);
    border-radius: 32px;
    border: 2px solid rgba(205, 127, 50, 0.3);
    box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.8), inset 0 0 60px rgba(205, 127, 50, 0.03);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-overlay.active .aspect-container {
    transform: scale(1);
}

.list-overlay .header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 2px solid rgba(205, 127, 50, 0.3);
    background: linear-gradient(180deg, rgba(205, 127, 50, 0.08), transparent);
}

.list-overlay .header-title {
    color: #f5d76e;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    text-shadow: 0 2px 15px rgba(205, 127, 50, 0.15);
}

.list-overlay .header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.list-overlay .counter {
    color: #f5d76e;
    font-weight: 600;
    padding: 4px 14px;
    background: rgba(205, 127, 50, 0.08);
    border-radius: 24px;
    border: 1px solid rgba(205, 127, 50, 0.3);
}

.list-overlay .close-btn {
    background: rgba(205, 127, 50, 0.1);
    border: 1px solid rgba(205, 127, 50, 0.3);
    color: #f5d76e;
    font-weight: 700;
    border-radius: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    user-select: none;
}

.list-overlay .close-btn:active {
    transform: scale(0.95);
    background: rgba(205, 127, 50, 0.05);
}

.list-overlay .list-wrapper {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.list-overlay .list-container {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-right: 6px;
}

/* Скроллбар (базовый) */
.list-overlay .list-container::-webkit-scrollbar {
    width: 6px;
}

.list-overlay .list-container::-webkit-scrollbar-track {
    background: rgba(205, 127, 50, 0.05);
    border-radius: 10px;
}

.list-overlay .list-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #f5d76e, #9b4a3a);
    border-radius: 10px;
}

.list-overlay .list-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #f5d76e, #d4a04a);
}

/* Список */
.list-overlay .item-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.list-overlay .item-list li {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.08), rgba(205, 127, 50, 0.02));
    border-radius: 18px;
    display: flex;
    align-items: center;
    color: #f5d76e;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    border: 1px solid rgba(205, 127, 50, 0.15);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    touch-action: manipulation;
    -webkit-tap-highlight-color: rgba(205, 127, 50, 0.15);
    user-select: none;
    backdrop-filter: blur(5px);
}

.list-overlay .item-list li:active {
    transform: scale(0.97);
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.18), rgba(205, 127, 50, 0.06));
    border-color: rgba(205, 127, 50, 0.4);
}

.list-overlay .item-list li.selected {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.25), rgba(205, 127, 50, 0.08));
    border-color: #f5d76e;
    box-shadow: 0 0 30px rgba(205, 127, 50, 0.1), inset 0 0 30px rgba(205, 127, 50, 0.03);
}

.list-overlay .item-number {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #f5d76e, #d4a04a 40%, #9b4a3a);
    border-radius: 14px;
    font-weight: 700;
    color: #1a0f0a;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(205, 127, 50, 0.2);
}

.list-overlay .item-text {
    flex: 1;
    line-height: 1.3;
    color: #f5d76e;
}

.list-overlay .item-icon {
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.list-overlay .item-right {
    flex-shrink: 0;
    color: #f5d76e;
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

.list-overlay .item-list li:hover .item-right {
    opacity: 0.8;
}

/* .list-overlay .item-right.badge {
    background: rgba(205, 127, 50, 0.15);
    border: 1px solid rgba(205, 127, 50, 0.3);
    border-radius: 20px;
    color: #f5d76e;
    text-align: center;
} */

/* .list-overlay .item-right.badge {
    background: linear-gradient(135deg, #f5d76e, #d4a04a 40%, #9b4a3a);
    border: none;
    color: #1a0f0a;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(245, 215, 110, 0.4);
    text-shadow: none;
} */

/* .list-overlay .item-right.badge {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    border: 2px solid #f5d76e;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(255, 107, 53, 0.5);
} */

.list-overlay .item-right.badge {
    background: #f5d76e;
    border: 2px solid #ffffff;
    color: #1a0f0a;
    font-weight: 800;
    box-shadow: 
        0 0 0 3px rgba(245, 215, 110, 0.3),
        0 0 20px rgba(245, 215, 110, 0.5);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

.list-overlay .scroll-hint {
    text-align: center;
    color: rgba(205, 127, 50, 0.3);
    letter-spacing: 2px;
}

/* ================================================================
   2. ДЕСКТОП (body.desktop)
   ================================================================ */

/* ----- #modalOverlay (десктоп) ----- */
body.desktop #modalOverlay {
    padding: 20px;
}

body.desktop #modalOverlay .modal-window {
    width: 420px;
    max-width: 90%;
    padding: 32px 28px;
    border-radius: 28px;
}

body.desktop #modalOverlay .modal-header {
    padding: 20px 20px 10px;
}

body.desktop #modalOverlay .modal-header h4 {
    font-size: 1.5rem;
}

body.desktop #modalOverlay .modal-body {
    font-size: 1.1rem;
    padding: 20px 24px;
    min-height: 80px;
}

body.desktop #modalOverlay .modal-footer {
    gap: 14px;
    padding: 12px 24px 20px;
}

body.desktop #modalOverlay .modal-btn {
    padding: 10px 24px;
    font-size: 1rem;
    min-width: 100px;
}

/* ----- .custom-modal (десктоп) ----- */
body.desktop .custom-modal {
    padding: 20px;
}

body.desktop .custom-modal-window {
    width: 420px;
    max-width: 90%;
    padding: 32px 28px;
    border-radius: 28px;
}

body.desktop .custom-modal-title {
    font-size: 1.6rem;
    margin-bottom: 12px;
}

body.desktop .custom-modal-body {
    font-size: 1.2rem;
    padding: 10px 0 20px;
}

body.desktop .custom-modal-btn {
    font-size: 1.1rem;
    padding: 12px 36px;
    border-radius: 50px;
}

/* ----- СПИСОК (десктоп) ----- */
body.desktop .list-overlay .aspect-container {
    max-width: min(90vw, calc(90vh - 60px) * 9 / 16);
    max-height: min(90vh - 60px, 90vw * 16 / 9);
    height: 85vh;
    border-radius: 32px;
}

body.desktop .list-overlay .header {
    padding: 20px 24px 16px;
}

body.desktop .list-overlay .header-title {
    font-size: clamp(20px, 2.5vw, 28px);
}

body.desktop .list-overlay .counter {
    font-size: clamp(16px, 2vw, 20px);
}

body.desktop .list-overlay .close-btn {
    font-size: clamp(18px, 2vw, 24px);
    padding: 6px 16px;
    min-width: 44px;
}

body.desktop .list-overlay .list-wrapper {
    padding: 12px 20px 20px;
}

body.desktop .list-overlay .item-list {
    gap: 10px;
}

body.desktop .list-overlay .item-list li {
    padding: 14px 18px;
    font-size: 16px;
    gap: 14px;
    min-height: 48px;
    border-radius: 14px;
}

body.desktop .list-overlay .item-number {
    min-width: 40px;
    height: 40px;
    font-size: 15px;
    border-radius: 10px;
    padding: 0 8px;
}

body.desktop .list-overlay .item-icon {
    font-size: 20px;
}

body.desktop .list-overlay .item-right {
    font-size: 14px;
}

body.desktop .list-overlay .item-right.badge {
    padding: 2px 12px;
    font-size: 12px;
    min-width: 24px;
    height: 24px;
}

body.desktop .list-overlay .scroll-hint {
    font-size: 14px;
    padding: 8px;
}

body.desktop .list-overlay .list-container::-webkit-scrollbar {
    width: 8px;
}

body.desktop .list-overlay .list-container::-webkit-scrollbar-track {
    background: rgba(205, 127, 50, 0.08);
}

body.desktop .list-overlay .list-container::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #f5d76e, #9b4a3a);
    border-radius: 10px;
    border: 1px solid rgba(205, 127, 50, 0.2);
}

body.desktop .list-overlay .list-container {
    scrollbar-width: thin;
    scrollbar-color: #f5d76e rgba(205, 127, 50, 0.08);
}

/* ================================================================
   3. МОБИЛЬНЫЕ УСТРОЙСТВА (body.mobile)
   ================================================================ */

/* ----- #modalOverlay (мобила) ----- */
body.mobile #modalOverlay {
    padding: 16px;
}

body.mobile #modalOverlay .modal-window {
    width: 75% !important;
    max-width: 75% !important;
    min-width: 75% !important;
    padding: 32px 24px 28px;
    border-radius: 24px;
    min-height: 45vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

body.mobile #modalOverlay .modal-header {
    padding: 16px 0 12px;
    border-bottom: 2px solid rgba(205, 127, 50, 0.3);
    width: 100%;
    flex-shrink: 0;
}

body.mobile #modalOverlay .modal-header h4 {
    font-size: clamp(26px, 5vw, 34px);
    text-align: center;
    margin: 0;
    padding: 0;
}

body.mobile #modalOverlay .modal-body {
    font-size: clamp(22px, 4.5vw, 30px);
    padding: 24px 0;
    min-height: 100px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    word-wrap: break-word;
}

body.mobile #modalOverlay .modal-footer {
    display: flex;
    flex-direction: column;
    gap: 28px !important;              /* ← увеличенное расстояние */
    padding: 16px 0 0;
    width: 100%;
    flex-shrink: 0;
}

body.mobile #modalOverlay .modal-btn {
    width: 100%;
    max-width: 100%;
    padding: 18px 24px;
    font-size: clamp(22px, 4.5vw, 30px);
    min-height: 60px;
    border-radius: 40px;
    box-sizing: border-box;
    display: block;
    text-align: center;
    margin: 0;
}

/* ----- .custom-modal (мобила) ----- */
body.mobile .custom-modal {
    padding: 16px;
}

body.mobile .custom-modal-window {
    width: 75%;
    max-width: 75%;
    min-width: 75%;
    padding: 32px 24px 28px;
    border-radius: 24px;
    min-height: 40vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

body.mobile .custom-modal-title {
    font-size: clamp(26px, 5vw, 34px);
    font-weight: 700;
    color: #f5d76e;
    text-align: center;
    margin-bottom: 16px;
    text-shadow: 0 2px 15px rgba(205, 127, 50, 0.15);
}

body.mobile .custom-modal-body {
    font-size: clamp(22px, 4.5vw, 30px);
    padding: 24px 0;
    min-height: 80px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #f5d76e;
    line-height: 1.5;
    word-wrap: break-word;
}

body.mobile .custom-modal-btn {
    width: 100%;
    max-width: 100%;
    padding: 18px 24px;
    font-size: clamp(22px, 4.5vw, 30px);
    min-height: 60px;
    border-radius: 40px;
    box-sizing: border-box;
    display: block;
    text-align: center;
    margin: 0;
    background: linear-gradient(135deg, #f5d76e, #d4a04a 40%, #9b4a3a);
    border: none;
    color: #1a0f0a;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    box-shadow: 0 4px 20px rgba(205, 127, 50, 0.15);
}

body.mobile .custom-modal-btn:active {
    transform: scale(0.95);
}

/* ----- СПИСОК (мобила) ----- */
body.mobile .list-overlay {
    display: flex;
    justify-content: stretch;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    padding: 0;
    margin: 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

body.mobile .list-overlay .aspect-container {
    flex: 1 0 100%;
    flex-grow: 1;
    flex-shrink: 0;
    flex-basis: 100%;
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
    border-radius: 0;
    aspect-ratio: auto;
}

body.mobile .list-overlay .header {
    padding: 20px 20px 16px;
}

body.mobile .list-overlay .header-title {
    font-size: clamp(26px, 6vw, 36px);
}

body.mobile .list-overlay .counter {
    font-size: clamp(20px, 4vw, 26px);
    padding: 6px 16px;
}

body.mobile .list-overlay .close-btn {
    font-size: clamp(26px, 5vw, 36px);
    padding: 8px 18px;
    min-width: 48px;
}

body.mobile .list-overlay .list-wrapper {
    padding: 12px 16px 20px;
}

body.mobile .list-overlay .item-list {
    gap: 14px;
}

body.mobile .list-overlay .item-list li {
    padding: 22px 24px;
    font-size: clamp(24px, 6vw, 34px);
    gap: 18px;
    min-height: 72px;
    border-radius: 16px;
}

body.mobile .list-overlay .item-number {
    min-width: 56px;
    height: 56px;
    font-size: clamp(24px, 5vw, 30px);
    border-radius: 14px;
    padding: 0 12px;
}

body.mobile .list-overlay .item-icon {
    font-size: clamp(32px, 7vw, 44px);
}

body.mobile .list-overlay .item-right {
    font-size: clamp(18px, 4vw, 24px);
}

body.mobile .list-overlay .item-right.badge {
    padding: 4px 18px;
    font-size: clamp(18px, 4vw, 24px);
    min-width: 36px;
    height: 36px;
    border-radius: 24px;
}

body.mobile .list-overlay .scroll-hint {
    font-size: clamp(18px, 4vw, 24px);
    padding: 14px;
}

body.mobile .list-overlay .list-container::-webkit-scrollbar {
    width: 4px;
}

/* ================================================================
   4. АНИМАЦИИ
   ================================================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ================================================================
   КНОПКА "ИГРАТЬ" В ШАПКЕ СПИСКА
   ================================================================ */

.list-overlay .play-btn {
    background: linear-gradient(135deg, #f5d76e, #d4a04a 40%, #9b4a3a);
    border: none;
    color: #1a0f0a;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    text-align: center;
    box-shadow: 0 4px 20px rgba(205, 127, 50, 0.3);
    letter-spacing: 1px;
    flex: 1;
    max-width: 60%;
}

.list-overlay .play-btn:active {
    transform: scale(0.97);
    background: linear-gradient(135deg, #d4a04a, #b8822a 40%, #7a3a2a);
}

/* --- Десктоп --- */
body.desktop .list-overlay .play-btn {
    font-size: 18px;
    padding: 12px 24px;
    margin-right: 16px;
}

/* --- Мобила --- */
body.mobile .list-overlay .play-btn {
    font-size: clamp(22px, 5vw, 30px);
    padding: 16px 24px;
    min-height: 56px;
    margin-right: 12px;
}