:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-light: #eef2ff;
  --accent-glow: rgba(79, 70, 229, 0.35);
  --warm: #f59e0b;
  --success: #059669;
  --radius: 16px;
  --radius-sm: 12px;
}

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

html {
  scroll-behavior: smooth;
}

body.hub.pany-home {
  font-family: "PingFang TC", "Heiti TC", "Noto Sans TC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.5rem);
  -webkit-font-smoothing: antialiased;
}

body.hub-drawer-open {
  overflow: hidden;
}

.hub-header--compact {
  padding-bottom: 1rem;
}

.hub-back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 700;
}

/* ── Drawer (pany 工具箱) ── */

.hub-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
}

.hub-drawer-backdrop[hidden] {
  display: none !important;
}

.hub-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 61;
  width: min(300px, 86vw);
  background: var(--surface);
  box-shadow: 8px 0 32px rgba(15, 23, 42, 0.12);
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
}

.hub-drawer.is-open {
  transform: translateX(0);
}

.hub-drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 1.35rem 1.15rem 1rem;
  border-bottom: 1px solid var(--border);
}

.hub-drawer-icon {
  font-size: 1.5rem;
  line-height: 1;
}

.hub-drawer-head h2 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.15rem;
}

.hub-drawer-head p {
  font-size: 0.78rem;
  color: var(--muted);
}

.hub-drawer-nav {
  flex: 1;
  padding: 0.5rem 0;
  overflow-y: auto;
}

.hub-drawer-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.75rem 1.15rem;
  border: none;
  background: transparent;
  text-decoration: none;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}

.hub-drawer-item:hover,
.hub-drawer-item:focus-visible {
  background: var(--accent-light);
}

.hub-drawer-item-icon {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--accent-light);
  font-size: 1.15rem;
  flex-shrink: 0;
}

.hub-drawer-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.hub-drawer-item-text strong {
  font-size: 0.92rem;
  font-weight: 700;
}

.hub-drawer-item-text small {
  font-size: 0.72rem;
  color: var(--muted);
}

.hub-drawer-chevron {
  color: #9ca3af;
  font-size: 1.25rem;
  font-weight: 700;
}

/* ── Header (pany gradient) ── */

.hub-header {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: calc(0.75rem + env(safe-area-inset-top, 0px)) 1rem 1.25rem;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 55%, #7c3aed 100%);
  color: #fff;
}

.hub-menu-btn {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}

.hub-header-text {
  flex: 1;
  min-width: 0;
  padding-top: 0.15rem;
}

.hub-header-text h1 {
  font-size: clamp(1.45rem, 5.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 0.35rem;
}

.hub-header-text p {
  font-size: 0.88rem;
  opacity: 0.9;
  line-height: 1.35;
}

/* ── Search ── */

.hub-search-wrap {
  margin: -0.65rem 1rem 0;
  position: relative;
  z-index: 2;
}

.hub-search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.85rem;
  min-height: 3rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
}

.hub-search:focus-within {
  border-color: rgba(79, 70, 229, 0.45);
  box-shadow: 0 6px 24px rgba(79, 70, 229, 0.15);
}

.hub-search-icon {
  font-size: 1rem;
  opacity: 0.55;
  flex-shrink: 0;
}

.hub-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  padding: 0.65rem 0;
  outline: none;
}

.hub-search-input::placeholder {
  color: #9ca3af;
}

.hub-search-clear {
  border: none;
  background: #f3f4f6;
  color: var(--muted);
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.hub-search-clear[hidden] {
  display: none;
}

/* ── Main content ── */

.hub-home-view,
.hub-search-view {
  max-width: 640px;
  margin: 0 auto;
  padding: 1rem 1rem 0;
}

.hub-search-view[hidden],
.hub-home-view[hidden] {
  display: none !important;
}

.hub-search-meta {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.65rem;
  padding: 0 0.15rem;
}

.hub-block {
  margin-bottom: 1.5rem;
}

.hub-block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0 0.15rem;
}

.hub-block-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hub-block-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}

.hub-block-link:hover {
  text-decoration: underline;
}

.hub-block-meta {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.hub-catalog-hint {
  margin: -0.35rem 0 0.65rem;
  padding: 0 0.15rem;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.hub-load-more {
  display: block;
  width: 100%;
  margin-top: 0.65rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}

.hub-load-more[hidden] {
  display: none !important;
}

/* ── Continue banner ── */

.continue-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface);
  padding: 0.9rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  border: 1px solid var(--border);
}

.continue-banner[hidden] {
  display: none !important;
}

.continue-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.continue-banner-text p {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}

.continue-banner-text strong {
  color: var(--text);
  font-weight: 700;
}

.btn-continue {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* ── Lesson list (pany card) ── */

.hub-lesson-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pany-lesson-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: none;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  width: 100%;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}

.pany-lesson-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(79, 70, 229, 0.12);
}

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

.pany-lesson-num {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent-light), #e0e7ff);
  color: var(--accent);
  font-size: 1rem;
  font-weight: 800;
}

.pany-lesson-body {
  flex: 1;
  min-width: 0;
}

.pany-lesson-body h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.pany-lesson-body p {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pany-lesson-meta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--success);
}

.pany-lesson-chevron {
  color: #9ca3af;
  font-size: 1.2rem;
  font-weight: 700;
}

/* ── Song list (pany) ── */

.hub-song-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.pany-song-card {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  background: var(--surface);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
  transition: transform 0.15s, box-shadow 0.15s;
}

.pany-song-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
}

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

.pany-song-main {
  flex: 1;
  min-width: 0;
}

.pany-song-title {
  display: block;
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pany-singer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pany-singer-chip::before {
  content: "👤";
  font-size: 0.7rem;
  opacity: 0.7;
}

.pany-key-chip {
  flex-shrink: 0;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
}

.pany-song-chevron {
  flex-shrink: 0;
  color: #d1d5db;
  font-size: 1.1rem;
  font-weight: 700;
}

.hub-songs-loading,
.hub-songs-empty,
.hub-search-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

@media (max-width: 380px) {
  .continue-banner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .btn-continue {
    width: 100%;
  }
}
