:root {
    --bg-main: #06070d;
    --bg-card: rgba(20, 22, 37, 0.6);
    --border-color: rgba(255, 255, 255, 0.06);
    --text-primary: #f1f2f6;
    --text-secondary: #8f92a1;
    
    /* Сучасні неонові акценти з правильним свіченням */
    --accent-orange: #ff9f43;
    --accent-orange-glow: rgba(255, 159, 67, 0.25);
    
    --accent-cyan: #00d2ff;
    --accent-cyan-glow: rgba(0, 210, 255, 0.3);
    
    --accent-red: #ff4757;
    --accent-red-glow: rgba(255, 71, 87, 0.4);
    
    --accent-green: #2ed573;
    --accent-green-glow: rgba(46, 213, 115, 0.25);
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    margin: 0;
    padding: 12px 16px;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    box-sizing: border-box;
}

.container {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Заголовок */
h1 {
    color: #ffffff;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 2px;
    margin: 5px 0 10px 0;
    text-align: center;
    text-transform: uppercase;
    background: linear-gradient(90deg, #ffffff, var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Картки */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 20px 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    box-sizing: border-box;
}

h2 {
    color: #ffffff;
    font-size: 18px;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
}

p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 15px;
}

/* Баланс */
.balance-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #ffffff;
    padding: 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

#summons-balance {
    color: var(--accent-cyan);
    font-weight: 800;
}

/* Кнопки */
button {
    color: #ffffff;
    border: none;
    border-radius: 14px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
    letter-spacing: 0.3px;
    margin-top: 8px;
}

#btn-buy-scroll {
    background: var(--accent-orange);
    box-shadow: 0 4px 15px var(--accent-orange-glow);
}

#btn-use-scroll, #btn-fight, #btn-back-to-menu {
    background: var(--accent-cyan);
    color: #06070d;
    box-shadow: 0 4px 15px var(--accent-cyan-glow);
}

button:active {
    transform: scale(0.98);
    opacity: 0.85;
}

/* ОПТИМІЗАЦІЯ: Обмеження розміру великого аватара монстра */
.monster-avatar-container {
    margin: 15px 0;
    display: flex;
    justify-content: center;
}

#monster-avatar {
    width: 160px;          /* Фіксована компактна ширина */
    height: 160px;         /* Фіксована висота */
    object-fit: cover;     /* Акуратне обрізання, якщо пропорції інші */
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Список навичок */
.skills-box {
    background: rgba(0, 0, 0, 0.25);
    border-left: 3px solid var(--accent-orange);
    padding: 12px;
    border-radius: 10px;
    text-align: left;
    margin: 15px 0;
}

.skills-box h4 {
    margin: 0 0 8px 0;
    color: #ffffff;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.skills-box p {
    margin: 4px 0;
    font-size: 13px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats {
    font-size: 12px;
    margin-bottom: 15px;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: 0.3px;
    text-align: center;
}

/* Арена бою */
.vs-title {
    font-size: 16px;
    letter-spacing: 2px;
    color: var(--text-secondary);
    text-align: center;
}

.vs-display-container {
    margin: 15px 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 14px 8px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
    gap: 4px;
}

/* Компактні круглі аватарки на Арені */
.arena-fighter {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 40%;
    text-align: center;
}

.arena-fighter img {
    width: 60px;           /* Зменшено з 76px */
    height: 60px;          /* Зменшено з 76px */
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.02);
}

.arena-fighter span {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.2;
}

.vs-neon {
    color: var(--accent-red);
    font-size: 18px;
    font-weight: 900;
    text-shadow: 0 0 10px var(--accent-red-glow);
    font-style: italic;
    width: 20%;
    text-align: center;
    flex-shrink: 0;
}

/* Лог битви */
.battle-log-box {
    background: #020306;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    padding: 12px;
    min-height: 160px;     /* Зменшено висоту терміналу */
    max-height: 240px;
    overflow-y: auto;
    text-align: left;
    margin-bottom: 15px;
}

.battle-log-box::-webkit-scrollbar {
    width: 4px;
}
.battle-log-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.round-text {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding: 8px 0;
    font-size: 12.5px;
    line-height: 1.5;
    color: #d1d2d6;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.round-text b {
    color: var(--accent-cyan);
}

/* Результати */
.result-box {
    padding: 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.4;
    text-align: center;
}

.win { 
    background: rgba(46, 213, 115, 0.1); 
    color: var(--accent-green); 
    border: 1px solid rgba(46, 213, 115, 0.2);
}

.lose { 
    background: rgba(255, 71, 87, 0.1); 
    color: var(--accent-red); 
    border: 1px solid rgba(255, 71, 87, 0.2);
}

/* Лоадер */
#battle-loader h2 {
    color: var(--accent-orange);
    text-shadow: 0 0 10px var(--accent-orange-glow);
    animation: pulseGlow 2s infinite ease-in-out;
    text-align: center;
    font-size: 16px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.8; text-shadow: 0 0 8px var(--accent-orange-glow); }
    50% { opacity: 1; text-shadow: 0 0 20px rgba(255, 159, 67, 0.5); }
}

/* Відступ знизу, щоб нижня панель навігації не перекривала контент */
body {
    padding-bottom: 90px !important;
}

/* Контейнери табів */
.tab-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Нижня панель навігації */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 440px;
    height: 70px;
    background: rgba(10, 11, 22, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    box-sizing: border-box;
    padding: 0 10px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.5;
    color: var(--text-secondary);
}

.nav-item.active {
    opacity: 1;
    color: var(--accent-cyan);
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.nav-text {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Стилі для екрана профілю */
.ton-balance-container {
    background: linear-gradient(135deg, rgba(0, 210, 255, 0.1), rgba(6, 7, 13, 0.4));
    border: 1px solid rgba(0, 210, 255, 0.2);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    margin: 20px 0 15px 0;
}

.ton-title {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.ton-value {
    font-size: 32px;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 15px var(--accent-cyan-glow);
}

.payout-notice {
    background: rgba(255, 159, 67, 0.05);
    border: 1px solid rgba(255, 159, 67, 0.15);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 12px;
    color: #f1f2f6;
    line-height: 1.5;
    margin-bottom: 20px;
    text-align: left;
}