:root {
    --primary: #ff4444;
    --primary-dark: #cc0000;
    --secondary: #00d4ff;
    --gold: #ffd700;
    --bg-dark: #0a0a0f;
    --bg-card: #1a1a2e;
    --bg-card-hover: #252540;
    --text: #e0e0e0;
    --text-muted: #9a9a9a;
    --border: #333;
}
* { margin: 0; padding: 0; box-sizing: border-box; }

/* === ACCESSIBILITY === */
.skip-link {
    position: absolute; top: -100px; left: 16px; background: var(--primary); color: #fff;
    padding: 10px 20px; border-radius: 0 0 8px 8px; font-weight: 700; z-index: 9999;
    text-decoration: none; font-size: 0.95rem; transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* Focus-visible for all interactive elements */
*:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}
.tree-card:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; border-color: var(--secondary); }
.tree-node:focus-visible { outline: 2px solid var(--secondary); outline-offset: 2px; border-color: var(--secondary); }

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* High contrast mode support */
@media (forced-colors: active) {
    .tree-card, .tree-node, .node-detail { border: 2px solid ButtonText; }
    .tree-card-icon, .tree-node-icon, .node-detail-hdr .nd-icon { forced-color-adjust: none; }
}

.promo-banner {
    background: linear-gradient(90deg, var(--primary), #ff6b35);
    color: #fff; text-align: center; padding: 10px 20px; font-size: 0.9rem; font-weight: 600;
}
.promo-banner p { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px; margin: 0; }
.promo-banner a { color: #000; text-decoration: none; background: rgba(255,255,255,0.95); padding: 4px 12px; border-radius: 15px; font-weight: 700; transition: all 0.3s; }
.promo-banner a:hover { background: var(--gold); transform: scale(1.02); }

body {
    font-family: 'Rajdhani', sans-serif; background: var(--bg-dark); color: var(--text); min-height: 100vh;
    background-image: radial-gradient(ellipse at top, rgba(255,68,68,0.1) 0%, transparent 50%), radial-gradient(ellipse at bottom, rgba(0,212,255,0.05) 0%, transparent 50%);
}

.top-nav {
    background: rgba(26,26,46,0.98); border-bottom: 1px solid var(--border); padding: 0 20px;
    display: flex; align-items: center; justify-content: space-between; z-index: 1001;
    position: sticky; top: 0; height: 50px; box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.top-nav-brand { font-family: 'Orbitron', sans-serif; font-size: 1.1rem; font-weight: 700; color: var(--primary); text-decoration: none; white-space: nowrap; }
.top-nav-brand:hover { color: #ff6b35; }
.top-nav-links { display: flex; align-items: center; gap: 5px; list-style: none; }
.top-nav-links a { color: var(--text-muted); text-decoration: none; font-size: 0.95rem; font-weight: 600; padding: 8px 14px; border-radius: 8px; transition: all 0.2s; }
.top-nav-links a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.top-nav-links a.active { color: var(--primary); background: rgba(255,68,68,0.1); }

/* Translate */
.translate-wrap { position: relative; }
.translate-btn {
    background: none; border: 1px solid var(--border); color: var(--text-muted);
    padding: 6px 12px; border-radius: 8px; font-size: 0.85rem; font-family: 'Rajdhani', sans-serif;
    font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px;
    transition: all 0.3s ease; white-space: nowrap;
}
.translate-btn:hover { border-color: var(--secondary); color: var(--secondary); }
.translate-btn svg { width: 16px; height: 16px; fill: currentColor; }
.translate-dropdown {
    display: none; position: absolute; top: 100%; right: 0; margin-top: 8px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 0; min-width: 180px; z-index: 2000; box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-height: 350px; overflow-y: auto;
}
.translate-dropdown.open { display: block; }
.translate-dropdown a { display: block; padding: 8px 16px; color: var(--text-muted); text-decoration: none; font-size: 0.9rem; transition: all 0.2s; }
.translate-dropdown a:hover { background: rgba(255,255,255,0.08); color: var(--text); }
.translate-dropdown a.active-lang { color: var(--secondary); }
.goog-te-banner-frame { display: none !important; }
body > .skiptranslate:not(#google_translate_element) { display: none !important; }
#google_translate_element { display: block !important; position: absolute !important; top: -9999px !important; left: -9999px !important; }

.container { max-width: 960px; margin: 0 auto; padding: 20px; }

.breadcrumb { font-size: 0.85rem; margin-bottom: 20px; color: var(--text-muted); }
.breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text); }

.wiki-header { text-align: center; padding: 40px 20px; border-bottom: 2px solid var(--primary); margin-bottom: 30px; position: relative; overflow: hidden; }
.wiki-header::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at center, rgba(255,68,68,0.15) 0%, transparent 70%); pointer-events: none; }
.wiki-header h1 { font-family: 'Orbitron', sans-serif; font-size: 2.5rem; font-weight: 900; background: linear-gradient(135deg, var(--primary), #ff6b35, var(--gold)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: 10px; }
.wiki-header p { color: var(--text-muted); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }
.total-badge { display: inline-block; background: rgba(255,215,0,0.15); border: 1px solid var(--gold); color: var(--gold); padding: 4px 16px; border-radius: 20px; font-size: 0.95rem; font-weight: 600; margin-bottom: 10px; }

/* === TREE CARDS GRID === */
.tree-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.tree-card {
    background: var(--bg-card); border: 2px solid var(--border); border-radius: 14px; padding: 20px;
    cursor: pointer; transition: all 0.3s ease; position: relative; overflow: hidden;
}
.tree-card:hover { border-color: var(--secondary); transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,212,255,0.15); }
.tree-card-icon {
    width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px; font-weight: 900; font-family: 'Orbitron', sans-serif; font-size: 1.1rem; color: #fff;
}
.tree-card-name { font-family: 'Orbitron', sans-serif; font-size: 0.85rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.tree-card-badges { font-size: 1.1rem; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.tree-card-info { font-size: 0.75rem; color: var(--text-muted); }
.tree-card-nodes { font-size: 0.7rem; color: var(--secondary); margin-top: 6px; }
.tree-card-bar { height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.tree-card-bar-fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.tree-card-arrow { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 1.2rem; color: var(--text-muted); transition: all 0.3s; }
.tree-card:hover .tree-card-arrow { color: var(--secondary); transform: translateY(-50%) translateX(4px); }

/* === BACK BUTTON === */
.back-btn {
    display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
    color: var(--text-muted); padding: 10px 20px; border-radius: 10px; font-size: 0.9rem; font-weight: 600;
    cursor: pointer; transition: all 0.3s; font-family: 'Rajdhani', sans-serif; margin-bottom: 20px;
}
.back-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(255,68,68,0.05); }
.back-btn svg { width: 16px; height: 16px; fill: currentColor; }

/* === TREE DETAIL VIEW === */
.tree-detail { display: none; animation: fadeIn 0.3s ease; }
.tree-detail.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.tree-detail-header {
    background: var(--bg-card); border: 2px solid var(--border); border-radius: 14px; padding: 24px;
    margin-bottom: 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.tree-detail-header .icon { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-family: 'Orbitron', sans-serif; font-size: 1.3rem; color: #fff; flex-shrink: 0; }
.tree-detail-header .info { flex: 1; min-width: 200px; }
.tree-detail-header .info h2 { font-family: 'Orbitron', sans-serif; font-size: 1.4rem; color: var(--text); margin-bottom: 4px; }
.tree-detail-header .info p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }
.tree-detail-header .badges-total { text-align: right; }
.tree-detail-header .badges-total .num { font-size: 1.5rem; font-weight: 900; color: var(--gold); font-family: 'Orbitron', sans-serif; }
.tree-detail-header .badges-total .label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* === SKILL TREE VISUAL === */
.skill-tree { padding: 10px 0; }
.tree-row { display: flex; justify-content: center; gap: 14px; }
.tree-connector { display: flex; justify-content: center; height: 28px; }
.tree-connector .line { width: 2px; height: 100%; background: var(--secondary); opacity: 0.35; }

.tree-node {
    background: var(--bg-card); border: 2px solid var(--border); border-radius: 10px; padding: 10px 14px;
    text-align: center; cursor: pointer; transition: all 0.3s ease; min-width: 120px; max-width: 160px; flex: 1;
}
.tree-node:hover { border-color: var(--secondary); background: var(--bg-card-hover); transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,212,255,0.15); }
.tree-node.expanded { border-color: var(--gold); box-shadow: 0 4px 20px rgba(255,215,0,0.2); }
.tree-node-icon { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; font-weight: 900; font-family: 'Orbitron', sans-serif; font-size: 0.9rem; color: #fff; }
.tree-node-name { font-size: 0.75rem; font-weight: 700; color: var(--text); margin-bottom: 4px; line-height: 1.2; }
.tree-node-meta { display: flex; justify-content: space-between; font-size: 0.65rem; color: var(--text-muted); gap: 6px; }
.tree-node-meta .badges { color: var(--gold); font-weight: 700; }
.tree-node-stat { font-size: 0.6rem; color: var(--secondary); margin-top: 3px; opacity: 0.8; }

/* === NODE DETAIL PANEL === */
.node-detail {
    display: none; background: var(--bg-card); border: 1px solid var(--gold); border-radius: 10px;
    margin: 10px auto 16px; max-width: 520px; overflow: hidden; animation: slideDown 0.25s ease;
}
.node-detail.show { display: block; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.node-detail-hdr { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: rgba(255,215,0,0.04); }
.node-detail-hdr .nd-icon { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-family: 'Orbitron', sans-serif; font-size: 0.8rem; color: #fff; flex-shrink: 0; }
.node-detail-hdr h3 { font-size: 0.95rem; color: var(--text); margin: 0; font-weight: 700; }
.node-detail-hdr .nd-total { margin-left: auto; text-align: right; font-size: 0.7rem; color: var(--text-muted); }
.node-detail-hdr .nd-total span { display: block; color: var(--gold); font-weight: 700; font-size: 0.85rem; }
.node-detail table { width: 100%; border-collapse: collapse; }
.node-detail th { background: rgba(255,68,68,0.1); color: var(--primary); font-family: 'Orbitron', sans-serif; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; padding: 7px 10px; text-align: center; border-bottom: 1px solid var(--border); }
.node-detail td { padding: 7px 10px; border-bottom: 1px solid rgba(51,51,51,0.4); font-size: 0.82rem; text-align: center; color: var(--text); }
.node-detail td:nth-child(2) { color: var(--gold); font-weight: 700; }
.node-detail td:nth-child(3) { color: var(--secondary); }
.node-detail td:nth-child(4) { color: var(--text-muted); font-size: 0.75rem; }
.node-detail tr:hover td { background: rgba(255,255,255,0.02); }
.node-detail td.tbc { color: var(--text-muted); font-style: italic; opacity: 0.5; }

/* === VIEW TOGGLE === */
.view-toggle { display: flex; gap: 6px; margin-bottom: 16px; }
.view-toggle button {
    background: rgba(255,255,255,0.05); border: 1px solid var(--border); color: var(--text-muted);
    padding: 8px 18px; border-radius: 8px; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s; font-family: 'Rajdhani', sans-serif;
}
.view-toggle button:hover { border-color: var(--secondary); color: var(--text); }
.view-toggle button.active { border-color: var(--primary); color: var(--primary); background: rgba(255,68,68,0.08); }

/* === TABLE VIEW === */
.table-view { display: none; }
.table-view.active { display: block; }
.rank-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.rank-table th { background: rgba(255,68,68,0.15); color: var(--primary); font-family: 'Orbitron', sans-serif; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; padding: 10px 14px; text-align: left; border-bottom: 2px solid var(--primary); }
.rank-table td { padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.rank-table tr:hover td { background: rgba(255,255,255,0.03); }
.rank-table tr { cursor: pointer; transition: all 0.2s; }

/* Footer */
footer { text-align: center; padding: 30px; color: var(--text-muted); border-top: 1px solid var(--border); margin-top: 50px; }
footer a { color: var(--secondary); text-decoration: none; }
footer a:hover { text-decoration: underline; }

/* Mobile Nav */
.mobile-nav { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: rgba(26,26,46,0.98); border-top: 1px solid var(--border); padding: 8px 0; z-index: 1002; justify-content: space-around; }
.mobile-nav-item { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text-muted); font-size: 0.7rem; font-weight: 600; padding: 4px 8px; border-radius: 8px; transition: all 0.2s; }
.mobile-nav-item:hover, .mobile-nav-item:active { color: var(--text); background: rgba(255,255,255,0.05); }
.mobile-nav-item span:first-child { font-size: 1.3rem; margin-bottom: 2px; }
.mobile-nav-item.active { color: var(--primary); }

.go-top-btn { position: fixed; bottom: 80px; right: 20px; width: 40px; height: 40px; background: var(--primary); color: #fff; border: none; border-radius: 50%; font-size: 1rem; cursor: pointer; opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 999; }
.go-top-btn.visible { opacity: 1; pointer-events: auto; }

/* === SCROLL WRAPPER for mobile === */
.tree-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 8px; }
.tree-scroll::-webkit-scrollbar { height: 4px; }
.tree-scroll::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); border-radius: 2px; }
.tree-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.tree-scroll-inner { min-width: fit-content; }

/* === SEARCH === */
.tree-search {
    width: 100%; padding: 12px 16px; margin-bottom: 16px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text); font-size: 0.95rem; font-family: 'Rajdhani', sans-serif; outline: none; transition: border-color 0.2s;
}
.tree-search:focus { border-color: var(--primary); }
.tree-search::placeholder { color: var(--text-muted); }

@media (max-width: 768px) {
    .mobile-nav { display: flex; }
    .container { padding: 15px; padding-bottom: 80px; }
    .wiki-header h1 { font-size: 1.8rem; }
    .tree-cards { grid-template-columns: 1fr; }
    .tree-card { padding: 16px; display: flex; align-items: center; gap: 14px; }
    .tree-card-icon { margin-bottom: 0; flex-shrink: 0; }
    .tree-card-bar { display: none; }
    .tree-card-arrow { position: static; transform: none; margin-left: auto; }
    .tree-card:hover .tree-card-arrow { transform: translateX(4px); }
    .skill-tree { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tree-row { gap: 8px; min-width: max-content; padding: 0 10px; }
    .tree-node { min-width: 95px; max-width: 120px; padding: 10px 8px; }
    .tree-node-icon { width: 34px; height: 34px; font-size: 0.8rem; }
    .tree-node-name { font-size: 0.7rem; }
    .tree-node-meta { font-size: 0.6rem; flex-direction: column; gap: 2px; }
    .tree-node-stat { font-size: 0.55rem; }
    .tree-connector { min-width: max-content; }
    .node-detail { margin-left: 10px; margin-right: 10px; max-width: none; }
    .node-detail th, .node-detail td { padding: 6px 8px; font-size: 0.75rem; }
    .tree-detail-header { flex-direction: column; text-align: center; }
    .tree-detail-header .badges-total { text-align: center; }
    .top-nav-links { display: none; }
    .translate-label { display: none; }
    .translate-btn { padding: 6px 8px; }
    .rank-table th, .rank-table td { padding: 8px 10px; font-size: 0.82rem; }
    .rank-table { display: block; overflow-x: auto; }
}
@media (min-width: 600px) and (max-width: 900px) {
    .tree-cards { grid-template-columns: repeat(2, 1fr); }
}
