/* ============================================================
   FrakTyle — styles.css
   ============================================================ */

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

:root {
    --bg: #0f1115;
    --bg-soft: #171a21;
    --bg-card: #1e222b;
    --accent: #ffd700;
    --accent-2: #4f8cff;
    --text: #e6e8ee;
    --muted: #9aa3b2;
    --border: #2a2f3a;
    --danger: #ff5c5c;
    --success: #4cd964;
}

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    line-height: 1.5;
    min-height: 100%;
}

img { max-width: 100%; display: block; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ БАНЕР ============ */
.welcome-banner {
    background: linear-gradient(90deg, #2a2f3a, #1e222b);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.welcome-banner.hidden { display: none; }
.banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
}
.banner-icon { font-size: 20px; }
.banner-content p { flex: 1; font-size: 14px; }
.banner-close {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 16px;
    cursor: pointer;
}
.banner-close:hover { color: var(--text); }

/* ============ HEADER ============ */
header {
    text-align: center;
    padding: 24px 16px 8px;
}
.logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 8px;
    object-fit: contain;
    border-radius: 12px;
}
header h1 {
    font-size: 26px;
    margin-bottom: 16px;
    background: linear-gradient(90deg, var(--accent), #ffb800);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
    flex-wrap: wrap;
}
.header-left { flex: 1; }

.lang-switcher {
    display: flex;
    gap: 6px;
    background: var(--bg-soft);
    padding: 4px;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.lang-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.lang-btn:hover { color: var(--text); }
.lang-btn.active {
    background: var(--accent);
    color: #111;
    font-weight: 600;
}

.header-right { display: flex; align-items: center; gap: 10px; }
.auth-buttons { display: flex; gap: 8px; }

.btn-auth {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    color: var(--text);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.btn-login:hover { border-color: var(--accent-2); color: var(--accent-2); }
.btn-register {
    background: var(--accent);
    color: #111;
    border-color: var(--accent);
    font-weight: 600;
}
.btn-register:hover { background: #ffb800; }

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-soft);
    padding: 6px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.user-profile.hidden { display: none; }
.avatar-wrap { flex-shrink: 0; }
.avatar-letter {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}
.avatar-letter.big { width: 64px; height: 64px; font-size: 28px; }
.user-info { display: flex; flex-direction: column; font-size: 13px; }
.user-info small { color: var(--muted); }
.mc-gold { color: var(--accent); }

.btn-cabinet, .btn-logout {
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.btn-cabinet:hover { border-color: var(--accent); color: var(--accent); }
.btn-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ============ NAV ============ */
nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
nav a {
    color: var(--muted);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
}
nav a:hover {
    color: var(--text);
    background: var(--bg-card);
    text-decoration: none;
}
nav a.active {
    background: var(--accent);
    color: #111;
    font-weight: 600;
}

/* ============ MAIN ============ */
main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}

section { margin-bottom: 32px; }
section h2 {
    font-size: 22px;
    margin-bottom: 12px;
    color: var(--accent);
}
section h3 {
    font-size: 17px;
    margin-bottom: 8px;
}

/* Вкладки: приховуємо неактивні */
main > section.tab-section.tab-hidden {
    display: none !important;
}

/* ============ HERO ============ */
.hero {
    text-align: center;
    padding: 32px 16px;
    background: linear-gradient(135deg, rgba(79,140,255,0.15), rgba(255,215,0,0.1));
    border-radius: 16px;
    border: 1px solid var(--border);
    margin-bottom: 32px;
}
.hero h2 { font-size: 26px; margin-bottom: 12px; }
.hero p { color: var(--muted); max-width: 720px; margin: 0 auto; }

.home-block { margin-top: 32px; text-align: left; }

/* ============ VERSIONS ============ */
.versions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.version-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.version-card h3 { font-size: 16px; margin-bottom: 8px; }
.version-card p { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.version-card p.ip strong {
    color: var(--accent);
    font-size: 16px;
    font-family: monospace;
}

/* ============ GUIDE CARDS ============ */
.guide-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}
.guide-card h3 { color: var(--text); margin-bottom: 10px; }
.guide-card p { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.guide-card ul {
    margin: 8px 0 0;
    padding-left: 20px;
    color: var(--muted);
    font-size: 14px;
}
.guide-card ul li { margin: 6px 0; }
.guide-card ul li strong { color: var(--text); }
.guide-card code {
    background: rgba(0,0,0,0.35);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--accent);
}

.btn-video {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 16px;
    background: var(--accent-2);
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}
.btn-video:hover { background: #3a7bef; text-decoration: none; }

/* ============ FAQ ============ */
.faq h3 {
    cursor: pointer;
    user-select: none;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-top: 8px;
    font-size: 15px;
    transition: all 0.2s;
}
.faq h3:hover { border-color: var(--accent); color: var(--accent); }
.faq-content {
    display: none;
    padding: 12px 16px;
    background: rgba(79,140,255,0.08);
    border-left: 3px solid var(--accent-2);
    margin-top: 6px;
    border-radius: 0 8px 8px 0;
    color: var(--muted);
    font-size: 14px;
}
.faq-content.open { display: block; }

/* ============ TOP PLAYERS ============ */
.top-players {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}
.top-player {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    transition: border-color 0.2s;
}
.top-player:hover { border-color: var(--accent); }
.top-player .rank {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}
.top-player:nth-child(1) .rank { background: #ffd700; color: #111; }
.top-player:nth-child(2) .rank { background: #c0c0c0; color: #111; }
.top-player:nth-child(3) .rank { background: #cd7f32; color: #111; }
.top-player .name { flex: 1; font-weight: 600; }
.top-player .points { color: var(--accent); font-weight: 700; }
.loading { color: var(--muted); text-align: center; padding: 16px; }

/* ============ GALLERY ============ */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.gallery img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: transform 0.2s;
}
.gallery img:hover { transform: scale(1.03); }

/* ============ BUTTONS ============ */
button {
    font-family: inherit;
    cursor: pointer;
}
#discordButton {
    padding: 10px 20px;
    background: #5865f2;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.2s;
    margin-top: 8px;
}
#discordButton:hover { background: #4752c4; }

.btn-save {
    width: 100%;
    padding: 10px 16px;
    background: var(--accent);
    color: #111;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    margin-top: 12px;
    transition: background 0.2s;
}
.btn-save:hover { background: #ffb800; }

/* ============ WIDGET ============ */
.widget-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    min-height: 120px;
}

/* ============ FOOTER ============ */
footer {
    text-align: center;
    padding: 24px 16px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 13px;
}
.footer-disclaimer { margin-top: 6px; font-size: 12px; opacity: 0.7; }

/* ============ MODALS ============ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 200;
}
.modal.hidden { display: none; }
.modal-content {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}
.modal-content.small { max-width: 380px; }
.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
}
.modal-close:hover { color: var(--danger); }

.modal-content h2 { font-size: 20px; margin-bottom: 16px; color: var(--accent); }
.modal-content label {
    display: block;
    font-size: 13px;
    color: var(--muted);
    margin: 12px 0 6px;
}
.modal-content input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.modal-content input:focus { border-color: var(--accent); }

.save-msg { color: var(--danger); font-size: 13px; margin-top: 10px; min-height: 18px; }
.reward-hint { color: var(--success); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* ============ CABINET ============ */
.cabinet-header { text-align: center; margin-bottom: 20px; }
.cabinet-header .avatar-letter { margin: 0 auto 12px; }
.cabinet-balance { color: var(--muted); font-size: 14px; margin-top: 6px; }
.cabinet-balance strong { color: var(--accent); font-size: 16px; }

.cabinet-body { display: flex; flex-direction: column; gap: 12px; }
.cabinet-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
}
.cabinet-item .icon { font-size: 20px; flex-shrink: 0; }
.cabinet-item strong { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.cabinet-item p { font-size: 14px; }
.cabinet-item input {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    margin-top: 4px;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
    header h1 { font-size: 20px; }
    .hero h2 { font-size: 20px; }
    nav { gap: 2px; }
    nav a { padding: 6px 10px; font-size: 13px; }
    .header-row { flex-direction: column; }
    .user-profile { flex-wrap: wrap; justify-content: center; }
}