:root {
  color-scheme: dark;
  --bg: #090b12;
  --panel: rgba(20, 24, 36, 0.86);
  --panel-strong: #171b28;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f4f6fb;
  --muted: #a8b0c3;
  --pink: #ff66aa;
  --cyan: #63e6d1;
  --purple: #9c83ff;
  --danger: #ff7185;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.ambient { position: fixed; width: 42rem; height: 42rem; border-radius: 50%; filter: blur(110px); opacity: .14; pointer-events: none; }
.ambient-one { top: -18rem; left: -12rem; background: var(--pink); }
.ambient-two { right: -18rem; top: 20rem; background: var(--purple); }
.shell { position: relative; width: min(1420px, calc(100% - 40px)); margin: 0 auto; }
.site-header { min-height: 92px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 28px; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; width: max-content; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: linear-gradient(135deg, var(--pink), var(--purple)); font-weight: 900; }
.brand b, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 3px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.main-nav { display: flex; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.025); }
.nav-button { border: 0; color: var(--muted); background: transparent; padding: 9px 17px; border-radius: 999px; cursor: pointer; }
.main-nav a { text-decoration: none; white-space: nowrap; }
.home-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 24px 0 70px; }
.home-tool-card { display: block; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; text-decoration: none; }
.home-tool-card:hover, .home-tool-card:focus-visible { border-color: var(--cyan); }
.home-tool-card h2 { font-size: 24px; margin: 0 0 14px; display: flex; justify-content: space-between; gap: 16px; }
.home-tool-card h2 span { color: var(--cyan); }
.home-tool-card p { color: var(--muted); margin: 0; line-height: 1.7; }
@media (max-width: 900px) { .home-tools { grid-template-columns: 1fr; } .main-nav { flex-wrap: wrap; justify-content: center; } }
.nav-button.active { color: var(--text); background: rgba(255,255,255,.09); }
.auth-area { justify-self: end; }
.login-button, .primary-button { display: inline-flex; align-items: center; justify-content: center; border: 0; padding: 11px 18px; border-radius: 12px; color: #10121a; background: linear-gradient(135deg, var(--cyan), #6cf0a7); text-decoration: none; font-weight: 800; cursor: pointer; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip img { width: 38px; height: 38px; border-radius: 11px; object-fit: cover; }
.user-chip small { display: block; color: var(--muted); }
.logout-button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 10px; padding: 8px 10px; cursor: pointer; }
.hero { min-height: 390px; display: grid; grid-template-columns: 1fr; align-items: center; padding: 72px 4vw; }
.eyebrow { color: var(--cyan); font-size: 12px; font-weight: 800; letter-spacing: .18em; }
.hero h1 { margin: 14px 0 20px; font-size: clamp(42px, 6vw, 82px); line-height: .98; letter-spacing: -.055em; }
.hero h1 span { color: transparent; background: linear-gradient(90deg, var(--pink), var(--purple)); background-clip: text; }
.hero > div > p:last-child { max-width: 700px; color: var(--muted); line-height: 1.8; }
.hero-card { padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: linear-gradient(145deg, rgba(255,102,170,.12), rgba(99,230,209,.05)); box-shadow: 0 25px 70px rgba(0,0,0,.22); }
.hero-card span { color: var(--pink); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.hero-card strong { display: block; margin: 13px 0; font-size: 23px; }
.hero-card p { color: var(--muted); line-height: 1.65; margin-bottom: 0; }
.notice { margin: 0 0 22px; padding: 14px 18px; border: 1px solid rgba(99,230,209,.3); border-radius: 14px; background: rgba(99,230,209,.08); }
.notice.error { border-color: rgba(255,113,133,.35); background: rgba(255,113,133,.08); color: #ffc3cc; }
.workspace { display: none; padding: 38px 0 80px; border-top: 1px solid var(--line); }
.workspace.active { display: block; }
.workspace-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 26px; }
.workspace-heading > div { display: flex; align-items: center; gap: 14px; }
.workspace-heading h2 { margin: 0; font-size: 30px; }
.workspace-heading p { color: var(--muted); }
.step { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: rgba(156,131,255,.14); color: #b9a9ff; font-size: 12px; font-weight: 800; }
.control-card, .analysis-card { border: 1px solid var(--line); border-radius: 20px; background: var(--panel); backdrop-filter: blur(16px); }
.control-card { padding: 22px; }
.analysis-form, .compare-form { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(2, minmax(150px, .7fr)) auto; gap: 14px; align-items: end; }
label { color: var(--muted); font-size: 12px; font-weight: 700; }
input, select { width: 100%; margin-top: 8px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: #10131d; color: var(--text); outline: none; }
input:focus, select:focus { border-color: rgba(99,230,209,.55); box-shadow: 0 0 0 3px rgba(99,230,209,.08); }
.player-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-top: 16px; }
.player-result { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); background: #111520; border-radius: 14px; cursor: pointer; text-align: left; color: var(--text); }
.player-result img { width: 48px; height: 48px; border-radius: 12px; }
.player-result span { color: var(--muted); font-size: 12px; }
.progress-card { margin-top: 20px; padding: 24px; }
.progress-top { display: flex; justify-content: space-between; gap: 16px; }
.progress-top strong { font-size: 22px; }
.progress-track { height: 10px; margin: 18px 0 12px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.07); }
.progress-fill { height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--pink), var(--purple), var(--cyan)); transition: width .32s ease-out; }
.progress-status { color: var(--muted); }
.profile-card { margin-top: 20px; overflow: hidden; }
.profile-header { display: flex; align-items: center; gap: 16px; padding: 24px; border-bottom: 1px solid var(--line); }
.profile-header img { width: 68px; height: 68px; border-radius: 18px; }
.profile-header h3 { margin: 0 0 6px; font-size: 26px; }
.profile-header p { margin: 0; color: var(--muted); }
.style-badge { margin-left: auto; padding: 9px 14px; border-radius: 999px; background: rgba(99,230,209,.12); color: var(--cyan); font-weight: 800; }
.metric-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--line); }
.metric { padding: 19px; background: var(--panel-strong); }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin: 7px 0 4px; font-size: 21px; }
.client-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 20px; }
.client-card { padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.client-card b { color: var(--pink); text-transform: uppercase; }
.client-card p { margin: 7px 0 0; color: var(--muted); }
.ability-section { padding: 0 20px 20px; }
.ability-section summary { cursor: pointer; padding: 16px 0; font-weight: 800; }
.ability-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.ability { min-height: 122px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.ability b { display: block; margin: 8px 0; color: var(--cyan); font-size: 18px; }
.ability p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.score-section { padding: 0 20px 22px; }
.score-section h4 { margin: 18px 0 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 11px 10px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
td { font-size: 13px; }
td a { text-decoration: none; }
td a:hover { color: var(--cyan); }
.compare-form { grid-template-columns: 1fr 1fr .7fr .55fr auto; }
.compare-output { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.compare-output .metric-grid { grid-template-columns: repeat(3, 1fr); }
.lookup-form { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; }
.beatmap-results { display: grid; gap: 12px; margin-top: 18px; }
.beatmap-card { display: grid; grid-template-columns: 110px 1fr auto; gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.beatmap-card img { width: 110px; height: 72px; object-fit: cover; border-radius: 10px; }
.beatmap-card h3 { margin: 0 0 5px; }
.beatmap-card p { margin: 0; color: var(--muted); }
.difficulty-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.difficulty-list a { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 12px; text-decoration: none; }
.external-link { color: var(--cyan); text-decoration: none; font-weight: 800; white-space: nowrap; }
.empty { padding: 24px; color: var(--muted); text-align: center; }
footer { display: flex; justify-content: space-between; padding: 28px 0 44px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.footer-credit { display: grid; gap: 8px; }
.pp-list { margin: 20px 0 30px; }
.pp-list-card { display: flex; align-items: center; gap: 20px; max-width: 620px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; text-decoration: none; }
.pp-list-card:hover { border-color: var(--cyan); }
.pp-list-card h3 { margin: 0 0 6px; font-size: 20px; }
.pp-list-card p { margin: 0; color: var(--muted); }
.pp-list-card > span:last-child { margin-left: auto; color: var(--cyan); font-size: 24px; }
.pp-mode { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 14px; background: rgba(255,102,170,.12); color: var(--pink); font-size: 24px; font-weight: 900; flex-shrink: 0; }
.local-library { margin: 24px 0; padding: 18px 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.local-library summary { cursor: pointer; font-weight: 800; line-height: 1.8; }
.local-library summary span { margin-left: 14px; color: var(--cyan); font-size: 12px; font-weight: 400; }
.local-library p { color: var(--muted); line-height: 1.75; font-size: 13px; }
.local-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.local-path-label { max-width: 620px; }
.local-library .local-error { color: var(--danger); }
.local-map-card { grid-template-columns: 1fr auto; }
.local-map-card small { color: var(--muted); overflow-wrap: anywhere; }
.lookup-form { grid-template-columns: minmax(0, 1fr) minmax(150px, .4fr) auto; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 12px 20px; max-width: 65%; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover, .footer-links a:focus-visible { color: var(--cyan); text-decoration: underline; }
.about-page { max-width: 980px; margin: 40px auto 72px; line-height: 1.9; overflow-wrap: anywhere; }
.about-heading h1 { margin: 8px 0; font-size: clamp(32px, 5vw, 52px); line-height: 1.2; }
.about-heading p, .about-page dd, .about-page section p, .about-page li { color: var(--muted); }
.about-updated { font-size: 13px; }
.about-toc { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 22px 0; border-block: 1px solid var(--line); margin: 28px 0; }
.about-page a { color: var(--cyan); text-underline-offset: 4px; }
.about-page section { padding: 12px 0 24px; scroll-margin-top: 24px; }
.about-page h2 { font-size: 24px; margin-bottom: 16px; }
.about-page h3 { font-size: 17px; }
.about-page dt { font-weight: 800; margin-top: 18px; }
.about-page dd { margin: 6px 0 0; }
.about-repositories { display: grid; gap: 16px; }
.about-repositories > div { padding: 8px 22px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }

@media (max-width: 1000px) {
  .site-header { grid-template-columns: 1fr auto; }
  .main-nav { grid-row: 2; grid-column: 1 / -1; justify-self: center; margin-bottom: 16px; }
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .analysis-form, .compare-form { grid-template-columns: 1fr 1fr; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .compare-output { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 24px, 1420px); }
  .site-header { padding-top: 14px; }
  .brand small { display: none; }
  .main-nav { width: 100%; overflow-x: auto; justify-content: start; }
  .nav-button { white-space: nowrap; }
  .hero { min-height: auto; padding: 54px 0; }
  .hero h1 { font-size: 45px; }
  .workspace-heading { display: block; }
  .analysis-form, .compare-form, .lookup-form { grid-template-columns: 1fr; }
  .metric-grid, .compare-output .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .client-row { grid-template-columns: 1fr; }
  .profile-header { align-items: start; flex-wrap: wrap; }
  .style-badge { margin-left: 0; }
  .beatmap-card { grid-template-columns: 1fr; }
  .beatmap-card img { width: 100%; height: 130px; }
  footer { display: grid; gap: 8px; }
  .footer-links { justify-content: flex-start; max-width: 100%; margin-top: 12px; }
  .local-library summary span { display: block; margin-left: 0; }
  .local-map-card { grid-template-columns: 1fr; }
}
