:root {
    /* --- СВЕТЛАЯ ТЕМА --- */
    --bg-app: #f0f0f0;
    --bg-card: #ffffff;
    --bg-element: #f7f7f7;
    --text-main: #000000;
    --text-hint: #8e8e93;
    --accent: #3390ec;
    --accent-text: #ffffff;
    --border-color: rgba(0, 0, 0, 0.08);
    --heart-color: #ff3b30;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.08);
}

/* --- ТЕМНАЯ ТЕМА --- */
[data-theme="dark"] {
    --bg-app: #000000;
    --bg-card: #141414;
    --bg-element: #262626;
    --text-main: #ffffff;
    --text-hint: #888888;
    --accent: #e1e1e1;
    --accent-text: #000000;
    --border-color: #333333;
    --heart-color: #ff453a;
    --shadow-card: none;
}

html {
    scroll-snap-type: y proximity;
    -webkit-tap-highlight-color: transparent;
}

body {
    margin: 0; padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    background-color: var(--bg-app);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.no-scroll { overflow: hidden; height: 100vh; }

.container {
    padding: 12px; max-width: 600px; margin: 0 auto; padding-bottom: 80px;
}

/* --- UI ELEMENTS --- */
.card, .tab-btn, .filter-chip, .play-btn, .download-btn, .icon-btn, .like-button, .get-btn {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transform: translate3d(0,0,0);
    transition: transform 0.15s ease-out, background-color 0.2s, opacity 0.2s;
}

.card:active, .tab-btn:active, .filter-chip:active, .download-btn:active, .icon-btn:active, .card.is-pressed {
    transform: scale(0.99) !important;
    transition-duration: 0.05s;
}

/* --- HEADER & SEARCH --- */
.top-bar {
    position: sticky; top: 0; z-index: 20;
    background-color: var(--bg-app);
    padding: 10px 0 5px 0;
    transition: background-color 0.3s ease;
}

.search-wrapper {
    position: relative; width: 100%; margin-bottom: 12px; display: flex; align-items: center;
}

.search-input {
    width: 100%; padding: 12px 40px 12px 16px;
    font-size: 16px; border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-main);
    outline: none; box-shadow: var(--shadow-card);
}
.search-input::placeholder { color: var(--text-hint); }
.search-input:focus { border-color: var(--accent); }

.search-clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; padding: 8px;
    color: var(--text-hint); font-size: 18px; line-height: 1;
    cursor: pointer; display: none; z-index: 5;
}
.search-clear.visible { display: block; }

/* --- TABS & FILTERS --- */
.engine-tabs {
    display: flex; background-color: var(--bg-element);
    padding: 3px; border-radius: 12px; margin-bottom: 12px;
}
.tab-btn {
    flex: 1; border: 1px solid transparent; background: none; padding: 8px;
    font-size: 13px; font-weight: 600; border-radius: 8px;
    color: var(--text-hint);
}
.tab-btn.active {
    background-color: var(--bg-card); color: var(--text-main);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); border-color: var(--border-color);
}
[data-theme="dark"] .tab-btn.active { color: #fff; }

/* AI Tab Specifics */
.tab-btn[onclick*="'ai'"].active {
    background-color: var(--bg-card); color: #007aff;
    text-shadow: 0 0 12px rgba(0, 122, 255, 0.5);
    border-color: rgba(0, 122, 255, 0.2);
}
[data-theme="dark"] .tab-btn[onclick*="'ai'"].active {
    color: #60a5fa;
    text-shadow: 0 0 12px rgba(96, 165, 250, 0.6);
    border-color: rgba(96, 165, 250, 0.3);
}

.filter-scroll {
    overflow-x: auto; white-space: nowrap; padding-bottom: 4px; margin-bottom: 8px;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
    mask-image: linear-gradient(to right, transparent, black 10px, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10px, black 90%, transparent);
    padding-left: 10px; padding-right: 10px;
}
.filter-scroll::-webkit-scrollbar { display: none; }

.filter-chip {
    display: inline-block; padding: 8px 16px; background-color: var(--bg-card);
    border-radius: 20px; font-size: 13px; font-weight: 600;
    color: var(--text-main); margin-right: 8px; border: 1px solid var(--border-color);
}
.filter-chip.active {
    background-color: var(--accent); color: var(--accent-text); border-color: var(--accent);
}

/* --- CONTROLS --- */
.controls-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sort-container { flex: 1; display: flex; align-items: center; margin-right: 10px; }
.sort-select {
    background-color: var(--bg-card); color: var(--text-main);
    border: 1px solid var(--border-color); padding: 8px 12px; border-radius: 10px;
    font-size: 13px; font-weight: 500; outline: none; flex: 1;
}

.icon-btn {
    background: var(--bg-card); border: 1px solid var(--border-color);
    padding: 8px; border-radius: 10px; color: var(--text-hint);
    display: flex; align-items: center; justify-content: center;
    margin-left: 8px; width: 40px; height: 40px;
}
.icon-btn.active { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* --- GRID & CARDS --- */
.grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.card {
    position: relative; background-color: var(--bg-card);
    border-radius: 18px; overflow: hidden; display: flex; flex-direction: column;
    border: 1px solid var(--border-color); box-shadow: var(--shadow-card);
    padding: 12px; scroll-snap-align: start; scroll-margin-top: 140px;
}
.card.is-legacy { opacity: 0.6; filter: grayscale(100%); transition: 0.3s; }
.card.is-legacy:active { opacity: 0.9; filter: grayscale(50%); transform: scale(0.97); }

/* Animation */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.card.animate-in { opacity: 0; animation: fadeInUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; }

.card-top-controls {
    position: absolute; top: 12px; right: 12px; display: flex; align-items: center; gap: 8px; z-index: 5;
}

/* Badges */
.badge {
    font-size: 10px; font-weight: 800; padding: 4px 6px; border-radius: 6px;
    color: white; text-transform: uppercase; height: 16px; line-height: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.badge-new { background: #34c759; animation: pulse-green 2s infinite; }
.badge-hot { background: #ff9500; }
.badge-beta { background: #ffcc00; color: #000; }
.badge-legacy { background: #505055; }
.badge-stable { background: #2196F3; box-shadow: 0 2px 5px rgba(33, 150, 243, 0.3); }

@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(52, 199, 89, 0); }
    100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}

.like-button {
    background: var(--bg-element); border: none; padding: 0;
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: var(--text-hint);
}
.like-button.active { color: var(--heart-color); background: rgba(255, 59, 48, 0.15); }
.like-button svg { width: 16px; height: 16px; fill: currentColor; }

/* Card Content */
.card-header { display: flex; flex-direction: row; margin-bottom: 12px; padding-right: 110px; }
.card-image {
    width: 70px; height: 70px; border-radius: 14px; object-fit: cover;
    background-color: var(--bg-element); flex-shrink: 0; margin-right: 14px;
    border: 1px solid var(--border-color); opacity: 0; transition: opacity 0.3s;
}
.card-image.loaded { opacity: 1; }

.card-info { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.card-title {
    font-size: 17px; font-weight: 700; margin: 0 0 4px 0; color: var(--text-main);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.mini-tag {
    font-size: 10px; background-color: var(--bg-element); color: var(--text-hint);
    padding: 2px 6px; border-radius: 4px; font-weight: 700; text-transform: uppercase;
}
.card-meta { font-size: 11px; color: var(--accent); font-weight: 600; }

/* Player */
.audio-player {
    display: flex; align-items: center; background: var(--bg-element);
    padding: 6px 12px; border-radius: 12px; margin-bottom: 10px; height: 40px;
}
.play-btn {
    background: var(--accent); color: var(--accent-text); border: none;
    width: 30px; height: 30px; border-radius: 50%; display: flex;
    align-items: center; justify-content: center; margin-right: 10px; flex-shrink: 0; padding: 0;
}
.play-btn svg { width: 14px; height: 14px; fill: currentColor; }

.visualizer { display: flex; align-items: flex-end; justify-content: center; height: 16px; width: 20px; gap: 2px; margin-right: 10px; }
.viz-bar { width: 3px; background-color: var(--accent); border-radius: 2px; height: 3px; transition: height 0.1s ease; opacity: 0.5; }
.visualizer.playing .viz-bar { opacity: 1; animation: bounce 0.5s ease-in-out infinite alternate; }
.visualizer.playing .viz-bar:nth-child(1) { animation-duration: 0.45s; }
.visualizer.playing .viz-bar:nth-child(2) { animation-duration: 0.6s; animation-delay: 0.1s; }
.visualizer.playing .viz-bar:nth-child(3) { animation-duration: 0.35s; animation-delay: 0.2s; }
.visualizer.playing .viz-bar:nth-child(4) { animation-duration: 0.5s; animation-delay: 0.05s; }
@keyframes bounce { 0% { height: 3px; } 50% { height: 12px; } 100% { height: 16px; } }

.player-controls { flex-grow: 1; display: flex; align-items: center; }
.seek-slider {
    width: 100%; height: 4px; border-radius: 2px; background: rgba(127, 127, 127, 0.2);
    outline: none; -webkit-appearance: none; appearance: none; cursor: pointer;
}
.seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: var(--accent); margin-top: -1.5px; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.download-btn {
    width: 100%; padding: 12px; background-color: var(--bg-element);
    color: var(--accent); border: none; border-radius: 12px;
    font-size: 15px; font-weight: 600; text-align: center;
}
.download-btn.protected { background-color: #ffcc00; color: #000; }
.download-btn[disabled] { opacity: 0.5; }

/* --- LIST VIEW --- */
.layout-list { display: flex; flex-direction: column; gap: 8px; }
.layout-list .card {
    display: grid !important; grid-template-columns: 44px 1fr auto 100px;
    grid-template-areas: "img info badges btn"; align-items: center; gap: 12px;
    padding: 8px 12px; min-height: 64px; height: auto;
}
.layout-list .card.hidden { display: none !important; }
.layout-list .card-header { grid-area: img_area; display: contents; }
.layout-list .card-image { grid-area: img; width: 44px; height: 44px; border-radius: 10px; margin: 0; }
.layout-list .card-info { grid-area: info; min-width: 0; }
.layout-list .card-title { font-size: 15px; margin-bottom: 2px; }
.layout-list .card-meta { font-size: 11px; }
.layout-list .card-top-controls {
    grid-area: badges; position: static; transform: scale(0.85); justify-self: end; margin: 0;
}
.layout-list .like-button, .layout-list .card-desc, .layout-list .card-tags, .layout-list .audio-player { display: none; }
.layout-list .download-btn {
    grid-area: btn; width: 100px !important; min-width: 100px !important;
    padding: 8px 0 !important; font-size: 12px !important; margin: 0;
}

/* --- MODAL --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); display: flex; align-items: flex-end; justify-content: center;
    z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s;
    backdrop-filter: blur(2px);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal-content {
    background: var(--bg-card); width: 100%; max-width: 600px;
    border-top-left-radius: 24px; border-top-right-radius: 24px;
    padding: 24px 24px 40px 24px; transform: translateY(100%); will-change: transform;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: 80vh; overflow-y: auto !important; -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain; position: relative;
}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-content::before {
    content: ''; display: block; width: 40px; height: 5px;
    background: var(--text-hint); opacity: 0.3; border-radius: 5px; margin: 0 auto 15px auto;
}

.modal-backdrop {
    position: absolute; top: 0; left: 0; width: 100%; height: 150px;
    background-size: cover; background-position: center; background-repeat: no-repeat;
    filter: blur(3px) grayscale(20%); opacity: 0.15; z-index: 0;
    mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, transparent 100%);
    pointer-events: none; transition: background-image 0.3s ease;
}
.modal-header, .modal-description, #modal-specs, #modal-versions-list { position: relative; z-index: 1; }

.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.modal-title { font-size: 20px; font-weight: 800; margin: 0; color: var(--text-main); }
.close-modal {
    background: var(--bg-element); border: none; width: 32px; height: 32px;
    border-radius: 50%; font-size: 20px; color: var(--text-hint);
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.modal-description {
    font-size: 15px; line-height: 1.5; color: var(--text-main);
    background: var(--bg-element); padding: 12px; border-radius: 12px; margin-bottom: 20px; white-space: pre-wrap;
}

/* Timeline & Specs */
.tech-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; }
.tech-item {
    background: var(--bg-element); padding: 10px 12px; border-radius: 14px;
    border: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 4px;
}
.tech-label { font-size: 11px; text-transform: uppercase; color: var(--text-hint); font-weight: 700; letter-spacing: 0.5px; }
.tech-value { font-size: 14px; font-weight: 600; color: var(--text-main); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tech-modes { display: flex; flex-wrap: wrap; gap: 4px; }
.mini-mode { font-size: 10px; background: var(--bg-card); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border-color); }
.phonemes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.phoneme-item { display: flex; align-items: center; font-size: 13px; font-weight: 500; }
.ph-check { color: #34c759; margin-right: 6px; }
.ph-cross { color: #ff3b30; margin-right: 6px; }
.ph-text-dim { color: var(--text-hint); text-decoration: line-through; }

.timeline-wrapper { background: var(--bg-element); border-radius: 16px; padding: 20px; margin-top: 16px; border: 1px solid var(--border-color); }
.timeline-container { position: relative; padding-left: 20px; }
.timeline-container::before {
    content: ''; position: absolute; top: 8px; bottom: 20px; left: 6px; width: 2px;
    background: rgba(128, 128, 128, 0.2); border-radius: 2px;
}
.version-item {
    position: relative; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border-color);
    display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px;
}
.version-item:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.version-dot {
    width: 10px; height: 10px; border-radius: 50%; background: var(--bg-element);
    border: 2px solid var(--text-hint); margin-left: 1px; position: relative; z-index: 2;
}
.version-item.latest .version-dot {
    border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}
.version-info h4 { margin: 0 0 2px 0; font-size: 15px; }
.version-changelog { font-size: 13px; color: var(--text-hint); margin: 6px 0; white-space: pre-wrap; line-height: 1.4; }
.version-meta { font-size: 11px; color: var(--text-hint); margin-top: 4px; }

.get-btn {
    min-width: 80px; text-align: center; background: var(--accent);
    color: #fff !important; border: none; padding: 8px 12px; border-radius: 8px;
    font-size: 13px; font-weight: 600; position: relative; overflow: hidden; z-index: 1;
    display: flex; align-items: center; justify-content: center;
}
[data-theme="dark"] .get-btn { color: #000 !important; }
.get-btn::before {
    content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 0%;
    background: rgba(255, 255, 255, 0.25); z-index: -1; transition: width 0.1s ease;
}
[data-theme="dark"] .get-btn::before { background: rgba(0, 0, 0, 0.1) !important; }
.get-btn.btn-loading::before { width: 100%; transition: width 2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.get-btn.btn-success { background-color: #4cd964 !important; border-color: #4cd964 !important; }
[data-theme="dark"] .get-btn.btn-success { color: #fff !important; }
.btn-spinner {
    width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff; border-radius: 50%; animation: btn-spin 0.8s linear infinite;
}
[data-theme="dark"] .btn-spinner { border-color: rgba(0, 0, 0, 0.1); border-top-color: #000000; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* --- MISC --- */
.toast-container {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    z-index: 3000; display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
    background: rgba(30, 30, 30, 0.9); color: #fff; padding: 10px 16px;
    border-radius: 20px; font-size: 14px; font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2); opacity: 0;
    transform: translateY(20px); transition: all 0.3s ease;
    text-align: center; max-width: 90vw; backdrop-filter: blur(4px);
}
.toast.show { opacity: 1; transform: translateY(0); }

.scroll-top-btn {
    position: fixed; bottom: 90px; right: 20px; width: 44px; height: 44px;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 50%; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transform: translateY(20px); transition: all 0.3s ease;
    z-index: 2900; pointer-events: none; color: var(--text-main);
}
.scroll-top-btn.show { opacity: 1; transform: translateY(0); pointer-events: all; }
.scroll-top-btn svg { width: 24px; height: 24px; fill: currentColor; }

.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 20px; text-align: center; color: var(--text-hint); animation: fadeInUp 0.3s ease-out;
}
.empty-state.hidden { display: none !important; }
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-btn {
    background: var(--bg-element); color: var(--accent); border: none; padding: 10px 20px;
    border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer;
}

/* Skeleton */
.skeleton-card {
    background: var(--bg-card); border-radius: 18px; padding: 12px;
    border: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 10px;
}
.sk-box, .sk-line {
    background: linear-gradient(90deg, var(--bg-element) 25%, rgba(128, 128, 128, 0.1) 50%, var(--bg-element) 75%);
    background-size: 200% 100%; animation: shimmer 1.5s infinite linear; border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.sk-top { display: flex; align-items: center; }
.sk-img { width: 70px; height: 70px; border-radius: 14px; flex-shrink: 0; margin-right: 14px; }
.sk-info { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.sk-line { height: 14px; width: 100%; }
.sk-line.short { width: 60%; }
.sk-player { height: 40px; width: 100%; border-radius: 12px; }
.sk-btn { height: 44px; width: 100%; border-radius: 12px; margin-top: auto; }

/* Pull to Refresh */
.ptr-loader {
    position: fixed; top: 0; left: 0; width: 100%; height: 80px;
    display: flex; align-items: center; justify-content: center; z-index: 100;
    transform: translateY(-100%); transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); pointer-events: none;
}
.ptr-spinner {
    width: 28px; height: 28px; border: 3px solid var(--accent); border-radius: 50%;
    border-top-color: transparent; animation: rotate 0.8s linear infinite;
    background-color: var(--bg-card); box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 2px; background-clip: content-box;
}
@keyframes rotate { 100% { transform: rotate(360deg); } }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-hint); border-radius: 4px; opacity: 0.5; }

/* --- MAINTENANCE MODE --- */
.maintenance-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}

.maintenance-overlay.active {
    opacity: 1; pointer-events: all;
}

.maintenance-card {
    background: #FFD60A; /* Яркий желтый */
    color: #000000;
    width: 85%; max-width: 320px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

.maintenance-overlay.active .maintenance-card {
    transform: scale(1);
}

/* Бегущие полоски */
.maintenance-stripes {
    height: 24px;
    background: repeating-linear-gradient(
        -45deg,
        #000,
        #000 10px,
        #FFD60A 10px,
        #FFD60A 20px
    );
    background-size: 28px 28px;
    border-bottom: 4px solid #000;
    animation: moveStripes 1s linear infinite;
}

@keyframes moveStripes {
    0% { background-position: 0 0; }
    100% { background-position: 28px 0; }
}

.maintenance-body {
    padding: 24px 20px;
}

.maintenance-icon {
    font-size: 48px; margin-bottom: 12px;
    animation: bounceIcon 2s infinite;
}

@keyframes bounceIcon {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

.maintenance-card h3 {
    margin: 0 0 8px 0;
    font-size: 22px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.5px;
}

.maintenance-card p {
    margin: 0 0 20px 0; font-size: 14px;
    font-weight: 600; line-height: 1.4; opacity: 0.8;
}

.maintenance-close-btn {
    background: #000; color: #FFD60A;
    border: none; padding: 12px 24px;
    border-radius: 12px; font-weight: 700;
    font-size: 14px; text-transform: uppercase;
    width: 100%; cursor: pointer;
    transition: transform 0.1s;
}
.maintenance-close-btn:active { transform: scale(0.96); }

/* --- RULES MODAL --- */
.rules-modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.rules-modal-overlay.active { opacity: 1; }
.rules-modal-overlay.hidden { display: none; }

.rules-modal-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    max-width: 320px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.25s ease;
}
.rules-modal-overlay.active .rules-modal-card { transform: scale(1); }

.rules-modal-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.rules-modal-card h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
}

.rules-modal-card p {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: var(--text-hint);
    line-height: 1.5;
}

.rules-modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.rules-btn {
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}
.rules-btn:active { transform: scale(0.96); }
.rules-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.rules-btn-primary {
    background: var(--accent);
    color: var(--accent-text);
}

.rules-btn-secondary {
    background: var(--bg-element);
    color: var(--text-main);
}