:root {
  color-scheme: light;
  --ant-color-primary: #1677ff;
  --ant-color-primary-hover: #4096ff;
  --ant-color-primary-active: #0958d9;
  --ant-color-success: #52c41a;
  --ant-color-warning: #faad14;
  --ant-color-error: #ff4d4f;
  --ant-color-text: rgba(0, 0, 0, 0.88);
  --ant-color-text-secondary: rgba(0, 0, 0, 0.65);
  --ant-color-border: #d9d9d9;
  --ant-color-split: rgba(5, 5, 5, 0.06);
  --ant-color-bg-layout: #f5f7fb;
  --ant-color-bg-container: #ffffff;
  --ant-border-radius: 6px;
  --ant-border-radius-lg: 8px;
  --ant-box-shadow: 0 6px 16px 0 rgba(0, 0, 0, 0.08), 0 3px 6px -4px rgba(0, 0, 0, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--ant-color-bg-layout); }
body { margin: 0; min-height: 100vh; color: var(--ant-color-text); background: var(--ant-color-bg-layout); font-size: 14px; line-height: 1.5715; }
button, input, textarea, select { font: inherit; }
button, label[for], .upload-button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(22, 119, 255, 0.24); outline-offset: 2px; }
[hidden] { display: none !important; }

.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; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.app-sider { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: #111827; color: #fff; }
.brand { height: 72px; display: flex; align-items: center; gap: 12px; padding: 0 24px; font-size: 18px; font-weight: 700; letter-spacing: 0.3px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; box-shadow: 0 5px 16px rgba(22, 119, 255, 0.3); }
.side-caption { padding: 18px 24px 8px; color: #9ca3af; font-size: 11px; letter-spacing: 1.4px; }
.side-nav { display: grid; gap: 4px; padding: 0 8px; }
.nav-item { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 0 16px; border: 0; border-radius: var(--ant-border-radius); color: rgba(255, 255, 255, 0.72); background: transparent; cursor: pointer; text-align: left; transition: color 0.2s, background 0.2s; }
.nav-item > span:first-child { width: 18px; text-align: center; font-size: 16px; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.nav-item.is-active { color: #fff; background: var(--ant-color-primary); }
.app-main { min-width: 0; }
.app-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 32px; background: #fff; border-bottom: 1px solid #e8ebf0; }
.page-title { margin: 0; font-size: 22px; line-height: 1.3; font-weight: 700; }
.page-subtitle { margin: 4px 0 0; color: #7b8496; font-size: 13px; }
.header-actions, .toolbar-actions, .token-row, .card-heading, .pagination, .pagination > div, .progress-line { display: flex; align-items: center; gap: 10px; }
.content { width: 100%; max-width: 1600px; margin: 0 auto; padding: 28px 32px 48px; }

.ant-card { background: var(--ant-color-bg-container); border: 1px solid var(--ant-color-split); border-radius: var(--ant-border-radius-lg); box-shadow: 0 8px 24px rgba(17, 24, 39, 0.05); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px; }
.stat-label { color: #7b8496; font-size: 13px; margin-bottom: 8px; }
.stat-value { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 28px; line-height: 1.1; font-weight: 700; white-space: nowrap; }
.stat-version { font-size: 20px; padding-top: 4px; }
.stat-icon { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 12px; font-size: 18px; }
.stat-icon.blue { color: #1677ff; background: #e6f4ff; }
.stat-icon.cyan { color: #13c2c2; background: #e6fffb; }
.stat-icon.purple { color: #722ed1; background: #f9f0ff; }
.stat-icon.orange { color: #fa8c16; background: #fff7e6; }
.library-card, .settings-card { padding: 20px; }
.settings-card { max-width: 760px; }
.settings-card h2, .card-heading h2 { margin: 0; font-size: 18px; }
.card-heading { justify-content: space-between; margin-bottom: 18px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar-actions { flex-wrap: wrap; }

.ant-btn { appearance: none; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 4px 15px; border: 1px solid var(--ant-color-border); border-radius: var(--ant-border-radius); color: var(--ant-color-text); background: #fff; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.02); cursor: pointer; text-decoration: none; white-space: nowrap; transition: color 0.2s, border-color 0.2s, background 0.2s, opacity 0.2s; }
.ant-btn:hover:not(:disabled) { color: var(--ant-color-primary-hover); border-color: var(--ant-color-primary-hover); }
.ant-btn:active:not(:disabled) { color: var(--ant-color-primary-active); border-color: var(--ant-color-primary-active); }
.ant-btn:disabled, .ant-btn.is-loading { cursor: not-allowed; opacity: 0.55; }
.ant-btn-primary { color: #fff; border-color: var(--ant-color-primary); background: var(--ant-color-primary); }
.ant-btn-primary:hover:not(:disabled) { color: #fff; border-color: var(--ant-color-primary-hover); background: var(--ant-color-primary-hover); }
.ant-btn-primary:active:not(:disabled) { color: #fff; border-color: var(--ant-color-primary-active); background: var(--ant-color-primary-active); }
.ant-btn-ghost { color: var(--ant-color-primary); background: #fff; }
.ant-btn-ghost:hover:not(:disabled) { color: var(--ant-color-primary-hover); background: #fff; }
.ant-btn-link { min-height: 28px; padding: 2px 6px; border-color: transparent; color: var(--ant-color-primary); background: transparent; box-shadow: none; }
.ant-btn-link:hover:not(:disabled) { border-color: transparent; background: #f0f7ff; }
.ant-btn-small { min-height: 26px; padding: 1px 9px; font-size: 12px; }
.upload-input { display: none; }

.ant-input { width: 100%; min-height: 32px; padding: 4px 11px; border: 1px solid var(--ant-color-border); border-radius: var(--ant-border-radius); color: var(--ant-color-text); background: #fff; transition: border-color 0.2s, box-shadow 0.2s; }
.ant-input:hover { border-color: var(--ant-color-primary-hover); }
.ant-input:focus { border-color: var(--ant-color-primary); box-shadow: 0 0 0 2px rgba(5, 145, 255, 0.1); outline: none; }
.ant-textarea { display: block; resize: vertical; line-height: 1.55; }
.search-box { width: min(100%, 360px); min-height: 34px; display: flex; align-items: center; gap: 8px; padding-left: 11px; border: 1px solid var(--ant-color-border); border-radius: var(--ant-border-radius); background: #fff; transition: border-color 0.2s, box-shadow 0.2s; }
.search-box:focus-within { border-color: var(--ant-color-primary); box-shadow: 0 0 0 2px rgba(5, 145, 255, 0.1); }
.search-box input { min-width: 0; flex: 1; height: 32px; padding: 0; border: 0; outline: 0; background: transparent; }
.search-submit { align-self: stretch; padding: 0 14px; border: 0; border-left: 1px solid var(--ant-color-border); color: #fff; background: var(--ant-color-primary); cursor: pointer; }
.search-submit:hover { background: var(--ant-color-primary-hover); }

.status-tag, .ant-tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border: 1px solid; border-radius: 4px; font-size: 12px; line-height: 20px; white-space: nowrap; }
.status-success, .tag-success { color: #389e0d; border-color: #b7eb8f; background: #f6ffed; }
.status-error, .tag-error { color: #cf1322; border-color: #ffa39e; background: #fff1f0; }
.tag-processing, .tag-blue { color: #0958d9; border-color: #91caff; background: #e6f4ff; }
.tag-default { color: var(--ant-color-text-secondary); border-color: var(--ant-color-border); background: #fafafa; }

.notice { position: relative; display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; padding: 10px 38px 10px 12px; border: 1px solid; border-radius: var(--ant-border-radius-lg); }
.notice.notice-success { color: #135200; border-color: #b7eb8f; background: #f6ffed; }
.notice.notice-error { color: #820014; border-color: #ffa39e; background: #fff1f0; }
.notice.notice-warning { color: #613400; border-color: #ffe58f; background: #fffbe6; }
.notice.notice-info { color: #003a8c; border-color: #91caff; background: #e6f4ff; }
.notice-icon { width: 18px; height: 18px; flex: none; display: grid; place-items: center; margin-top: 1px; border: 1px solid currentColor; border-radius: 50%; font-size: 11px; font-weight: 700; }
.notice-message { overflow-wrap: anywhere; }
.notice-close { position: absolute; top: 5px; right: 8px; padding: 2px 7px; border: 0; color: currentColor; background: transparent; cursor: pointer; font-size: 20px; opacity: 0.7; }

.upload-progress { margin: 0 0 16px; }
.progress-line { justify-content: space-between; margin-bottom: 6px; color: var(--ant-color-text-secondary); font-size: 12px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: #f0f0f0; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--ant-color-primary), #69b1ff); transition: width 0.2s ease; }

.table-wrap { position: relative; width: 100%; overflow-x: auto; border: 1px solid var(--ant-color-split); border-radius: var(--ant-border-radius-lg); }
.ant-table { width: 100%; min-width: 980px; border-collapse: collapse; table-layout: fixed; background: #fff; }
.ant-table th { padding: 12px 14px; color: var(--ant-color-text); background: #fafafa; border-bottom: 1px solid var(--ant-color-split); font-weight: 600; text-align: left; }
.ant-table td { padding: 12px 14px; border-bottom: 1px solid var(--ant-color-split); color: var(--ant-color-text-secondary); vertical-align: middle; overflow-wrap: anywhere; }
.ant-table tbody tr:last-child td { border-bottom: 0; }
.ant-table tbody tr:hover td { background: #fafcff; }
.ant-table th:nth-child(1) { width: 260px; }
.ant-table th:nth-child(2) { width: 170px; }
.ant-table th:nth-child(3) { width: 80px; }
.ant-table th:nth-child(4) { width: 80px; }
.ant-table th:nth-child(5) { width: 80px; }
.ant-table th:nth-child(6) { width: 330px; }
.song-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cover { width: 42px; height: 42px; flex: none; border-radius: 9px; object-fit: cover; background: #eef2f7; }
.cover-fallback { display: grid; place-items: center; color: #8da0b7; font-size: 18px; }
.song-copy { min-width: 0; }
.song-title { overflow: hidden; color: #172033; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.song-meta { overflow: hidden; margin-top: 3px; color: #8a94a6; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0; }
.empty-cell { padding: 48px 16px !important; text-align: center; color: #8c8c8c !important; }
.empty-icon { display: block; margin-bottom: 8px; color: #bfbfbf; font-size: 34px; }
.loading-mask { position: absolute; inset: 0; min-height: 160px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ant-color-text-secondary); background: rgba(255, 255, 255, 0.78); backdrop-filter: blur(1px); }
.spinner { width: 18px; height: 18px; border: 2px solid #d9d9d9; border-top-color: var(--ant-color-primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pagination { justify-content: space-between; margin-top: 14px; color: var(--ant-color-text-secondary); }
.page-number { display: inline-block; min-width: 54px; text-align: center; }
.footer-note, .form-help { margin: 14px 0 0; color: #8c8c8c; font-size: 12px; }

.ant-modal { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0; overflow: hidden; border: 0; border-radius: var(--ant-border-radius-lg); box-shadow: var(--ant-box-shadow); }
.ant-modal::backdrop { background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(1px); }
.ant-modal-wide { width: min(720px, calc(100vw - 32px)); }
.modal-header { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--ant-color-split); }
.modal-header h2 { margin: 0; font-size: 16px; }
.modal-close { width: 30px; height: 30px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; color: #8c8c8c; background: transparent; cursor: pointer; font-size: 22px; }
.modal-close:hover { color: var(--ant-color-text); background: #f5f5f5; }
.modal-body { max-height: calc(100vh - 190px); padding: 20px 24px; overflow-y: auto; }
.modal-footer { min-height: 60px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 10px 24px; border-top: 1px solid var(--ant-color-split); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.one-column { grid-template-columns: minmax(0, 1fr); }
.form-grid label { display: grid; gap: 5px; color: var(--ant-color-text-secondary); font-size: 12px; }
.form-grid label .ant-input { color: var(--ant-color-text); font-size: 14px; }
.full-row { grid-column: 1 / -1; margin: 0; }
.match-list { display: grid; gap: 10px; }
.match-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px; border: 1px solid var(--ant-color-split); border-radius: var(--ant-border-radius-lg); }
.match-title { font-weight: 600; }
.match-meta { margin-top: 4px; color: var(--ant-color-text-secondary); font-size: 12px; }
.token-row { max-width: 560px; }
.token-row .ant-input { flex: 1; }
.noscript { margin: 24px; padding: 12px; border: 1px solid #ffa39e; border-radius: 6px; color: #820014; background: #fff1f0; }

@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-sider { position: static; height: auto; overflow: visible; }
  .brand { height: 60px; padding: 0 16px; }
  .side-caption { display: none; }
  .side-nav { grid-template-columns: repeat(3, 1fr); padding: 0 8px 8px; }
  .nav-item { justify-content: center; padding: 0 8px; }
  .app-header { padding: 12px 20px; }
  .content { padding: 20px; }
}

@media (max-width: 760px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-header { align-items: flex-start; }
  .page-subtitle { display: none; }
  .toolbar, .token-row { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions > .ant-btn { flex: 1 1 auto; }
  .pagination { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .nav-item { min-height: 40px; font-size: 12px; }
  .nav-item > span:first-child { display: none; }
  .app-header { min-height: 62px; padding: 10px 14px; }
  .page-title { font-size: 19px; }
  .content { padding: 14px 10px 32px; }
  .stats-grid { gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 23px; }
  .stat-icon { width: 32px; height: 32px; }
  .library-card, .settings-card { padding: 14px; }
  .header-actions { gap: 6px; }
  .status-tag { padding: 0 5px; }
  .modal-header, .modal-body, .modal-footer { padding-left: 16px; padding-right: 16px; }
}

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