  /* ===== 设计变量（微光深色 / 现代玻璃拟态） ===== */
  :root {
    --brand-1: #6366f1;
    --brand-2: #8b5cf6;
    --brand-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    --bg-dark: #0b0f19;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-card-hover: rgba(30, 41, 59, 0.85);
    --ink: #f1f5f9;
    --ink-sub: #94a3b8;
    --line: rgba(255, 255, 255, 0.12);
    --radius: 14px;
    --shadow-card: 0 20px 50px rgba(0, 0, 0, 0.5);
    --shadow-btn: 0 6px 24px rgba(99, 102, 241, 0.35);
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: radial-gradient(circle at 50% -20%, #1e1b4b 0%, #0b0f19 80%);
    background-attachment: fixed;
    color: var(--ink);
    min-height: 100vh;
    padding: 24px 16px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
  }
  img { max-width: 100%; }
  ::selection { background: rgba(99, 102, 241, 0.4); color: #fff; }
  
  .container {
    max-width: 1120px;
    margin: 0 auto;
    background: var(--bg-card);
    border: 1px solid var(--line);
    backdrop-filter: blur(16px);
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
  }
  .header {
    background: linear-gradient(180deg, rgba(30, 27, 75, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%);
    border-bottom: 1px solid var(--line);
    color: #fff;
    padding: 36px 40px 24px;
    text-align: center;
  }
  .header h1 {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(90deg, #a5b4fc, #e9d5ff, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 8px;
  }
  .header p { color: var(--ink-sub); font-size: 14.5px; }
  
  .tabs {
    display: flex;
    background: rgba(15, 23, 42, 0.9);
    border-bottom: 1px solid var(--line);
    padding: 6px 12px;
    gap: 6px;
  }
  .tab {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-sub);
    transition: all 0.25s ease;
    border: none;
    border-radius: 10px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }
  .tab.active {
    background: var(--brand-grad);
    color: #fff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
  }
  .tab:hover:not(.active) { background: rgba(255, 255, 255, 0.05); color: #f8fafc; }
  .panel { display: none; padding: 32px 40px; }
  .panel.active { display: block; }
  
  .section-title {
    font-size: 17px;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .section-title .icon { font-size: 20px; color: #a5b4fc; }
  
  textarea {
    width: 100%;
    min-height: 150px;
    padding: 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: #f8fafc;
    font-family: "JetBrains Mono", "Consolas", "Courier New", monospace;
    font-size: 14px;
    line-height: 1.65;
    resize: vertical;
    transition: all 0.25s;
  }
  textarea:focus { outline: none; border-color: var(--brand-1); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25); }
  
  .btn-row {
    display: flex;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
  }
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    font-size: 14.5px;
    font-weight: 600;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
  }
  .btn-primary {
    background: var(--brand-grad);
    color: #fff;
    box-shadow: var(--shadow-btn);
  }
  .btn-primary:hover { opacity: 0.92; transform: translateY(-1px); }
  .btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
    border: 1px solid var(--line);
  }
  .btn-secondary:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
  
  .preview-area {
    margin-top: 24px;
    padding: 20px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    min-height: 100px;
  }
  .preview-area .placeholder {
    color: var(--ink-sub);
    text-align: center;
    padding: 30px;
    font-size: 14px;
  }
  
  /* abc 渲染与深色容器适配 */
  #abc-render, #jianpu-abc-render {
    background: #ffffff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    margin-top: 14px;
  }
  
  .status {
    margin-top: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    display: none;
  }
  .status.success { display: block; background: rgba(52, 211, 153, 0.15); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.3); }
  .status.error { display: block; background: rgba(248, 113, 113, 0.15); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.3); }
  .status.info { display: block; background: rgba(129, 140, 248, 0.15); color: #a5b4fc; border: 1px solid rgba(129, 140, 248, 0.3); }
  
  .help-box {
    margin-top: 20px;
    padding: 16px 20px;
    background: rgba(251, 191, 36, 0.08);
    border-left: 4px solid #fbbf24;
    border-radius: 8px;
    font-size: 13.5px;
    line-height: 1.7;
    color: #fef08a;
  }
  .help-box code {
    background: rgba(255, 255, 255, 0.1);
    color: #fde047;
    padding: 2px 6px;
    border-radius: 4px;
  }
  .help-box strong { color: #fde047; }
  .note-info {
    margin-top: 12px;
    font-size: 13px;
    color: var(--ink-sub);
  }
  #abc-render { overflow-x: auto; }
  .upload-area {
    border: 2px dashed rgba(129, 140, 248, 0.4);
    border-radius: var(--radius);
    padding: 44px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(15, 23, 42, 0.4);
  }
  .upload-area:hover, .upload-area.dragover {
    border-color: var(--brand-1);
    background: rgba(99, 102, 241, 0.12);
  }
  .upload-icon { font-size: 48px; margin-bottom: 12px; }
  .upload-text { font-size: 16px; font-weight: 600; color: #f1f5f9; margin-bottom: 6px; }
  .upload-hint { font-size: 13px; color: var(--ink-sub); }
  .progress-bar {
    background: #f0f0f5;
    border-radius: 8px;
    padding: 16px;
    position: relative;
  }
  .progress-fill {
    height: 8px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    width: 100%;
    animation: pulse 1.5s ease-in-out infinite;
  }
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
  }
  .progress-text {
    font-size: 13px;
    color: #666;
    margin-top: 8px;
    text-align: center;
  }
  .footer {
    text-align: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.9);
    color: var(--ink-sub);
    font-size: 13px;
    border-top: 1px solid var(--line);
  }
  /* MIDI 播放器 */
  .midi-player {
    margin-top: 18px;
    padding: 18px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: var(--radius);
    border: 1px solid var(--line);
  }
  .midi-player-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
  }
  .midi-player-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--brand-grad);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
  }
  .midi-player-btn:hover { transform: scale(1.08); }
  .midi-player-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
  .midi-player-btn.stop { background: #ef4444; box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3); }
  .midi-player-time {
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 13px;
    color: var(--ink-sub);
    min-width: 90px;
  }
  .midi-player-progress {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .midi-player-progress-fill {
    height: 100%;
    background: var(--brand-grad);
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s linear;
  }
  .midi-player-note {
    font-size: 12px;
    color: var(--ink-sub);
    margin-top: 6px;
  }
  /* BPM 速度调节 */
  .tempo-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 12px 16px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--line);
    border-radius: 10px;
  }
  .tempo-control label {
    font-size: 13.5px;
    color: #e2e8f0;
    font-weight: 600;
    white-space: nowrap;
  }
  .tempo-control input[type="range"] {
    flex: 1;
    accent-color: var(--brand-1);
  }
  .tempo-control .tempo-value {
    font-family: "JetBrains Mono", Consolas, monospace;
    font-size: 14px;
    color: #a5b4fc;
    font-weight: 700;
    min-width: 50px;
    text-align: right;
  }
  /* 每页下载按钮组 */
  .page-downloads {
    margin-top: 14px;
    padding: 14px;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 10px;
    border: 1px solid var(--line);
  }
  .page-download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
  }
  .page-download-item:last-child { border-bottom: none; }
  .page-download-item .page-name { color: #cbd5e1; flex: 1; }
  .page-download-item .page-btns { display: flex; gap: 8px; }
  .page-download-item button {
    padding: 5px 12px;
    font-size: 12.5px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.08);
    color: #a5b4fc;
    cursor: pointer;
    transition: all 0.2s;
  }
  .page-download-item button:hover { background: rgba(99, 102, 241, 0.2); border-color: var(--brand-1); color: #fff; }
  /* ========== 公告弹窗 ========== */
  .ann-modal-mask {
    display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.55); z-index: 9999; align-items: center; justify-content: center;
    padding: 20px; animation: annFadeIn 0.25s ease;
  }
  .ann-modal-mask.show { display: flex; }
  @keyframes annFadeIn { from { opacity: 0; } to { opacity: 1; } }
  @keyframes annSlideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
  .ann-modal {
    background: #fff; border-radius: 14px; width: 520px; max-width: 100%;
    max-height: 85vh; overflow: hidden; display: flex; flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3); animation: annSlideUp 0.3s ease;
  }
  .ann-modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff; padding: 18px 24px; display: flex; justify-content: space-between; align-items: center;
  }
  .ann-modal-header h3 { font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
  .ann-close-btn {
    width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(255,255,255,0.2);
    color: #fff; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s; line-height: 1;
  }
  .ann-close-btn:hover { background: rgba(255,255,255,0.35); }
  .ann-modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
  .ann-modal-body .ann-title { font-size: 16px; font-weight: 700; color: #333; margin-bottom: 10px; }
  .ann-modal-body .ann-meta { font-size: 12px; color: #999; margin-bottom: 12px; }
  .ann-modal-body .ann-image { width: 100%; border-radius: 8px; margin-top: 16px; display: block; }
  .ann-modal-body .ann-content { font-size: 14px; line-height: 1.8; color: #444; white-space: pre-wrap; word-break: break-word; }
  .ann-modal-footer {
    padding: 14px 24px; border-top: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center;
    background: #fafafa;
  }
  .ann-nav-info { font-size: 13px; color: #888; }
  .ann-nav-btns { display: flex; gap: 8px; }
  .ann-nav-btn {
    padding: 6px 16px; border: 1px solid #ddd; border-radius: 6px; background: #fff;
    color: #555; font-size: 13px; cursor: pointer; transition: all 0.2s;
  }
  .ann-nav-btn:hover:not(:disabled) { border-color: #667eea; color: #667eea; }
  .ann-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .ann-nav-btn.primary { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; border: none; }
  .ann-nav-btn.primary:hover { opacity: 0.9; }

  /* ============ 全局交互打磨 ============ */
  button, .tab, .upload-area, .ann-nav-btn { -webkit-tap-highlight-color: transparent; }
  .tab { user-select: none; }
  .btn:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
  .btn { touch-action: manipulation; }
  input[type="range"] { accent-color: var(--brand-1); }
  textarea { scrollbar-width: thin; scrollbar-color: #c9cde8 transparent; }

  /* ============ 响应式适配：平板 ============ */
  @media (max-width: 900px) {
    body { padding: 14px; }
    .panel { padding: 24px 22px; }
    .midi-player-controls { flex-wrap: wrap; }
    .midi-player-progress { min-width: 140px; }
  }

  /* ============ 响应式适配：手机 ============ */
  @media (max-width: 640px) {
    body { padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
    .container { border-radius: 12px; }
    .header { padding: 22px 16px; }
    .header h1 { font-size: 20px; margin-bottom: 6px; }
    .header p { font-size: 12.5px; line-height: 1.6; }
    /* 4 个标签改 2×2 排列，避免文字挤压 */
    .tabs { display: grid; grid-template-columns: 1fr 1fr; }
    .tab { padding: 13px 8px; font-size: 13.5px; line-height: 1.3; }
    .panel { padding: 18px 14px; }
    .section-title { font-size: 16px; }
    /* 输入框 16px 字号，避免 iOS 聚焦自动放大 */
    textarea { min-height: 120px; font-size: 16px; padding: 12px; }
    .btn-row { gap: 10px; }
    .btn { flex: 1 1 44%; justify-content: center; padding: 11px 14px; font-size: 14px; }
    .upload-area { padding: 28px 14px; border-width: 2px; }
    .upload-icon { font-size: 38px; margin-bottom: 8px; }
    .upload-text { font-size: 14px; line-height: 1.5; }
    .upload-hint { font-size: 12px; line-height: 1.6; margin-top: 6px; }
    .preview-area { padding: 14px; }
    .preview-area .placeholder { padding: 18px 8px; font-size: 13px; }
    .help-box { font-size: 12.5px; padding: 12px 14px; line-height: 1.7; }
    .note-info { font-size: 12px; }
    .status { font-size: 13px; padding: 10px 12px; word-break: break-word; }
    .tempo-control { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
    .tempo-control input[type="range"] { flex: 1 1 160px; }
    .midi-player { padding: 12px; }
    .midi-player-controls { gap: 8px; }
    .midi-player-btn { width: 36px; height: 36px; font-size: 14px; }
    .midi-player-progress { flex: 1 1 100%; order: 3; min-width: 0; }
    .midi-player-time { min-width: 0; margin-left: auto; font-size: 12px; }
    .page-download-item { flex-direction: column; align-items: flex-start; gap: 6px; }
    /* JS 动态生成的缩略图在窄屏略微收窄（内联样式需 !important 覆盖） */
    #preview-thumbs > div { width: 104px !important; }
    #preview-thumbs img, #preview-thumbs > div > div[style*="height:120px"] { height: 104px !important; }
    /* 公告弹窗：接近全屏，按钮可点 */
    .ann-modal-mask { padding: 12px; }
    .ann-modal { width: 100%; max-height: 92vh; border-radius: 12px; }
    .ann-modal-header { padding: 14px 16px; }
    .ann-modal-body { padding: 16px; }
    .ann-modal-footer { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 16px; }
    .ann-nav-info { text-align: center; }
    .ann-nav-btns { display: flex; }
    .ann-nav-btn { flex: 1; padding: 9px 8px; }
    .footer { padding: 12px; font-size: 11.5px; line-height: 1.6; }
  }

  /* ============ 响应式适配：窄屏手机（按钮整行堆叠） ============ */
  @media (max-width: 400px) {
    .header h1 { font-size: 18.5px; }
    .tab { font-size: 12.5px; padding: 12px 6px; }
    .btn-row { flex-direction: column; }
    .btn { flex: 1 1 100%; width: 100%; }
    #preview-thumbs > div { width: 96px !important; }
    #preview-thumbs img, #preview-thumbs > div > div[style*="height:120px"] { height: 96px !important; }
  }

  /* ============ 用户偏好：减少动态效果 ============ */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
      scroll-behavior: auto !important;
    }
    .progress-fill { animation: none; }
  }

/* ===== 用户登录与会员状态栏样式 ===== */
.user-auth-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.user-auth-info { display: flex; align-items: center; gap: 10px; }
.user-badge {
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.user-badge-vip {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}
.user-badge-normal {
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}
.user-usage-text { color: #94a3b8; font-size: 12.5px; }
.user-auth-btn {
  padding: 5px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
  color: #f1f5f9;
  transition: all 0.2s;
}
.user-auth-btn:hover { background: rgba(255, 255, 255, 0.18); }
.user-auth-btn.primary {
  background: var(--brand-grad);
  border: none;
  color: #fff;
}
.user-auth-btn.primary:hover { opacity: 0.9; }

/* 登录弹窗 */
.user-login-mask {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.user-login-mask.show { display: flex; }
.user-login-box {
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 16px;
  width: 380px;
  max-width: 90vw;
  padding: 30px 26px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  position: relative;
  color: #f8fafc;
}
.user-auth-tabs {
  display: flex;
  margin-bottom: 20px;
  background: rgba(15, 23, 42, 0.6);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
}
.user-auth-tab {
  flex: 1;
  text-align: center;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  border: none;
  background: transparent;
}
.user-auth-tab.active {
  background: #6366f1;
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}
.user-login-close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 22px;
  cursor: pointer;
}
.user-login-field { margin-bottom: 14px; }
.user-login-field label { display: block; font-size: 12.5px; color: #94a3b8; margin-bottom: 5px; }
.user-login-field input {
  width: 100%;
  padding: 10px 12px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  box-sizing: border-box;
}
.user-login-field input:focus { outline: none; border-color: #6366f1; }
.user-login-btn {
  width: 100%;
  padding: 11px;
  border: none;
  border-radius: 8px;
  background: var(--brand-grad);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 6px;
  transition: opacity 0.2s;
}
.user-login-btn:hover { opacity: 0.9; }
.user-login-msg {
  font-size: 13px;
  text-align: center;
  margin-bottom: 12px;
  min-height: 18px;
  color: #f87171;
}
.user-login-tip {
  font-size: 12px;
  color: #64748b;
  text-align: center;
  margin-top: 14px;
}

