:root {
    --gold: #ffb703;
    --gold-light: #ffd54f;
    --green: #00c853;
    --green-bright: #00ff88;
    --green-dark: #0d2818;
    --green-panel: #142a1c;
    --bg-dark: #05060a;
    --card-dark: rgba(0, 0, 0, 0.35);
    --energy: #ffd54f;
    --coin: #00ff88;
    /* legacy aliases */
    --neon-purple: var(--gold);
    --light-purple: var(--green-panel);
    --btn-purple: var(--green-dark);
}

body {
    margin: 0; padding: 0;
    background: var(--bg-dark);
    color: #fff;
    font-family: 'Segoe UI', sans-serif;
    overflow-x: hidden;
}

.app-container {
    display: flex; flex-direction: column;
    min-height: 100vh; max-width: 480px; margin: 0 auto;
}

/* --- ШАПКА ПРОФІЛЮ --- */
.profile-header {
    margin: 10px 15px 0;
    padding: 12px 15px;
    background: var(--card-dark);
    border: 1px solid rgba(255, 183, 3, 0.3);
    border-radius: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tg-user { display: flex; align-items: center; gap: 10px; }

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 2px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 13px;
    font-weight: bold;
    color: var(--gold);
    flex-shrink: 0;
    cursor: pointer;
}

.settings-btn {
    background: var(--green-dark);
    border: 1px solid var(--gold);
    color: var(--gold);
    font-size: 16px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    line-height: 1;
}

.user-info-text {
    display: flex;
    flex-direction: column;
}

.user-info-text h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    color: #fff;
}

/* --- БАЛАНСИ --- */
.balance-section {
    padding: 10px 15px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.balance-box {
    border-radius: 10px;
    padding: 10px 8px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.balance-fuel {
    background: linear-gradient(135deg, var(--green-dark), rgba(255, 183, 3, 0.12));
    border: 1px solid rgba(255, 183, 3, 0.4);
}

.balance-cash {
    background: linear-gradient(135deg, var(--green-dark), rgba(0, 255, 136, 0.1));
    border: 1px solid rgba(0, 255, 136, 0.35);
}

.balance-emoji {
    font-size: 18px;
    line-height: 1;
}

.balance-value {
    font-size: 15px;
    font-weight: 900;
    line-height: 1;
}

.balance-fuel .balance-value { color: var(--gold); text-shadow: 0 0 8px rgba(255, 183, 3, 0.3); }
.balance-cash .balance-value { color: var(--green-bright); text-shadow: 0 0 8px rgba(0, 255, 136, 0.3); }

/* Контент */
.content { flex: 1; padding: 10px 15px 140px; }

/* Нижнє меню */
.bottom-nav-grid {
    position: fixed; bottom: 8px; left: 8px; right: 8px;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;
    padding: 8px;
    background: rgba(13, 40, 24, 0.95);
    border: 1px solid rgba(255, 183, 3, 0.4);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    z-index: 1000;
    max-width: 464px;
    margin: 0 auto;
}

.nav-btn {
    background: var(--green-dark);
    border: 1px solid rgba(0, 200, 83, 0.3);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 2px;
    gap: 3px;
    color: #fff;
    text-decoration: none;
    outline: none;
    cursor: pointer;
}

.nav-emoji { font-size: 16px; line-height: 1; }
.nav-btn span:not(.nav-emoji) { font-size: 8px; font-weight: 800; text-transform: uppercase; }
.nav-btn.active {
    background: linear-gradient(180deg, var(--gold), #e6a200);
    border-color: var(--gold-light);
    color: #000;
}

.page { display: none; }
.page.active { display: block; }

#user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Емодзі-іконки */
.icon-emoji {
    font-size: 14px;
    line-height: 1;
    display: inline-block;
    vertical-align: middle;
}

.icon-emoji-lg { font-size: 20px; }
.icon-emoji-sm { font-size: 12px; }

/* Контейнер списку (mini-list) */
.mini-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mini-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: rgba(0, 200, 83, 0.03);
    border: 1px solid rgba(255, 183, 3, 0.15);
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 0.85em;
    transition: 0.3s ease;
}

.mini-list-item:hover {
    background: rgba(0, 200, 83, 0.07);
    border-color: rgba(255, 183, 3, 0.3);
    transform: translateX(2px);
}

.mini-list-user {
    color: #efedff;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
}

.mini-list-amount {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.mini-list-amount.silver { color: var(--gold); text-shadow: 0 0 10px rgba(255, 183, 3, 0.2); }
.mini-list-amount.gold { color: var(--green-bright); text-shadow: 0 0 10px rgba(0, 255, 136, 0.2); }

.list-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 183, 3, 0.1);
    border: 1px solid rgba(255, 183, 3, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: var(--gold);
    flex-shrink: 0;
    text-transform: uppercase;
    box-shadow: 0 0 8px rgba(255, 183, 3, 0.2);
}

.user-with-avatar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

/* MINERS */
.miner-card {
	background: rgba(30, 30, 35, 0.6);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 16px;
	padding: 15px;
	position: relative;
	overflow: hidden;
	transition: 0.3s;
}

.glow-effect {
	position: absolute;
	top: -50px;
	left: -50px;
	width: 100px;
	height: 100px;
	filter: blur(40px);
	border-radius: 50%;
	pointer-events: none;
}

.miner-main-block {
	display: flex;
	gap: 15px;
	margin-bottom: 15px;
	position: relative;
	z-index: 1;
	align-items: stretch;
}

.miner-image-wrapper {
	flex: 0 0 40%;
	aspect-ratio: 1 / 1;
	background: rgba(0,0,0,0.3);
	border-radius: 12px;
	border: 1px solid;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
}

.miner-image-wrapper img {
	width: 80%;
	height: 80%;
	object-fit: contain;
}

.miner-info-side {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}

.miner-name {
	margin: 0;
	color: #fff;
	font-size: 1.05em;
	letter-spacing: 0.5px;
	text-transform: uppercase;
}

.miner-stats {
	font-size: 0.75em;
	font-weight: bold;
	display: flex;
	flex-direction: column;
	gap: 2px;
	margin-top: 2px;
}

.price-tag {
	display: flex;
	align-items: center;
	gap: 4px;
	color: rgba(255,255,255,0.8);
}

.owned-badge {
	text-align: right;
	background: rgba(0,0,0,0.2);
	padding: 4px 8px;
	border-radius: 8px;
	border: 1px solid rgba(255,255,255,0.05);
}
.owned-badge span {
	font-size: 0.6em;
	color: rgba(255,255,255,0.4);
	letter-spacing: 1px;
}
.owned-badge strong {
	font-size: 1.1em;
	color: #fff;
}

.collection-section {
	background: rgba(0,0,0,0.2);
	padding: 12px;
	border-radius: 12px;
	border: 1px solid rgba(255,255,255,0.03);
	margin-bottom: 15px;
}

.collection-header {
	display: flex;
	justify-content: space-between;
	font-size: 0.75em;
	margin-bottom: 8px;
	align-items: center;
}

.energy-label {
	display: flex;
	align-items: center;
	gap: 5px;
	color: var(--energy);
	font-weight: 800;
	text-transform: uppercase;
}

.progress-container {
	width: 100%;
	height: 8px;
	background: rgba(255,255,255,0.05);
	border-radius: 4px;
	overflow: hidden;
	border: 1px solid rgba(255,255,255,0.05);
}

.miner-controls {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.game-btn {
	border: 1px solid rgba(255,255,255,0.1);
	border-radius: 8px;
	color: #fff;
	font-size: 0.75em;
	font-weight: 800;
	cursor: pointer;
	transition: 0.2s;
	background: rgba(255,255,255,0.05);
	text-transform: uppercase;
	padding: 8px 0;
}
.game-btn:active { transform: scale(0.96); }

.btn-buy-gray { border-color: rgba(160, 160, 170, 0.4); background: rgba(160, 160, 170, 0.1); }
.btn-buy-purple { border-color: var(--gold); background: rgba(255, 183, 3, 0.1); }
.btn-buy-gold { border-color: var(--gold); background: rgba(255, 215, 0, 0.1); color: var(--gold); }

.btn-refill { border-color: var(--energy); color: var(--energy); }
.btn-collect { border-color: #00ffa3; color: #00ffa3; }

.btn-start {
    border-color: #ff4b2b !important;
    color: #ff4b2b !important;
}

.animated-tank {
	position: relative;
	transition: width 0.5s ease-in-out;
	height: 100%;
}
.animated-tank::after {
	content: '';
	position: absolute;
	top: 0; left: 0; right: 0; bottom: 0;
	background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
	animation: energy-shimmer 2s infinite linear;
}
@keyframes energy-shimmer {
	0% { transform: translateX(-100%); }
	100% { transform: translateX(100%); }
}

#refill-input:focus {
    border-color: var(--gold) !important;
    box-shadow: 0 0 10px rgba(255, 183, 3, 0.4);
    background: rgba(255, 183, 3, 0.05) !important;
}

.modal-overlay {
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    animation: slideUp 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.game-info-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(90deg, rgba(255, 183, 3, 0.08) 0%, rgba(30, 30, 35, 0.4) 100%);
    border: 1px solid rgba(255, 183, 3, 0.2);
    border-left: 4px solid var(--gold);
    border-radius: 14px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.game-info-banner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 10% 50%, rgba(255, 183, 3, 0.1), transparent 70%);
    pointer-events: none;
}

.info-icon-wrapper {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    background: rgba(255, 183, 3, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-size: 18px;
    animation: icon-pulse 2s infinite ease-in-out;
}

.info-text-content p {
    font-size: 0.85em;
    color: rgba(239, 237, 255, 0.8);
    line-height: 1.5;
    margin: 0;
    font-weight: 500;
}

@keyframes icon-pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

/* TASKS */
.top-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    gap: 4px;
}

.tab-item {
    flex: 1;
    padding: 10px 5px;
    text-align: center;
    font-size: 0.75em;
    font-weight: 700;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.5);
    background: transparent;
    border: 1px solid transparent;
    transition: 0.2s;
}

.active-tab {
    background: var(--gold) !important;
    color: #000 !important;
    border: 1px solid var(--gold-light) !important;
}

.pulsate-tab {
    animation: textPulsate 1.5s infinite ease-in-out;
}
@keyframes textPulsate {
    0% { opacity: 1; }
    50% { color: #fffb00; opacity: 0.8; }
    100% { opacity: 1; }
}

.internal-tasks-container {
	--accent: var(--gold);
	--accent-dim: rgba(255, 183, 3, 0.1);
	--bg-card: rgba(255, 255, 255, 0.03);
	--border-color: rgba(255, 255, 255, 0.1);
	--text-dim: rgba(255, 255, 255, 0.5);
	--success: #00ff88;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.task-card-manage {
	background: rgba(30, 30, 35, 0.7) !important;
	border: 1px solid var(--border-color) !important;
	border-radius: 16px;
	padding: 15px;
	transition: 0.3s;
}

.mini-ctrl-btn {
	flex: 1;
	padding: 10px 5px;
	border-radius: 10px;
	font-size: 0.75em;
	font-weight: 800;
	text-transform: uppercase;
	border: 1px solid var(--border-color);
	background: rgba(255, 255, 255, 0.05);
	color: #fff;
	cursor: pointer;
	transition: 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
}
.mini-ctrl-btn:active { transform: scale(0.95); }
.mini-ctrl-btn.deposit { border-color: var(--accent); color: var(--accent); }
.mini-ctrl-btn.pause { border-color: #ffb703; color: #ffb703; }
.mini-ctrl-btn.delete { border-color: #ff4d6d; color: #ff4d6d; }

.ios-input {
	width: 100%;
	background: rgba(255, 255, 255, 0.05) !important;
	border: 1px solid var(--border-color) !important;
	border-radius: 12px !important;
	padding: 12px 15px !important;
	color: white !important;
	outline: none;
	box-sizing: border-box;
	transition: 0.2s;
}
.ios-input:focus { border-color: var(--accent) !important; background: rgba(255, 255, 255, 0.08) !important; }

.task-type-card input[type="radio"] { display: none; }
.task-type-card .card-content {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px;
	background: var(--bg-card);
	border: 1px solid var(--border-color);
	border-radius: 12px;
	cursor: pointer;
	transition: 0.2s;
}
.task-type-card input:checked + .card-content {
	border-color: var(--accent);
	background: var(--accent-dim);
}
.task-type-card .title { font-weight: bold; font-size: 0.9em; }
.task-type-card .desc { font-size: 0.7em; color: var(--text-dim); }

.method-chip input { display: none; }
.method-chip span {
	padding: 8px 15px;
	background: var(--bg-card);
	border-radius: 20px;
	font-size: 0.8em;
	border: 1px solid var(--border-color);
	cursor: pointer;
	color: var(--text-dim);
	display: inline-block;
	transition: 0.2s;
}
.method-chip input:checked + span {
	border-color: var(--accent);
	color: var(--accent);
	background: var(--accent-dim);
}

@keyframes fadeIn {
	from { opacity: 0; transform: translateY(8px); }
	to { opacity: 1; transform: translateY(0); }
}
.animate-field { animation: fadeIn 0.3s ease forwards; }

.ios-share-btn-green {
	background: var(--gold) !important;
	border: none !important;
	border-radius: 12px !important;
	color: #000 !important;
	font-weight: bold !important;
	cursor: pointer;
	transition: 0.2s;
}
.ios-share-btn-green:active { opacity: 0.8; transform: scale(0.98); }

/* Select arrow via emoji */
.select-wrap { position: relative; }
.select-arrow {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 10px;
    color: var(--gold);
}

.input-with-icon { position: relative; }
.input-icon-left {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    pointer-events: none;
}



.lang-btn {
	background: var(--btn-purple);
	border: 1px solid var(--neon-purple);
	color: #fff;
	padding: 6px 12px;
	border-radius: 8px;
	font-size: 0.8em;
	display: flex;
	align-items: center;
	gap: 6px;
	cursor: pointer;
	transition: 0.3s;
}
.lang-btn:active { transform: scale(0.95); opacity: 0.8; }
.lang-btn img { width: 18px; height: 12px; border-radius: 2px; }
#goog-gt-tt, .goog-te-banner-frame, .skiptranslate { display: none !important; }
body { top: 0 !important; }

.hero-header {
    position: relative;
    width: 100%;
    border-radius: 0 0 24px 24px;
    overflow: hidden;
    margin-bottom: 10px;
}

.hero-bg-img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    object-position: center;
    display: block;
    filter: brightness(0.6);
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.1) 0%,
        rgba(20,10,40,0.7) 100%
    );
}

.hero-content {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px 15px 12px;
}

.hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.race-info-banner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(110deg, rgba(255, 100, 0, 0.15) 0%, rgba(255, 183, 3, 0.08) 60%, transparent 100%);
    border: 1px solid rgba(255, 140, 0, 0.35);
    border-left: 4px solid #ff6400;
    border-radius: 14px;
    padding: 14px 14px 14px 16px;
    margin-bottom: 10px;
    overflow: hidden;
}

.race-info-banner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 18px,
        rgba(255, 140, 0, 0.04) 18px,
        rgba(255, 140, 0, 0.04) 20px
    );
    pointer-events: none;
}

.race-banner-flag {
    font-size: 26px;
    flex-shrink: 0;
    filter: drop-shadow(0 0 8px rgba(255, 140, 0, 0.6));
    animation: flag-wave 1.8s infinite ease-in-out;
}

@keyframes flag-wave {
    0%   { transform: rotate(-5deg) scale(1); }
    50%  { transform: rotate(5deg) scale(1.1); }
    100% { transform: rotate(-5deg) scale(1); }
}

.race-banner-body {
    flex: 1;
    position: relative;
    z-index: 1;
}

.race-banner-title {
    font-size: 0.7em;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #ff8c00;
    margin-bottom: 5px;
}

.race-banner-text {
    font-size: 0.82em;
    color: rgba(255, 235, 200, 0.85);
    line-height: 1.5;
    margin: 0;
    font-weight: 500;
}

.race-banner-speed-lines {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 5px;
    opacity: 0.2;
}

.race-banner-speed-lines span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, #ff8c00);
    animation: speed-line 1.5s infinite ease-in-out;
}

.race-banner-speed-lines span:nth-child(1) { width: 30px; animation-delay: 0s; }
.race-banner-speed-lines span:nth-child(2) { width: 20px; animation-delay: 0.2s; }
.race-banner-speed-lines span:nth-child(3) { width: 25px; animation-delay: 0.4s; }

@keyframes speed-line {
    0%   { transform: translateX(0); opacity: 0.2; }
    50%  { transform: translateX(-5px); opacity: 0.5; }
    100% { transform: translateX(0); opacity: 0.2; }
}

#splash-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.5s ease;
}

#splash-screen.hide {
    opacity: 0;
    pointer-events: none;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
}

.splash-road {
    position: absolute;
    bottom: -30px;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 20px;
    box-sizing: border-box;
}

.road-line {
    height: 3px;
    background: linear-gradient(90deg, 
        transparent 0%, 
        rgba(255,183,3,0.3) 20%, 
        rgba(255,183,3,0.3) 80%, 
        transparent 100%
    );
    animation: road-move 0.4s linear infinite;
}

@keyframes road-move {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-40px); }
}

.splash-car {
    font-size: 80px;
    animation: car-shake 0.15s infinite alternate;
    filter: drop-shadow(0 0 20px rgba(255,183,3,0.5));
    margin-bottom: 10px;
}

@keyframes car-shake {
    0%   { transform: translateY(0px) rotate(-1deg); }
    100% { transform: translateY(-4px) rotate(1deg); }
}

.splash-money {
    position: absolute;
    bottom: 110px; /* під машинкою */
    left: 60%;
    transform: translateX(-50%);
    width: 200px;
    height: 80px;
    pointer-events: none;
}

.money-particle {
    position: absolute;
    font-size: 20px;
    animation: money-fly 1s ease-out forwards;
    bottom: 0;
}

@keyframes money-fly {
    0%   { transform: translate(0, 0) rotate(0deg); opacity: 1; }
    100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; }
}

.splash-title {
    font-size: 2em;
    font-weight: 900;
    background: linear-gradient(90deg, #ffb703, #00ff88);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 3px;
    margin-top: 20px;
    margin-bottom: 25px;
}

.splash-loader {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    overflow: hidden;
}

.splash-loader-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffb703, #00ff88);
    border-radius: 2px;
    animation: loader-fill 2s ease forwards;
}

@keyframes loader-fill {
    0%   { width: 0%; }
    100% { width: 100%; }
}