:root {
  --background: #ffffff;
  --foreground: #16161d;
  --card: #ffffff;
  --primary: #030213;
  --primary-foreground: #ffffff;
  --secondary: #f1f2f5;
  --muted: #ececf0;
  --muted-foreground: #717182;
  --border: rgba(0, 0, 0, 0.1);
  --destructive: #d4183d;
  --radius: 20px;
  --shadow-soft: 0 18px 40px rgba(3, 2, 19, 0.06);
  --shadow-card: 0 10px 24px rgba(3, 2, 19, 0.05);
}

body.theme-dark {
  --background: #0b1020;
  --foreground: #eef2ff;
  --card: #121a30;
  --primary: #eef2ff;
  --primary-foreground: #0b1020;
  --secondary: rgba(255, 255, 255, 0.06);
  --muted: rgba(255, 255, 255, 0.08);
  --muted-foreground: rgba(226, 232, 240, 0.72);
  --border: rgba(255, 255, 255, 0.08);
  --destructive: #fb7185;
  --shadow-soft: 0 22px 44px rgba(0, 0, 0, 0.34);
  --shadow-card: 0 12px 28px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--foreground);
  font-family: "SF Pro Display", "PingFang SC", "Noto Sans SC", "Inter", system-ui, sans-serif;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 92px;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 28px 22px 22px;
  border-radius: 26px;
  background: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: var(--shadow-soft);
}

.auth-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: rgba(113, 113, 130, 0.45);
}

.auth-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(3, 2, 19, 0.82), rgba(3, 2, 19, 1));
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 28px rgba(3, 2, 19, 0.16);
}

.auth-badge svg {
  width: 24px;
  height: 24px;
}

.auth-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.auth-subtitle {
  margin: 10px 0 20px;
  color: var(--muted-foreground);
  font-size: 14px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: rgba(241, 242, 245, 0.85);
}

.auth-tab {
  flex: 1;
  padding: 10px 0;
  border-radius: 12px;
  color: var(--muted-foreground);
  transition: all 0.2s ease;
}

.auth-tab.active {
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 4px 14px rgba(3, 2, 19, 0.06);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--card);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-input:focus {
  border-color: rgba(3, 2, 19, 0.18);
  box-shadow: 0 0 0 4px rgba(3, 2, 19, 0.06);
}

.auth-submit {
  width: 100%;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 16px 28px rgba(3, 2, 19, 0.16);
}

.auth-error {
  margin-top: 0;
}

.page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 40px 16px 24px;
  animation: fade-up 0.35s ease;
}

.search-page {
  padding-top: 56px;
}

.global-notice {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  min-width: min(320px, calc(100vw - 32px));
  max-width: 520px;
  padding: 12px 16px;
  border-radius: 16px;
  background: rgba(3, 2, 19, 0.92);
  color: #fff;
  box-shadow: 0 18px 40px rgba(3, 2, 19, 0.22);
  backdrop-filter: blur(12px);
}

.global-notice.success {
  background: rgba(5, 150, 105, 0.94);
}

.global-notice.error {
  background: rgba(212, 24, 61, 0.94);
}

.search-bar-wrap {
  position: relative;
  margin-bottom: 20px;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted-foreground);
}

.search-input {
  width: 100%;
  padding: 16px 96px 16px 44px;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--card);
  color: var(--foreground);
  outline: none;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.02);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.search-input::placeholder {
  color: rgba(113, 113, 130, 0.65);
}

.search-input:focus {
  border-color: rgba(3, 2, 19, 0.18);
  box-shadow: 0 0 0 4px rgba(3, 2, 19, 0.06);
}

.search-action {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 10px 20px;
  border-radius: 12px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 14px;
}

.error-box,
.empty-text {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(212, 24, 61, 0.08);
  color: var(--destructive);
  font-size: 14px;
}

.empty-text {
  background: var(--secondary);
  color: var(--muted-foreground);
}

.empty-state {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top: 84px;
  color: rgba(113, 113, 130, 0.4);
}

.empty-state svg {
  width: 64px;
  height: 64px;
}

.results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.download-banner {
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(3, 2, 19, 0.96), rgba(31, 41, 55, 0.96));
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 34px rgba(3, 2, 19, 0.18);
}

.download-banner-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.download-banner-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.download-banner-text {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.download-banner-value {
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
}

.result-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--card);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.02);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.result-card:hover {
  transform: translateY(-2px);
  border-color: rgba(3, 2, 19, 0.14);
  box-shadow: var(--shadow-card);
}

.cover {
  width: 48px;
  height: 64px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.92);
  flex-shrink: 0;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
}

.cover svg {
  width: 20px;
  height: 20px;
}

.cover-media {
  padding: 0;
  overflow: hidden;
  background: #f3f4f6;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

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

.cover.orange {
  background: linear-gradient(135deg, #fb923c, #f43f5e);
}

.cover.blue {
  background: linear-gradient(135deg, #60a5fa, #6366f1);
}

.cover.violet {
  background: linear-gradient(135deg, #a78bfa, #7c3aed);
}

.cover.amber {
  background: linear-gradient(135deg, #fbbf24, #f97316);
}

.cover.green {
  background: linear-gradient(135deg, #34d399, #14b8a6);
}

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

.result-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-author {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--muted-foreground);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.download-feedback {
  margin-top: 12px;
}

.download-feedback-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted-foreground);
}

.download-feedback.success,
.download-feedback.error {
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 12px;
}

.download-feedback.success {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.download-feedback.error {
  background: rgba(212, 24, 61, 0.08);
  color: var(--destructive);
}

.download-progress-track {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(3, 2, 19, 0.08);
}

.download-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #111827, #4f46e5);
  transition: width 0.18s ease;
}

.download-inline-progress {
  margin-top: 10px;
  max-width: 340px;
}

.download-inline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted-foreground);
}

.download-inline-head span:last-child {
  color: #4338ca;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.download-progress-track.banner {
  margin-top: 12px;
  background: rgba(255, 255, 255, 0.12);
}

.download-progress-track.banner span {
  background: linear-gradient(90deg, #ffffff, #c4b5fd);
}

.meta-pill {
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--secondary);
  font-size: 11px;
  color: rgba(113, 113, 130, 0.9);
}

.meta-pill.status-finish {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.meta-pill.status-progress {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.download-btn {
  min-width: 78px;
  height: 42px;
  padding: 0 12px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 8px 20px rgba(3, 2, 19, 0.18);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.download-btn:active {
  transform: scale(0.92);
}

.download-btn:disabled {
  cursor: default;
}

.download-btn.downloading {
  background: rgba(79, 70, 229, 0.08);
  color: #4338ca;
  box-shadow: none;
}

.download-btn.done {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  box-shadow: none;
}

.download-btn.error {
  background: rgba(212, 24, 61, 0.08);
  color: var(--destructive);
  box-shadow: none;
}

.download-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.download-btn svg {
  width: 16px;
  height: 16px;
}

.download-btn-text {
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

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

.platform-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 120px;
  padding: 18px 14px;
  border-radius: 20px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--card);
  text-align: center;
  transition: border-color 0.18s ease, background 0.18s ease;
}

.platform-card:active {
  transform: none;
}

.platform-card:hover {
  border-color: rgba(3, 2, 19, 0.12);
}

.platform-card.selected {
  border-color: rgba(3, 2, 19, 0.16);
  background: rgba(3, 2, 19, 0.04);
}

.platform-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.platform-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}

.platform-check svg {
  width: 12px;
  height: 12px;
}

.platform-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.platform-icon.red {
  background: linear-gradient(135deg, #f87171, #f43f5e);
}

.platform-icon.green {
  background: linear-gradient(135deg, #4ade80, #10b981);
}

.platform-icon.blue {
  background: linear-gradient(135deg, #60a5fa, #6366f1);
}

.platform-icon.orange {
  background: linear-gradient(135deg, #fb923c, #f87171);
}

.platform-icon.yellow {
  background: linear-gradient(135deg, #fcd34d, #f59e0b);
}

.platform-icon.violet {
  background: linear-gradient(135deg, #a78bfa, #8b5cf6);
}

.platform-icon.gray {
  background: linear-gradient(135deg, #d1d5db, #9ca3af);
}

.platform-icon.pink {
  background: linear-gradient(135deg, #f472b6, #fb7185);
}

.platform-name {
  font-size: 14px;
}

.soon-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--muted);
  font-size: 10px;
  color: rgba(113, 113, 130, 0.7);
}

.floating-save-shell {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 80px;
  z-index: 45;
  pointer-events: none;
}

.floating-save {
  position: fixed;
  left: 50%;
  bottom: 80px;
  width: calc(100% - 32px);
  max-width: 42rem;
  transform: translateX(-50%);
  z-index: 46;
  pointer-events: auto;
}

.floating-save button {
  width: 100%;
  padding: 14px 18px;
  border-radius: 18px;
  background: var(--primary);
  color: var(--primary-foreground);
  box-shadow: 0 16px 28px rgba(3, 2, 19, 0.16);
  font-size: 14px;
  letter-spacing: 0.01em;
  transition: none !important;
  transform: none !important;
}

.profile {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(3, 2, 19, 0.82), rgba(3, 2, 19, 1));
  color: var(--primary-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 28px rgba(3, 2, 19, 0.16);
}

.avatar svg {
  width: 24px;
  height: 24px;
}

.profile-name {
  margin: 0;
  font-size: 16px;
}

.profile-id {
  margin: 4px 0 0;
  color: var(--muted-foreground);
  font-size: 14px;
}

.profile-settings {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--secondary);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-settings svg {
  width: 16px;
  height: 16px;
}

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

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 10px;
  border-radius: 20px;
  background: var(--card);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.stat-card svg {
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
  margin-bottom: 2px;
}

.stat-value {
  font-size: 16px;
}

.stat-label {
  font-size: 11px;
  color: var(--muted-foreground);
}

.tab-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 18px;
  background: rgba(241, 242, 245, 0.75);
  margin-bottom: 16px;
}

.tab-btn {
  position: relative;
  flex: 1;
  padding: 10px 0;
  border-radius: 14px;
  color: var(--muted-foreground);
  font-size: 14px;
}

.tab-btn.active {
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 4px 14px rgba(3, 2, 19, 0.06);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item,
.setting-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: var(--card);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.history-item:hover,
.setting-item:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-card);
}

.history-cover {
  width: 40px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.92);
  flex-shrink: 0;
}

.history-cover svg {
  width: 16px;
  height: 16px;
}

.history-info {
  flex: 1;
  min-width: 0;
}

.history-title {
  margin: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted-foreground);
}

.format-pill {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--secondary);
}

.history-date {
  font-size: 11px;
  color: rgba(113, 113, 130, 0.55);
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.user-page {
  padding-top: 28px;
}

.profile-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  margin-bottom: 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(99, 102, 241, 0.12), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 248, 251, 0.96));
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.08);
}

.profile-hero-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.profile-topline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.profile-caption {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(113, 113, 130, 0.88);
}

.user-section {
  margin-bottom: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-kicker {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(113, 113, 130, 0.65);
}

.section-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.section-meta {
  font-size: 12px;
  color: rgba(113, 113, 130, 0.75);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.verified {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}

.status-pill.pending {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.account-panel {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: var(--card);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.05);
}

.account-panel.verified {
  background:
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 253, 250, 0.98));
}

.account-panel.pending {
  background:
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 251, 244, 0.98));
}

.account-panel-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.account-panel-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 2, 19, 0.06);
  color: var(--foreground);
  flex-shrink: 0;
}

.account-panel-icon svg {
  width: 18px;
  height: 18px;
}

.account-panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.account-panel-text {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(113, 113, 130, 0.9);
}

.benefit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.benefit-card {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.benefit-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: rgba(113, 113, 130, 0.78);
}

.benefit-value {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.membership-section {
  display: grid;
  gap: 12px;
  overflow: hidden;
}

.membership-count {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
  color: rgba(15, 23, 42, 0.64);
  font-size: 12px;
  font-weight: 700;
}

.membership-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(241, 245, 249, 0.88);
  border: 1px solid rgba(15, 23, 42, 0.05);
}

.membership-tab {
  min-height: 54px;
  padding: 8px 6px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: rgba(71, 85, 105, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 12px;
  font-weight: 800;
}

.membership-tab strong {
  font-size: 13px;
  color: #0f172a;
}

.membership-tab.active {
  background: #fff;
  color: #0f766e;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.membership-plan.featured {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(20, 184, 166, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(240, 253, 250, 0.78));
}

.membership-plan-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.membership-name {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  color: var(--foreground);
}

.membership-days {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.membership-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.1);
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
}

.membership-price-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.membership-price {
  display: block;
  font-size: 34px;
  line-height: 1;
  font-weight: 800;
  color: #0f172a;
}

.membership-unit {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: rgba(71, 85, 105, 0.76);
}

.membership-pay {
  min-width: 144px;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 14px 26px rgba(15, 118, 110, 0.22);
}

.membership-pay:disabled {
  opacity: 0.72;
}

.membership-benefits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.membership-benefits span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: rgba(15, 23, 42, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.membership-benefits svg {
  width: 13px;
  height: 13px;
  color: #0f766e;
}

.stats-grid.refined .stat-card {
  align-items: flex-start;
  padding: 16px 14px;
}

.stats-grid.refined .stat-card.accent {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98), rgba(30, 41, 59, 0.96));
  color: #fff;
  box-shadow: 0 20px 34px rgba(15, 23, 42, 0.16);
}

.stats-grid.refined .stat-card.accent svg,
.stats-grid.refined .stat-card.accent .stat-label {
  color: rgba(255, 255, 255, 0.72);
}

.setting-copy {
  flex: 1;
  min-width: 0;
}

.setting-subtitle {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(113, 113, 130, 0.72);
}

.setting-item {
  border: 0;
  box-shadow: none;
}

.setting-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: var(--secondary);
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.setting-icon svg {
  width: 16px;
  height: 16px;
}

.setting-item.danger .setting-icon {
  background: rgba(212, 24, 61, 0.1);
  color: var(--destructive);
}

.setting-item.danger .setting-label {
  color: var(--destructive);
}

.setting-label {
  flex: 1;
  font-size: 14px;
}

.setting-value {
  font-size: 12px;
  color: rgba(113, 113, 130, 0.6);
}

.setting-arrow {
  width: 16px;
  height: 16px;
  color: rgba(113, 113, 130, 0.3);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(18px);
}

.bottom-nav-inner {
  max-width: 42rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-around;
  padding: 8px 24px;
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 20px;
  border-radius: 18px;
  color: var(--muted-foreground);
  transition: color 0.2s ease, transform 0.2s ease;
}

.nav-item.active {
  color: var(--foreground);
  background: rgba(3, 2, 19, 0.05);
}

.nav-item:active {
  transform: scale(0.92);
}

.nav-item svg {
  width: 20px;
  height: 20px;
}

.nav-item span {
  font-size: 11px;
}

.spin {
  animation: spin 1s linear infinite;
}

.hidden {
  display: none !important;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 520px) {
  .page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .profile-hero {
    padding: 16px;
  }

  .profile-hero-main {
    gap: 12px;
  }

  .benefit-grid {
    grid-template-columns: 1fr;
  }

  .global-notice {
    top: 12px;
    min-width: calc(100vw - 24px);
  }

  .platform-grid {
    gap: 10px;
  }

  .platform-card {
    padding: 18px 10px;
  }

  .search-input {
    padding-right: 88px;
  }

  .search-action {
    padding: 9px 16px;
  }

  .download-banner {
    padding: 12px 14px;
  }

  .download-banner-value {
    font-size: 18px;
  }

  .result-card {
    gap: 12px;
  }

  .download-btn {
    min-width: 72px;
    padding: 0 10px;
  }

  .download-btn-text {
    font-size: 11px;
  }
}

/* Modern workspace refresh */
:root {
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: rgba(79, 70, 229, 0.1);
  --line-soft: rgba(15, 23, 42, 0.08);
}

body {
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.14), transparent 32rem),
    linear-gradient(180deg, #f7f8fc 0%, #ffffff 48%, #f8fafc 100%);
}

body.theme-dark {
  --surface: rgba(18, 26, 48, 0.86);
  --surface-strong: #121a30;
  --brand-soft: rgba(129, 140, 248, 0.16);
  --line-soft: rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, 0.2), transparent 30rem),
    linear-gradient(180deg, #080d1a 0%, #0b1020 100%);
}

.page {
  max-width: 46rem;
  padding-top: 26px;
}

.search-hero,
.page-header-card,
.profile-hero.refined,
.user-section,
.quick-panel,
.empty-panel {
  border: 1px solid var(--line-soft);
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.07);
  backdrop-filter: blur(18px);
}

.search-hero {
  padding: 22px;
  border-radius: 30px;
}

.hero-topline,
.platform-card-top,
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-badge,
.platform-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
}

.source-link,
.text-action,
.result-toolbar button,
.platform-actions button {
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.hero-title,
.page-title {
  margin: 14px 0 18px;
  font-size: clamp(28px, 7vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.06em;
}

.search-bar-wrap.elevated {
  height: 62px;
  border-radius: 22px;
  border: 1px solid rgba(79, 70, 229, 0.16);
  background: var(--surface-strong);
  box-shadow: 0 18px 36px rgba(79, 70, 229, 0.12);
}

.search-bar-wrap.elevated .search-input {
  font-size: 16px;
  font-weight: 600;
}

.search-bar-wrap.elevated .search-action {
  height: 44px;
  min-width: 82px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 24px rgba(79, 70, 229, 0.28);
}

.source-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.source-summary strong {
  min-width: 0;
  color: var(--foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-chips {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.history-chip {
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  color: var(--foreground);
  font-size: 13px;
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 2px 10px;
  color: var(--muted-foreground);
  font-size: 13px;
}

.results {
  gap: 12px;
}

.result-card.refined-card,
.result-card.skeleton {
  padding: 13px;
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  background: var(--surface-strong);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.result-card.refined-card:hover {
  transform: translateY(-2px);
  border-color: rgba(79, 70, 229, 0.18);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.09);
}

.result-card .cover {
  width: 58px;
  height: 78px;
  border-radius: 16px;
}

.result-title {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.platform-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.platform-dot.orange { background: #fb923c; }
.platform-dot.yellow { background: #f59e0b; }
.platform-dot.gray { background: #94a3b8; }
.platform-dot.blue { background: #3b82f6; }
.platform-dot.green { background: #10b981; }
.platform-dot.pink { background: #ec4899; }

.meta-pill.source {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}

.download-btn {
  min-width: 86px;
  height: 44px;
  border-radius: 16px;
  background: #111827;
}

.download-btn.error {
  background: rgba(212, 24, 61, 0.1);
}

.download-btn.ghost {
  background: rgba(15, 23, 42, 0.06);
  box-shadow: none;
}

.quick-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border-radius: 24px;
}

.quick-panel div {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.quick-panel strong {
  display: block;
  font-size: 22px;
  letter-spacing: -0.04em;
}

.quick-panel span,
.empty-panel span,
.empty-mini {
  color: var(--muted-foreground);
  font-size: 12px;
}

.empty-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 34px 18px;
  border-radius: 26px;
  text-align: center;
}

.empty-panel svg {
  width: 28px;
  height: 28px;
  color: var(--brand);
}

.skeleton-list {
  margin-top: 16px;
}

.skeleton span,
.shimmer {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.16), rgba(148, 163, 184, 0.28), rgba(148, 163, 184, 0.16));
  background-size: 220% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}

.skeleton .result-main span:nth-child(1) { width: 72%; height: 16px; }
.skeleton .result-main span:nth-child(2) { width: 48%; height: 12px; margin-top: 10px; }
.skeleton .result-main span:nth-child(3) { width: 58%; height: 12px; margin-top: 12px; }

.page-header-card {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border-radius: 28px;
  margin-bottom: 16px;
}

.page-header-card .page-title {
  margin: 4px 0 0;
  font-size: 28px;
}

.platform-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.platform-actions button {
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
}

.platform-grid.refined {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.platform-grid.refined .platform-card {
  position: relative;
  align-items: stretch;
  padding: 16px;
  min-height: 156px;
  border: 1px solid var(--line-soft);
  border-radius: 24px;
  background: var(--surface-strong);
  text-align: left;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.05);
}

.platform-grid.refined .platform-card.selected {
  border-color: rgba(79, 70, 229, 0.4);
  background: linear-gradient(180deg, rgba(79, 70, 229, 0.08), var(--surface-strong));
}

.platform-grid.refined .platform-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
}

.platform-grid.refined .platform-name {
  margin-top: 14px;
  font-size: 16px;
  font-weight: 800;
}

.platform-meta {
  margin-top: 4px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.platform-tags {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

.platform-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.05);
  color: var(--muted-foreground);
  font-size: 11px;
}

.platform-check {
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.platform-check.visible {
  opacity: 1;
  transform: scale(1);
}

.profile-hero.refined {
  padding: 20px;
  border-radius: 28px;
}

.profile-hero.refined .avatar {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}

.stats-grid.compact {
  grid-template-columns: repeat(3, 1fr);
}

.user-section {
  padding: 18px;
  border-radius: 26px;
}

.account-panel {
  box-shadow: none;
}

.modern-history .history-item {
  border: 1px solid var(--line-soft);
}

.empty-mini {
  padding: 20px;
  border: 1px dashed var(--line-soft);
  border-radius: 18px;
  text-align: center;
}

.bottom-nav {
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(22px);
}

.nav-item.active {
  color: var(--brand);
  background: var(--brand-soft);
}

.error-box.modern {
  margin-top: 14px;
  border: 1px solid rgba(212, 24, 61, 0.12);
}

@keyframes shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

@media (max-width: 520px) {
  .page {
    padding-top: 18px;
  }

  .search-hero {
    padding: 18px;
    border-radius: 26px;
  }

  .hero-title {
    font-size: 31px;
  }

  .search-bar-wrap.elevated {
    height: 58px;
    border-radius: 20px;
  }

  .search-bar-wrap.elevated .search-input {
    padding-left: 46px;
    padding-right: 94px;
  }

  .quick-panel,
  .stats-grid.compact {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .quick-panel div,
  .stats-grid.compact .stat-card {
    padding: 10px 6px;
  }

  .result-card.refined-card {
    align-items: center;
  }

  .result-card .cover {
    width: 52px;
    height: 70px;
  }

  .download-btn {
    min-width: 76px;
  }

  .page-header-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .platform-grid.refined {
    grid-template-columns: 1fr 1fr;
  }

  .platform-grid.refined .platform-card {
    min-height: 148px;
    padding: 14px;
  }

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

  .membership-tab {
    min-height: 50px;
    padding-inline: 4px;
  }

  .membership-plan.featured {
    padding: 16px;
  }

  .membership-price-row {
    align-items: stretch;
    flex-direction: column;
  }

  .membership-pay {
    width: 100%;
  }
}

.search-hero.minimal {
  padding: 14px;
  border-radius: 28px;
}

.search-hero.minimal .search-bar-wrap.elevated {
  margin: 0;
}

/* Prevent full-page flash on state changes */
.page {
  animation: none !important;
}

.platform-card,
.setting-item,
.history-item,
.user-section,
.profile-hero,
.account-panel,
.stat-card {
  will-change: auto;
}

.platform-card:focus,
.setting-item:focus,
.nav-item:focus,
.download-btn:focus,
.search-action:focus {
  outline: none;
}

.platform-grid.refined .platform-card,
.setting-item {
  -webkit-tap-highlight-color: transparent;
}

/* Extra flash guard */
html {
  scroll-behavior: auto !important;
}

.app-shell,
#app {
  backface-visibility: hidden;
  transform: translateZ(0);
}

.global-notice {
  animation: none !important;
}
