/* CSS Variables */
:root {
  --bg: #081016;
  --surface: rgba(16, 24, 31, 0.88);
  --surface-2: rgba(25, 36, 45, 0.9);
  --surface-3: rgba(34, 48, 59, 0.86);
  --text: #ffffff;
  --muted: #aab9c4;
  --accent: #4fd8ff;
  --accent-2: #ff70ad;
  --accent-3: #6bf2b8;
  --warn: #ffd56a;
  --border: rgba(143, 181, 202, 0.18);
  --hairline: rgba(255, 255, 255, 0.07);
  --glass: rgba(11, 19, 26, 0.68);
  --shadow: 0 18px 60px rgba(0,0,0,0.42);
}

/* Level colors (difficulty 1-7) — darkened for WCAG contrast with white text */
.lv-1 { background-color: #053d87 !important; }
.lv-2 { background-color: #2a6b18 !important; }
.lv-3 { background-color: #6a6a21 !important; }
.lv-4 { background-color: #950000 !important; }
.lv-5 { background-color: #7c157c !important; }
.lv-6 { background-color: #f48df4 !important; color: #000 !important; }
.lv-7 { background-color: #9a5800 !important; }

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  background-color: var(--bg);
  color: var(--text);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.4;
  overflow-x: hidden;
  background:
    linear-gradient(120deg, rgba(79, 216, 255, 0.13), transparent 34%),
    linear-gradient(250deg, rgba(255, 112, 173, 0.11), transparent 34%),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(180deg, #081016 0%, #0d1720 48%, #081016 100%);
  background-size: auto, auto, 48px 48px, 48px 48px, auto;
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.06), transparent 18rem),
    linear-gradient(90deg, rgba(79,216,255,0.06), rgba(255,112,173,0.035), rgba(107,242,184,0.045));
  mask-image: linear-gradient(180deg, #000, transparent 72%);
  z-index: -1;
}

a {
  text-decoration: none;
  color: inherit;
}

.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;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
  outline: none;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(7, 13, 18, 0.74);
  backdrop-filter: blur(18px) saturate(1.25);
  border-bottom: 1px solid rgba(143, 181, 202, 0.16);
  width: 100%;
  padding: 12px 0 0;
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.28);
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  opacity: 0.9;
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 14px;
}

.brand::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2), var(--accent-3));
}

.brand-title {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.logo {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  margin-bottom: 2px;
  display: inline-block;
  letter-spacing: 0;
  text-shadow: 0 0 26px rgba(79, 216, 255, 0.38);
}

.subtitle {
  font-size: 11px;
  color: #b7c7d2;
  line-height: 1.4;
}

.ma-tip-link {
  color: #ffc850;
  text-decoration: none;
  transition: color 0.15s ease;
}

.ma-tip-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.ma-tip-link--footer {
  font-size: 13px;
  font-weight: 600;
}

.controls-area {
  width: 100%;
}

.search-row {
  display: flex;
  gap: 8px;
  width: 100%;
  flex-wrap: wrap;
}

.search-bar {
  flex: 1 1 280px;
  min-width: 0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(143, 181, 202, 0.22);
  color: #fff;
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.search-bar:focus,
.search-bar:focus-visible {
  border-color: var(--accent);
  background: rgba(7, 16, 22, 0.86);
  outline: none;
  box-shadow: 0 0 0 3px rgba(79, 216, 255, 0.18);
}

.search-bar::placeholder {
  color: var(--muted);
}

.sort-select {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(143, 181, 202, 0.22);
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  min-width: 100px;
}

.sort-select:focus,
.sort-select:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(90, 209, 255, 0.35);
}

.btn-tool {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(143, 181, 202, 0.22);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, background 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}

.btn-tool:hover {
  background: rgba(79, 216, 255, 0.15);
  border-color: rgba(79, 216, 255, 0.55);
  color: #e9fbff;
  box-shadow: 0 10px 26px rgba(79, 216, 255, 0.12);
}

.btn-tool:active {
  transform: scale(0.98);
}

.btn-small {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  background: var(--accent);
  color: #000;
}

.filter-toggle-btn {
  min-width: 56px;
}

.filter-toggle-btn.active {
  background: linear-gradient(135deg, rgba(79, 216, 255, 0.92), rgba(107, 242, 184, 0.82));
  color: #04151b;
  border-color: rgba(79, 216, 255, 0.7);
}

.batch-download-btn {
  min-width: 72px;
}

.batch-download-btn.active {
  background: linear-gradient(135deg, rgba(255, 112, 173, 0.88), rgba(79, 216, 255, 0.76));
  color: #061017;
  border-color: rgba(255, 112, 173, 0.65);
}

.manifest-download-btn {
  min-width: 72px;
}

.theme-toggle-btn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.manifest-download-btn:hover {
  background: #4dd88a;
  color: #000;
}

/* Filter Panel */
.filter-panel {
  display: none;
  background: rgba(7, 13, 18, 0.86);
  border-bottom: 1px solid rgba(143, 181, 202, 0.16);
  padding: 12px;
  animation: slideDown 0.3s ease;
  backdrop-filter: blur(16px);
}

.filter-panel.open {
  display: block;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.filter-panel-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  gap: 10px;
}

.filter-section {
  background: rgba(255, 255, 255, 0.055);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(143, 181, 202, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.filter-title {
  font-size: 13px;
  font-weight: bold;
  color: #dcf7ff;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.filter-ranges {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.range-filter-row {
  display: grid;
  grid-template-columns: 68px 1fr;
  align-items: center;
  gap: 10px;
}

.range-filter-row .filter-title {
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
}

.range-filter-row .dual-slider-container {
  min-width: 0;
}

.range-filter-row .slider-values {
  margin-top: 2px;
}

/* Dual Range Slider */
.dual-slider-container {
  padding: 0 4px;
}

.dual-slider {
  position: relative;
  height: 24px;
}

.dual-slider input[type="range"] {
  position: absolute;
  width: 100%;
  height: 6px;
  background: transparent;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
  top: 50%;
  transform: translateY(-50%);
}

.dual-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
}

.dual-slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  pointer-events: auto;
  margin-top: -7px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.dual-slider input[type="range"]::-moz-range-track {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
}

.dual-slider input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  pointer-events: auto;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.slider-values {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text);
  margin-top: 4px;
}

.slider-values span:first-child,
.slider-values span:last-child {
  min-width: 36px;
  text-align: center;
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

/* Genre Buttons */
.genre-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.genre-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(143, 181, 202, 0.16);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 16px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.genre-btn.active {
  background: linear-gradient(135deg, rgba(79, 216, 255, 0.95), rgba(107, 242, 184, 0.86));
  color: #021218;
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(79, 216, 255, 0.16);
}

.genre-btn:hover:not(.active) {
  border-color: var(--accent);
  color: var(--text);
}

.genre-hint {
  font-size: 10px;
  color: var(--muted);
  margin-top: 6px;
}

/* OC (deleted songs) filter modes */
.oc-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.oc-filter-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(143, 181, 202, 0.16);
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.oc-filter-btn.active {
  background: linear-gradient(135deg, rgba(255, 112, 173, 0.24), rgba(255, 213, 106, 0.12));
  color: #ffc0d8;
  border-color: rgba(255, 112, 173, 0.62);
}

.oc-filter-btn:hover:not(.active) {
  border-color: #ff7878;
  color: var(--text);
}

/* Chart Type Buttons */
.type-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.type-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(143, 181, 202, 0.16);
  border-radius: 8px;
  padding: 5px;
  cursor: pointer;
  transition: all 0.2s;
  width: 92px;
  opacity: 0.72;
  filter: grayscale(0.35);
}

.type-btn img {
  width: 100%;
  display: block;
}

.type-btn.active {
  opacity: 1;
  filter: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(79, 216, 255, 0.22), 0 10px 28px rgba(79, 216, 255, 0.14);
}

.type-btn:hover:not(.active) {
  opacity: 0.65;
}

/* Difficulty Buttons */
.diff-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.diff-btn {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  border: 2px solid transparent;
  color: #fff;
  opacity: 1;
}

.diff-btn:not(.active) {
  opacity: 0.7;
  filter: grayscale(0.35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.diff-btn:hover:not(.active) {
  opacity: 0.6;
}

/* Batch section full width */
.batch-section {
  grid-column: 1 / -1;
}

/* Version Filter Buttons */
.version-filter-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
}

.version-filter-btn {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(143, 181, 202, 0.16);
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.version-filter-btn img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.version-filter-btn.active {
  border-color: var(--accent);
  background: rgba(79, 216, 255, 0.08);
  box-shadow: 0 0 0 1px rgba(79, 216, 255, 0.22), 0 10px 28px rgba(79, 216, 255, 0.14);
}

.version-filter-btn:not(.active) {
  opacity: 0.7;
  filter: grayscale(0.35);
}

.version-filter-btn:hover:not(.active) {
  opacity: 0.6;
}

/* Version Download Grid */
.batch-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.all-versions-download-btn {
  border-color: rgba(90, 209, 255, 0.45);
}

.oc-download-btn {
  border-color: rgba(255, 120, 120, 0.45);
  color: #ff7878;
}

.oc-download-btn.active,
.oc-mode-toggle.active {
  background: rgba(255, 120, 120, 0.18);
  border-color: #ff7878;
  color: #ff9a9a;
  box-shadow: 0 0 0 1px rgba(255, 120, 120, 0.25);
}

.all-versions-download-btn.oc-mode-active {
  border-color: rgba(255, 120, 120, 0.55);
  color: #ff9a9a;
}

.version-download-grid.oc-mode .version-dl-btn {
  border-color: rgba(255, 120, 120, 0.45);
}

.version-download-grid.oc-mode .version-dl-btn:hover {
  border-color: #ff7878;
  box-shadow: 0 0 8px rgba(255, 120, 120, 0.45);
}

.version-download-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 6px;
}

.version-dl-btn {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(143, 181, 202, 0.16);
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.version-dl-btn img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
}

.version-dl-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(79, 216, 255, 0.15);
  transform: scale(1.05);
}

/* Side rails (desktop extras) */
.side-rail {
  display: none;
  width: 160px;
  flex-shrink: 0;
}

.side-rail-slot {
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  padding: 15px;
  border-radius: 8px;
  font-size: 12px;
  border: 1px dashed rgba(143, 181, 202, 0.22);
}

.side-rail-slot--tall {
  min-height: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.side-rail-label {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 10px;
}

.side-rail-ad {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}

.side-rail-ad:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.side-rail-ad img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* Main Content */
.content {
  display: flex;
  max-width: 1600px;
  margin: 0 auto;
  padding: 22px 16px 28px;
  gap: 18px;
}

.main-content {
  flex: 1;
  min-width: 0;
  text-align: center;
}

.stats-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  font-size: 13px;
  color: #d6e6ee;
  margin: 0 auto 12px;
  padding: 8px 12px;
  border: 1px solid rgba(143, 181, 202, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stats-text::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent-3);
  box-shadow: 0 0 12px rgba(107, 242, 184, 0.72);
  flex: 0 0 auto;
}

.main-content .grid,
.main-content .pagination {
  text-align: left;
}

.circle-plus-tip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
  padding: 11px 14px;
  border-radius: 8px;
  border: 1px solid rgba(79, 216, 255, 0.25);
  background: linear-gradient(135deg, rgba(79, 216, 255, 0.12), rgba(107, 242, 184, 0.07), rgba(255, 112, 173, 0.08));
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.circle-plus-tip:hover,
.circle-plus-tip:focus-visible {
  border-color: rgba(79, 216, 255, 0.58);
  background: linear-gradient(135deg, rgba(79, 216, 255, 0.18), rgba(107, 242, 184, 0.1), rgba(255, 112, 173, 0.1));
  outline: none;
}

.circle-plus-tip:active {
  transform: scale(0.99);
}

.circle-plus-tip-label {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(79, 216, 255, 0.16);
  border: 1px solid rgba(79, 216, 255, 0.35);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.circle-plus-tip-text {
  font-size: 13px;
  color: #d7e2ea;
  line-height: 1.4;
}

.circle-plus-tip-arrow {
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.empty-state-hint {
  margin: 14px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* Grid & Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.card {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), transparent 38%),
    rgba(10, 18, 24, 0.72);
  border: 1px solid rgba(143, 181, 202, 0.16);
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
  cursor: pointer;
  min-width: 0;
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
  opacity: 0.45;
  z-index: 1;
  pointer-events: none;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-4px);
  border-color: rgba(79, 216, 255, 0.5);
  box-shadow: 0 18px 46px rgba(0,0,0,0.36), 0 0 0 1px rgba(79, 216, 255, 0.08);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card.selected-custom {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 216, 255, 0.24), 0 18px 46px rgba(0, 0, 0, 0.3);
}

.card.is-oc {
  border-color: rgba(255, 120, 120, 0.45);
}

.card.is-oc:hover {
  border-color: #ff7878;
}

.card.is-oc .cover {
  filter: grayscale(0.35);
}

.stats-action {
  margin-left: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.stats-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.card:active {
  transform: translateY(-2px);
}

.img-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #071017;
  position: relative;
  border-bottom: 1px solid rgba(143, 181, 202, 0.13);
}

.img-container::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background:
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72)),
    linear-gradient(90deg, rgba(79,216,255,0.12), transparent 38%, rgba(255,112,173,0.12));
  pointer-events: none;
}

.dl-count {
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(5, 12, 16, 0.78);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  pointer-events: none;
  line-height: 1.2;
  z-index: 2;
}

.chart-type {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: auto;
  pointer-events: none;
  z-index: 2;
}

.oc-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(255, 112, 112, 0.88);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  line-height: 1.2;
  z-index: 2;
}

.cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease, filter 0.24s ease;
}

.card:hover .cover {
  transform: scale(1.055);
  filter: saturate(1.08) contrast(1.03);
}

.meta {
  padding: 12px 12px 13px;
  min-width: 0;
}

.card-facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 5px;
  min-width: 0;
  margin-bottom: 7px;
  color: #a9c5d3;
  font-size: 10px;
  line-height: 1.2;
}

.card-version-full,
.card-chart-summary {
  width: fit-content;
  max-width: 100%;
  padding: 3px 6px;
  border: 1px solid rgba(143, 181, 202, 0.13);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.055);
}

.card-version-full {
  color: #40566a;
  font-weight: 750;
  white-space: normal;
  overflow-wrap: anywhere;
}

.card-chart-summary {
  color: #607486;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card-title-full {
  font-size: 14px;
  font-weight: 800;
  margin: 0;
  min-height: 2.7em;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.card-artist-full {
  font-size: 11px;
  color: #a8b9c3;
  margin: 4px 0 0;
  min-height: 2.7em;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
}

.badge {
  font-size: 8px;
  padding: 3px 6px;
  border-radius: 4px;
  font-weight: bold;
  color: #fff;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 30px 0;
  padding: 0 16px;
}

.page-info {
  font-size: 13px;
  color: var(--muted);
  font-weight: bold;
  padding: 0 10px;
}

.page-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  background: var(--accent);
  color: #000;
}

.page-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.page-jump {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-jump-input {
  width: 60px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  text-align: center;
}

/* Back to Top */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 20px;
  width: 50px;
  height: 50px;
  background-color: var(--accent);
  color: #000;
  border: none;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}

.back-to-top:hover {
  transform: scale(1.1);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 7, 10, 0.72);
  backdrop-filter: blur(14px) saturate(1.25);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.085), transparent 22%),
    rgba(8, 15, 21, 0.9);
  border: 1px solid rgba(143, 181, 202, 0.2);
  border-radius: 10px;
  padding: 24px;
  max-width: min(980px, 96vw);
  width: 100%;
  text-align: left;
  animation: modalIn 0.22s ease;
  max-height: min(92vh, 980px);
  overflow: auto;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.54), inset 0 1px 0 rgba(255,255,255,0.08);
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-title {
  font-size: 24px;
  color: #f8fdff;
  margin: 0 0 8px 0;
  line-height: 1.2;
  letter-spacing: 0;
}

.modal-song-info {
  font-size: 14px;
  color: #a9bdc8;
  margin: 0 0 20px 0;
  word-break: break-word;
}

.chart-preview-pane {
  margin: 0 0 18px;
}

.modal-download-panel {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.preview-shell {
  display: grid;
  grid-template-columns: minmax(220px, 0.72fr) minmax(0, 1.28fr);
  gap: 20px;
  align-items: start;
}

.preview-media,
.preview-info {
  min-width: 0;
}

.preview-cover-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(143, 181, 202, 0.22);
  background: #050708;
  aspect-ratio: 1 / 1;
}

.preview-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview-type-mark {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(4, 12, 17, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.preview-player {
  margin-top: 12px;
  padding: 11px;
  border-radius: 8px;
  border: 1px solid rgba(107, 242, 184, 0.22);
  background: linear-gradient(135deg, rgba(107, 242, 184, 0.1), rgba(79, 216, 255, 0.055));
}

.preview-player-label {
  margin-bottom: 8px;
  color: #a7f0c8;
  font-size: 12px;
  font-weight: 800;
}

.preview-player audio {
  width: 100%;
  display: block;
  color-scheme: dark;
}

.preview-video-details {
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 107, 157, 0.22);
  background: rgba(255, 107, 157, 0.06);
  overflow: hidden;
}

.preview-video-details summary {
  cursor: pointer;
  padding: 10px 12px;
  color: #ffb6ce;
  font-size: 12px;
  font-weight: 800;
}

.preview-video-details video {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
  background: #000;
  color-scheme: dark;
}

.preview-unavailable {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(255, 200, 80, 0.24);
  border-radius: 8px;
  background: rgba(255, 200, 80, 0.07);
  color: #ffe0a1;
  font-size: 12px;
}

.preview-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.preview-meta-grid div {
  min-width: 0;
  padding: 10px 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(143, 181, 202, 0.14);
}

.preview-meta-grid span {
  display: block;
  margin-bottom: 5px;
  color: #8fa5b3;
  font-size: 11px;
  line-height: 1;
}

.preview-meta-grid strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-size: 13px;
}

.preview-section-title {
  margin: 16px 0 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.preview-diff-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.preview-diff-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.8fr) 54px minmax(0, 1.2fr);
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 7px 8px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.052);
  border: 1px solid rgba(143, 181, 202, 0.13);
}

.preview-diff-name {
  color: #dbe8ef;
  font-size: 12px;
  font-weight: 800;
}

.preview-diff-level {
  justify-self: start;
  min-width: 44px;
  padding: 3px 7px;
  border-radius: 4px;
  text-align: center;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.preview-diff-designer {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.preview-empty-line {
  padding: 10px;
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.maidata-preview {
  min-height: 168px;
  max-height: 260px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(79, 216, 255, 0.2);
  background:
    linear-gradient(rgba(79,216,255,0.035) 1px, transparent 1px),
    #071015;
  background-size: 100% 24px;
  color: #d8edf4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.modal-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  text-align: center;
}

.btn-download {
  min-height: 48px;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.18s, filter 0.18s, box-shadow 0.18s;
}

.btn-download span {
  font-size: 11px;
  font-weight: bold;
}

.btn-zip {
  background: linear-gradient(135deg, #4fd8ff, #6bf2b8);
  color: #03151a;
  box-shadow: 0 12px 28px rgba(79, 216, 255, 0.16);
}

.btn-zip:hover {
  background: #7de0ff;
  transform: scale(1.02);
}

.btn-dx {
  background: linear-gradient(135deg, #ff70ad, #ffd56a);
  color: #18070e;
  box-shadow: 0 12px 28px rgba(255, 112, 173, 0.15);
}

.btn-dx:hover {
  background: #ff8fb5;
  transform: scale(1.02);
}

.btn-folder {
  background: #7dd87d;
  color: #000;
}

.btn-folder:hover {
  background: #9be89b;
  transform: scale(1.02);
}

.btn-manifest {
  background: #4dd88a;
  color: #000;
  grid-column: 1 / -1;
}

.btn-manifest:hover {
  background: #6fe6a4;
  transform: scale(1.02);
}

.btn-close {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(143, 181, 202, 0.18);
  color: var(--muted);
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-close:hover {
  border-color: var(--accent);
  color: var(--text);
}

.captcha-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  min-height: 58px;
  text-align: center;
}

.captcha-container cap-widget {
  display: block;
  width: 100%;
  max-width: 280px;
  min-height: 58px;
}

.cap-widget-status {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #ffb4b4;
  text-align: center;
  max-width: 280px;
}

.btn-tac-verify {
  width: 100%;
  max-width: 280px;
  padding: 12px 16px;
  border: 1px solid rgba(90, 209, 255, 0.45);
  border-radius: 10px;
  background: rgba(90, 209, 255, 0.12);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.btn-tac-verify:hover:not(:disabled) {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.btn-tac-verify:disabled {
  opacity: 0.72;
  cursor: default;
  border-color: rgba(120, 220, 140, 0.45);
  background: rgba(120, 220, 140, 0.12);
  color: #8ee4a0;
}

.tac-verify-status {
  margin: 0;
  font-size: 12px;
  color: #8ee4a0;
}

.pack-progress-overlay {
  z-index: 1200;
}

.pack-progress-content {
  max-width: 420px;
  width: 90%;
}

.pack-progress-bar-wrap {
  height: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin: 16px 0 10px;
}

.pack-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #7de0ff);
  border-radius: 8px;
  transition: width 0.25s ease;
}

.pack-progress-text {
  font-size: 22px;
  font-weight: bold;
  color: var(--accent);
  margin: 0 0 8px;
  text-align: center;
}

.pack-progress-size {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 8px;
  text-align: center;
}

.pack-progress-detail {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  text-align: center;
  word-break: break-word;
  min-height: 1.2em;
}

.pack-progress-browser-tip {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(90, 209, 255, 0.35);
  background: rgba(90, 209, 255, 0.08);
  font-size: 12px;
  line-height: 1.5;
  color: #d8f4ff;
  text-align: left;
}

.pack-progress-browser-tip.is-blocked {
  border-color: rgba(255, 140, 60, 0.55);
  background: rgba(255, 140, 60, 0.1);
  color: #ffe2c8;
}

.pack-progress-browser-tip strong {
  color: #fff;
  font-weight: 700;
}

.pack-progress-hint {
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 0;
  text-align: center;
  opacity: 0.85;
}

.pack-progress-promo {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.pack-progress-promo-text {
  margin: 0 0 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
}

.pack-progress-promo-link {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  background: rgba(90, 209, 255, 0.12);
  border: 1px solid rgba(90, 209, 255, 0.35);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.pack-progress-promo-link:hover,
.pack-progress-promo-link:active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.pack-progress-eta {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 8px;
  text-align: center;
  min-height: 1.2em;
}

.pack-progress-cancel {
  margin-top: 12px;
}

.site-header .queue-strip {
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(90, 209, 255, 0.06), rgba(90, 209, 255, 0.02));
  padding: 5px 12px 6px;
  min-height: 28px;
  display: flex;
  align-items: center;
}

.site-header .queue-strip-inner {
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
}

.site-header .queue-stats-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  min-width: 0;
}

.site-header .queue-stat,
.site-header .queue-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
}

.site-header .queue-stat-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  margin: 0 7px;
  flex-shrink: 0;
}

.site-header .queue-stat-chip {
  padding: 2px 0;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

.site-header .queue-stat-chip.is-busy .queue-stat-value {
  color: var(--accent);
}

.site-header .queue-stat-chip.is-activity-idle .queue-stat-value {
  color: var(--muted);
}

.site-header .queue-stat-chip.is-activity-download {
  color: #7ee8b0;
}
.site-header .queue-stat-chip.is-activity-download .queue-stat-value {
  color: #7ee8b0;
}

.site-header .queue-stat-chip.is-activity-packing {
  color: #ffc850;
}
.site-header .queue-stat-chip.is-activity-packing .queue-stat-value {
  color: #ffc850;
}

.site-header .queue-stat-chip.is-activity-queue {
  color: #ff9a4d;
}
.site-header .queue-stat-chip.is-activity-queue .queue-stat-value {
  color: #ff9a4d;
}

.site-header .queue-stat-chip.is-activity-heavy {
  color: #ff7a7a;
}
.site-header .queue-stat-chip.is-activity-heavy .queue-stat-value {
  color: #ff7a7a;
}

.site-header .queue-stat-chip.is-pressure-low {
  background: rgba(90, 209, 255, 0.06);
}
.site-header .queue-stat-chip.is-pressure-medium {
  background: rgba(255, 200, 80, 0.08);
}
.site-header .queue-stat-chip.is-pressure-high {
  background: rgba(255, 140, 60, 0.1);
}
.site-header .queue-stat-chip.is-pressure-critical {
  background: rgba(255, 90, 90, 0.12);
}

.site-header .queue-stat-chip.is-bw-idle .queue-stat-value {
  color: var(--muted);
}
.site-header .queue-stat-chip.is-bw-low .queue-stat-value {
  color: var(--accent);
}
.site-header .queue-stat-chip.is-bw-medium .queue-stat-value {
  color: #ffc850;
}
.site-header .queue-stat-chip.is-bw-high .queue-stat-value {
  color: #ff9a4d;
}
.site-header .queue-stat-chip.is-bw-critical .queue-stat-value {
  color: #ff7a7a;
}

.site-header .queue-stat-link {
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  border: 1px solid rgba(90, 209, 255, 0.35);
  background: rgba(90, 209, 255, 0.1);
  transition: background 0.15s ease;
}

.site-header .queue-stat-link:hover {
  background: rgba(90, 209, 255, 0.16);
}

.site-header .queue-stat-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  flex-shrink: 0;
}

.site-header .queue-stat-value {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-count-toggle,
.stat-animated-value {
  cursor: pointer;
  text-decoration: underline dotted transparent;
  transition: text-decoration-color 0.15s ease, color 0.2s ease, transform 0.2s ease;
  font-variant-numeric: tabular-nums;
}

.stat-transfer-toggle {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
}

.stat-transfer-toggle:hover {
  text-decoration: underline dotted currentColor;
}

.stat-animated-value.is-ticking {
  color: var(--accent);
  transform: translateY(-1px);
}

.stat-count-toggle:hover {
  text-decoration-color: rgba(255, 255, 255, 0.45);
}

.stats-summary-card.stat-count-toggle-card {
  cursor: pointer;
}

.stats-summary-card.stat-count-toggle-card .stat-count-toggle:hover {
  text-decoration-color: rgba(90, 209, 255, 0.55);
}

.site-header .queue-stat.is-busy .queue-stat-value,
.site-header .queue-stat-chip.is-busy .queue-stat-value {
  color: var(--accent);
}

.site-header .queue-stat-sep {
  display: none;
}

.site-header .queue-stat-pressure-value {
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(90, 209, 255, 0.22);
  background: rgba(90, 209, 255, 0.1);
  color: var(--accent);
}

.site-header .queue-stat-pressure.is-low .queue-stat-pressure-value {
  border-color: rgba(90, 209, 255, 0.22);
  background: rgba(90, 209, 255, 0.1);
  color: var(--accent);
}

.site-header .queue-stat-pressure.is-medium .queue-stat-pressure-value {
  border-color: rgba(255, 200, 80, 0.35);
  background: rgba(255, 200, 80, 0.12);
  color: #ffc850;
}

.site-header .queue-stat-pressure.is-high .queue-stat-pressure-value {
  border-color: rgba(255, 140, 60, 0.4);
  background: rgba(255, 140, 60, 0.14);
  color: #ff9a4d;
}

.site-header .queue-stat-pressure.is-critical .queue-stat-pressure-value {
  border-color: rgba(255, 90, 90, 0.45);
  background: rgba(255, 90, 90, 0.16);
  color: #ff7a7a;
}

.site-header .queue-strip-sep--lanes {
  display: none;
}

.site-header .queue-lanes-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.site-header .queue-lanes-row.is-idle {
  display: none;
}

.site-header .queue-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 0;
  overflow: hidden;
}

.site-header .queue-pill strong {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(90, 209, 255, 0.12);
  color: var(--accent);
  border: 1px solid rgba(90, 209, 255, 0.22);
}

.site-header .queue-pill.is-active strong {
  background: var(--accent);
  color: #0b0f12;
  border-color: var(--accent);
}

.site-header .queue-pill.is-idle strong {
  opacity: 0.55;
}

.site-header .queue-pill-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.site-header .queue-pill.is-active .queue-pill-text {
  color: var(--text);
}

.delivery-lanes-row {
  display: none;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0;
  width: 100%;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
  font-size: 10px;
  color: var(--muted);
}

.delivery-lanes-row:not(.is-idle):not([hidden]) {
  display: flex;
}

.delivery-lane-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  max-width: min(240px, 42vw);
  opacity: 0;
  transform: translateX(-10px) scale(0.96);
  transition:
    opacity 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.42s cubic-bezier(0.4, 0, 0.2, 1),
    max-width 0.48s cubic-bezier(0.4, 0, 0.2, 1),
    margin 0.48s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.48s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.delivery-lane-item.is-visible {
  opacity: 1;
  transform: translateX(0) scale(1);
}

.delivery-lane-item.is-exiting {
  opacity: 0;
  transform: translateX(18px) scale(0.9);
  max-width: 0 !important;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.delivery-lane-item.is-complete .delivery-lane-pct {
  color: #78dc8c;
}

.pack-progress-overlay.is-success-dismissible {
  cursor: pointer;
}

.pack-progress-overlay.is-success-dismissible .pack-progress-content {
  cursor: default;
}

.delivery-lane-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  min-width: 0;
}

.delivery-lane-bar-wrap {
  width: 36px;
  height: 3px;
  flex-shrink: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.delivery-lane-bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5ad1ff, #78dc8c);
  transition: width 0.35s ease;
}

.delivery-lane-pct {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.delivery-lane-sep {
  flex-shrink: 0;
  padding: 0 6px;
  color: var(--border);
  user-select: none;
}

.delivery-lane-wait {
  flex-shrink: 0;
  color: var(--muted);
}

.pack-progress-content {
  position: relative;
  overflow: hidden;
}

.pack-confetti-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

.pack-progress-content.is-success .pack-progress-bar {
  background: linear-gradient(90deg, #78dc8c, #5ad1ff);
}

.pack-progress-content.is-success .modal-title {
  color: #78dc8c;
}

@media (min-width: 901px) {
  .site-header .queue-strip-inner {
    flex-wrap: wrap;
  }

  .delivery-lanes-row {
    flex-basis: 100%;
  }
}

@media (max-width: 900px) {
  .delivery-lanes-row {
    display: none !important;
  }
}

.site-header .queue-strip-sep {
  flex-shrink: 0;
  color: var(--border);
  opacity: 0.8;
  user-select: none;
}

.btn-download.btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
}

.btn-download.btn-disabled:hover {
  transform: none;
}

/* Responsive Design */

/* Tablet Portrait */
@media (min-width: 480px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablet Landscape */
@media (min-width: 768px) {
  .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
  }

  .controls-area {
    width: auto;
    min-width: 500px;
  }

  .site-header .queue-strip {
    padding: 5px 24px 6px;
  }

  .site-header .queue-strip-inner {
    flex-direction: row;
    align-items: center;
    gap: 14px;
  }

  .site-header .queue-stats-row {
    flex: 0 1 auto;
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-header .queue-stats-row::-webkit-scrollbar {
    display: none;
  }

  .site-header .queue-strip-sep--lanes {
    flex-shrink: 0;
    color: var(--border);
    opacity: 0.6;
    font-size: 11px;
    user-select: none;
  }

  .site-header .queue-strip-inner:has(.queue-lanes-row:not(.is-idle)) .queue-strip-sep--lanes {
    display: inline;
  }

  .site-header .queue-lanes-row {
    flex: 1 1 auto;
    justify-content: flex-end;
    min-width: 0;
  }

  .site-header .queue-lanes-row.is-idle {
    display: none;
  }

  .search-row {
    flex-wrap: nowrap;
  }

  .grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
  }

  .filter-panel {
    padding: 16px;
  }

  .filter-panel-inner {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .filter-section {
    padding: 14px 16px;
  }

  .genre-btn {
    padding: 8px 14px;
    font-size: 12px;
  }

  .diff-btn {
    padding: 8px 14px;
    font-size: 12px;
  }

  .version-download-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .header-inner {
    align-items: flex-start;
  }

  .brand {
    flex: 0 0 auto;
  }

  .controls-area {
    flex: 1 1 auto;
    min-width: 0;
  }

  .search-row {
    display: grid;
    grid-template-columns: minmax(140px, 1fr) repeat(4, auto);
  }

  .search-bar {
    grid-column: 1 / -1;
    width: 100%;
  }

  .sort-select {
    width: 100%;
    min-width: 0;
  }
}

@media (min-width: 1200px) {
  .brand {
    flex: 0 0 auto;
  }

  .controls-area {
    flex: 1 1 auto;
    min-width: 0;
  }

  .search-bar {
    min-width: 220px;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
  }

  /* Filter panel as floating modal on desktop */
  .filter-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    background: rgba(2, 7, 10, 0.72);
    border-bottom: none;
    padding: 0;
    display: none;
    align-items: center;
    justify-content: center;
    animation: none;
  }

  .filter-panel.open {
    display: flex;
  }

  .filter-panel-inner {
    background:
      linear-gradient(180deg, rgba(255,255,255,0.08), transparent 24%),
      rgba(8, 15, 21, 0.92);
    border: 1px solid rgba(143, 181, 202, 0.2);
    border-radius: 10px;
    padding: 24px;
    max-width: 900px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    animation: modalFadeIn 0.25s ease;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255,255,255,0.08);
  }

  /* Left column: ranges + type + genre */
  .filter-ranges { grid-column: 1; }
  .filter-type { grid-column: 1; }
  .filter-genre { grid-column: 1; }

  /* Right column: 难度 + 版本 */
  .filter-diff { grid-column: 2; grid-row: 1; }
  .filter-version { grid-column: 2; grid-row: 2 / span 2; }

  .version-filter-buttons {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }

  .version-download-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  }

  .side-rail {
    display: block;
  }

  .meta {
    padding: 14px;
  }

  .card-title-full {
    font-size: 14px;
  }

  .card-artist-full {
    font-size: 12px;
  }
}

/* Large Desktop */
@media (min-width: 1400px) {
  .grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .side-rail {
    width: 200px;
  }
}

/* Extra Large Desktop */
@media (min-width: 1800px) {
  .grid {
    grid-template-columns: repeat(7, 1fr);
  }
}

/* Mobile Landscape */
@media (max-height: 500px) and (orientation: landscape) {
  .site-header {
    padding: 8px 0 0;
  }

  .header-inner {
    flex-direction: row;
    align-items: center;
  }

  .brand {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .subtitle {
    display: none;
  }

  .filter-panel {
    max-height: 60vh;
    overflow-y: auto;
  }
}

/* Mobile: scroll down → compact header (logo only) */
@media (max-width: 639px) {
  .site-header .header-collapsible {
    transition:
      max-height 0.34s cubic-bezier(0.4, 0, 0.2, 1),
      opacity 0.28s ease,
      margin 0.34s ease,
      padding 0.34s ease;
    max-height: 520px;
    opacity: 1;
    overflow: hidden;
  }

  .site-header.is-compact {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .site-header.is-compact .header-collapsible {
    max-height: 0;
    opacity: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
  }

  .site-header.is-compact .logo {
    margin-bottom: 0;
    font-size: 17px;
  }

  .site-header .header-inner {
    gap: 0;
    transition: gap 0.3s ease;
  }

  .site-header.is-compact .header-inner {
    gap: 0;
  }
}

/* Mobile queue stats */
@media (max-width: 639px) {
  .site-header .queue-strip {
    padding: 6px 10px 7px;
  }

  .site-header .queue-strip-inner {
    gap: 6px;
  }

  .site-header .queue-stats-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .site-header .queue-stat-dot,
  .site-header .queue-stat-dot--wide {
    display: none;
  }

  .site-header .queue-stat-chip {
    justify-content: center;
    padding: 6px 10px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
  }

  .site-header .queue-stat-chip-bandwidth,
  .site-header .queue-stat-chip-transfer {
    display: none;
  }

  .site-header .queue-stat-link {
    grid-column: 1 / -1;
    margin-left: 0;
    justify-content: center;
    padding: 7px 12px;
  }

  .site-header .queue-stat-label {
    font-size: 9px;
  }

  .site-header .queue-stat-value {
    font-size: 11px;
  }

  .site-header .queue-stat-pressure-value {
    font-size: 9px;
    padding: 1px 5px;
  }

  .site-header .queue-lanes-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    font-size: 11px;
  }

  .site-header .queue-strip-sep {
    display: none;
  }

  .site-header .queue-pill {
    width: 100%;
    justify-content: flex-start;
  }

  .site-header .queue-pill strong {
    font-size: 9px;
    padding: 2px 5px;
  }
}

@media (max-width: 479px) {
  .site-header .queue-stat-value {
    font-size: 10px;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  .card:hover {
    transform: none;
  }

  .card:active {
    transform: scale(0.98);
  }

  .btn-tool:hover {
    background: var(--surface-2);
    color: #fff;
  }

  .btn-tool:active {
    background: var(--accent);
    color: #000;
  }
}

/* High DPI Screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .cover {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Dark Mode Preference (already dark, but ensure consistency) */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 639px) {
  .modal-content {
    max-width: 96vw;
    padding: 16px;
  }

  .preview-shell {
    grid-template-columns: 1fr;
  }

  .preview-meta-grid {
    grid-template-columns: 1fr;
  }

  .preview-diff-row {
    grid-template-columns: minmax(78px, 0.9fr) 50px minmax(0, 1fr);
    gap: 6px;
  }

  .modal-buttons {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .maidata-preview {
    max-height: 210px;
    font-size: 11px;
  }
}

/* Modern bright theme refresh */
:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f2f6fa;
  --surface-3: #e9f1f7;
  --text: #17212b;
  --muted: #627282;
  --accent: #1687d9;
  --accent-2: #ef5f8f;
  --accent-3: #22a77a;
  --warn: #d99a18;
  --border: #dce5ed;
  --hairline: #eef3f6;
  --glass: rgba(255, 255, 255, 0.86);
  --shadow: 0 18px 46px rgba(25, 47, 69, 0.12);
}

html,
body {
  background-color: var(--bg);
  color: var(--text);
}

body {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,248,251,0.94) 280px),
    linear-gradient(120deg, rgba(22,135,217,0.08), transparent 34%),
    linear-gradient(250deg, rgba(34,167,122,0.07), transparent 36%),
    #f6f8fb;
}

body::before {
  display: none;
}

.site-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(214, 226, 236, 0.92);
  box-shadow: 0 8px 28px rgba(31, 54, 77, 0.08);
}

.site-header::before {
  height: 3px;
  background: linear-gradient(90deg, #1687d9, #22a77a, #ef5f8f);
  opacity: 1;
}

.brand::before {
  background: linear-gradient(180deg, #1687d9, #22a77a);
}

.logo {
  color: #17212b;
  text-shadow: none;
}

.subtitle,
.circle-plus-tip-text,
.card-artist-full,
.card-facts,
.modal-song-info,
.preview-diff-designer {
  color: var(--muted);
}

.ma-tip-link {
  color: #b87300;
}

.search-bar,
.sort-select,
.btn-tool,
.btn-small,
.page-btn,
.page-jump-input,
.stats-action,
.btn-close {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(27, 45, 65, 0.04);
}

.search-bar:focus,
.search-bar:focus-visible,
.sort-select:focus,
.sort-select:focus-visible {
  background: #fff;
  border-color: #1687d9;
  box-shadow: 0 0 0 3px rgba(22, 135, 217, 0.14);
}

.search-bar::placeholder {
  color: #8a9aaa;
}

.btn-tool:hover,
.page-btn:hover:not(:disabled),
.btn-small:hover,
.btn-close:hover {
  background: #edf7ff;
  border-color: #9bcdef;
  color: #0f5f9c;
  box-shadow: 0 8px 20px rgba(22, 135, 217, 0.1);
}

.filter-toggle-btn.active,
.batch-download-btn.active,
.genre-btn.active,
.oc-filter-btn.active {
  background: #e8f5ff;
  border-color: #8bc4ea;
  color: #0f5f9c;
  box-shadow: none;
}

.filter-panel {
  background: rgba(255, 255, 255, 0.88);
  border-bottom-color: var(--border);
}

.filter-section,
.side-rail-slot,
.circle-plus-tip,
.preview-meta-grid div,
.preview-diff-row,
.preview-empty-line {
  background: #fff;
  border-color: var(--border);
  box-shadow: 0 8px 24px rgba(25, 47, 69, 0.06);
}

.filter-title,
.modal-title,
.preview-section-title {
  color: #17212b;
}

.genre-btn,
.oc-filter-btn,
.type-btn,
.version-filter-btn,
.version-dl-btn,
.card-version-full,
.card-chart-summary {
  background: #f7fafc;
  border-color: var(--border);
  color: var(--muted);
}

.type-btn.active,
.version-filter-btn.active {
  background: #edf7ff;
  border-color: #9bcdef;
  box-shadow: none;
}

.content {
  padding-top: 24px;
}

.stats-text {
  background: #fff;
  border-color: var(--border);
  color: #516273;
  box-shadow: 0 8px 24px rgba(25, 47, 69, 0.06);
}

.stats-text::before {
  background: #22a77a;
  box-shadow: none;
}

.circle-plus-tip {
  background: linear-gradient(135deg, #ffffff, #f0f8ff);
  color: var(--text);
}

.circle-plus-tip:hover,
.circle-plus-tip:focus-visible {
  background: linear-gradient(135deg, #ffffff, #e8f5ff);
  border-color: #9bcdef;
}

.circle-plus-tip-label,
.preview-player-label {
  background: #eaf8f2;
  border-color: #b8ead4;
  color: #147a5a;
}

.card {
  background: #fff;
  border-color: var(--border);
  box-shadow: 0 10px 28px rgba(25, 47, 69, 0.08);
  backdrop-filter: none;
}

.card::before {
  background: linear-gradient(90deg, #1687d9, #22a77a, #ef5f8f);
  opacity: 0;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-3px);
  border-color: #9bcdef;
  box-shadow: 0 16px 38px rgba(25, 47, 69, 0.14);
}

.img-container {
  background: #eef4f8;
  border-bottom-color: var(--hairline);
}

.img-container::after {
  background: linear-gradient(180deg, transparent, rgba(15, 33, 48, 0.5));
}

.card-title-full {
  color: #17212b;
}

.dl-count,
.preview-type-mark {
  background: rgba(23, 33, 43, 0.78);
}

.modal-overlay {
  background: rgba(19, 31, 43, 0.38);
  backdrop-filter: blur(8px);
}

.modal-content {
  background: #fff;
  border-color: var(--border);
  box-shadow: 0 28px 90px rgba(25, 47, 69, 0.22);
}

.preview-cover-wrap,
.preview-player,
.preview-video-details,
.maidata-preview {
  border-color: var(--border);
  background: #f7fafc;
}

.preview-player {
  background: #f0fbf6;
}

.preview-video-details {
  background: #fff7fa;
}

.preview-video-details summary {
  color: #bc3f69;
}

.preview-unavailable {
  background: #fff8e8;
  border-color: #f1d99f;
  color: #8a5d00;
}

.preview-meta-grid span {
  color: #7c8b99;
}

.preview-meta-grid strong,
.preview-diff-name {
  color: #17212b;
}

.maidata-preview {
  color: #334452;
  background:
    linear-gradient(rgba(22,135,217,0.04) 1px, transparent 1px),
    #f8fbfd;
  background-size: 100% 24px;
}

.btn-zip {
  background: #1687d9;
  color: #fff;
  box-shadow: 0 10px 24px rgba(22, 135, 217, 0.18);
}

.btn-zip:hover {
  background: #0f78c5;
}

.btn-dx {
  background: #ef5f8f;
  color: #fff;
  box-shadow: 0 10px 24px rgba(239, 95, 143, 0.16);
}

.btn-dx:hover {
  background: #df4e7f;
}

.btn-manifest {
  background: #22a77a;
  color: #fff;
}

.btn-manifest:hover {
  background: #1b966c;
}

/* Chart confirmation and unified media preview */
body {
  font-size: 15px;
  line-height: 1.55;
}

.modal-content {
  max-width: min(1040px, 96vw);
  padding: 28px;
}

.modal-title {
  font-size: 26px;
  line-height: 1.25;
}

.modal-song-info {
  margin-bottom: 18px;
  color: #536576;
  font-size: 14px;
}

.preview-confirm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid #cfe1ef;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: #f4f9fd;
}

.preview-confirm-header h3 {
  margin: 0;
  color: #132231;
  font-size: 17px;
  line-height: 1.3;
}

.preview-confirm-header p {
  margin: 3px 0 0;
  color: #5d7082;
  font-size: 13px;
}

.preview-resource-status {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid #addfc9;
  border-radius: 4px;
  background: #edf9f3;
  color: #126b4f;
  font-size: 12px;
  font-weight: 800;
}

.preview-shell {
  grid-template-columns: minmax(300px, 1.08fr) minmax(300px, 0.92fr);
  gap: 18px;
}

.preview-media,
.preview-info {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.preview-media {
  padding: 12px;
}

.preview-info {
  padding: 14px;
}

.preview-combined-player {
  min-width: 0;
}

.preview-media-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.preview-media-head strong {
  color: #17212b;
  font-size: 14px;
}

.preview-sync-badge {
  padding: 4px 7px;
  border: 1px solid #addfc9;
  border-radius: 4px;
  background: #edf9f3;
  color: #126b4f;
  font-size: 11px;
  font-weight: 800;
}

.preview-sync-badge.is-muted {
  border-color: #d7e0e8;
  background: #f5f7f9;
  color: #657789;
}

.preview-sync-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid #d5dee6;
  border-radius: 5px;
  background: #050607;
  color-scheme: dark;
  object-fit: contain;
}

.preview-sync-audio {
  display: none;
}

.preview-volume-control {
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) 42px;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px solid #d8e3eb;
  border-radius: 5px;
  background: #f7fafc;
}

.preview-mute-button {
  min-width: 70px;
  padding: 5px 8px;
  border: 1px solid #cbd9e3;
  border-radius: 4px;
  background: #fff;
  color: #31465a;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.preview-mute-button:hover {
  border-color: #88bfe5;
  color: #0f659f;
}

.preview-volume-range {
  width: 100%;
  accent-color: var(--accent);
}

.preview-volume-value {
  color: #536779;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.preview-media-note {
  margin: 8px 1px 0;
  color: #657789;
  font-size: 12px;
}

.preview-cover-wrap {
  border-radius: 5px;
}

.preview-meta-grid {
  gap: 7px;
}

.preview-meta-grid div,
.preview-diff-row {
  border-radius: 5px;
  box-shadow: none;
}

.preview-meta-grid div {
  padding: 10px 11px;
  background: #f7fafc;
}

.preview-meta-grid span {
  color: #647789;
  font-size: 12px;
}

.preview-meta-grid strong {
  color: #142434;
  font-size: 14px;
}

.preview-section-title {
  margin-top: 15px;
  color: #24384a;
  font-size: 14px;
}

.preview-diff-row {
  min-height: 38px;
  padding: 8px 9px;
  background: #f9fbfc;
}

.preview-diff-name,
.preview-diff-designer {
  font-size: 12px;
}

.preview-chart-text {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid #ccdbe6;
  border-radius: 6px;
  background: #fff;
}

.preview-chart-text summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #f4f8fb;
  color: #1a2c3d;
  cursor: pointer;
  font-size: 14px;
  font-weight: 850;
}

.preview-chart-text summary::marker {
  color: var(--accent);
}

.preview-chart-text summary small {
  color: #687b8c;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 650;
}

.preview-chart-text-status {
  padding: 8px 14px;
  border-top: 1px solid #dce6ed;
  border-bottom: 1px solid #dce6ed;
  background: #fff;
  color: #607284;
  font-size: 12px;
}

.preview-chart-text .maidata-preview {
  min-height: 220px;
  max-height: 340px;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: 14px 16px;
  color: #203445;
  background: #f9fbfc;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre;
  tab-size: 2;
}

@media (max-width: 760px) {
  .modal-content {
    max-width: 96vw;
    padding: 16px;
  }

  .modal-title {
    font-size: 22px;
  }

  .preview-confirm-header {
    align-items: flex-start;
    padding: 12px;
  }

  .preview-shell {
    grid-template-columns: 1fr;
  }

  .preview-info {
    padding: 12px;
  }

  .preview-chart-text .maidata-preview {
    min-height: 180px;
    max-height: 260px;
    padding: 12px;
    font-size: 11px;
  }
}

/* Interactive maidata chart player */
.modal-content {
  max-width: min(1180px, 96vw);
}

.chart-player-host {
  min-width: 0;
}

.chart-player {
  overflow: hidden;
  border: 1px solid #ccdbe6;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(27, 52, 72, 0.09);
}

.chart-player-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid #dce6ed;
  background: #f5f9fc;
}

.chart-player-head h3 {
  margin: 0;
  color: #172635;
  font-size: 17px;
  line-height: 1.3;
}

.chart-player-status {
  margin: 3px 0 0;
  color: #607486;
  font-size: 12px;
}

.chart-player-difficulties {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.chart-player-difficulty {
  min-height: 30px;
  padding: 5px 8px;
  border: 2px solid transparent;
  border-radius: 5px;
  color: #fff;
  font: inherit;
  font-size: 11px;
  font-weight: 850;
  cursor: pointer;
  opacity: 0.72;
  transition: opacity 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.chart-player-difficulty:hover,
.chart-player-difficulty.is-active {
  opacity: 1;
  transform: translateY(-1px);
}

.chart-player-difficulty.is-active {
  border-color: #fff;
  box-shadow: 0 0 0 2px #243b4d;
}

.chart-player-stage-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(300px, 1.1fr);
  gap: 0;
  background: #0a0d10;
}

.chart-player-canvas-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #050607;
}

.chart-player-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #050607;
}

.chart-player-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #0a0d10;
  color: #d8e6ee;
  font-size: 13px;
  text-align: center;
}

.chart-player-loading[hidden] {
  display: none;
}

.chart-player-statements {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid #26333d;
  background: #111820;
  color: #e6eef3;
}

.chart-player-statements-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid #26333d;
}

.chart-player-statements-head strong {
  font-size: 13px;
}

.chart-player-statements-head span {
  color: #8da2b1;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.chart-player-statement-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

.chart-player-statement-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #afbdc7;
  font: inherit;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  text-align: left;
  cursor: pointer;
}

.chart-player-statement-row:hover {
  background: #19232c;
  color: #e5edf2;
}

.chart-player-statement-row.is-active {
  border-color: #315c78;
  background: #172c3b;
  color: #fff;
}

.chart-player-statement-beat {
  color: #6f8798;
  font-variant-numeric: tabular-nums;
}

.chart-player-statement-chunks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.chart-player-statement-chunks span {
  padding: 1px 3px;
  border-radius: 3px;
}

.chart-player-statement-chunks .is-current {
  background: #ef5f8f;
  color: #fff;
  box-shadow: 0 2px 8px rgba(239, 95, 143, 0.28);
}

.chart-player-controls {
  display: grid;
  grid-template-columns: auto 40px minmax(140px, 1fr) 40px minmax(104px, 0.35fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 14px;
  border-top: 1px solid #dce6ed;
  background: #fff;
}

.chart-player-play,
.chart-player-fullscreen,
.chart-player-speed {
  min-height: 34px;
  border: 1px solid #cbd9e3;
  border-radius: 5px;
  background: #fff;
  color: #263d50;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
}

.chart-player-play,
.chart-player-fullscreen {
  padding: 7px 12px;
  cursor: pointer;
}

.chart-player-play {
  min-width: 64px;
  border-color: #1687d9;
  background: #1687d9;
  color: #fff;
}

.chart-player-play:hover:not(:disabled) {
  background: #0f78c5;
}

.chart-player-play:disabled {
  opacity: 0.5;
  cursor: wait;
}

.chart-player-progress {
  width: 100%;
  accent-color: #1687d9;
}

.chart-player-time {
  color: #607486;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.chart-player-volume {
  display: grid;
  grid-template-columns: auto minmax(56px, 1fr);
  align-items: center;
  gap: 6px;
  color: #607486;
  font-size: 11px;
}

.chart-player-volume input {
  width: 100%;
  accent-color: #1687d9;
}

.chart-player-speed {
  padding: 5px 8px;
}

.chart-player > audio,
.chart-player > video {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.preview-info-rail {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #dce6ed;
  border-radius: 7px;
  background: #fff;
}

.preview-info-rail .preview-meta-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chart-player:fullscreen {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
  background: #080c10;
}

.chart-player:fullscreen .chart-player-stage-grid {
  flex: 1 1 auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.62fr);
}

.chart-player:fullscreen .chart-player-canvas-wrap {
  width: auto;
  height: 100%;
  max-height: calc(100vh - 130px);
  margin: 0 auto;
}

@media (max-width: 760px) {
  .chart-player-head {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  .chart-player-difficulties {
    justify-content: flex-start;
  }

  .chart-player-stage-grid {
    grid-template-columns: 1fr;
  }

  .chart-player-statements {
    min-height: 250px;
    max-height: 320px;
    border-top: 1px solid #26333d;
    border-left: 0;
  }

  .chart-player-controls {
    grid-template-columns: auto 36px minmax(80px, 1fr) 36px;
    gap: 7px;
    padding: 9px 10px;
  }

  .chart-player-volume,
  .chart-player-speed,
  .chart-player-fullscreen {
    grid-row: 2;
  }

  .chart-player-volume {
    grid-column: 1 / 5;
    grid-row: 2;
  }

  .chart-player-speed {
    grid-column: 1 / 3;
    grid-row: 3;
  }

  .chart-player-fullscreen {
    grid-column: 3 / 5;
    grid-row: 3;
  }

  .preview-info-rail .preview-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Print Styles */
@media print {
  .site-header,
  .filter-panel,
  .side-rail,
  .pagination,
  .back-to-top,
  .modal-overlay {
    display: none !important;
  }

  .content {
    display: block;
  }

  .grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Loading State */
.loading {
  opacity: 0.5;
  pointer-events: none;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state h3 {
  font-size: 18px;
  margin: 0 0 10px 0;
  color: var(--text);
}

.empty-state p {
  font-size: 14px;
  margin: 0;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Selection */
::selection {
  background: var(--accent);
  color: #000;
}

/* Stats dashboard page */
.stats-page-body {
  min-height: 100vh;
  overflow-x: hidden;
  color-scheme: light;
  color: #17212b;
  background: #f4f7fa;
}

.stats-page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-top: 3px solid #1687d9;
  border-bottom: 1px solid #dbe5ec;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 28px rgba(29, 52, 72, 0.07);
  backdrop-filter: blur(14px);
}

.stats-page-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.stats-page-brand {
  min-width: 0;
}

.stats-page-back {
  display: inline-flex;
  align-items: center;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 700;
  color: #477084;
  transition: color 0.16s ease, transform 0.16s ease;
}

.stats-page-back:hover {
  color: #0f6fae;
  transform: translateX(-2px);
}

.stats-page-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.stats-page-title {
  margin: 0;
  color: #142331;
  font-size: 28px;
  font-weight: 850;
  line-height: 1.15;
  letter-spacing: 0;
}

.stats-live-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  padding: 4px 7px;
  border: 1px solid #b8e5ce;
  border-radius: 5px;
  background: #effaf4;
  color: #137354;
  font-size: 11px;
  font-weight: 800;
}

.stats-live-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22a77a;
  box-shadow: 0 0 0 0 rgba(34, 167, 122, 0.28);
  animation: stats-live-pulse 2.2s ease-out infinite;
}

.stats-page-lead {
  margin: 5px 0 0;
  color: #66798a;
  font-size: 13px;
}

.stats-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.stats-range-tabs {
  display: flex;
  flex: 1 1 auto;
  gap: 4px;
  padding: 4px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid #d9e4ec;
  border-radius: 7px;
  background: #f4f7f9;
}

.stats-range-tabs::-webkit-scrollbar {
  display: none;
}

.stats-range-tab {
  min-height: 32px;
  border: 1px solid transparent;
  background: transparent;
  color: #607384;
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.stats-range-tab:hover {
  color: #225a7c;
  background: #fff;
}

.stats-range-tab.is-active {
  border-color: #c7ddea;
  background: #fff;
  color: #0f6fae;
  box-shadow: 0 2px 8px rgba(24, 72, 103, 0.08);
}

.stats-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 42px;
  border: 1px solid #1687d9;
  background: #1687d9;
  color: #fff;
  border-radius: 6px;
  padding: 9px 15px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(22, 135, 217, 0.16);
  transition: background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.stats-refresh-btn:hover:not(:disabled) {
  background: #0f78c5;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(22, 135, 217, 0.22);
}

.stats-refresh-btn:disabled {
  opacity: 0.72;
  cursor: wait;
}

.stats-refresh-btn.is-loading::before {
  content: "";
  width: 12px;
  height: 12px;
  margin-right: 7px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: stats-spin 0.7s linear infinite;
}

.stats-page-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.stats-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stats-summary-card {
  --stats-tone: #7d8e9c;
  position: relative;
  min-width: 0;
  min-height: 118px;
  overflow: hidden;
  padding: 16px 16px 14px;
  border-radius: 8px;
  border: 1px solid #dce6ed;
  background: #fff;
  box-shadow: 0 9px 24px rgba(31, 55, 75, 0.06);
  animation: stats-card-enter 0.45s both cubic-bezier(0.22, 1, 0.36, 1);
}

.stats-summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--stats-tone);
}

.stats-summary-card[data-tone="blue"] { --stats-tone: #1687d9; }
.stats-summary-card[data-tone="pink"] { --stats-tone: #ef5f8f; }
.stats-summary-card[data-tone="green"] { --stats-tone: #22a77a; }
.stats-summary-card[data-tone="amber"] { --stats-tone: #d79a21; }
.stats-summary-card[data-tone="cyan"] { --stats-tone: #2b9bb5; }
.stats-summary-card[data-tone="neutral"] { --stats-tone: #66798a; }

.stats-summary-card:nth-child(2) { animation-delay: 40ms; }
.stats-summary-card:nth-child(3) { animation-delay: 80ms; }
.stats-summary-card:nth-child(4) { animation-delay: 120ms; }
.stats-summary-card:nth-child(5) { animation-delay: 160ms; }
.stats-summary-card:nth-child(6) { animation-delay: 200ms; }

.stats-summary-card.stat-count-toggle-card {
  cursor: pointer;
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.stats-summary-card.stat-count-toggle-card:hover {
  transform: translateY(-2px);
  border-color: #b7cedd;
  box-shadow: 0 13px 28px rgba(31, 55, 75, 0.1);
}

.stats-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.stats-summary-head > span:last-child {
  padding: 3px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--stats-tone) 9%, white);
  color: color-mix(in srgb, var(--stats-tone) 78%, #17212b);
  font-size: 10px;
  font-weight: 800;
}

.stats-summary-label {
  color: #5c6f80;
  font-size: 12px;
  font-weight: 750;
}

.stats-summary-sub {
  display: block;
  margin-top: 7px;
  overflow: hidden;
  color: #778897;
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-summary-value {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: #142331;
  font-size: 27px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-summary-pressure.is-low { color: #1687d9; }
.stats-summary-pressure.is-medium { color: #ad7507; }
.stats-summary-pressure.is-high { color: #c55f1d; }
.stats-summary-pressure.is-critical { color: #cf3f4c; }

.stats-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 2px 12px;
}

.stats-section-head h2 {
  margin: 0;
  color: #172635;
  font-size: 18px;
  line-height: 1.3;
}

.stats-section-head p {
  margin: 3px 0 0;
  color: #718290;
  font-size: 12px;
}

.stats-section-head > span {
  flex: 0 0 auto;
  color: #647789;
  font-size: 11px;
  font-weight: 700;
}

.stats-chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.stats-chart-card {
  border-radius: 8px;
  border: 1px solid #dce6ed;
  background: #fff;
  padding: 15px 15px 12px;
  box-shadow: 0 10px 28px rgba(31, 55, 75, 0.07);
  display: flex;
  flex-direction: column;
  min-height: 268px;
  max-width: 100%;
  overflow: hidden;
}

.stats-chart-card.is-chart-entering {
  animation: stats-chart-enter 0.42s both cubic-bezier(0.22, 1, 0.36, 1);
}

.stats-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  padding: 0 2px 10px;
  border-bottom: 1px solid #edf2f5;
}

.stats-chart-head h2 {
  margin: 0;
  color: #1d2e3e;
  font-size: 15px;
  font-weight: 800;
}

.stats-chart-hint {
  margin: 0;
  padding: 4px 7px;
  border-radius: 4px;
  background: #f1f5f8;
  color: #637687;
  font-size: 10px;
  font-weight: 700;
  text-align: right;
}

.stats-chart-body {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  position: relative;
}

.stats-chart-body--bars {
  max-height: 360px;
  overflow-y: auto;
}

.stats-chart-canvas {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  cursor: crosshair;
  touch-action: none;
}

.stats-chart-tooltip {
  position: fixed;
  z-index: 200;
  pointer-events: none;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #cadbe6;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 12px 32px rgba(27, 52, 72, 0.18);
  font-size: 12px;
  line-height: 1.45;
  color: #203445;
  max-width: 240px;
}

.stats-chart-tooltip-time {
  margin-bottom: 4px;
  color: #718291;
  font-size: 11px;
}

.stats-chart-tooltip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stats-chart-tooltip-row strong {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.stats-page-footnote {
  margin: 18px 4px 0;
  font-size: 11px;
  color: #70818f;
  text-align: center;
}

.site-icp-footer {
  margin-top: 24px;
  padding: 20px 16px 28px;
  border-top: 1px solid #dce6ed;
  background: #fff;
}

.site-icp-footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.site-icp-footer-logo {
  display: block;
  width: auto;
  max-width: 140px;
  height: 32px;
  object-fit: contain;
  opacity: 0.88;
}

.site-icp-footer-beian {
  font-size: 12px;
  color: #687b8b;
  transition: color 0.15s ease;
}

.site-icp-footer-beian:hover {
  color: #0f6fae;
}

@keyframes stats-card-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes stats-chart-enter {
  from { opacity: 0.35; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes stats-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 167, 122, 0.3); }
  60%, 100% { box-shadow: 0 0 0 7px rgba(34, 167, 122, 0); }
}

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

@media (min-width: 640px) {
  .stats-page-header-inner {
    padding: 18px 22px;
  }

  .stats-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .stats-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .stats-chart-card--wide {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .stats-page-header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .stats-toolbar {
    flex: 0 1 720px;
  }

  .stats-page-main {
    padding: 28px 24px 52px;
  }

  .stats-summary-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .stats-page-header {
    position: relative !important;
  }

  .stats-page-header-inner {
    padding: 13px 14px 12px;
  }

  .stats-page-title {
    font-size: 22px;
  }

  .stats-toolbar {
    align-items: stretch;
  }

  .stats-refresh-btn {
    min-width: 72px;
    padding-inline: 10px;
  }

  .stats-page-main {
    padding: 18px 14px 36px;
  }

  .stats-summary-grid {
    gap: 9px;
    margin-bottom: 24px;
  }

  .stats-summary-card {
    min-height: 108px;
    padding: 13px 12px 12px 14px;
  }

  .stats-summary-head {
    margin-bottom: 12px;
  }

  .stats-summary-value {
    font-size: 20px;
  }

  .stats-summary-sub {
    font-size: 10px;
  }

  .stats-section-head {
    align-items: flex-start;
  }

  .stats-section-head > span {
    margin-top: 4px;
  }

  .stats-chart-card {
    padding: 12px 10px 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .stats-summary-card,
  .stats-chart-card.is-chart-entering,
  .stats-live-pill i,
  .stats-refresh-btn.is-loading::before {
    animation: none;
  }
}

/* Mobile in-app browser download guidance */
.browser-warn-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  background: linear-gradient(135deg, #1a2836 0%, #12171c 100%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.browser-warn-banner.is-hard-blocked .browser-warn-dismiss {
  display: none;
}

.browser-warn-banner.is-hard-blocked {
  border-bottom-color: rgba(255, 140, 60, 0.55);
}

.browser-warn-banner:not([hidden]) {
  display: block;
}

.browser-warn-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 12px 16px 14px;
}

.browser-warn-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: #ffc850;
}

.browser-warn-text {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.browser-warn-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.browser-warn-btn {
  flex: 1 1 calc(50% - 4px);
  min-width: 120px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, border-color 0.2s;
}

.browser-warn-btn:hover,
.browser-warn-btn:active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.browser-warn-btn--primary {
  background: rgba(90, 209, 255, 0.15);
  border-color: rgba(90, 209, 255, 0.45);
  color: var(--accent);
}

.browser-warn-btn--primary:hover,
.browser-warn-btn--primary:active {
  background: var(--accent);
  color: #000;
}

.browser-warn-dismiss {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.browser-warn-dismiss:hover {
  color: var(--text);
}

.browser-warn-modal.is-hard-blocked .browser-warn-inner {
  border-color: rgba(255, 140, 60, 0.45);
}

.browser-warn-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.82);
}

.browser-warn-modal.open {
  display: flex;
}

.browser-warn-modal .browser-warn-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  max-width: 400px;
  width: 100%;
  animation: modalIn 0.25s ease;
}

body.has-browser-warn-banner .site-header {
  top: 0;
}

@media (max-width: 639px) {
  .browser-warn-btn {
    flex: 1 1 100%;
  }
}

/* Support tip dialog */
.ma-tip-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.82);
}

.ma-tip-dialog.open {
  display: flex;
}

.ma-tip-dialog-inner {
  background: var(--surface);
  border: 1px solid rgba(255, 200, 80, 0.35);
  border-radius: 16px;
  padding: 22px 20px 16px;
  max-width: 400px;
  width: 100%;
  animation: modalIn 0.25s ease;
}

.ma-tip-dialog-title {
  margin: 0 0 10px;
  font-size: 17px;
  font-weight: 600;
  color: #ffc850;
  text-align: center;
}

.ma-tip-dialog-text {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  text-align: center;
}

.ma-tip-dialog-actions {
  margin-bottom: 12px;
}

.ma-tip-dialog-btn {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
  box-sizing: border-box;
}

.ma-tip-dialog-btn:hover,
.ma-tip-dialog-btn:active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.ma-tip-dialog-btn--primary {
  background: rgba(255, 200, 80, 0.15);
  border-color: rgba(255, 200, 80, 0.45);
  color: #ffc850;
}

.ma-tip-dialog-btn--primary:hover,
.ma-tip-dialog-btn--primary:active {
  background: #ffc850;
  color: #000;
  border-color: #ffc850;
}

.ma-tip-dialog-dismiss {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ma-tip-dialog-btn--secondary {
  width: auto;
  min-width: 0;
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 500;
  background: transparent;
  color: var(--muted);
}

.ma-tip-dialog-btn--secondary:hover:not(:disabled),
.ma-tip-dialog-btn--secondary:active:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.ma-tip-dialog-btn--secondary:disabled,
.ma-tip-dialog-snooze:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ma-tip-dialog-snooze {
  display: block;
  width: auto;
  padding: 4px 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}

.ma-tip-dialog-snooze:hover:not(:disabled) {
  color: var(--text);
}

/* User-selected dark theme */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f151b;
  --surface: #151d24;
  --surface-2: #1b252e;
  --surface-3: #23313c;
  --text: #e7eef3;
  --muted: #9cafbc;
  --border: #2d3c47;
  --hairline: #202c35;
  --glass: rgba(18, 26, 33, 0.9);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(24, 34, 42, 0.98), rgba(15, 21, 27, 0.96) 320px),
    #0f151b;
  color: var(--text);
}

html[data-theme="dark"] .site-header,
html[data-theme="dark"] .stats-page-header {
  background: rgba(18, 26, 33, 0.94);
  border-color: #2b3944;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .logo,
html[data-theme="dark"] .filter-title,
html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .preview-section-title,
html[data-theme="dark"] .card-title-full,
html[data-theme="dark"] .preview-meta-grid strong,
html[data-theme="dark"] .preview-diff-name,
html[data-theme="dark"] .stats-page-title,
html[data-theme="dark"] .stats-section-head h2,
html[data-theme="dark"] .stats-chart-head h2 {
  color: #edf4f7;
}

html[data-theme="dark"] .subtitle,
html[data-theme="dark"] .sub,
html[data-theme="dark"] .card-artist-full,
html[data-theme="dark"] .modal-song-info,
html[data-theme="dark"] .preview-diff-designer,
html[data-theme="dark"] .stats-page-lead,
html[data-theme="dark"] .stats-chart-hint,
html[data-theme="dark"] .stats-page-footnote,
html[data-theme="dark"] .stats-section-head p,
html[data-theme="dark"] .stats-section-head > span {
  color: #9cafbc;
}

html[data-theme="dark"] .search-bar,
html[data-theme="dark"] .sort-select,
html[data-theme="dark"] .btn-tool,
html[data-theme="dark"] .btn-small,
html[data-theme="dark"] .page-btn,
html[data-theme="dark"] .page-jump-input,
html[data-theme="dark"] .btn-close,
html[data-theme="dark"] .stats-action {
  background: #182129;
  border-color: #33434f;
  color: #e7eef3;
  box-shadow: none;
}

html[data-theme="dark"] .search-bar:focus,
html[data-theme="dark"] .search-bar:focus-visible,
html[data-theme="dark"] .sort-select:focus,
html[data-theme="dark"] .sort-select:focus-visible {
  background: #141c23;
  border-color: #4aa9e6;
}

html[data-theme="dark"] .btn-tool:hover,
html[data-theme="dark"] .btn-close:hover,
html[data-theme="dark"] .page-btn:hover:not(:disabled) {
  background: #20313d;
  border-color: #4d8eaf;
  color: #a9ddf5;
}

html[data-theme="dark"] .theme-toggle-btn[aria-pressed="true"],
html[data-theme="dark"] .stats-theme-btn[aria-pressed="true"] {
  border-color: #d7b659;
  color: #f3d77d;
  background: #2b291f;
}

html[data-theme="dark"] .filter-panel,
html[data-theme="dark"] .batch-panel {
  background: rgba(12, 18, 23, 0.92);
  border-color: #2d3c47;
}

html[data-theme="dark"] .filter-section,
html[data-theme="dark"] .side-rail-slot,
html[data-theme="dark"] .circle-plus-tip,
html[data-theme="dark"] .preview-meta-grid div,
html[data-theme="dark"] .preview-diff-row,
html[data-theme="dark"] .preview-empty-line {
  background: #161f27;
  border-color: #2c3b46;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] .genre-btn,
html[data-theme="dark"] .oc-filter-btn,
html[data-theme="dark"] .type-btn,
html[data-theme="dark"] .version-filter-btn,
html[data-theme="dark"] .version-dl-btn,
html[data-theme="dark"] .card-version-full,
html[data-theme="dark"] .card-chart-summary {
  background: #1b2630;
  border-color: #33444f;
  color: #aabcc8;
}

html[data-theme="dark"] .card {
  background: #151d24;
  border-color: #2c3a45;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);
}

html[data-theme="dark"] .card:hover,
html[data-theme="dark"] .card:focus-visible {
  border-color: #4c94ba;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.34);
}

html[data-theme="dark"] .img-container {
  background: #111820;
  border-bottom-color: #26343e;
}

html[data-theme="dark"] .stats-text,
html[data-theme="dark"] .preview-info-rail,
html[data-theme="dark"] .chart-player,
html[data-theme="dark"] .modal-content {
  background: #151d24;
  border-color: #2d3c47;
  color: #e7eef3;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .modal-overlay {
  background: rgba(5, 9, 12, 0.72);
}

html[data-theme="dark"] .modal-download-panel {
  border-color: #2d3c47;
}

html[data-theme="dark"] .chart-player-head,
html[data-theme="dark"] .chart-player-controls {
  background: #182129;
  border-color: #2d3c47;
}

html[data-theme="dark"] .chart-player-head h3 {
  color: #edf4f7;
}

html[data-theme="dark"] .chart-player-status,
html[data-theme="dark"] .chart-player-time,
html[data-theme="dark"] .chart-player-volume {
  color: #9cafbc;
}

html[data-theme="dark"] .chart-player-play,
html[data-theme="dark"] .chart-player-fullscreen,
html[data-theme="dark"] .chart-player-speed {
  border-color: #3a4b58;
  background: #1c2730;
  color: #dce8ee;
}

html[data-theme="dark"] .chart-player-play {
  border-color: #1687d9;
  background: #1687d9;
  color: #fff;
}

html[data-theme="dark"] .queue-strip {
  background: #121b22;
  border-color: #293842;
}

html[data-theme="dark"] .stats-page-main {
  color: #e7eef3;
}

html[data-theme="dark"] .stats-summary-card,
html[data-theme="dark"] .stats-chart-card {
  background: #151d24;
  border-color: #2d3c47;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .stats-summary-head,
html[data-theme="dark"] .stats-summary-sub {
  color: #95aab7;
}

html[data-theme="dark"] .stats-summary-value {
  color: #edf4f7;
}

html[data-theme="dark"] .stats-range-tabs {
  background: #141d24;
  border-color: #2d3c47;
}

html[data-theme="dark"] .stats-range-tab {
  color: #9cafbc;
}

html[data-theme="dark"] .stats-range-tab:hover,
html[data-theme="dark"] .stats-range-tab.is-active {
  background: #22313b;
  border-color: #3b5667;
  color: #a7ddf6;
}

.stats-theme-btn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  border: 1px solid #c9d8e2;
  border-radius: 6px;
  background: #fff;
  color: #40596b;
  font-size: 18px;
  cursor: pointer;
}
