/* =========================================
   Gametop Design System V2 (Source)
   与 gametop.css 变量保持一致
   ========================================= */

:root {
  /* Brand */
  --gt-primary: #6366f1;
  --gt-primary-hover: #4f46e5;
  --gt-bg-header: #f8fafc;

  /* Text */
  --gt-text-main: #1f2937;
  --gt-text-sub: #6b7280;
  --gt-text-muted: #9ca3af;

  /* Status Colors */
  --gt-success: #10b981;
  --gt-warning: #f59e0b;
  --gt-danger: #ef4444;
  --gt-info: #3b82f6;

  /* Tier Colors */
  --gt-tier-t0: #fbbf24;
  --gt-tier-t1: #ef4444;
  --gt-tier-t2: #a855f7;
  --gt-tier-t3: #3b82f6;
  --gt-tier-t4: #3498db;
  --gt-tier-t5: #9b59b6;

  /* UI Elements */
  --gt-radius: 8px;
  --gt-radius-lg: 12px;
  --gt-radius-sm: 4px;
  --gt-border: #e2e8f0;
  --gt-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --gt-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

  /* Compatibility Aliases (旧变量名) */
  --gt-text: var(--gt-text-main);
  --gt-text-light: var(--gt-text-sub);
  --gt-border-light: #f3f4f6;
}

/* Base Reset */
#gt-app-root,
.gt-ranking-widget,
.gt-shell {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: var(--gt-text-main);
  line-height: 1.5;
  box-sizing: border-box;
}

#gt-app-root, .gt-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

#gt-app-root *, #gt-app-root *::before, #gt-app-root *::after,
.gt-ranking-widget *, .gt-ranking-widget *::before, .gt-ranking-widget *::after,
.gt-shell *, .gt-shell *::before, .gt-shell *::after {
  box-sizing: border-box;
}

#gt-app-root button {
  font-family: inherit;
}

/* Links inside wrapper */
#gt-app-root a {
  text-decoration: none !important;
  border: none !important;
  box-shadow: none !important;
  color: inherit;
}
#gt-app-root a:hover {
  text-decoration: none !important;
  color: inherit;
}

.gt-ranking-widget a {
  text-decoration: none !important;
  border: none !important;
  box-shadow: none !important;
  color: inherit;
}
.gt-ranking-widget a:hover {
  text-decoration: none !important;
  color: inherit;
}

/* Transparent Wrapper (default) */
.gt-wrapper-transparent {
  background: rgba(0,0,0,0.02);
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,0.06);
  overflow: hidden;
  padding: 0;
}

/* sr-only for AI/Screen Readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* =========================================
   Ranking Page Components (Source)
   与 gametop.css 同步的榜单页样式
   ========================================= */

/* =========================================
   Ranking Toolbar
   ========================================= */
.gt-ranking-toolbar {
  padding: 1.5rem;
  border-bottom: 1px solid var(--gt-border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  gap: 1rem;
}

.gt-filter-group { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.gt-filter-btn {
  appearance: none;
  -webkit-appearance: none;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s;
  opacity: 0.7;
}
.gt-filter-btn:hover { background: rgba(0,0,0,0.05); opacity: 1; }
.gt-filter-btn.active { background: rgba(0,0,0,0.8); color: white; border-color: transparent; opacity: 1; }

.gt-search-input-v2 {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  width: 240px;
  font-size: 0.875rem;
  background: rgba(255,255,255,0.5);
  transition: all 0.2s;
}
.gt-search-input-v2:focus {
  background: white;
  outline: 2px solid rgba(99, 102, 241, 0.2);
  border-color: var(--gt-primary);
}

/* =========================================
   Ranking Table Grid
   ========================================= */
.gt-ranking-list {
  display: flex;
  flex-direction: column;
}

.gt-ranking-header {
  display: grid;
  grid-template-columns: 60px 3fr 60px 80px 100px 100px 120px;
  column-gap: 1.5rem;
  padding: 0.75rem 1.5rem;
  background: rgba(0,0,0,0.02);
  border-bottom: 2px solid rgba(0,0,0,0.06);
  font-size: 0.8rem;
  font-weight: 700;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-items: center;
}

.gt-ranking-header > div {
  display: flex;
  align-items: center;
  height: 100%;
}

/* Explicit Header Alignments & Resets */
.gt-ranking-header .gt-col-rank,
.gt-ranking-header .gt-col-game,
.gt-ranking-header .gt-col-tier,
.gt-ranking-header .gt-col-score,
.gt-ranking-header .gt-col-stat,
.gt-ranking-header .gt-col-lang,
.gt-ranking-header .gt-col-price {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  opacity: 1;
  font-family: inherit;
  display: flex;
  align-items: center;
}

.gt-ranking-header .gt-col-rank { justify-content: center; }
.gt-ranking-header .gt-col-game { justify-content: flex-start; }
.gt-ranking-header .gt-col-tier { justify-content: center; }
.gt-ranking-header .gt-col-score { justify-content: center; }
.gt-ranking-header .gt-col-stat { justify-content: center; }
.gt-ranking-header .gt-col-lang { justify-content: center; }
.gt-ranking-header .gt-col-price { justify-content: flex-end; }

.gt-ranking-item {
  display: grid;
  grid-template-columns: 60px 3fr 60px 80px 100px 100px 120px;
  column-gap: 1.5rem;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  transition: all 0.2s;
  cursor: pointer;
  text-decoration: none !important;
  color: inherit;
}
.gt-empty-row {
  grid-column: 1 / -1;
  padding: 4rem;
  text-align: center;
  color: var(--gt-text-sub);
  font-size: 0.95rem;
}
.gt-ranking-item:hover {
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transform: translateY(-1px);
  border-color: transparent;
}

/* =========================================
   Column Styles
   ========================================= */
.gt-col-rank {
  font-size: 1.25rem;
  font-weight: 700;
  opacity: 0.4;
  font-family: monospace;
  text-align: center;
}
.gt-col-rank.top-3 { opacity: 1; color: #fbbf24; }

.gt-col-game { display: flex; gap: 1rem; align-items: center; text-align: left; }

.gt-game-cover-v2 {
  width: 80px;
  height: 45px;
  background: rgba(0,0,0,0.1);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

.gt-game-info h3 { margin: 0 !important; font-size: 0.95rem; color: inherit; font-weight: 700; line-height: 1.1; padding: 0 !important; }
.gt-game-en { display: block; font-size: 0.75rem; opacity: 0.6; margin-top: 2px; line-height: 1.1; }
.gt-game-tags { margin-top: 4px; display: flex; gap: 4px; }
.gt-tag-v2 { font-size: 0.7rem; padding: 1px 4px; background: rgba(0,0,0,0.05); opacity: 0.7; border-radius: 3px; }

.gt-col-tier { display:flex; align-items:center; justify-content:center; }
.gt-tier-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  min-width: 2.5em;
}

.gt-col-score { font-weight: 700; font-size: 1.1rem; text-align: center; }

.gt-col-stat {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 32px;
  opacity: 0.8;
}
.gt-trend-bar {
  flex: 1;
  min-width: 6px;
  background: rgba(0,0,0,0.15);
  border-radius: 1px;
}

.gt-col-lang { font-size: 0.85rem; opacity: 0.7; text-align: center; }
.gt-lang-audio { color: var(--gt-primary); font-weight: 700; background: rgba(99, 102, 241, 0.1); padding: 2px 6px; border-radius: 4px; }
.gt-lang-full { color: var(--gt-success); font-weight: 700; background: rgba(16, 185, 129, 0.1); padding: 2px 6px; border-radius: 4px; }
.gt-lang-text { color: var(--gt-info); font-weight: 700; background: rgba(59, 130, 246, 0.1); padding: 2px 6px; border-radius: 4px; }
.gt-lang-none { opacity: 0.4; font-size: 0.8rem; }

.gt-col-price {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  text-align: right;
}
.gt-price-val { font-weight: 700; color: #10b981; font-size: 1rem; }
.gt-price-meta { display: flex; align-items: center; gap: 4px; font-size: 0.7rem; opacity: 0.6; margin-top: 2px; }
.gt-discount-tag { background: #ef4444; color: white; padding: 0 3px; border-radius: 2px; opacity: 1; }
.gt-price-old { text-decoration: line-through; }

/* =========================================
   Ranking Widget (Top10)
   ========================================= */
.gt-ranking-widget {
  background: rgba(0,0,0,0.02);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 16px;
  overflow: hidden;
}

.gt-ranking-widget-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.gt-ranking-widget-item {
  margin: 0;
  padding: 0;
}

.gt-ranking-widget-link {
  display: grid;
  grid-template-columns: 44px 1fr 64px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.03);
  transition: background 0.2s, box-shadow 0.2s;
}
.gt-ranking-widget-item:last-child .gt-ranking-widget-link {
  border-bottom: none;
}
.gt-ranking-widget-link:hover {
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.gt-ranking-widget-rank {
  font-size: 1rem;
  font-weight: 700;
  opacity: 0.4;
  font-family: monospace;
  text-align: center;
}
.gt-ranking-widget-rank.is-top {
  opacity: 1;
  color: var(--gt-tier-t0);
}

.gt-ranking-widget-name {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gt-ranking-widget-score {
  font-size: 0.95rem;
  font-weight: 800;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.gt-ranking-widget-empty {
  padding: 1rem;
  color: var(--gt-text-sub);
  font-size: 0.9rem;
}

.gt-ranking-widget-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.gt-ranking-widget-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.6rem 1rem;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 6px;
  background: transparent;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 0.2s, opacity 0.2s;
}
.gt-ranking-widget-btn:hover {
  background: rgba(0,0,0,0.05);
}
/* =========================================
   Detail Page Components (Source)
   与 gametop.css 同步的详情页样式
   ========================================= */

.gt-detail-container {
  padding: 20px;
}

/* Breadcrumb */
.gt-breadcrumb {
  font-size: 0.875rem;
  color: var(--gt-text-sub);
  margin-bottom: 20px;
}
.gt-breadcrumb a { color: var(--gt-text-sub); text-decoration: none; }
.gt-breadcrumb a:hover { color: var(--gt-primary); }
.gt-breadcrumb-sep { margin: 0 0.5rem; opacity: 0.5; }
.gt-breadcrumb-current { font-weight: 500; color: var(--gt-text-main); }

/* Header Card */
.gt-header-card {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 2rem;
  background: rgba(0,0,0,0.03);
  padding: 1.5rem;
  border-radius: var(--gt-radius-lg);
  border: 1px solid rgba(0,0,0,0.06);
  margin-bottom: 2rem;
  align-items: start;
}

.gt-header-cover {
  width: 100%;
  aspect-ratio: 460 / 215;
  border-radius: 8px;
  overflow: hidden;
  background: #cbd5e1;
  border: 1px solid rgba(0,0,0,0.1);
  position: relative;
}

.gt-header-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

.gt-header-content-wrapper {
  display: flex;
  gap: 2rem;
}

.gt-header-main { flex: 1; }

.gt-header-titles h1 { font-size: 1.8rem; font-weight: 800; margin: 0 0 0.5rem 0; line-height: 1.1; }
.gt-title-en { font-size: 1.1rem; color: #6b7280; margin-bottom: 1rem; }
.gt-description {
  margin-bottom: 1.5rem;
  line-height: 1.6;
  font-size: 0.9rem;
  color: #4b5563;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gt-tags-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.gt-header-tag {
  background: rgba(0,0,0,0.05);
  color: inherit;
  opacity: 0.8;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
}

.gt-meta-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 3rem;
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px dashed rgba(0,0,0,0.1);
}
.gt-meta-column { display: flex; flex-direction: column; gap: 0.5rem; }
.gt-meta-item { font-size: 0.875rem; color: var(--gt-text-main); }
.gt-meta-item span { color: inherit; opacity: 0.6; margin-right: 0.5rem; }
.gt-meta-item strong { color: inherit; opacity: 0.9; }

/* Side Column (Score, Lang, Steam) */
.gt-header-side {
  width: 130px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.gt-score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 2px solid var(--gt-border);
  border-radius: 12px;
  padding: 1rem;
  background: #ffffff;
  text-align: center;
}
.gt-score-tier { font-size: 1.5rem; font-weight: 900; line-height: 1; margin-bottom: 0.25rem; }
.gt-score-value { font-size: 1.25rem; font-weight: 700; color: var(--gt-text-main); }
.gt-score-label { font-size: 0.7rem; color: var(--gt-text-muted); margin-top: 0.25rem; }

.gt-lang-card {
  border: 1px solid rgba(0,0,0,0.1);
  background: rgba(255,255,255,0.8);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
}
.gt-lang-label { font-size: 0.7rem; display: block; color: var(--gt-text-muted); margin-bottom: 2px; }
.gt-lang-status { font-weight: 600; font-size: 0.9rem; color: var(--gt-text-main); }

.gt-steam-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  background: #171a21;
  color: white !important;
  padding: 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: auto;
  transition: opacity 0.2s;
}
.gt-steam-btn:hover { opacity: 0.9; }

/* Section Cards (Events/Trend/FAQ/Mentions) */
.gt-section, .gt-events-card, .gt-index-section, .gt-faq-section, .gt-mentions-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 2rem;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.gt-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0;
  margin-bottom: 1rem;
  padding-left: 12px;
  border-left: 4px solid var(--gt-primary);
  line-height: 1.2;
}

/* Event Timeline */
.gt-event-timeline { display: flex; flex-direction: column; }
.gt-event-item {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.gt-event-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.gt-event-title { font-weight: 700; color: var(--gt-text-main); display: block; }
.gt-event-desc { margin-top: 0.5rem; color: var(--gt-text-sub); font-size: 0.95rem; line-height: 1.6; margin-bottom: 0; }
.gt-event-note { margin-top: 1.5rem; padding-top: 0.5rem; border-top: 1px dashed rgba(0,0,0,0.1); font-size: 0.85rem; color: var(--gt-text-muted); }

/* Trend Chart */
.gt-index-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 160px;
  gap: 4px;
}
.gt-index-col { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 4px; }
.gt-chart-bar {
  width: 80%;
  background: rgba(0,0,0,0.1);
  border-radius: 2px 2px 0 0;
  transition: height 0.3s;
  min-height: 4px;
}
.gt-chart-bar.active { background: var(--gt-primary); }
.gt-chart-bar:hover { opacity: 0.8; }
.gt-index-col-label { font-size: 0.7rem; margin-top: 6px; color: var(--gt-text-muted); }

/* Dashboard Grid (FAQ + Mentions) */
.gt-dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

/* FAQ */
.gt-faq-list { display: flex; flex-direction: column; }
.gt-faq-item {
  padding: 1rem 0;
  border-bottom: 1px solid #f3f4f6;
}
.gt-faq-item:last-child { border-bottom: none; }
.gt-faq-q { font-weight: 600; margin-bottom: 4px; color: #1f2937; display: flex; gap: 0.5rem; }
.gt-faq-a { font-size: 0.9rem; color: #4b5563; line-height: 1.5; display: flex; gap: 0.5rem; }
.gt-q-icon { color: var(--gt-primary); font-weight: 800; }
.gt-a-icon { color: var(--gt-success); font-weight: 800; }

/* Mentions */
.gt-mentions-list { display: flex; flex-direction: column; gap: 0.75rem; }
.gt-mention-link {
  display: block;
  text-decoration: none;
  color: #374151;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 8px;
  border: 1px solid #f3f4f6;
  transition: all 0.2s;
}
.gt-mention-link:hover {
  background: white;
  border-color: var(--gt-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.gt-mention-meta { display: block; font-size: 0.75rem; color: var(--gt-text-muted); margin-bottom: 4px; }
.gt-mention-title { font-weight: 500; font-size: 0.9rem; }

.gt-empty-placeholder {
  padding: 2rem;
  text-align: center;
  color: var(--gt-text-sub);
  font-size: 0.9rem;
  background: rgba(0,0,0,0.02);
  border-radius: 8px;
  border: 1px dashed rgba(0,0,0,0.1);
}
/* =========================================
   Responsive Rules (Source)
   与 gametop.css 同步的断点
   ========================================= */

@media (max-width: 1024px) {
  .gt-ranking-header, .gt-ranking-item {
    grid-template-columns: 50px 3fr 50px 70px 80px 80px 100px;
    padding: 1rem;
  }

  .gt-header-card { grid-template-columns: 1fr; gap: 1.5rem; }
  .gt-header-content-wrapper { flex-direction: column; }
  .gt-header-side { width: 100%; flex-direction: row; justify-content: space-between; }
  .gt-score-card, .gt-lang-card, .gt-steam-btn { width: 32%; margin: 0; }
}

@media (max-width: 768px) {
  .gt-detail-container { padding: 1rem; }
  .gt-header-cover { max-width: 100%; }

  /* Ranking Mobile */
  .gt-ranking-header { display: none; }
  .gt-ranking-item {
    display: flex;
    flex-wrap: wrap;
    position: relative;
    padding: 1rem;
    gap: 0.5rem;
  }

  .gt-col-rank {
    position: absolute;
    top: 1rem; left: 1rem;
    font-size: 0.9rem; opacity: 0.5;
  }
  .gt-col-game { width: 100%; margin-left: 1.5rem; }
  .gt-col-tier { width: auto; margin-left: 1.5rem; }
  .gt-col-score { width: auto; margin-left: 0.5rem; text-align: left; }
  .gt-col-stat, .gt-col-lang { display: none; }
  .gt-col-price { margin-left: auto; text-align: right; }

  /* Detail Mobile */
  .gt-dashboard-grid { grid-template-columns: 1fr; }
  .gt-header-side { flex-wrap: wrap; gap: 0.5rem; }
  .gt-score-card, .gt-lang-card { width: 48%; }
  .gt-steam-btn { width: 100%; }

  .gt-meta-grid { grid-template-columns: 1fr; gap: 1rem; }
  .gt-header-titles h1 { font-size: 1.5rem; }
}

@media (max-width: 640px) {
  .gt-ranking-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.75rem;
  }
  .gt-visual-filters {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem !important;
  }
  .gt-search-wrap { width: 100%; }
  .gt-search-input-v2 { width: 100%; }

  .gt-header-card { padding: 1.25rem; }
  .gt-section, .gt-events-card, .gt-mentions-card { padding: 1.25rem; }
  .gt-index-chart { height: 140px; }
}

@media (max-width: 480px) {
  .gt-ranking-item { padding: 0.75rem; }
  .gt-game-cover-v2 { width: 64px; height: 36px; }
  .gt-col-game { margin-left: 1.25rem; }
  .gt-col-tier { margin-left: 1.25rem; }
  .gt-col-score { margin-left: 0.25rem; }
  .gt-price-val { font-size: 0.95rem; }

  .gt-ranking-widget-link {
    grid-template-columns: 40px 1fr 56px;
    padding: 0.65rem 0.9rem;
  }
}
