/* 律谱 — 极简风格，移动端优先 */
:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --text: #111;
  --text-dim: #999;
  --text-muted: #ccc;
  --border: #eee;
  --accent: #14b8a6;
  --accent-dim: #0d9488;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 顶栏 */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.top-bar .logo {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.top-bar .search-box {
  flex: 1;
  position: relative;
  max-width: 360px;
}

.top-bar .search-box input {
  width: 100%;
  height: 36px;
  padding: 0 0.75rem 0 2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.875rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

.top-bar .search-box input:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.top-bar .search-box .search-icon {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 0.75rem;
  pointer-events: none;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
  flex-shrink: 0;
}

.back-btn:hover { background: var(--bg); }

/* 主内容 */
.content {
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* 列表页标题 */
.page-header {
  margin-bottom: 1.25rem;
}

.page-header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.page-header .sub {
  font-size: 0.8125rem;
  color: var(--text-dim);
}

/* 曲谱列表 */
.score-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.score-item {
  display: block;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s;
}

.score-item:hover {
  border-color: var(--accent);
}

.score-item:active {
  background: #fafafa;
}

.score-item .title {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.score-item .composer {
  font-size: 0.8125rem;
  color: var(--text-dim);
  margin-bottom: 0.375rem;
}

.score-item .meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.score-item .badge {
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-weight: 500;
}

.badge-easy { background: #e8f5e9; color: #2e7d32; }
.badge-medium { background: #e3f2fd; color: #1565c0; }
.badge-hard { background: #fce4ec; color: #c62828; }

.badge-tag {
  background: var(--bg);
  color: var(--text-dim);
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-dim);
  font-size: 0.875rem;
}

/* 搜索无结果 */
.search-meta {
  margin-bottom: 1.25rem;
}

.search-meta .query {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.search-meta .count {
  font-size: 0.8125rem;
  color: var(--text-dim);
}

/* 分类页 */
.category-meta {
  margin-bottom: 1.25rem;
}

.category-meta h1 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.category-meta .count {
  font-size: 0.8125rem;
  color: var(--text-dim);
}

/* 面包屑 */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  font-size: 0.8125rem;
  color: var(--text-dim);
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

/* 详情页 */
.detail-header {
  margin-bottom: 1.5rem;
}

.detail-header h1 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  line-height: 1.3;
}

.detail-header .composer {
  font-size: 0.9375rem;
  color: var(--text-dim);
  margin-bottom: 0.5rem;
}

.detail-header .meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* 渲染模式切换 */
.mode-bar {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  padding: 0.25rem;
  background: var(--bg);
  border-radius: 999px;
  width: fit-content;
}

.mode-btn {
  padding: 0.375rem 0.875rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.play-btn {
  margin-left: auto;
  padding: 0.375rem 0.875rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}

.play-btn:hover { opacity: 0.85; }

/* 乐谱容器 */
.score-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 60px;
}

.score-container .jp-score {
  border: none;
  border-radius: 0;
  min-height: 60px;
}

.score-container .jp-score svg {
  display: block;
  width: 100% !important;
  height: auto !important;
}

.jp-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-dim);
  font-size: 0.875rem;
}

/* 曲谱说明 */
.detail-notes {
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-dim);
  line-height: 1.7;
}

/* 图片查看器 */
.image-viewer {
  background: #111;
  border-radius: var(--radius);
  overflow: hidden;
}

.image-viewer img {
  display: block;
  width: 100%;
  height: auto;
}

.viewer-pagination {
  text-align: center;
  padding: 0.75rem;
  font-size: 0.75rem;
  color: #888;
  border-top: 1px solid #222;
}

.viewer-nav {
  display: none;
}

/* 打印 */
@media print {
  .top-bar, .back-btn, .mode-bar, .breadcrumb { display: none !important; }
  .content { max-width: none; padding: 0; }
}
