: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);
}

* {
  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;
}

.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;
}

.result-card {
  display: flex;
  align-items: center;
  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;
}

.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 {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  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;
}

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

.download-btn.downloading {
  background: var(--secondary);
  color: var(--muted-foreground);
  box-shadow: none;
}

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

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

.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;
}

.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;
  }

  .platform-grid {
    gap: 10px;
  }

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

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

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