:root {
  --bg: #f5efe4;
  --bg-strong: #f0e3c8;
  --ink: #1f2330;
  --subtle: #6f7380;
  --line: rgba(31, 35, 48, 0.1);
  --card: rgba(255, 255, 255, 0.82);
  --brand: #c44d2f;
  --brand-dark: #8b341f;
  --accent: #0d6b6b;
  --success: #1c8f51;
  --danger: #c23b22;
  --shadow: 0 18px 50px rgba(67, 43, 12, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(196, 77, 47, 0.18), transparent 26rem),
    radial-gradient(circle at bottom right, rgba(13, 107, 107, 0.16), transparent 24rem),
    linear-gradient(160deg, var(--bg), #fcfaf5 60%, var(--bg-strong));
}

a {
  color: inherit;
}

.app-shell {
  width: min(100%, 960px);
  margin: 0 auto;
  min-height: 100vh;
  padding: 20px 16px 96px;
}

.topbar,
.section-head,
.hero-actions,
.profile-row,
.quota-row,
.history-meta,
.package-meta,
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  margin-bottom: 24px;
}

.brand {
  font-size: 28px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.04em;
}

.page {
  display: grid;
  gap: 20px;
}

.hero-card,
.card-block,
.profile-card,
.center-panel,
.result-card,
.recommend-card {
  background: var(--card);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-card,
.card-block,
.profile-card,
.center-panel {
  padding: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.02;
}

h2 {
  font-size: 22px;
}

.hero-copy,
.muted,
.history-meta,
.package-copy,
.empty-state,
#callback-status {
  color: var(--subtle);
}

.hero-input,
.ghost-btn,
.primary-btn,
.text-link,
.field,
textarea,
input {
  font: inherit;
}

.hero-input {
  width: 100%;
  min-height: 160px;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  resize: vertical;
}

.primary-btn,
.ghost-btn,
.text-btn {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff;
}

.ghost-btn {
  background: rgba(31, 35, 48, 0.06);
  color: var(--ink);
}

.text-btn {
  background: transparent;
  color: var(--accent);
  padding: 0;
}

.primary-btn:hover,
.ghost-btn:hover,
.text-btn:hover {
  transform: translateY(-1px);
  opacity: 0.94;
}

.result-slot,
.card-list,
.package-grid,
.history-list {
  display: grid;
  gap: 14px;
}

.result-card,
.recommend-card {
  overflow: hidden;
}

.recommend-card {
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.recommend-card:hover {
  transform: translateY(-2px);
}

.result-media,
.recommend-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
  background: rgba(31, 35, 48, 0.08);
}

.result-body,
.recommend-body {
  padding: 18px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(13, 107, 107, 0.12);
  color: var(--accent);
  font-size: 13px;
}

.profile-card {
  display: grid;
  gap: 18px;
}

.profile-row {
  justify-content: flex-start;
}

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand), #f2b460);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.quota {
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 800;
  line-height: 1;
}

.package-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.package-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.8);
  display: grid;
  gap: 12px;
}

.package-price {
  font-size: 30px;
  font-weight: 800;
}

.history-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.history-item:last-child {
  border-bottom: none;
}

.history-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

#buy-link {
  text-decoration: none;
  white-space: nowrap;
}

.pay-debug {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(31, 35, 48, 0.92);
  color: #fff;
  box-shadow: var(--shadow);
}

.pay-debug-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.pay-debug pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12px/1.6 Consolas, Monaco, monospace;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  width: min(calc(100% - 32px), 920px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.bottom-nav a {
  text-align: center;
  text-decoration: none;
  padding: 12px 10px;
  border-radius: 999px;
  color: var(--subtle);
}

.bottom-nav a.active {
  background: rgba(196, 77, 47, 0.12);
  color: var(--brand-dark);
  font-weight: 700;
}

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

.center-panel {
  width: min(92vw, 520px);
  margin: 16vh auto 0;
}

.toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  display: grid;
  gap: 10px;
  z-index: 50;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  padding: 14px 16px;
  border-radius: 14px;
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.info {
  background: #24364f;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 14px 14px 96px;
  }

  .hero-actions,
  .section-head,
  .quota-row {
    flex-direction: column;
    align-items: stretch;
  }

  .brand {
    font-size: 24px;
  }
}
