:root {
    --profile-bg: #07131b;
    --profile-panel: #0c2029;
    --profile-panel-strong: #102b34;
    --profile-line: rgba(139, 207, 196, 0.18);
    --profile-text: #f8f5ed;
    --profile-muted: #9eb2b7;
    --profile-gold: #f0cc6e;
    --profile-green: #62e6a7;
    --profile-coral: #f06b78;
    --profile-cyan: #45d4e8;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--profile-bg); color: var(--profile-text); font-family: 'Montserrat', sans-serif; line-height: 1.55; }
button, input, select { font: inherit; }

nav { position: fixed; z-index: 1000; top: 0; width: 100%; border-bottom: 1px solid var(--profile-line); background: rgba(5, 16, 23, 0.94); backdrop-filter: blur(12px); }
nav .nav-inner { width: min(1280px, 100%); min-height: 64px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; justify-content: space-between; }
nav .logo { color: var(--profile-cyan); font-family: 'Playfair Display', serif; font-size: 1.65rem; font-weight: 900; letter-spacing: 1px; text-decoration: none; white-space: nowrap; }
nav .logo span { color: var(--profile-text); font-family: 'Montserrat', sans-serif; font-size: 0.72rem; letter-spacing: 2px; }
nav .nav-right, nav .nav-links, .desktop-controls, .lang-switch { display: flex; align-items: center; }
nav .nav-right { gap: 16px; }
nav .nav-links { margin: 0; padding: 0; gap: 16px; list-style: none; }
nav .nav-links a { color: var(--profile-muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 1px; text-decoration: none; text-transform: uppercase; white-space: nowrap; }
nav .nav-links a:hover, nav .nav-links a.active { color: var(--profile-gold); }
.desktop-controls { gap: 12px; }
.lang-switch { gap: 4px; }
.lang-switch a { min-width: 34px; padding: 5px 8px; border: 1px solid var(--profile-line); border-radius: 4px; color: var(--profile-muted); font-size: 0.62rem; font-weight: 800; text-align: center; text-decoration: none; }
.lang-switch a.active { border-color: var(--profile-coral); background: var(--profile-coral); color: #fff; }
.hamburger, .mobile-only-item { display: none; }

.profile-page { width: min(1160px, calc(100% - 40px)); margin: 0 auto; padding: 94px 0 70px; }
.profile-page-heading { position: relative; min-height: 228px; margin-bottom: 28px; padding: 40px 280px 36px 0; display: flex; align-items: center; border-bottom: 1px solid var(--profile-line); overflow: hidden; }
.profile-page-heading > div { position: relative; z-index: 1; }
.profile-page-heading > div > span, .section-heading > span, .join-profile > div > span, .member-copy > span { color: var(--profile-green); font-size: 0.64rem; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.profile-page-heading h1 { max-width: 760px; margin: 7px 0 12px; font-family: 'Playfair Display', serif; font-size: clamp(2.45rem, 5vw, 4.4rem); line-height: 0.98; letter-spacing: 0; }
.profile-page-heading p { max-width: 680px; margin: 0; color: var(--profile-muted); font-size: 0.92rem; }
.profile-page-heading > img { position: absolute; right: 18px; bottom: -58px; width: 226px; height: 292px; object-fit: contain; object-position: center bottom; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.45)); }

.profile-notice { margin: 0 0 18px; padding: 12px 14px; display: flex; align-items: center; gap: 9px; border-left: 3px solid; background: var(--profile-panel); font-size: 0.78rem; font-weight: 600; }
.profile-notice.success { border-color: var(--profile-green); }
.profile-notice.success i { color: var(--profile-green); }
.profile-notice.error { border-color: var(--profile-coral); }
.profile-notice.error i { color: var(--profile-coral); }

.member-summary { min-height: 160px; padding: 22px; display: grid; grid-template-columns: auto minmax(180px, 1fr) auto; align-items: center; gap: 20px; border: 1px solid var(--profile-line); border-radius: 8px; background: var(--profile-panel); }
.member-avatar { display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; border-radius: 50%; border: 2px solid var(--profile-gold); background: #17313a; color: var(--profile-gold); font-weight: 900; }
.member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-avatar.large { width: 104px; height: 104px; font-size: 1.7rem; }
.member-avatar.preview { width: 72px; height: 72px; font-size: 1.15rem; }
.member-avatar.small { width: 44px; height: 44px; border-width: 1px; font-size: 0.72rem; }
.member-copy h2 { margin: 4px 0 9px; font-family: 'Playfair Display', serif; font-size: 2rem; line-height: 1; overflow-wrap: anywhere; }
.member-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--profile-muted); font-size: 0.66rem; }
.member-meta span { display: inline-flex; align-items: center; gap: 6px; }
.member-meta i { color: var(--profile-cyan); }
.flight-stats { min-width: 310px; display: grid; grid-template-columns: repeat(3, 1fr); border-left: 1px solid var(--profile-line); }
.flight-stats div { min-width: 0; padding: 7px 16px; border-right: 1px solid var(--profile-line); }
.flight-stats div:last-child { border-right: 0; }
.flight-stats span, .flight-stats strong { display: block; }
.flight-stats span { min-height: 30px; color: var(--profile-muted); font-size: 0.56rem; font-weight: 700; text-transform: uppercase; }
.flight-stats strong { margin-top: 5px; color: var(--profile-gold); font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.profile-editor { margin-top: 30px; padding: 30px 0 34px; border-top: 1px solid var(--profile-line); border-bottom: 1px solid var(--profile-line); }
.section-heading h2, .section-heading h3 { margin: 4px 0 0; font-family: 'Playfair Display', serif; letter-spacing: 0; }
.section-heading h2 { font-size: 2rem; }
.section-heading h3 { font-size: 1.45rem; }
.section-heading p { max-width: 620px; margin: 6px 0 0; color: var(--profile-muted); font-size: 0.75rem; }
.identity-fields { margin-top: 22px; display: grid; grid-template-columns: minmax(220px, 0.8fr) minmax(330px, 1.2fr); gap: 28px; }
.text-field > span, .avatar-field > span { display: block; margin-bottom: 7px; color: var(--profile-muted); font-size: 0.62rem; font-weight: 800; text-transform: uppercase; }
.text-field input { width: 100%; height: 46px; padding: 0 12px; border: 1px solid var(--profile-line); border-radius: 5px; outline: none; background: #061820; color: var(--profile-text); }
.text-field input:focus { border-color: var(--profile-cyan); box-shadow: 0 0 0 2px rgba(69, 212, 232, 0.12); }
.avatar-actions { display: flex; align-items: center; gap: 14px; }
.avatar-actions small { display: block; margin-top: 7px; color: var(--profile-muted); font-size: 0.56rem; }
.upload-button { min-height: 38px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--profile-line); border-radius: 5px; background: #061820; color: var(--profile-text); font-size: 0.65rem; font-weight: 700; cursor: pointer; }
.upload-button:hover { border-color: var(--profile-gold); color: var(--profile-gold); }
.upload-button input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.reset-photo { display: block; margin-top: 7px; color: var(--profile-muted); font-size: 0.58rem; cursor: pointer; }
.reset-photo input { accent-color: var(--profile-gold); }

.top5-editor { margin-top: 30px; }
.section-heading.compact { margin-bottom: 13px; }
.top5-selects { display: grid; gap: 7px; }
.rank-select { min-height: 58px; padding: 8px 10px; display: grid; grid-template-columns: 40px 90px minmax(0, 1fr); align-items: center; gap: 9px; border: 1px solid rgba(139, 207, 196, 0.12); background: rgba(12, 32, 41, 0.7); }
.rank-select > strong { color: var(--profile-gold); font-family: 'Playfair Display', serif; font-size: 1.55rem; text-align: center; }
.rank-select > span { color: var(--profile-muted); font-size: 0.58rem; font-weight: 700; text-transform: uppercase; }
.rank-select select { width: 100%; height: 38px; padding: 0 34px 0 11px; border: 1px solid var(--profile-line); border-radius: 4px; outline: 0; background: #061820; color: var(--profile-text); cursor: pointer; }
.rank-select select:focus { border-color: var(--profile-cyan); }
.rank-select select option:disabled { color: #65767b; }
.save-profile { min-height: 46px; margin-top: 18px; padding: 0 18px; display: inline-flex; align-items: center; gap: 8px; border: 0; border-radius: 6px; background: var(--profile-gold); color: #172127; font-size: 0.7rem; font-weight: 800; cursor: pointer; }
.save-profile:hover { background: #ffe294; }

.join-profile { min-height: 132px; padding: 24px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-left: 3px solid var(--profile-cyan); background: var(--profile-panel); }
.join-profile h2 { margin: 4px 0 6px; font-family: 'Playfair Display', serif; font-size: 1.8rem; }
.join-profile p { max-width: 590px; margin: 0; color: var(--profile-muted); font-size: 0.75rem; }
.join-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.join-actions a { min-height: 42px; padding: 0 13px; display: inline-flex; align-items: center; gap: 8px; border-radius: 5px; color: #fff; font-size: 0.63rem; font-weight: 800; text-decoration: none; }
.join-google { background: #f7f9fb; color: #172127 !important; }
.join-discord { background: #5865f2; }

.community-grid { margin-top: 34px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, 0.85fr); gap: 42px; }
.fan-ranking, .recent-fans { min-width: 0; }
.ranking-list { margin: 19px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--profile-line); }
.ranking-list li { min-height: 76px; display: grid; grid-template-columns: 46px minmax(0, 1fr) 38px; align-items: center; gap: 10px; border-bottom: 1px solid var(--profile-line); }
.ranking-position { color: var(--profile-gold); font-family: 'Playfair Display', serif; font-size: 1.7rem; text-align: center; }
.ranking-song { min-width: 0; padding: 12px 0; }
.ranking-song a { display: block; color: var(--profile-text); font-size: 0.8rem; font-weight: 800; text-decoration: none; overflow-wrap: anywhere; }
.ranking-song > span { display: block; margin: 3px 0 8px; color: var(--profile-muted); font-size: 0.56rem; }
.ranking-song > i { display: block; width: 100%; height: 3px; background: rgba(255, 255, 255, 0.09); }
.ranking-song > i::after { content: ''; display: block; width: var(--ranking-width); height: 100%; background: var(--profile-green); }
.lyrics-link { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--profile-line); border-radius: 50%; color: var(--profile-cyan); text-decoration: none; }
.lyrics-link:hover { border-color: var(--profile-cyan); }
.recent-fan-list { margin-top: 19px; border-top: 1px solid var(--profile-line); }
.recent-fan { min-height: 70px; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; border-bottom: 1px solid var(--profile-line); }
.recent-fan h3 { margin: 0; font-size: 0.72rem; overflow-wrap: anywhere; }
.recent-fan div > span { display: block; margin-top: 3px; color: var(--profile-muted); font-size: 0.54rem; }
.recent-fan > i { color: var(--profile-cyan); font-size: 0.9rem; }
.empty-community { min-height: 190px; margin-top: 19px; padding: 24px; display: grid; place-items: center; align-content: center; gap: 12px; border-top: 1px solid var(--profile-line); border-bottom: 1px solid var(--profile-line); color: var(--profile-muted); text-align: center; }
.empty-community i { color: var(--profile-gold); font-size: 1.7rem; }
.empty-community p { max-width: 380px; margin: 0; font-size: 0.72rem; }

.profile-footer { padding: 26px 20px; border-top: 1px solid var(--profile-line); color: var(--profile-muted); font-size: 0.65rem; text-align: center; }
.profile-footer p { margin: 0; }
.profile-footer a { color: var(--profile-gold); text-decoration: none; }

body.light-fan-theme { --profile-bg: #eef5f3; --profile-panel: #fff; --profile-panel-strong: #e1efeb; --profile-line: rgba(24, 72, 70, 0.18); --profile-text: #10242a; --profile-muted: #60777a; }
body.light-fan-theme nav { background: rgba(238, 245, 243, 0.95); }
body.light-fan-theme .text-field input, body.light-fan-theme .upload-button, body.light-fan-theme .rank-select select { background: #fff; }

@media (max-width: 991px) {
    .profile-page { padding-top: 82px; }
    .profile-page-heading { padding-right: 190px; }
    .profile-page-heading > img { right: 0; width: 185px; }
    .member-summary { grid-template-columns: auto minmax(0, 1fr); }
    .flight-stats { grid-column: 1 / -1; min-width: 0; border-top: 1px solid var(--profile-line); border-left: 0; padding-top: 13px; }
    .identity-fields { grid-template-columns: 1fr; }
    .community-grid { grid-template-columns: 1fr; gap: 36px; }
    .join-profile { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 620px) {
    .profile-page { width: min(100% - 24px, 1160px); padding-bottom: 46px; }
    .profile-page-heading { min-height: 200px; padding: 28px 110px 26px 0; }
    .profile-page-heading h1 { font-size: 2.25rem; }
    .profile-page-heading p { font-size: 0.72rem; }
    .profile-page-heading > img { right: -48px; bottom: -54px; width: 164px; opacity: 0.82; }
    .member-summary { padding: 16px; grid-template-columns: 68px minmax(0, 1fr); gap: 13px; }
    .member-avatar.large { width: 68px; height: 68px; font-size: 1.05rem; }
    .member-copy h2 { font-size: 1.45rem; }
    .member-meta { display: grid; gap: 5px; }
    .flight-stats div { padding: 5px 9px; }
    .flight-stats span { min-height: 28px; font-size: 0.48rem; }
    .flight-stats strong { font-size: 0.82rem; }
    .profile-editor { padding-top: 24px; }
    .avatar-actions { align-items: flex-start; }
    .rank-select { grid-template-columns: 36px minmax(0, 1fr); gap: 6px; }
    .rank-select > span { display: none; }
    .rank-select select { grid-column: 2; }
    .save-profile { width: 100%; justify-content: center; }
    .join-actions { width: 100%; display: grid; grid-template-columns: 1fr; }
    .join-actions a { justify-content: center; }
    .community-grid { margin-top: 28px; }
    .ranking-list li { grid-template-columns: 36px minmax(0, 1fr) 34px; }
}
