:root {
    --bg-color: #0d0c12;
    --primary-glow: rgba(0, 119, 255, 0.4);
    --text-color: #ffffff;
    --text-secondary: #8e8e93;
    --glass-bg: rgba(28, 28, 30, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-color: #007aff;
    --success-color: #34c759;
    --error-color: #ff3b30;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0; padding: 0; background: var(--bg-color); color: var(--text-color); overflow: hidden;
    height: 100vh; width: 100vw; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent;
}

/* --- Динамический и Реактивный фон --- */
.background-animation { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; background: linear-gradient(315deg, #4c00ff, #002661, #2f004b); background-size: 400% 400%; animation: animate-background 20s ease infinite; }
.background-animation::before { content: ''; position: absolute; top: 50%; left: 50%; width: 1px; height: 1px; background: white; border-radius: 50%; box-shadow: 0 0 400px 200px rgba(255, 255, 255, 0.3); opacity: 0; transition: opacity 0.5s ease-out; }
.background-animation.pulse::before { animation: bg-pulse 0.5s ease-out forwards; }
@keyframes animate-background { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes bg-pulse { from { transform: translate(-50%, -50%) scale(0); opacity: 1; } to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }

/* --- Загрузчик --- */
#loader { display: flex; justify-content: center; align-items: center; height: 100%; }
.spinner { border: 4px solid rgba(255, 255, 255, 0.2); border-left-color: var(--accent-color); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Основной контейнер --- */
.hidden { display: none !important; }
#app-container { display: flex; flex-direction: column; height: 100vh; box-sizing: border-box; opacity: 0; transform: scale(1.2); transition: opacity 0.7s ease-out, transform 0.7s ease-out, filter 0.4s ease-out; }
#app-container.visible { opacity: 1; transform: scale(1); }
#app-container.focused-out { transform: scale(0.95); filter: blur(4px); pointer-events: none; }
.main-content { padding: 25px 20px 0; z-index: 1; }

/* --- Верхняя часть (счет) --- */
.header { text-align: center; width: 100%; margin-bottom: 20px; }
.score-title { font-size: 14px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0.5px; margin-bottom: 5px; }
.score-display { display: flex; justify-content: center; align-items: center; font-size: 48px; font-weight: 900; line-height: 1; font-family: 'Orbitron', sans-serif; }
#score-value { transition: transform 0.1s ease-out; display: inline-block; }
#score-value.updated { transform: scale(1.1); }
.coin-icon { width: 32px; height: 32px; background: linear-gradient(135deg, #f1c40f, #f39c12); border-radius: 50%; margin-left: 12px; box-shadow: 0 0 10px #f1c40f; }

/* --- Кнопки действий --- */
.actions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; margin-bottom: 30px; }
.action-btn { background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 18px; padding: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-color); font-size: 14px; font-weight: 500; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); cursor: pointer; transition: background 0.2s, transform 0.1s; position: relative; overflow: hidden; }
.visible .action-btn { animation: fly-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; opacity: 0; }
.visible .action-btn:nth-child(1) { animation-delay: 0.1s; }
.visible .action-btn:nth-child(2) { animation-delay: 0.2s; }
.visible .action-btn:nth-child(3) { animation-delay: 0.3s; }
@keyframes fly-in { from { opacity: 0; transform: translateY(20px) scale(0.8); } to { opacity: 1; transform: translateY(0) scale(1); } }
.action-btn:active { transform: scale(0.96); background: rgba(255, 255, 255, 0.1); }
.icon-wrapper { width: 32px; height: 32px; margin-bottom: 8px; display: flex; align-items: center; justify-content: center; transition: transform 0.2s ease-out; }
.icon-wrapper svg { width: 100%; height: 100%; fill: currentColor; filter: drop-shadow(0 0 5px rgba(0, 190, 255, 0.7)); }
.action-btn:active .icon-wrapper { transform: scale(1.2) rotate(10deg); }

/* --- Секция "Автоматически" --- */
.auto-section { width: 100%; }
.section-title { font-size: 13px; color: var(--text-secondary); font-weight: 500; display: block; margin-bottom: 10px; }
.boost-btn { width: 100%; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 12px; padding: 15px; font-size: 16px; font-weight: 700; color: var(--accent-color); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-lightning { margin-right: 10px; }

/* --- Зона Тапа --- */
.tapper-zone { flex-grow: 1; display: flex; justify-content: center; align-items: center; position: relative; z-index: 1; }
#tapper-coin { width: 280px; height: 280px; background: radial-gradient(circle, #5b21b6 0%, #1e1b4b 70%); border-radius: 50%; cursor: pointer; box-shadow: 0 0 20px rgba(91, 33, 182, 0.5), 0 0 40px rgba(91, 33, 182, 0.3), inset 0 0 15px rgba(255, 255, 255, 0.1); border: 2px solid var(--glass-border); transform-origin: center center; transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1); position: relative; overflow: hidden; }
#tapper-coin.pressed { animation: coin-press 0.2s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
@keyframes coin-press { 0% { transform: scale(1); } 50% { transform: scale(0.92) rotateY(5deg); } 100% { transform: scale(1); } }

/* --- Эффекты --- */
.particle { position: absolute; width: 8px; height: 8px; background: radial-gradient(circle, #ffffff 0%, rgba(255, 255, 255, 0) 70%); border-radius: 50%; pointer-events: none; animation: particle-fly-out 0.8s ease-out forwards; }
@keyframes particle-fly-out { from { transform: translate(0, 0) scale(1); opacity: 1; } to { transform: translate(var(--x), var(--y)) scale(0); opacity: 0; } }
#plus-one-container { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; }
.plus-one-animation { position: absolute; font-size: 42px; font-weight: 900; color: white; text-shadow: 0 0 10px var(--primary-glow); animation: floatUp 1.5s ease-out forwards; }
@keyframes floatUp { from { transform: translateY(0) scale(1); opacity: 1; } to { transform: translateY(-150px) scale(0.8); opacity: 0; } }

/* --- Модальное окно --- */
.modal { position: fixed; z-index: 100; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(5px); display: flex; justify-content: center; align-items: center; }
.modal-content { background: var(--glass-bg); border: 1px solid var(--glass-border); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 20px; padding: 25px; width: 85%; max-width: 400px; position: relative; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }
#close-modal { position: absolute; top: 10px; right: 20px; font-size: 32px; color: var(--text-secondary); cursor: pointer; }
#leaderboard-list p { padding: 8px 0; border-bottom: 1px solid var(--glass-border); }
#leaderboard-list p:last-child { border-bottom: none; }

/* --- Всплывающая панель --- */
.bottom-sheet { position: fixed; bottom: 0; left: 0; width: 100%; background: var(--glass-bg); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px); border-top: 1px solid var(--glass-border); border-top-left-radius: 20px; border-top-right-radius: 20px; padding: 20px; box-sizing: border-box; z-index: 101; transform: translateY(100%); transition: transform 0.4s ease-out; }
.bottom-sheet.visible { transform: translateY(0); }
.sheet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.sheet-header h3 { margin: 0; font-size: 20px; font-weight: 700; font-family: 'Orbitron', sans-serif; }
.sheet-content input { width: 100%; padding: 15px; margin-bottom: 15px; border-radius: 12px; border: 1px solid var(--glass-border); background: rgba(0,0,0,0.2); color: var(--text-color); font-size: 16px; box-sizing: border-box; }
.sheet-content input::placeholder { color: var(--text-secondary); }
.sheet-action-btn { width: 100%; padding: 15px; border-radius: 12px; border: none; background: var(--accent-color); color: var(--text-color); font-size: 18px; font-weight: 700; cursor: pointer; display: flex; justify-content: center; align-items: center; min-height: 54px; }
.btn-loader { border: 3px solid rgba(255, 255, 255, 0.3); border-left-color: #fff; border-radius: 50%; width: 24px; height: 24px; animation: spin 1s linear infinite; }

/* --- Уведомления --- */
#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.toast { padding: 12px 20px; border-radius: 12px; color: #fff; font-weight: 500; box-shadow: 0 5px 15px rgba(0,0,0,0.2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border: 1px solid var(--glass-border); animation: slide-in 0.5s ease-out forwards, fade-out 0.5s ease-in 3.5s forwards; }
.toast.success { background: rgba(52, 199, 89, 0.7); }
.toast.error { background: rgba(255, 59, 48, 0.7); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fade-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-20px); } }