:root {
    --theme-color: #fe2c55;
    --bg-color: #161823;
    --card-bg: #252732;
    --hover-bg: #333645;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.75);
    --border-color: #3a3a4a;
}

body {
    margin: 0; padding: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color); color: var(--text-primary);
}

.hidden { display: none !important; }
.loading { text-align: center; color: var(--text-secondary); padding: 15px; font-size: 13px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }

#nav-container { margin-bottom: 20px; }
.view-container {
    max-width: 1100px; margin: 0 auto 15px auto; background: var(--card-bg);
    padding: 12px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.nav-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px; margin-bottom: 12px; overflow-x: auto; white-space: nowrap; }
.nav-tab {
    background: transparent; border: none; color: var(--text-secondary);
    font-size: 14px; font-weight: 600; cursor: pointer; padding: 6px 10px;
    border-radius: 4px; transition: 0.2s; flex-shrink: 0;
}
.nav-tab.active { background: var(--theme-color); color: #fff; }

table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { text-align: left; padding: 8px 4px; color: var(--text-secondary); font-size: 11px; border-bottom: 1px solid var(--border-color); }
td { padding: 8px 4px; border-bottom: 1px solid var(--border-color); vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

#search-view table { font-size: 10px; }
#search-view td, #search-view th { padding: 4px 2px; }
#search-view td:last-child { white-space: normal; word-break: break-all; line-height: 1.1; }

.rank-row { cursor: pointer; }
.rank-row:hover { background-color: var(--hover-bg); }
.anchor-info { display: flex; align-items: center; gap: 6px; }
.score { color: var(--theme-color); font-weight: bold; font-family: monospace; font-size: 11px; }
.live-tag { background: linear-gradient(45deg, #ff0050, #00f2ea); color: #fff; font-size: 9px; padding: 1px 3px; border-radius: 3px; font-weight: bold; }

.header-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; flex-wrap: wrap; }
.action-group { display: flex; flex-direction: column; gap: 5px; }
.back-btn, .bottom-btn { background: #3a3a4a; color: #fff; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: bold; }
.bottom-btn { background: var(--theme-color); }
.pk-btn { background: #ff4500; color: #fff; border: none; padding: 4px 8px; border-radius: 6px; cursor: pointer; font-size: 11px; font-weight: bold; transition: 0.2s; }
.pk-btn:active { transform: scale(0.9); }

.pk-clear-btn { background: #555; color: #fff; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: bold; }

.search-inner-box { flex: 1; min-width: 150px; }
.inner-input { width: 100%; background: #333645; border: 1px solid var(--border-color); color: white; padding: 8px; border-radius: 6px; font-size: 12px; outline: none; box-sizing: border-box; }

.detail-sub-tabs { display: flex; gap: 10px; margin-bottom: 12px; }
.sub-tab { flex: 1; background: #1c1e2a; border: 1px solid var(--border-color); color: var(--text-secondary); padding: 8px 0; border-radius: 8px; font-size: 13px; font-weight: bold; cursor: pointer; transition: 0.2s; text-align: center; }
.sub-tab.active { background: var(--theme-color); color: #fff; border-color: var(--theme-color); }
.detail-section { display: none; background: #1c1e2a; padding: 10px; border-radius: 8px; }
.detail-section.active { display: block; }
.section-title { font-size: 13px; font-weight: bold; margin-bottom: 10px; padding-left: 8px; border-left: 3px solid var(--theme-color); }

.user-card { display: flex; align-items: center; gap: 8px; padding: 6px; margin-bottom: 4px; background: var(--card-bg); border-radius: 6px; cursor: pointer; }
.rank-badge { margin-left: auto; background: rgba(255,255,255,0.05); padding: 2px 4px; border-radius: 3px; font-size: 10px; color: #ffd700; }

.db-search-box { display: flex; gap: 5px; margin-bottom: 10px; background: #1c1e2a; padding: 8px; border-radius: 6px; }
.db-input { background: #333645; border: 1px solid var(--border-color); color: white; padding: 8px; border-radius: 4px; font-size: 12px; flex: 1; outline: none; }
.db-btn { background: var(--theme-color); color: white; border: none; padding: 0 12px; border-radius: 4px; cursor: pointer; font-weight: bold; font-size: 12px; white-space: nowrap; }

.level-badge { font-size: 8px; padding: 1px 2px; border-radius: 2px; margin-right: 1px; display: inline-block; vertical-align: middle; }
.level-fans { background: #ff9f00; color: #000; }
.level-pay { background: #1e90ff; color: #fff; }

#floating-tools { position: fixed; bottom: 20px; right: 15px; display: flex; flex-direction: column; gap: 10px; z-index: 9999; opacity: 0; visibility: hidden; transition: 0.3s; }
#floating-tools.show { opacity: 1; visibility: visible; }
.float-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--theme-color); color: white; border: none; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 12px rgba(0,0,0,0.5); }

#pk-arena-view { background: #0D0D0D; max-width: 1200px; }
.pk-scoreboard { text-align: center; background: #161618; padding: 20px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #333; }
.pk-grid { display: flex; flex-wrap: wrap; gap: 15px; justify-content: center; }
.pk-card {
    background: #151F28; width: 120px; padding: 15px 10px; border-radius: 10px;
    display: flex; flex-direction: column; align-items: center; border: 2px solid transparent;
    position: relative; transition: all 0.3s ease; box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}
.pk-card.team-blue { border-color: #00BFFF; background: #0a1118; }
.pk-card.team-red { border-color: #FF4500; background: #1a0808; }
.pk-avatar { width: 60px; height: 60px; border-radius: 50%; margin-bottom: 10px; border: 2px solid rgba(255,255,255,0.2); object-fit: cover; }
.pk-nickname { font-size: 13px; color: #fff; font-weight: bold; width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 5px; }
.pk-score { font-size: 20px; color: #FFD700; font-family: Impact, monospace; font-weight: normal; margin-top: 5px;}
.pk-leading { font-size: 11px; font-weight: bold; margin-bottom: 5px; opacity: 0; text-shadow: 0 0 5px currentColor; }
.team-blue .pk-leading { color: #00BFFF; }
.team-red .pk-leading { color: #FF4500; }
.pk-card.is-leading { transform: translateY(-5px); box-shadow: 0 8px 15px currentColor; }
.pk-card.is-leading .pk-leading { opacity: 1; }
.pk-match-status { font-size: 12px; font-weight: bold; padding: 2px 6px; border-radius: 4px; display: inline-block; margin-left: 10px;}

.pf-stat-box { flex:1; background: #1c1e2a; padding: 15px 10px; border-radius: 8px; text-align:center; border: 1px solid var(--border-color); }
.pf-stat-title { font-size:11px; color:#888; margin-bottom:5px; }
.pf-stat-val { font-size:18px; font-weight:bold; font-family: Impact, monospace; }
.pf-progress-bar { width:100%; background:#333; border-radius:4px; height:6px; overflow:hidden; margin-top:5px; }
.pf-progress-inner { height:100%; background:var(--theme-color); }