:root {
    --banner-safe: 72px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0b0b12;
    color: #ffffff;
    min-height: 100vh;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: transparent;
}

*::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 999px;
}

button {
    -webkit-tap-highlight-color: transparent;
    outline: none;
}

button:focus,
button:active {
    outline: none;
    box-shadow: none;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.settings-open {
    overflow: hidden;
}

body.settings-open #menuScreen {
    display: none;
}

.top-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-areas: "balance level actions";
    align-items: center;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 16px;
}

.balance {
    display: flex;
    flex-direction: column;
    gap: 4px;
    grid-area: balance;
    justify-self: start;
}

.balance-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.balance-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.level-top {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    grid-area: level;
    justify-self: center;
}

.top-actions {
    display: flex;
    gap: 8px;
    flex-direction: column;
    align-items: flex-end;
    grid-area: actions;
    justify-self: end;
}

.top-bar.is-menu .level-top {
    display: none;
}

.top-bar.is-menu #backToMenuBtnTop {
    display: none;
}

.level-mode {
    font-size: 1.1rem;
    font-weight: 700;
}

.level-progress {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.icon-btn {
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    cursor: pointer;
    font-weight: 600;
}

.screen {
    flex: 1;
    display: none;
    padding: 24px 20px calc(40px + var(--banner-safe) + env(safe-area-inset-bottom, 0px));
}

.screen.active {
    display: flex;
}

#gameScreen.screen.active {
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
}

.game-content {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0 auto;
}

.menu {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.title {
    font-size: 2.4rem;
    text-align: center;
    font-weight: 800;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 16px;
}

.mode-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    cursor: pointer;
    text-align: left;
}

.mode-card.active {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
}

.mode-image {
    width: 84px;
    height: 84px;
    border-radius: 16px;
    background-color: #1a1a26;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: block;
    filter: saturate(1.2) contrast(1.1) brightness(1.05);
}

.mode-image[data-mode="games"] {
    background-image: url("apple-touch-icon.png");
    background-color: #2a1b18;
}

.mode-image[data-mode="music"] {
    background-image: url("unnamed (1).png");
    background-color: #162225;
}

.mode-image[data-mode="movies"] {
    background-image: url("png-clipart-clapperboard-film-cinema-computer-icons-corporate-events-logo-film.png");
    background-color: #1b1b2d;
}

.mode-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mode-title {
    font-size: 1.2rem;
    font-weight: 800;
}

.mode-levels {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.primary-btn {
    padding: 16px;
    border-radius: 16px;
    border: none;
    background: linear-gradient(135deg, #ffe66d, #ff8b94);
    color: #0b0b12;
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
}

.hints-panel {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 6px;
    margin-top: -6px;
}

.hints-summary {
    width: 100%;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    cursor: pointer;
}

.hints-count {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
}

.hints-caret {
    font-size: 1.1rem;
}

.hints-dropdown {
    display: none;
    flex-direction: column;
    gap: 8px;
}

.hints-dropdown.active {
    display: flex;
}

.hint-row {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 600;
}

.hint-row:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hint-price {
    font-weight: 800;
    color: rgba(255, 255, 255, 0.8);
}

.hint-price.positive {
    color: #7dff9f;
}

.emoji-card {
    padding: 28px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.emoji {
    font-size: 3.8rem;
    letter-spacing: 10px;
    text-align: center;
}

.answer-block {
    display: flex;
    gap: 10px;
    margin-bottom: 6px;
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
}

.answer-field {
    position: relative;
    flex: 1 1 100%;
}

.answer-input {
    width: 100%;
    padding: 12px 44px 12px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-size: 1rem;
}

.backspace-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.secondary-btn {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.answer-block .secondary-btn {
    flex: 0 0 auto;
}

.info-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.next-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
}

.hidden {
    display: none;
}

.ghost-btn {
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
    cursor: pointer;
}

.letter-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-height: 32px;
    margin-bottom: 4px;
}

.letter-btn {
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.12);
    font-weight: 700;
    font-size: 0.95rem;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
}

.letter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.letter-btn:active {
    transform: scale(0.96);
}

.space-btn {
    min-width: 88px;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
}

.hint-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    min-height: 22px;
    margin-bottom: 4px;
}

.vk-banner-space {
    width: 100%;
    height: 72px;
}

.game-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: space-between;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.overlay.active {
    display: flex;
}

.info-panel {
    max-height: min(80vh, 620px);
    overflow-y: auto;
}

.emoji-info-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
}

.emoji-info-title {
    font-weight: 700;
    font-size: 1rem;
}

.emoji-info-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px 12px;
}

.emoji-info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.emoji-info-icon {
    font-size: 1.1rem;
    width: 26px;
    text-align: center;
}

.settings {
    width: 100%;
    max-width: 420px;
    background: #11111a;
    border-radius: 20px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-title {
    font-size: 1.2rem;
    font-weight: 800;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.95rem;
}

.settings-label {
    flex: 1;
}

.settings-item.column {
    flex-direction: column;
    align-items: flex-start;
}

.vk-action-btn {
    min-width: 110px;
    height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vk-action-btn.icon {
    min-width: 36px;
    width: 36px;
    padding: 0;
}

.vk-action-btn svg {
    display: block;
}

.select {
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.achievements {
    width: 100%;
    max-height: 160px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.achievement {
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.85rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.2s;
    border-radius: 20px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ffffff;
    transition: 0.2s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background: linear-gradient(135deg, #4ecdc4, #ffe66d);
}

.switch input:checked + .slider:before {
    transform: translateX(22px);
}

@media (max-width: 600px) {
    .top-bar {
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        gap: 8px;
        padding: 12px 14px;
    }
    .level-top {
        align-items: center;
    }
    .balance-value {
        font-size: 1.1rem;
    }
    .level-mode {
        font-size: 1rem;
    }
    .level-progress {
        font-size: 0.8rem;
    }
    .icon-btn,
    .ghost-btn {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    .title {
        font-size: 2rem;
    }
    .emoji {
        font-size: 3.2rem;
        letter-spacing: 6px;
    }
    .mode-image {
        width: 72px;
        height: 72px;
    }
    .game-actions {
        flex-direction: column;
    }
}
