/* ============================================================
   Academic Price Calculator — Apple Design System
   Strict compliance with appleDESIGN.md tokens
   ============================================================ */

/* --- Google Fonts: Inter as SF Pro substitute --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');
/* Noto Sans SC — cloud CJK font for Chinese mode */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@300;400;500;700&display=swap');
/* Material Symbols for icon font */
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap');

/* ============================================================
   Design Tokens (from appleDESIGN.md)
   ============================================================ */
:root {
  /* --- Colors: Brand & Accent --- */
  --color-primary: #0066cc;
  --color-primary-focus: #0071e3;
  --color-primary-on-dark: #2997ff;

  /* --- Colors: Surface --- */
  --color-canvas: #ffffff;
  --color-canvas-parchment: #f5f5f7;
  --color-surface-pearl: #fafafc;
  --color-surface-tile-1: #272729;
  --color-surface-tile-2: #2a2a2c;
  --color-surface-tile-3: #252527;
  --color-surface-black: #000000;
  --color-surface-chip-translucent: rgba(210, 210, 215, 0.64);

  /* --- Colors: Text --- */
  --color-ink: #1d1d1f;
  --color-body: #1d1d1f;
  --color-body-on-dark: #ffffff;
  --color-body-muted: #cccccc;
  --color-ink-muted-80: #333333;
  --color-ink-muted-48: #7a7a7a;

  /* --- Colors: On --- */
  --color-on-primary: #ffffff;
  --color-on-dark: #ffffff;

  /* --- Colors: Hairlines & Borders --- */
  --color-divider-soft: #f0f0f0;
  --color-hairline: #e0e0e0;

  /* --- Typography --- */
  --font-display: 'Inter', 'SF Pro Display', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-text: 'Inter', 'SF Pro Text', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  /* --- Rounded --- */
  --rounded-none: 0px;
  --rounded-xs: 5px;
  --rounded-sm: 8px;
  --rounded-md: 11px;
  --rounded-lg: 18px;
  --rounded-pill: 9999px;
  --rounded-full: 9999px;

  /* --- Spacing --- */
  --spacing-xxs: 4px;
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 17px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-xxl: 48px;
  --spacing-section: 80px;

  /* --- Elevation (product shadow only) --- */
  --shadow-product: rgba(0, 0, 0, 0.22) 3px 5px 30px 0px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 17px; /* Apple's 17px body convention */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  scrollbar-width: none;        /* Firefox: 隐藏原生滚动条 */
}

body {
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--color-body);
  background-color: var(--color-canvas);
}

/* Chromium/Safari: 隐藏原生滚动条 */
::-webkit-scrollbar { display: none; }

/* ============================================================
   Typography Scale
   ============================================================ */
.t-hero-display {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.28px;
}

.t-display-lg {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0;
}

.t-display-md {
  font-family: var(--font-text);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.47;
  letter-spacing: -0.374px;
}

.t-lead {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: 0.196px;
}

.t-lead-airy {
  font-family: var(--font-text);
  font-size: 24px;
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: 0;
}

.t-tagline {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.19;
  letter-spacing: 0.231px;
}

.t-body-strong {
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.374px;
}

.t-body {
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
}

.t-caption {
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.43;
  letter-spacing: -0.224px;
}

.t-caption-strong {
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.29;
  letter-spacing: -0.224px;
}

.t-fine-print {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.12px;
}

.t-nav-link {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.12px;
}

/* ============================================================
   Global Nav (component: global-nav)
   ============================================================ */
.global-nav {
  background-color: var(--color-surface-black);
  color: var(--color-on-dark);
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 1000;
}

.global-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 980px;
  padding: 0 var(--spacing-lg);
}

.global-nav__brand {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.12px;
  color: var(--color-on-dark);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.global-nav__brand .material-symbols-outlined {
  font-size: 20px;
}

.global-nav__links {
  display: flex;
  align-items: center;
  gap: 20px;
  list-style: none;
}

.global-nav__links a {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.12px;
  color: var(--color-body-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.global-nav__links a:hover {
  color: var(--color-on-dark);
}

/* ============================================================
   Sub Nav (component: sub-nav-frosted)
   ============================================================ */
.sub-nav {
  background-color: rgba(245, 245, 247, 0.8);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 44px;
  z-index: 999;
  border-bottom: 1px solid var(--color-hairline);
}

.sub-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 980px;
  padding: 0 var(--spacing-lg);
}

.sub-nav__title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.19;
  letter-spacing: 0.231px;
  color: var(--color-ink);
}

.sub-nav__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

/* ============================================================
   Buttons
   ============================================================ */

/* button-primary */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  border: none;
  border-radius: var(--rounded-pill);
  padding: 11px 22px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease;
  -webkit-user-select: none;
  user-select: none;
}

#startEvaluation{
  height: 33px;
  font-size: 14px;
}

.btn-primary:active {
  transform: scale(0.95);
}

.btn-primary:focus-visible {
  outline: 2px solid var(--color-primary-focus);
  outline-offset: 2px;
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* button-secondary-pill (ghost pill) */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  background-color: transparent;
  color: var(--color-primary);
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  border: 1px solid var(--color-primary);
  border-radius: var(--rounded-pill);
  padding: 11px 22px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease;
}

.btn-secondary:active {
  transform: scale(0.95);
}

/* button-dark-utility */
.btn-dark-utility {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-ink);
  color: var(--color-on-dark);
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.29;
  letter-spacing: -0.224px;
  border: none;
  border-radius: var(--rounded-sm);
  padding: 8px 15px;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.btn-dark-utility:active {
  transform: scale(0.95);
}

/* text-link */
.text-link {
  color: var(--color-primary);
  text-decoration: none;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.374px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.text-link:hover {
  text-decoration: underline;
}

/* text-link on dark */
.text-link-on-dark {
  color: var(--color-primary-on-dark);
  text-decoration: none;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: -0.374px;
}

/* ============================================================
   Product Tiles (section containers)
   ============================================================ */
.tile {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-section) var(--spacing-lg);
  text-align: center;
  position: relative;
}

.tile--light {
  background-color: var(--color-canvas);
  color: var(--color-ink);
}

.tile--parchment {
  background-color: var(--color-canvas-parchment);
  color: var(--color-ink);
}

.tile--dark {
  background-color: var(--color-surface-tile-1);
  color: var(--color-on-dark);
  overflow: hidden;
}

/* Hero background image — blurred photo + dark gradient overlay */
.tile--dark::before {
  content: '';
  position: absolute;
  inset: -30px;
  background-image: url('https://images.unsplash.com/photo-1481627834876-b7833e8f5570?auto=format&fit=crop&w=1920&q=80');
  background-size: cover;
  background-position: center 30%;
  filter: blur(5px);
  transform: scale(1.08);
  z-index: 0;
}

.tile--dark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, rgba(0,0,0,0.62) 0%, rgba(8,8,18,0.78) 100%);
  z-index: 1;
}

.tile--dark > * {
  position: relative;
  z-index: 2;
}

.tile--dark-2 {
  background-color: var(--color-surface-tile-2);
  color: var(--color-on-dark);
}

.tile--dark-3 {
  background-color: var(--color-surface-tile-3);
  color: var(--color-on-dark);
}

.tile--black {
  background-color: var(--color-surface-black);
  color: var(--color-on-dark);
}

.tile__content {
  max-width: 980px;
  width: 100%;
}

/* ============================================================
   Form Styles
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-lg);
  max-width: 720px;
  margin: 0 auto;
  text-align: left;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.form-group--full {
  grid-column: 1 / -1;
}

.form-label {
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.29;
  letter-spacing: -0.224px;
  color: var(--color-ink);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.form-label .material-symbols-outlined {
  font-size: 18px;
  color: var(--color-ink-muted-48);
}

.form-input {
  background-color: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-pill);
  padding: 12px 20px;
  height: 44px;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
}

.form-input:focus {
  border-color: var(--color-primary-focus);
}

.form-input::placeholder {
  color: var(--color-ink-muted-48);
}

/* Number input — hide spinners */
.form-input[type="number"]::-webkit-outer-spin-button,
.form-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.form-input[type="number"] {
  -moz-appearance: textfield;
}

/* ============================================================
   Searchable Dropdown
   ============================================================ */
.search-dropdown {
  position: relative;
  width: 100%;
}

.search-dropdown__input {
  background-color: var(--color-canvas);
  color: var(--color-ink);
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-pill);
  padding: 12px 44px 12px 20px;
  height: 44px;
  outline: none;
  transition: border-color 0.2s ease;
  width: 100%;
}

.search-dropdown__input:focus {
  border-color: var(--color-primary-focus);
}

.search-dropdown__input::placeholder {
  color: var(--color-ink-muted-48);
}

.search-dropdown__icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-ink-muted-48);
  pointer-events: none;
  font-size: 18px;
}

.search-dropdown__list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-lg);
  max-height: 280px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  list-style: none;
}

.search-dropdown__list.is-open {
  display: block;
}

.search-dropdown__item {
  padding: 10px 20px;
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.224px;
  color: var(--color-ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.15s ease;
  min-width: 0;
}

.search-dropdown__item-name {
  position: relative;
  overflow: hidden;
  min-width: 0;
  flex: 1;
  white-space: nowrap;
}

.search-dropdown__item-name-text {
  display: inline-block;
  white-space: nowrap;
}

.search-dropdown__item-name-text.is-scrolling {
  animation: name-marquee 3s ease-in-out infinite;
}

@keyframes name-marquee {
  0%, 15%  { transform: translateX(0); }
  70%, 85% { transform: translateX(var(--name-overflow, 0px)); }
  100%     { transform: translateX(0); }
}

.search-dropdown__item:hover,
.search-dropdown__item.is-highlighted {
  background-color: var(--color-canvas-parchment);
}

.search-dropdown__item.is-selected .search-dropdown__item-name-text {
  font-weight: 600;
  color: var(--color-primary);
}

.search-dropdown__item-rank {
  font-size: 12px;
  color: var(--color-ink-muted-48);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: var(--spacing-sm);
}

.search-dropdown__empty {
  padding: 16px 20px;
  font-family: var(--font-text);
  font-size: 14px;
  color: var(--color-ink-muted-48);
  text-align: center;
}

/* Custom scrollbar for dropdown */
.search-dropdown__list::-webkit-scrollbar {
  width: 6px;
}

.search-dropdown__list::-webkit-scrollbar-track {
  background: transparent;
}

.search-dropdown__list::-webkit-scrollbar-thumb {
  background-color: var(--color-hairline);
  border-radius: 3px;
}

/* ============================================================
   H-index Row with Google Scholar Link
   ============================================================ */
.h-index-row {
  display: flex;
  align-items: flex-end;
  gap: var(--spacing-sm);
}

.h-index-row .form-input {
  flex: 1;
}

.gs-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 14px;
  background-color: var(--color-canvas);
  border: 1px solid var(--color-hairline);
  border-radius: var(--rounded-pill);
  color: var(--color-primary);
  text-decoration: none;
  transition: transform 0.1s ease, border-color 0.2s ease;
  flex-shrink: 0;
  gap: var(--spacing-xs);
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: -0.224px;
}

.gs-link:active {
  transform: scale(0.95);
}

.gs-link:hover {
  border-color: var(--color-primary);
}

.gs-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* ============================================================
   Result Section
   ============================================================ */
.result-container {
  display: none;
  animation: resultFadeIn 0.6s ease forwards;
}

.result-container.is-visible {
  display: block;
}

@keyframes resultFadeIn {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-value {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.5px;
  color: var(--color-on-dark);
  margin: var(--spacing-lg) 0;
}

.result-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 1.14;
  letter-spacing: 0.196px;
  color: var(--color-body-muted);
  margin-bottom: var(--spacing-xs);
}

/* Commentary line */
.result-commentary {
  margin-top: var(--spacing-lg);
  max-width: 560px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--color-body-muted);
  font-style: italic;
  letter-spacing: 0.01em;
  opacity: 0.88;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* Player comparison card */
.player-card {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-lg);
  background-color: var(--color-surface-tile-2);
  border-radius: var(--rounded-lg);
  padding: var(--spacing-lg);
  margin-top: var(--spacing-xl);
  text-align: left;
  max-width: 480px;
}

.player-card__icon {
  width: 56px;
  height: 56px;
  border-radius: var(--rounded-full);
  background-color: var(--color-surface-chip-translucent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.player-card__icon .material-symbols-outlined {
  font-size: 28px;
  color: var(--color-ink);
}

.player-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-card__label {
  font-size: 12px;
  font-weight: 400;
  color: var(--color-body-muted);
  letter-spacing: -0.12px;
  text-transform: uppercase;
}

.player-card__name {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--color-on-dark);
  letter-spacing: 0.231px;
}

.player-card__detail {
  font-size: 14px;
  font-weight: 400;
  color: var(--color-body-muted);
  letter-spacing: -0.224px;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 480px;
  height: 100vh;
  background-color: var(--color-canvas);
  border-right: 1px solid var(--color-hairline);
  z-index: 2000;
  transform: translateX(-100%);
  transition: transform 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar.is-open {
  transform: translateX(0);
}

.sidebar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-lg);
  border-bottom: 1px solid var(--color-hairline);
  flex-shrink: 0;
}

.sidebar__title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.231px;
  color: var(--color-ink);
}

.sidebar__close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-ink-muted-48);
  border-radius: var(--rounded-full);
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.sidebar__close:hover {
  background-color: var(--color-canvas-parchment);
}

.sidebar__close:active {
  transform: scale(0.95);
}

.sidebar__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--spacing-lg);
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.12) transparent;
}
.sidebar__body::-webkit-scrollbar { width: 3px; }
.sidebar__body::-webkit-scrollbar-track { background: transparent; }
.sidebar__body::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 2px;
}
.sidebar__body::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.22); }

.sidebar__empty {
  text-align: center;
  color: var(--color-ink-muted-48);
  font-size: 14px;
  padding: var(--spacing-xxl) var(--spacing-lg);
}

.sidebar__empty .material-symbols-outlined {
  font-size: 48px;
  display: block;
  margin-bottom: var(--spacing-sm);
  color: var(--color-hairline);
}

/* Chart container */
.sidebar__chart-container {
  margin-bottom: var(--spacing-xl);
}

.sidebar__chart-title {
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.224px;
  color: var(--color-ink);
  margin-bottom: var(--spacing-sm);
}

.sidebar__chart {
  width: 100%;
  height: auto;
}

/* Scholar list */
.scholar-list {
  list-style: none;
}

.scholar-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--color-divider-soft);
}

.scholar-item:last-child {
  border-bottom: none;
}

.scholar-item__rank {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--color-ink-muted-48);
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}

.scholar-item__info {
  flex: 1;
  min-width: 0;
}

.scholar-item__name {
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.224px;
  color: var(--color-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scholar-item__value {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 400;
  color: var(--color-ink-muted-48);
}

.scholar-item__delete {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--color-ink-muted-48);
  border-radius: var(--rounded-full);
  transition: background-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  opacity: 0;
}

.scholar-item:hover .scholar-item__delete {
  opacity: 1;
}

.scholar-item__delete:hover {
  background-color: var(--color-canvas-parchment);
  color: var(--color-ink);
}

.scholar-item__delete .material-symbols-outlined {
  font-size: 16px;
}

/* Sidebar overlay */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.3);
  z-index: 1999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.sidebar-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar toggle button */
.sidebar-toggle {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  z-index: 1998;
  width: 36px;
  height: 80px;
  background-color: var(--color-canvas-parchment);
  border: 1px solid var(--color-hairline);
  border-left: none;
  border-radius: 0 var(--rounded-sm) var(--rounded-sm) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-ink-muted-48);
  transition: background-color 0.2s ease, transform 0.1s ease, color 0.2s ease;
}

.sidebar-toggle:hover {
  background-color: var(--color-canvas);
  color: var(--color-ink);
}

.sidebar-toggle:active {
  transform: translateY(-50%) scale(0.95);
}

.sidebar-toggle .material-symbols-outlined {
  font-size: 20px;
}

/* ============================================================
   Footer (component: footer)
   ============================================================ */
.site-footer {
  background-color: var(--color-canvas-parchment);
  color: var(--color-ink-muted-80);
  padding: 64px var(--spacing-lg);
  text-align: center;
}

.site-footer__content {
  max-width: 980px;
  margin: 0 auto;
}

.site-footer__legal {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.0;
  letter-spacing: -0.12px;
  color: var(--color-ink-muted-48);
}

.site-footer__links {
  display: flex;
  justify-content: center;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

.site-footer__links a {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: -0.12px;
  color: var(--color-primary);
  text-decoration: none;
}

.site-footer__links a:hover {
  text-decoration: underline;
}

/* ============================================================
   Utility
   ============================================================ */
.cta-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-md);
  margin-top: var(--spacing-xl);
}

.section-subtitle {
  color: var(--color-body-muted);
  max-width: 600px;
  margin: var(--spacing-sm) auto 0;
}

.tile--dark .section-subtitle {
  color: var(--color-body-muted);
}

/* Loading state */
.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: var(--color-on-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Value counter animation */
@keyframes countUp {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

.result-value--animate {
  animation: countUp 0.4s ease forwards;
}

/* ============================================================
   Bar chart (in sidebar)
   ============================================================ */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-chart__row {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.bar-chart__label {
  font-family: var(--font-text);
  font-size: 11px;
  font-weight: 400;
  color: var(--color-ink-muted-80);
  width: 140px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.bar-chart__bar-wrap {
  flex: 1;
  height: 20px;
  background-color: var(--color-canvas-parchment);
  border-radius: var(--rounded-xs);
  overflow: hidden;
}

.bar-chart__bar {
  height: 100%;
  background-color: var(--color-primary);
  border-radius: var(--rounded-xs);
  transition: width 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
  min-width: 2px;
}

.bar-chart__value {
  font-family: var(--font-text);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-ink-muted-48);
  width: 55px;
  text-align: left;
  flex-shrink: 0;
}

/* ============================================================
   Scholar Detail Card
   ============================================================ */
.sd-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.sd-overlay.is-visible {
  opacity: 1;
  pointer-events: all;
}

.sd-card {
  background: #f5f5f7;
  border-radius: 22px;
  width: 100%;
  max-width: 460px;
  max-height: 88vh;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  transform: translateY(28px) scale(0.96);
  transition: transform 0.38s cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: 0 24px 64px rgba(0,0,0,0.22), 0 4px 16px rgba(0,0,0,0.10);
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.15) transparent;
}

.sd-card::-webkit-scrollbar { width: 4px; }
.sd-card::-webkit-scrollbar-track { background: transparent; }
.sd-card::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.15);
  border-radius: 2px;
}

.sd-overlay.is-visible .sd-card {
  transform: translateY(0) scale(1);
}

/* Close button */
.sd-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.08);
  color: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.sd-close:hover { background: rgba(0,0,0,0.14); color: rgba(0,0,0,0.8); }
.sd-close .material-symbols-outlined { font-size: 17px; }

/* ── Header ── */
.sd-header {
  padding: 44px 28px 24px;
  text-align: center;
  border-bottom: 1px solid rgba(0,0,0,0.07);
}

.sd-scholar-name {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: rgba(0,0,0,0.38);
  margin-bottom: 10px;
}

.sd-scholar-value {
  font-size: 54px;
  font-weight: 700;
  color: rgba(0,0,0,0.88);
  line-height: 1;
  letter-spacing: -1.5px;
}

/* ── Player row ── */
.sd-player-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 22px;
  border-bottom: 1px solid rgba(0,0,0,0.07);
  background: #fff;
}

.sd-player-soccer {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,102,204,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sd-player-soccer .material-symbols-outlined {
  font-size: 18px;
  color: #0062cc;
}

.sd-player-texts { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sd-player-name  { font-size: 14px; font-weight: 600; color: rgba(0,0,0,0.85); }
.sd-player-meta  { font-size: 12px; color: rgba(0,0,0,0.38); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sd-player-val   { margin-left: auto; font-size: 14px; font-weight: 600; color: #0062cc; flex-shrink: 0; }

/* ── Section title ── */
.sd-section-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: rgba(0,0,0,0.28);
  padding: 20px 24px 8px;
}

/* ── Base value row ── */
.sd-base-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 12px 4px;
  padding: 12px 16px;
  background: rgba(0,102,204,0.07);
  border-radius: 11px;
}

.sd-base-left { display: flex; flex-direction: column; gap: 3px; }

.sd-base-tag {
  font-size: 11px;
  font-weight: 500;
  color: rgba(0,0,0,0.38);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sd-base-h {
  font-size: 22px;
  font-weight: 700;
  color: #0062cc;
  line-height: 1;
  letter-spacing: -0.5px;
}

.sd-base-amount {
  font-size: 16px;
  font-weight: 600;
  color: rgba(0,0,0,0.82);
}

/* ── Factor rows ── */
.sd-factors { padding: 0 0 4px; }

.sd-factor-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.sd-factor-row:last-child { border-bottom: none; }

.sd-factor-icon-wrap {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sd-factor-icon-wrap .material-symbols-outlined { font-size: 15px; color: rgba(0,0,0,0.4); }

.sd-factor-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sd-factor-name { font-size: 13px; font-weight: 500; color: rgba(0,0,0,0.82); }
.sd-factor-sub  { font-size: 11px; color: rgba(0,0,0,0.35); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Multiplier badge */
.sd-mult {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 20px;
  letter-spacing: -0.2px;
}
.sd-mult--max     { background: rgba(52,199,89,0.14);  color: #1a7f37; }
.sd-mult--high    { background: rgba(0,102,204,0.10);  color: #005dc1; }
.sd-mult--neutral { background: rgba(0,0,0,0.07);      color: rgba(0,0,0,0.42); }
.sd-mult--low     { background: rgba(255,149,0,0.13);  color: #954b00; }
.sd-mult--bad     { background: rgba(255,59,48,0.10);  color: #c0241c; }

/* ── Final total row ── */
.sd-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 12px 0;
  padding: 13px 16px;
  border: 1px solid rgba(0,0,0,0.09);
  border-radius: 11px;
  background: #fff;
}
.sd-total-label { font-size: 13px; font-weight: 500; color: rgba(0,0,0,0.45); }
.sd-total-value { font-size: 20px; font-weight: 700; color: rgba(0,0,0,0.88); letter-spacing: -0.5px; }

/* ── Stats grid ── */
.sd-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 0 12px 24px;
  background: rgba(0,0,0,0.08);
  border-radius: 13px;
  overflow: hidden;
}

.sd-stat {
  background: #fff;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sd-stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(0,0,0,0.30);
}

.sd-stat-value {
  font-size: 15px;
  font-weight: 600;
  color: rgba(0,0,0,0.85);
}

/* ── Disclaimer ── */
.sd-legacy {
  padding: 16px 28px 28px;
  text-align: center;
  color: rgba(0,0,0,0.28);
  font-size: 12px;
}

/* Scholar item clickable */
.scholar-item {
  cursor: pointer;
}
.scholar-item:hover .scholar-item__info {
  opacity: 0.82;
}

/* ============================================================
   Responsive (from appleDESIGN.md breakpoints)
   ============================================================ */

/* Small desktop */
@media (max-width: 1068px) {
  .t-hero-display {
    font-size: 40px;
  }
  .result-value {
    font-size: 56px;
  }
}

/* Tablet portrait */
@media (max-width: 833px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 100%;
  }
  .global-nav__links {
    display: none;
  }
  .tile {
    padding: var(--spacing-xxl) var(--spacing-lg);
  }
}

/* Phone */
@media (max-width: 640px) {
  .t-hero-display {
    font-size: 34px;
  }
  .t-display-lg {
    font-size: 28px;
  }
  .t-lead {
    font-size: 21px;
  }
  .result-value {
    font-size: 40px;
  }
  .player-card {
    flex-direction: column;
    text-align: center;
  }
  .tile {
    padding: var(--spacing-xl) var(--spacing-md);
  }
  .form-grid {
    gap: var(--spacing-md);
  }
}

/* Small phone */
@media (max-width: 419px) {
  .t-hero-display {
    font-size: 28px;
  }
  .result-value {
    font-size: 32px;
  }
  .cta-group {
    flex-direction: column;
  }
  .h-index-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ============================================================
   Chinese (zh) Language Layout Tweaks
   CJK characters are visually wider/heavier than Latin at the
   same px size, so we scale down sizes and adjust spacing.
   Cloud font: Noto Sans SC; system priority: PingFang SC.
   ============================================================ */
html:lang(zh) {
  /* PingFang SC first (macOS/iOS), Noto Sans SC as cloud fallback */
  --font-display: 'PingFang SC', 'Noto Sans SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --font-text:    'PingFang SC', 'Noto Sans SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  font-size: 15px;
}

/* Remove Latin negative letter-spacing — CJK looks better at 0 */
html:lang(zh) body,
html:lang(zh) .t-hero-display,
html:lang(zh) .t-display-lg,
html:lang(zh) .t-display-md,
html:lang(zh) .t-lead,
html:lang(zh) .t-lead-airy,
html:lang(zh) .t-tagline,
html:lang(zh) .t-body-strong,
html:lang(zh) .t-body,
html:lang(zh) .t-caption,
html:lang(zh) .t-caption-strong,
html:lang(zh) .t-fine-print,
html:lang(zh) .t-nav-link,
html:lang(zh) .scholar-item__name,
html:lang(zh) .bar-chart__label,
html:lang(zh) .sub-nav__title,
html:lang(zh) .player-card__label,
html:lang(zh) .player-card__name,
html:lang(zh) .player-card__detail,
html:lang(zh) .form-label,
html:lang(zh) .form-input,
html:lang(zh) .search-dropdown__input,
html:lang(zh) .search-dropdown__item,
html:lang(zh) .global-nav__brand,
html:lang(zh) .global-nav__links a,
html:lang(zh) .sidebar__title,
html:lang(zh) .sidebar__chart-title,
html:lang(zh) .gs-link,
html:lang(zh) .result-name,
html:lang(zh) .result-value,
html:lang(zh) .site-footer__links a,
html:lang(zh) .site-footer__legal {
  letter-spacing: 0.02em;
  font-family: 'PingFang SC', 'Noto Sans SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
}

html:lang(zh) body {
  font-size: 15px;
  line-height: 1.65;
  font-weight: 400;
}

/* --- Heading scale (CJK ~88% of Latin pt size) --- */
html:lang(zh) .t-hero-display {
  font-size: 42px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0;
}

html:lang(zh) .t-display-lg {
  font-size: 32px;
  line-height: 1.28;
  font-weight: 600;
  letter-spacing: 0;
}

html:lang(zh) .t-display-md {
  font-size: 26px;
  line-height: 1.4;
  font-weight: 500;
}

html:lang(zh) .t-lead {
  font-size: 20px;
  line-height: 1.5;
}

html:lang(zh) .t-lead-airy {
  font-size: 18px;
  line-height: 1.6;
}

html:lang(zh) .t-tagline {
  font-size: 18px;
  line-height: 1.4;
  font-weight: 500;
}

html:lang(zh) .t-body-strong,
html:lang(zh) .t-body {
  font-size: 15px;
  line-height: 1.65;
}

html:lang(zh) .t-caption,
html:lang(zh) .t-caption-strong {
  font-size: 13px;
  line-height: 1.5;
}

html:lang(zh) .t-fine-print,
html:lang(zh) .t-nav-link {
  font-size: 12px;
  line-height: 1.5;
}

/* --- Result display --- */
html:lang(zh) .result-value {
  font-size: 56px;
  letter-spacing: 0;
}

html:lang(zh) .result-name {
  font-size: 22px;
}

/* --- Form elements --- */
html:lang(zh) .form-input,
html:lang(zh) .search-dropdown__input {
  font-size: 15px;
}

html:lang(zh) .form-label {
  font-size: 14px;
}

/* --- Dropdown items --- */
html:lang(zh) .search-dropdown__item {
  font-size: 13px;
}

html:lang(zh) .search-dropdown__item-rank {
  font-size: 11px;
}

/* --- Navigation --- */
html:lang(zh) .global-nav__links a,
html:lang(zh) .global-nav__brand {
  font-size: 13px;
}

html:lang(zh) .sub-nav__title {
  font-size: 15px;
}

/* --- Buttons --- */
html:lang(zh) .btn-primary,
html:lang(zh) .btn-secondary,
html:lang(zh) button[type="submit"] {
  font-size: 15px;
  letter-spacing: 1.5px;
}

/* --- Sidebar / chart --- */
html:lang(zh) .scholar-item__name,
html:lang(zh) .bar-chart__label {
  font-size: 13px;
}

html:lang(zh) .sidebar__title,
html:lang(zh) .sidebar__chart-title {
  font-size: 15px;
}

/* --- Player card --- */
html:lang(zh) .player-card__name {
  font-size: 16px;
}

html:lang(zh) .player-card__label,
html:lang(zh) .player-card__detail {
  font-size: 12px;
}

/* --- Footer --- */
html:lang(zh) .site-footer__legal {
  font-size: 12px;
  line-height: 1.6;
}

