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

:root {
    --hint-block-height: 50px;
    --card-block-height: 90px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0b1220 0%, #111827 50%, #1a2740 100%);
    min-height: 100vh;
    color: #333;
    padding: 25px 0 0 0; /* верх увеличен на 5px */
    /* Предотвращаем сворачивание при свайпах */
    touch-action: pan-x;
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    min-height: calc(100vh - 20px);
    position: relative;
    display: flex;
    flex-direction: column;
    /* Предотвращаем сворачивание при свайпах */
    touch-action: pan-x;
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
}

.screen {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
    min-height: calc(100vh - 20px);
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.content-wrapper {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    min-height: 0;
}


/* Вкладка Игра - предотвращаем вертикальный скролл */
#gameTab {
    touch-action: none;
    overscroll-behavior: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
}

#gameTab .game-area {
    flex: 1;
    min-height: 320px;
    overflow-y: auto;
    touch-action: none;
    overscroll-behavior: none;
    padding: 0;
    padding-bottom: 90px; /* место под нижнее меню */
}

/* Загрузочный экран */
#loadingScreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    z-index: 1000;
}

#loadingScreen:not(.active) {
    display: none !important;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Заголовок */
.header {
    text-align: center;
    padding: 15px 0;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 15px;
}

.header h1 {
    font-size: 28px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-panel {
    display: flex;
    align-items: stretch;
    gap: 10px;
    background: var(--surface-2, #111827);
    border: 1px solid var(--border, #1f2937);
    border-radius: 16px;
    padding: 10px 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

.top-left {
    flex: 3;
    display: flex;
    gap: 14px;
    align-items: center;
    min-width: 0;
    position: relative;
}

.top-balance {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
}

.level-circle {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.level-circle-label {
    font-size: 12px;
    opacity: 0.85;
    letter-spacing: 1px;
}

.level-circle-value {
    font-size: 24px;
    font-weight: 800;
    line-height: 1;
}

.top-progress {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.progress-numbers {
    font-size: 12px;
    color: var(--muted, #9ca3af);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.progress-row {
    display: flex;
    align-items: center;
    gap: 0;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: var(--border, #1f2937);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #60a5fa 0%, #a855f7 100%);
    transition: width 0.3s ease;
}

.xp-needed {
    font-size: 12px;
    color: var(--muted, #9ca3af);
    min-width: 90px;
    text-align: right;
}

.energy-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text, #e5e7eb);
}

.energy-text, .xp-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.money-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: linear-gradient(135deg, #0f1724 0%, #1f2937 100%);
    border: 1px solid rgba(99,102,241,0.6);
    border-radius: 12px;
    color: #cbd5ff;
    font-weight: 800;
    letter-spacing: 0.2px;
    box-shadow: 0 4px 14px rgba(99,102,241,0.35);
    font-size: 13px;
    justify-content: center;
    width: 100%;
}

/* Balance page */
.balance-page .header h1 {
    font-size: 22px;
}

.balance-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.balance-card {
    background: #0f1724;
    border: 1px solid rgba(99,102,241,0.35);
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
    text-align: center;
}

.balance-amount {
    font-size: 28px;
    font-weight: 800;
    color: #cbd5ff;
}

.balance-subtext {
    margin-top: 6px;
    font-size: 13px;
    color: #9ca3af;
}

.withdraw-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #0f1724;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 14px;
}

.withdraw-block label {
    font-size: 13px;
    color: #cbd5ff;
}

.withdraw-block input {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.1);
    background: #0b1220;
    color: #fff;
}

.btn-primary {
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.withdraw-hint {
    font-size: 12px;
    color: #9ca3af;
}

.withdraw-error {
    color: #fca5a5;
    font-size: 12px;
}

.withdraw-success {
    color: #a7f3d0;
    font-size: 12px;
}

.payouts {
    background: #0f1724;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.payouts h3 {
    margin: 0;
    font-size: 16px;
    color: #e5e7eb;
}

.payouts-empty {
    color: #9ca3af;
    text-align: center;
    font-size: 13px;
}

.payouts-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.payout-item {
    background: #0b1220;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.payout-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.payout-amount {
    font-weight: 800;
    color: #cbd5ff;
}

.payout-status {
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 12px;
    text-transform: uppercase;
}

.payout-status.pending {
    background: rgba(251, 191, 36, 0.2);
    color: #fcd34d;
}

.payout-status.paid {
    background: rgba(52, 211, 153, 0.2);
    color: #34d399;
}

.payout-address {
    font-size: 12px;
    color: #9ca3af;
    word-break: break-all;
}

.payout-date {
    font-size: 12px;
    color: #6b7280;
}

.energy-regen {
    margin-left: 8px;
    font-size: 12px;
    color: #9fb4ff;
}

/* Игровая область */
.game-area {
    margin-bottom: 20px;
    position: relative;
}

/* Аватар */
.avatar-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 0 10px;
    background: none;
    border-radius: 0;
    min-height: var(--card-block-height);
}

.avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    margin-right: 12px;
}

.avatar-icon {
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.avatar-speech {
    flex: 1;
    background: white;
    padding: 12px 15px;
    border-radius: 15px;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s;
}

.avatar-speech::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 10px solid white;
}

.avatar-speech p {
    margin: 0;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* Герой */
.hero-section {
    margin: 6px 10px 14px;
    padding: 12px;
    background: var(--surface-2, #161e2e);
    border: 1px solid var(--border, #1f2937);
    border-radius: 16px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

.hero-section,
.inventory-section {
    display: none;
}

.hero-section.active,
.inventory-section.active {
    display: block;
}

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

.hero-title {
    font-weight: 800;
    font-size: 16px;
    color: #e5e7eb;
}

.hero-subtitle {
    font-size: 12px;
    color: var(--muted, #9ca3af);
}

.hero-tabs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 0 10px 12px;
}

.hero-tab-btn {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border, #1f2937);
    background: var(--surface-2, #161e2e);
    color: #e5e7eb;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hero-tab-btn.active {
    border-color: rgba(99,102,241,0.7);
    box-shadow: 0 6px 14px rgba(99,102,241,0.25);
    background: linear-gradient(135deg, rgba(99,102,241,0.14), rgba(167,139,250,0.16));
}

.inventory-section {
    margin: 6px 10px 14px;
    padding: 12px;
    background: var(--surface-2, #161e2e);
    border: 1px solid var(--border, #1f2937);
    border-radius: 16px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}

.inventory-grid {
    margin-top: 6px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.inventory-slot {
    min-height: 70px;
    border-radius: 12px;
    border: 1px dashed rgba(255,255,255,0.18);
    background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(167,139,250,0.06));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    color: #9ca3af;
    font-weight: 700;
    cursor: pointer;
}

.inventory-slot.selected {
    border-color: rgba(159, 180, 255, 0.6);
    box-shadow: 0 0 0 2px rgba(159, 180, 255, 0.25);
}

.inventory-slot.drag-over {
    border-color: rgba(130, 185, 255, 0.9);
    box-shadow: 0 0 0 2px rgba(130, 185, 255, 0.3);
    background: linear-gradient(135deg, rgba(130,185,255,0.15), rgba(99,102,241,0.1));
}

.inventory-slot .slot-index {
    font-size: 13px;
}

.inventory-slot.filled {
    border-style: solid;
    border-color: rgba(255,255,255,0.25);
    background: linear-gradient(145deg, rgba(99,102,241,0.12), rgba(167,139,250,0.14));
    color: #e5e7eb;
}

.inventory-slot .slot-icon {
    font-size: 26px;
    line-height: 1;
}

.inventory-slot .slot-label {
    font-size: 13px;
    color: #e5e7eb;
}

.inventory-slot .slot-effects {
    display: none;
}

.inventory-info {
    min-height: 18px;
    color: #e5e7eb;
    font-size: 13px;
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(99,102,241,0.12), rgba(167,139,250,0.14));
    border: 1px solid rgba(159, 180, 255, 0.25);
}

.inventory-info__row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.inventory-info__icon {
    font-size: 30px;
    line-height: 1;
}

.inventory-info__text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.inventory-info__name {
    font-weight: 700;
}

.inventory-info__slot,
.inventory-info__effects {
    font-size: 12px;
    color: #cbd5f5;
}

.inventory-info__effects-title {
    font-weight: 600;
    margin-top: 2px;
}

.inventory-info__effect {
    font-size: 12px;
    color: #cbd5f5;
    line-height: 1.4;
}

.inventory-info__empty {
    color: #a5b4fc;
    font-size: 12px;
}

.inventory-debug {
    margin: 6px 0 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(255, 99, 132, 0.12);
    border: 1px solid rgba(255, 99, 132, 0.35);
    color: #ffcbd6;
    font-size: 12px;
    white-space: pre-wrap;
}

.inventory-info__equip {
    margin-left: auto;
    padding: 8px 12px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.inventory-info__equip:hover {
    opacity: 0.9;
}

.inventory-info__equip.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.inventory-info__warn {
    margin-top: 6px;
    font-size: 12px;
    color: #fca5a5;
}

.hero-hint {
    font-size: 11px;
    color: #9fb4ff;
    background: rgba(159, 180, 255, 0.08);
    border: 1px solid rgba(159, 180, 255, 0.25);
    padding: 6px 10px;
    border-radius: 10px;
    white-space: nowrap;
}

.hero-figure {
    position: relative;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(70px, auto);
    gap: 10px;
}

.hero-slot {
    position: relative;
    background: linear-gradient(135deg, rgba(99,102,241,0.12) 0%, rgba(167,139,250,0.1) 100%);
    border: 1px dashed rgba(255,255,255,0.18);
    border-radius: 14px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #e5e7eb;
    text-align: center;
    min-height: 78px;
    transition: all 0.2s ease;
}

.hero-slot.empty {
    opacity: 0.85;
}

.hero-slot:hover {
    border-color: rgba(99,102,241,0.5);
    box-shadow: 0 6px 16px rgba(99,102,241,0.18);
    transform: translateY(-2px);
}

.hero-slot .slot-icon {
    font-size: 26px;
    line-height: 1;
}

.hero-slot .slot-label {
    font-size: 12px;
    color: var(--muted, #9ca3af);
}

.hero-slot-head { grid-column: 2; grid-row: 1; }
.hero-slot-neck { grid-column: 2; grid-row: 2; }
.hero-slot-torso { grid-column: 2; grid-row: 3; }
.hero-slot-leftHand { grid-column: 1; grid-row: 3; }
.hero-slot-rightHand { grid-column: 3; grid-row: 3; }
.hero-slot-leftLeg { grid-column: 1; grid-row: 4; }
.hero-slot-rightLeg { grid-column: 3; grid-row: 4; }

@media (max-width: 400px) {
    .hero-hint {
        display: none;
    }
    .hero-figure {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero-slot-head,
    .hero-slot-neck,
    .hero-slot-torso {
        grid-column: 1 / span 2;
    }
    .hero-slot-leftHand { grid-column: 1; }
    .hero-slot-rightHand { grid-column: 2; }
    .hero-slot-leftLeg { grid-column: 1; }
    .hero-slot-rightLeg { grid-column: 2; }
    .inventory-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Inline карточка предмета (вместо аватара) */
.item-card-inline {
    display: none;
    flex: 1;
    flex-direction: column;
    gap: 8px;
    min-height: var(--card-block-height);
    background: transparent;
}

.item-card-inline-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: transparent;
    padding: 8px 10px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.debug-info {
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
    font-size: 12px;
}

.item-card-inline-icon {
    font-size: 50px;
    width: 74px;
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0ff 100%);
    border-radius: 12px;
    flex-shrink: 0;
    overflow: hidden;
}

.item-card-inline-icon img {
    width: 74px;
    height: 74px;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.item-card-inline-info {
    flex: 1;
}

.item-card-inline-info h3 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #333;
}

.item-card-inline-name-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.rarity {
    font-size: 12px;
    color: #9ca3af;
}

.rarity.rare {
    color: #60a5fa;
}

.rarity.legendary {
    color: #a855f7;
}

.item-card-inline-details {
    font-size: 12px;
    color: #666;
}

.item-card-inline-details p {
    margin: 0;
}

.item-card-inline-actions {
    width: 100%;
    font-size: 12px;
    color: var(--muted, #9ca3af);
    text-align: left;
}

.btn-burn-inline {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-burn-inline:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(245, 87, 108, 0.4);
}

.btn-burn-inline.mini {
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 10px;
}



.game-field {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0;
    margin: 0;
    min-height: 300px;
    /* Предотвращаем сворачивание при свайпах внутри игрового поля */
    touch-action: none;
    overscroll-behavior: none;
}

.game-cell {
    aspect-ratio: 1;
    background: #1c273a;
    border: none;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: none;
}

.game-cell::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 10px;
    border: 1px solid transparent;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.game-cell:hover {
    transform: scale(1.05);
}

.game-cell:hover::after {
    opacity: 1;
    border: 1px solid transparent;
    border-image: linear-gradient(135deg, rgba(124,58,237,0.5), rgba(99,102,241,0.5)) 1;
}

.game-cell.selected {
    background: #111f33;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.4);
}

.game-cell.has-item {
    border-color: #f5576c;
}

.game-cell.legendary {
    background: radial-gradient(circle at 30% 30%, rgba(124, 58, 237, 0.65), rgba(99,102,241,0.85) 45%, rgba(17,24,39,0.95) 90%);
    box-shadow: none;
    border: none;
    position: relative;
    overflow: hidden;
}

.game-cell.legendary::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url('/assets/legendary-bg.png') center/cover no-repeat;
    opacity: 0.9;
    z-index: 0;
}

.game-cell.gift::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url('/assets/prize-bg.png') center/cover no-repeat;
    opacity: 0.9;
    z-index: 0;
}

.game-cell.legendary > * {
    position: relative;
    z-index: 1;
}

.game-cell.gift > * {
    position: relative;
    z-index: 1;
}
.game-cell.drag-over {
    background: #1a2644;
    transform: scale(1.1);
}

.game-cell.merge-effect {
    animation: merge-pulse 0.45s ease-out;
}

@keyframes merge-pulse {
    0%   { transform: scale(0.88); box-shadow: 0 0 0 rgba(96, 165, 250, 0);    background: radial-gradient(circle, rgba(99,102,241,0.30) 0%, rgba(17,24,39,0) 60%); }
    40%  { transform: scale(1.12); box-shadow: 0 0 26px rgba(99, 102, 241, 0.75); background: radial-gradient(circle, rgba(99,102,241,0.60) 0%, rgba(17,24,39,0) 70%); }
    70%  { transform: scale(1.04); box-shadow: 0 0 14px rgba(99, 102, 241, 0.35); background: radial-gradient(circle, rgba(99,102,241,0.25) 0%, rgba(17,24,39,0) 70%); }
    100% { transform: scale(1.0);  box-shadow: 0 0 0 rgba(96, 165, 250, 0);    background: inherit; }
}


.game-item {
    font-size: 80px;
    line-height: 1;
    position: relative;
    cursor: grab;
    user-select: none;
    touch-action: none;
    /* Предотвращаем выделение текста при свайпах */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.game-item .item-icon-img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

.game-item:active {
    cursor: grabbing;
}

.game-item.dragging {
    opacity: 0.5;
    z-index: 1000;
}

.drag-ghost {
    position: fixed;
    pointer-events: none;
    transform: translate(-50%, -50%);
    z-index: 2000;
    font-size: 100px;
}

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

.drag-ghost .game-cell {
    transform: scale(1.05);
    box-shadow: none;
}


/* Кнопка создания предмета */
.game-controls {
    margin-top: 16px;
}

.game-control-row {
    display: flex;
    gap: 10px;
}
.game-control-row .btn-create {
    width: 100%;
}
.game-control-row .btn-create.main {
    flex: 3;
}
.game-control-row .btn-create.burn {
    flex: 1;
}

.create-hints {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
    color: var(--muted, #9ca3af);
    text-align: center;
    min-height: var(--hint-block-height);
}

#energyRegenHint {
    color: #9fb4ff;
}

.btn-create {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-create:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-create:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-create.btn-secondary {
    background: linear-gradient(135deg, #374151 0%, #1f2937 100%);
    color: #e5e7eb;
}

.btn-create.legendary-mode {
    background: linear-gradient(135deg, #ff8a00 0%, #e52e71 100%);
}

.btn-icon {
    font-size: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.btn-subtext {
    display: block;
    font-size: 12px;
    opacity: 0.8;
}

.btn-cost {
    font-size: 14px;
    opacity: 0.9;
}

/* ---------------------- */
/* Темная тема */
/* ---------------------- */
:root {
    --bg: #0b0f17;
    --surface: #111827;
    --surface-2: #161e2e;
    --border: #1f2937;
    --text: #e5e7eb;
    --muted: #9ca3af;
}

body {
    background: var(--bg, #0b0f17);
    color: var(--text);
}

.container {
    background: var(--surface);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

#loadingScreen {
    background: var(--surface);
    color: var(--text);
}

.header {
    border-bottom-color: var(--border);
}

.xp-bar-label {
    color: var(--muted);
}

.xp-bar {
    background: var(--border);
}

.game-area {
    background: transparent;
}

/* avatar-container intentionally left without background */

.avatar-speech {
    background: var(--surface-2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.avatar-speech::before {
    border-right-color: var(--surface-2);
}

.avatar-speech p {
    color: var(--text);
}

.item-card-inline-content {
    background: var(--surface-2);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.item-card-inline-icon {
    background: linear-gradient(135deg, #1e293b 0%, #111827 100%);
}

.item-card-inline-info h3 {
    color: var(--text);
}

.item-card-inline-details {
    color: var(--muted);
}

.progress-container {
    background: var(--border);
}

.progress-fill {
    background: linear-gradient(90deg, #60a5fa 0%, #a855f7 100%);
}

.game-cell {
    background: #1c273a;
    border: none;
}

.game-cell.selected {
    background: #111f33;
    box-shadow: 0 0 10px rgba(96, 165, 250, 0.3);
}

.game-cell.drag-over {
    background: #142840;
}

.bottom-tabs {
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.bottom-tab {
    color: var(--muted);
}

.bottom-tab.active {
    color: white;
}

.task-card {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

.task-card .progress-container {
    background: var(--border);
}

.task-card .progress-fill {
    background: linear-gradient(90deg, #34d399 0%, #10b981 100%);
}

.task-card.ad-card {
    background: linear-gradient(135deg, #1f1508 0%, #2b1c0a 100%);
    border: 1px solid #b7791f;
}

.ad-info {
    color: #f2c97a;
}

.gift-card {
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
}

.gift-roulette-item {
    color: var(--text);
}

.gift-spinner {
    color: var(--muted);
}

/* Нижнее меню */
.bottom-tabs {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 500px;
    display: flex;
    background: linear-gradient(135deg, #141a2a 0%, #1f2b44 50%, #2f3f64 100%);
    border-top: 1px solid rgba(104, 116, 232, 0.35);
    box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.35);
    z-index: 100;
    border-radius: 20px 20px 0 0;
}

.bottom-tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 5px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s;
    gap: 5px;
}

.bottom-tab-btn.active {
    color: #e0e7ff;
    text-shadow: 0 0 8px rgba(99,102,241,0.8);
}

.bottom-tab-btn:not(.active) {
    color: #9fb4ff;
}

.bottom-tab-icon {
    font-size: 24px;
}

.bottom-tab-label {
    font-size: 12px;
    font-weight: 600;
}

/* Контент вкладок */
.tab-content {
    display: none;
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow: hidden;
    position: relative;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.tab-content h2 {
    margin-bottom: 15px;
    color: #333;
    font-size: 20px;
    padding: 0 15px;
}

/* Отдельные страницы для вкладок Топ и История */
.page-content {
    display: flex;
    flex-direction: column;
    background: white;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.page-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

.page-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 80px; /* Место для нижнего меню */
}

/* Задания */
.tasks-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-card {
    background: #111827;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
    border: 1px solid rgba(255,255,255,0.06);
    color: #e5e7f1;
}

.task-title {
    font-weight: 700;
    font-size: 16px;
    color: #f8fafc;
    margin-bottom: 10px;
}

.task-card.ad-card .task-title {
    color: #111;
}

.task-progress {
    margin-bottom: 10px;
}

.task-progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    overflow: hidden;
}

.task-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    width: 0%;
}

.task-progress-text {
    margin-top: 6px;
    font-size: 12px;
    color: #cbd5e1;
}

.task-reward {
    font-weight: 700;
    color: #c7d2fe;
    margin-bottom: 12px;
}

.task-claim-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

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

.task-claim-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(67, 206, 162, 0.35);
}

/* Реклама за ману */
.task-card.ad-card {
    border: 1px solid #ffe2b5;
    background: linear-gradient(135deg, #fff7e6 0%, #fff1d6 100%);
}

.ad-info {
    color: #a05a00;
    font-size: 12px;
    margin-top: 6px;
}

.ad-countdown {
    font-weight: 700;
}

.ad-watch-btn {
    margin-top: 12px;
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #ffb347 0%, #ffcc33 100%);
    color: #5a3b00;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.ad-watch-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ad-watch-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 179, 71, 0.35);
}

/* Модалка рекламы */
.ad-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.ad-modal.hidden {
    display: none;
}

.ad-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}

.ad-modal-content {
    position: relative;
    width: 90%;
    max-width: 420px;
    aspect-ratio: 9 / 16;
    background: #000;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.ad-mock-video {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 20px;
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
}

.ad-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-close-btn.hidden {
    display: none;
}

/* Гифт-боксы */
.gifts-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gift-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gift-section-title {
    font-weight: 800;
    font-size: 18px;
    color: var(--text, #e5e7f1);
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.gift-row {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
}

.gift-row.scrollable {
    padding-bottom: 8px;
}

.gift-card {
    background: #111827;
    border-radius: 14px;
    padding: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 180px;
    max-width: 210px;
    flex: 0 0 auto;
}

.gift-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: linear-gradient(135deg, rgba(167,139,250,0.2) 0%, rgba(99,102,241,0.3) 100%);
    border: 1px solid rgba(167,139,250,0.35);
    border-radius: 12px;
    color: #e5e7f1;
    font-size: 13px;
    font-weight: 700;
}

.gift-card-media {
    position: relative;
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: #0f1724;
    aspect-ratio: 4 / 3;
}

.gift-card-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url('/assets/legendary-bg.png') center/cover no-repeat;
    opacity: 0.9;
}

.gift-card-img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    padding: 12px;
}

.gift-preview-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text, #e5e7f1);
    text-align: center;
}

.gift-preview-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.gift-preview-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    min-height: 140px;
    background: #0f1724;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 8px;
    gap: 8px;
}

.gift-preview-card.energy {
    background: #000;
    color: #fff;
}

.gift-preview-card.dollars {
    background: #0b1220;
    color: #b2f5ea;
    border: 1px solid rgba(16,185,129,0.4);
}

.gift-preview-media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f1724;
}

.gift-preview-media.legendary {
    background: linear-gradient(135deg, rgba(167,139,250,0.25) 0%, rgba(55,65,81,0.9) 100%);
    border: 1px solid rgba(167,139,250,0.4);
}

.gift-preview-media.legendary .gift-preview-bg {
    background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url('/assets/legendary-bg.png') center/cover no-repeat;
    opacity: 0.9;
}

.gift-preview-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.7);
}

.energy-media {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dollars-media {
    background: radial-gradient(circle at 30% 30%, rgba(16,185,129,0.35), rgba(11,18,32,0.95));
    display: flex;
    align-items: center;
    justify-content: center;
}

.gift-preview-img {
    position: relative;
    width: 75%;
    max-width: 120px;
    object-fit: contain;
    z-index: 1;
}

.gift-preview-label {
    text-align: center;
    font-weight: 700;
    color: #e5e7f1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    font-size: 13px;
    line-height: 1.3;
}

.gift-energy-icon {
    font-size: 40px;
}

.gift-preview-card.energy .gift-preview-label {
    color: #fff;
}

.gift-action-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}

.gift-action-btn.ghost {
    background: transparent;
    color: var(--text, #e5e7f1);
    border: 1px solid rgba(255,255,255,0.2);
}

.gift-card-header {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.gift-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffe2e2 0%, #ffcaca 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.gift-title {
    font-weight: 700;
    font-size: 16px;
}

.gift-sub {
    font-size: 12px;
    color: #777;
}

.gift-open-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: auto;
}

.gift-open-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.35);
}

.gift-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.gift-modal.hidden {
    display: none;
}

.gift-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
}

.gift-modal-content {
    position: relative;
    width: 90%;
    max-width: 420px;
    background: #0d0d0f;
    color: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.4);
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.gift-spinner {
    text-align: center;
    font-weight: 700;
    font-size: 18px;
}

.gift-roulette-item {
    display: flex;
    justify-content: center;
}

.gift-roulette-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    width: 180px;
    background: #0f1724;
    border: 1px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 8px;
}

.gift-roulette-card.energy {
    background: #000;
    color: #fff;
}

.gift-roulette-card.dollars {
    background: #0b1220;
    color: #b2f5ea;
    border: 1px solid rgba(16,185,129,0.4);
}

.gift-roulette-media {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0f1724;
}

.gift-roulette-media.legendary {
    background: linear-gradient(135deg, rgba(167,139,250,0.25) 0%, rgba(55,65,81,0.9) 100%);
    border: 1px solid rgba(167,139,250,0.4);
}

.gift-roulette-media.legendary .gift-roulette-bg {
    background: linear-gradient(rgba(0,0,0,0.55), rgba(0,0,0,0.55)), url('/assets/legendary-bg.png') center/cover no-repeat;
    opacity: 0.9;
}

.gift-dollar-icon {
    font-size: 28px;
    font-weight: 900;
    color: #34d399;
}

.gift-roulette-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: brightness(0.7);
}

.gift-roulette-img {
    position: relative;
    width: 75%;
    max-width: 120px;
    object-fit: contain;
    z-index: 1;
}

.gift-roulette-label {
    text-align: center;
    font-weight: 700;
    color: #e5e7f1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    font-size: 13px;
    line-height: 1.3;
}

.gift-roulette-wrapper {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.gift-roulette-highlight {
    position: absolute;
    inset: -6px;
    border-radius: 16px;
    border: 2px solid #a78bfa;
    box-shadow: 0 0 14px rgba(167,139,250,0.7), 0 0 22px rgba(99,102,241,0.4);
    pointer-events: none;
}

/* Level circle states */
.level-circle.clickable {
    cursor: pointer;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.level-circle.claimable {
    box-shadow: 0 0 16px rgba(167, 139, 250, 0.65), 0 0 28px rgba(99, 102, 241, 0.45);
    animation: levelPulse 1.2s ease-in-out infinite;
    transform: scale(1.05);
}

.level-reward-hint {
    position: absolute;
    top: -6px;
    left: 82px;
    background: #ffffff;
    color: #1f2937;
    padding: 10px 12px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    border: 1px solid #e5e7eb;
    font-size: 13px;
    line-height: 1.3;
    max-width: 230px;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 12;
}

.level-reward-hint.visible {
    opacity: 1;
    transform: translateY(0);
}

.legendary-hint {
    position: absolute;
    top: -6px;
    right: 0;
    left: 0;
    margin: 0 auto;
    max-width: 320px;
    background: #0f172a;
    color: #f8fafc;
    padding: 12px 14px;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 14px;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 15;
    cursor: pointer;
}

.legendary-hint.visible {
    opacity: 1;
    transform: translateY(0);
}

.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 999;
}

.onboarding-overlay.visible {
    opacity: 1;
}

.onboarding-card {
    background: #0b1224;
    color: #f8fafc;
    border-radius: 16px;
    padding: 18px 18px 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 360px;
    width: 100%;
}

.onboarding-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.onboarding-list {
    margin: 0 0 16px;
    padding-left: 18px;
    color: #e5e7eb;
    font-size: 14px;
    line-height: 1.4;
}

.onboarding-list li {
    margin-bottom: 8px;
}

.onboarding-close {
    width: 100%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.35);
}

.onboarding-close:active {
    transform: translateY(1px);
}

.create-hint {
    position: absolute;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%) translateY(6px);
    background: #0f172a;
    color: #f8fafc;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
    box-shadow: 0 10px 26px rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.12);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 20;
    pointer-events: none;
}

.create-hint::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 8px solid transparent;
    border-top-color: #0f172a;
}

.create-hint.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@keyframes levelPulse {
    0% { box-shadow: 0 0 10px rgba(167,139,250,0.35), 0 0 20px rgba(99,102,241,0.25); transform: scale(1.02); }
    50% { box-shadow: 0 0 20px rgba(167,139,250,0.75), 0 0 32px rgba(99,102,241,0.55); transform: scale(1.07); }
    100% { box-shadow: 0 0 10px rgba(167,139,250,0.35), 0 0 20px rgba(99,102,241,0.25); transform: scale(1.02); }
}

/* Levels page */
.levels-page .header h1 {
    font-size: 22px;
}

.levels-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0 16px 90px;
}

.levels-error {
    margin: 0 16px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.08);
    color: #fca5a5;
    font-size: 14px;
}

.levels-empty {
    text-align: center;
    color: #9ca3af;
    padding: 20px;
    font-size: 14px;
}

.level-card {
    background: #111827;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 14px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.level-card.available {
    border-color: rgba(102,126,234,0.6);
    box-shadow: 0 8px 24px rgba(102,126,234,0.28);
}

.level-card.claimed {
    opacity: 0.85;
}

.level-card-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.level-card-media {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.level-card-media img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.level-card-media.energy {
    font-size: 26px;
    color: #c4d6ff;
    background: radial-gradient(circle at 30% 30%, rgba(102,126,234,0.35), rgba(17,24,39,0.9));
    border: 1px solid rgba(102,126,234,0.35);
}

.level-card-media.legendary {
    background: linear-gradient(135deg, rgba(167,139,250,0.25) 0%, rgba(55,65,81,0.9) 100%);
    border: 1px solid rgba(167,139,250,0.4);
}

.level-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.level-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 20px;
    padding: 6px 12px;
    font-weight: 700;
    font-size: 13px;
}

.level-status {
    font-size: 12px;
    color: #9ca3af;
}

.level-card-title {
    font-size: 16px;
    font-weight: 700;
    color: #e5e7eb;
}

.level-card-desc {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 4px;
}

.level-card-reward {
    margin-top: 8px;
    font-weight: 700;
    color: #c4d6ff;
    font-size: 14px;
}

.level-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.btn-claim {
    padding: 10px 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.2s ease;
}

.btn-claim:active {
    transform: scale(0.98);
}

.btn-claim.disabled,
.btn-claim:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.level-claimed-tag {
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(67,217,173,0.12);
    color: #a7f3d0;
    font-weight: 700;
    font-size: 13px;
}

.gift-result {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.gift-result.hidden {
    display: none;
}

.gift-reward {
    font-size: 22px;
}

.gift-subtext {
    margin-top: 6px;
    font-size: 12px;
    color: #ccc;
}

.gift-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.gift-action-btn {
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #43cea2 0%, #185a9d 100%);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.gift-action-btn.ghost {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
}


/* Лидерборд */
.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    background: #f9f9f9;
    border-radius: 15px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.leaderboard-rank {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    min-width: 40px;
    text-align: center;
}

.leaderboard-rank.top {
    color: #f5576c;
}

.leaderboard-info {
    flex: 1;
}

.leaderboard-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
}

.leaderboard-stats {
    font-size: 14px;
    color: #666;
}

.leaderboard-level {
    font-size: 20px;
    font-weight: bold;
    color: #f5576c;
}

/* Логи */
.logs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.log-item {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 12px;
    font-size: 14px;
    border-left: 3px solid #667eea;
}

.log-type {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.log-details {
    color: #666;
    font-size: 12px;
}

.log-date {
    color: #999;
    font-size: 11px;
    margin-top: 5px;
}


/* Анимация появления предмета */
@keyframes itemAppear {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.game-item.new-item {
    animation: itemAppear 0.3s ease;
}

/* Разрешаем ландшафтный режим — ранее блокировался */

/* Адаптивность */
@media (max-width: 480px) {
    .container {
        border-radius: 0;
        min-height: 100vh;
    }
    
    .screen {
        min-height: 100vh;
        padding: 10px;
    }
    
    .game-field {
        gap: 5px;
        padding: 0;
        min-height: 250px;
    }
    
    .game-item {
        font-size: 24px;
    }
    
    .user-stats {
        gap: 10px;
    }
    
    .stat-item {
        padding: 6px 12px;
        font-size: 14px;
    }
}
