:root {
  --bg: #f0f4f8;
  --surface: #ffffff;
  --text: #1a2332;
  --text-secondary: #5c6b7a;
  --accent: #0d6efd;
  --accent-dark: #0a58ca;
  --accent-soft: #e8f1ff;
  --border: #e2e8f0;
  --success: #198754;
  --warning: #fd7e14;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(15, 35, 70, 0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --footer-h: 96px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
  padding-bottom: calc(var(--footer-h) + var(--safe-bottom) + 12px);
}

.app {
  max-width: 480px;
  margin: 0 auto;
}

.header {
  padding: 20px 16px 12px;
  background: linear-gradient(160deg, #0d6efd 0%, #3d8bfd 55%, #6ea8fe 100%);
  color: #fff;
  border-radius: 0 0 24px 24px;
}

.header__badge {
  margin: 0 0 6px;
  font-size: 12px;
  opacity: 0.85;
  letter-spacing: 0.06em;
}

.header__title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.header__sub {
  margin: 8px 0 0;
  font-size: 13px;
  opacity: 0.9;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 14px 12px 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.15s;
  white-space: nowrap;
}

.tab:active {
  transform: scale(0.97);
}

.tab--active {
  background: var(--accent);
  color: #fff;
}

.main {
  padding: 8px 12px 16px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 12px;
}

.card--loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 16px;
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.card__tag {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 6px;
}

.card__date {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.copy-box {
  margin: 0;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
}

.copy-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn--ghost {
  flex: 1;
  background: var(--accent-soft);
  color: var(--accent);
}

.btn--sm {
  padding: 8px 12px;
  font-size: 13px;
}

.media-section {
  margin-top: 16px;
}

.media-section__title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.media-grid__item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: #e9ecef;
  border: none;
  padding: 0;
  cursor: pointer;
}

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

.media-empty {
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-secondary);
  background: #f8fafc;
  border-radius: 10px;
  border: 1px dashed var(--border);
}

.video-wrap {
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.video-wrap video {
  width: 100%;
  display: block;
  max-height: 240px;
  object-fit: contain;
}

.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  max-width: 480px;
  margin: 0 auto;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

.btn--primary {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  background: linear-gradient(135deg, var(--accent) 0%, #3d8bfd 100%);
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(13, 110, 253, 0.35);
}

.btn--primary:disabled {
  box-shadow: none;
}

.btn__icon {
  font-size: 18px;
}

.footer__hint {
  margin: 8px 0 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-secondary);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--footer-h) + var(--safe-bottom) + 20px);
  transform: translateX(-50%) translateY(20px);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  background: rgba(26, 35, 50, 0.92);
  color: #fff;
  font-size: 14px;
  border-radius: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  text-align: center;
  line-height: 1.4;
}

.toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.error-card {
  color: #842029;
  background: #f8d7da;
  border: 1px solid #f5c2c7;
}
