:root {
    --bg: #3a0d22;
    --felt-1: #7c2447;
    --felt-2: #4a1129;
    --gold: #f0c869;
    --gold-dark: #a8781f;
    --font-display: 'Fredoka', 'Segoe UI', sans-serif;
    --font-body: 'Quicksand', 'Segoe UI', sans-serif;
}

* {
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #1a0510;
}

body {
    font-family: var(--font-body);
    display: flex;
    justify-content: center;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

#game-container {
    position: relative;
    width: 440px;
    height: 100%;
    max-width: 600px;
    max-height: 900px;
    aspect-ratio: 600 / 900;
    background: radial-gradient(ellipse at 50% 0%, var(--felt-1) 0%, var(--felt-2) 65%, #380c22 100%);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.3), 0 0 0 6px rgba(184, 135, 40, 0.35);
    overflow: hidden;
    border-radius: 20px;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 20px;
    touch-action: none;
}

#preloader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 38%, #7c2447 0%, #4a1129 55%, #2c0919 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s ease;
    border-radius: 20px;
    pointer-events: all;
}

.loader-die {
    font-size: 54px;
    margin-bottom: 14px;
    animation: loaderSpin 1.1s ease-in-out infinite;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}

@keyframes loaderSpin {

    0%,
    100% {
        transform: rotate(-14deg) scale(1);
    }

    50% {
        transform: rotate(14deg) scale(1.08);
    }
}

.loader-title {
    font-family: var(--font-display);
    font-size: 38px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    margin-bottom: 30px;
    font-weight: 700;
    letter-spacing: 3px;
    background: linear-gradient(180deg, #f7dfa0 0%, #d4a03c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.loader-bar-container {
    width: 62%;
    height: 16px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 9px;
    overflow: hidden;
    padding: 2px;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4);
}

.loader-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #f0c869 0%, #ff9d4d 50%, #ff4d8d 100%);
    border-radius: 7px;
    transition: width 0.06s linear;
    box-shadow: 0 0 10px rgba(240, 200, 105, 0.6);
}

.loader-hint {
    font-family: var(--font-body);
    color: #d8b783;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    margin-top: 16px;
    text-transform: uppercase;
}

.modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 16px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    position: relative;
    background: linear-gradient(180deg, #7c2447 0%, #4a1129 100%);
    border-radius: 22px;
    width: 85%;
    max-width: 420px;
    padding: 32px 26px 26px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
    text-align: center;
    transform: scale(0.8);
    transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid #a8781f;
    overflow: hidden;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    height: 120px;
    background: radial-gradient(circle, rgba(240, 200, 105, 0.25) 0%, rgba(240, 200, 105, 0) 70%);
    pointer-events: none;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-title {
    font-family: var(--font-display);
    color: #f0c869;
    font-size: 25px;
    margin-bottom: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.modal-body {
    font-family: var(--font-body);
    color: #f0dfc8;
    font-size: 14.5px;
    font-weight: 500;
    line-height: 1.65;
    margin-bottom: 20px;
    text-align: left;
}

.modal-body ul {
    list-style: none;
    margin-left: 0;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-body li {
    margin-bottom: 0;
    background: rgba(240, 200, 105, 0.1);
    border-left: 3px solid #f0c869;
    border-radius: 8px;
    padding: 8px 10px;
}

.modal-body li strong {
    color: #f0c869;
}

.btn-close {
    font-family: var(--font-display);
    background: linear-gradient(180deg, #f7dfa0 0%, #b8873c 100%);
    border: none;
    border-radius: 25px;
    color: #3a1808;
    padding: 13px 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    outline: none;
    letter-spacing: 0.5px;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}

.btn-close:active {
    transform: scale(0.94);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}