:root {
  --paper: rgba(255, 249, 239, 0.88);
  --paper-strong: #fffaf1;
  --ink: #3d2819;
  --ink-soft: #76553e;
  --brand: #c8421d;
  --brand-deep: #932e14;
  --accent: #f0a934;
  --line: rgba(115, 73, 42, 0.14);
  --line-strong: rgba(200, 66, 29, 0.28);
  --shadow: 0 18px 40px rgba(114, 63, 23, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(240, 169, 52, 0.22), transparent 28%),
    radial-gradient(circle at top right, rgba(200, 66, 29, 0.12), transparent 24%),
    linear-gradient(180deg, #f8edd8 0%, #f6e3c0 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(122, 84, 52, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 84, 52, 0.04) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  opacity: 0.6;
}

body.modal-open {
  overflow: hidden;
}

.app-shell {
  width: min(100%, 720px);
  margin: 0 auto;
  padding: 22px 14px 112px;
  position: relative;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 24px 22px 24px;
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(206, 72, 27, 0.96), rgba(137, 32, 12, 0.95)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
  color: #fff9f1;
  box-shadow: 0 28px 60px rgba(126, 42, 18, 0.28);
}

.hero::after,
.hero::before {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.hero::before {
  width: 180px;
  height: 180px;
  top: -40px;
  right: -50px;
  background: rgba(255, 220, 167, 0.18);
}

.hero::after {
  width: 120px;
  height: 120px;
  bottom: -30px;
  left: -20px;
  background: rgba(255, 239, 211, 0.16);
}

.hero__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero__badge {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.hero-wallet {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 247, 237, 0.14);
}

.hero-wallet__label {
  font-size: 12px;
  opacity: 0.86;
}

.hero-wallet strong {
  font-size: 15px;
}

.hero h1 {
  margin: 14px 0 10px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: clamp(34px, 8vw, 48px);
  line-height: 1.06;
}

.hero__lead {
  margin: 0;
  color: rgba(255, 247, 237, 0.92);
  line-height: 1.75;
  font-size: 15px;
}

.hero__chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.hero__chips span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 247, 237, 0.14);
  font-size: 12px;
}

.content {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

.page-view {
  display: grid;
  gap: 16px;
}

.panel {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius-xl);
  padding: 20px 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

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

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

.panel h2,
.modal h2 {
  margin: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 24px;
}

.helper-text {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.7;
  font-size: 14px;
}

.workflow,
.profile-cards,
.saved-list,
.saved-poster-list {
  display: grid;
  gap: 12px;
}

.workflow article {
  position: relative;
  padding: 16px 16px 16px 62px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 249, 240, 0.82));
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
}

.workflow span {
  position: absolute;
  left: 16px;
  top: 16px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--accent), #ea8d1e);
  color: #5b2405;
  font-weight: 900;
  font-size: 13px;
}

.workflow h3,
.idea-card__title,
.detail-card h3,
.poster-card__meta h3,
.profile-card h3,
.saved-card h3,
.saved-poster-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.workflow p,
.idea-card__desc,
.detail-card p,
.detail-card li,
.poster-card__meta p,
.saved-card p,
.saved-poster-card p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.72;
  font-size: 14px;
}

.prompt-panel summary {
  cursor: pointer;
  color: var(--brand-deep);
  font-weight: 700;
}

.prompt-box {
  margin: 14px 0 0;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: #fffdf8;
  border: 1px solid rgba(143, 86, 44, 0.12);
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.75;
  font-size: 13px;
  max-height: 360px;
  overflow: auto;
}

.campaign-form,
.profile-card,
.saved-card,
.saved-poster-card {
  display: grid;
  gap: 14px;
}

.campaign-form label,
.studio-field {
  display: grid;
  gap: 8px;
}

.campaign-form span,
.studio-field span {
  font-size: 14px;
  font-weight: 700;
}

input,
select,
button,
textarea {
  font: inherit;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px 15px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(126, 84, 54, 0.16);
  background: rgba(255, 252, 245, 0.96);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(200, 66, 29, 0.65);
  box-shadow: 0 0 0 4px rgba(200, 66, 29, 0.12);
  transform: translateY(-1px);
}

.primary-button,
.ghost-button,
.select-button,
.mini-button,
.bottom-nav__item {
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-button:hover,
.ghost-button:hover,
.select-button:hover,
.mini-button:hover,
.bottom-nav__item:hover {
  transform: translateY(-1px);
}

.primary-button {
  padding: 16px 18px;
  border-radius: 20px;
  border: none;
  background: linear-gradient(180deg, #cb431d, #a73317);
  color: #fff8ef;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 16px 28px rgba(167, 51, 23, 0.24);
  cursor: pointer;
}

.ghost-button,
.mini-button {
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 247, 237, 0.92);
  color: var(--brand-deep);
  border: 1px solid rgba(143, 86, 44, 0.12);
  flex-shrink: 0;
  cursor: pointer;
}

.mini-button {
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 700;
}

.mini-button--active {
  background: rgba(200, 66, 29, 0.1);
  border-color: var(--line-strong);
}

.idea-grid {
  display: grid;
  gap: 12px;
}

.idea-card,
.profile-card,
.saved-card,
.saved-poster-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 249, 241, 0.98));
  border: 1px solid var(--line);
}

.idea-card--active {
  border-color: rgba(200, 66, 29, 0.55);
  box-shadow: 0 14px 28px rgba(154, 59, 29, 0.15);
}

.idea-card__top,
.profile-card__top,
.saved-card__top,
.saved-poster-card__top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.idea-card__index,
.idea-card__tag,
.poster-card__tag,
.detail-actions__badge,
.storage-tier-badge {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.idea-card__index,
.detail-actions__badge,
.storage-tier-badge {
  background: rgba(200, 66, 29, 0.1);
  color: var(--brand);
  font-weight: 900;
}

.idea-card__tag,
.poster-card__tag {
  background: rgba(240, 169, 52, 0.16);
  color: #8a4c09;
  font-weight: 700;
}

.select-button {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border-radius: 16px;
  border: none;
  background: #fff2df;
  color: var(--brand-deep);
  font-weight: 800;
  cursor: pointer;
}

.detail-content {
  display: grid;
  gap: 12px;
}

.detail-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--paper-strong);
  border: 1px solid var(--line);
}

.detail-card ul,
.detail-card ol {
  margin: 10px 0 0;
  padding-left: 20px;
}

.detail-card li + li {
  margin-top: 8px;
}

.detail-card strong {
  color: var(--brand-deep);
}

.section-title {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(200, 66, 29, 0.08);
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.meta-list {
  display: grid;
  gap: 8px;
}

.meta-list p {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 243, 227, 0.85);
}

.detail-actions {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 244, 229, 0.95), rgba(255, 250, 242, 0.92));
  border: 1px dashed var(--line-strong);
}

.detail-actions__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-actions__buttons,
.profile-actions,
.saved-card__actions,
.saved-poster-card__actions,
.recharge-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.storage-progress {
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(200, 66, 29, 0.1);
}

.storage-progress__bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #cb431d, #f0a934);
}

.wallet-balance {
  font-size: 32px;
  color: var(--brand-deep);
  line-height: 1;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 30;
  width: min(calc(100vw - 20px), 720px);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border-radius: 24px;
  background: rgba(255, 248, 238, 0.94);
  border: 1px solid rgba(143, 86, 44, 0.14);
  box-shadow: 0 20px 40px rgba(65, 31, 10, 0.18);
  backdrop-filter: blur(16px);
}

.bottom-nav__item {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 10px 8px;
  background: transparent;
  color: var(--brand-deep);
  font-weight: 800;
  cursor: pointer;
}

.bottom-nav__item--active {
  background: linear-gradient(180deg, #cb431d, #a73317);
  color: #fff8ef;
  box-shadow: 0 14px 24px rgba(167, 51, 23, 0.2);
}

.bottom-nav__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 247, 237, 0.18);
  font-size: 13px;
  font-weight: 900;
}

.coin-rules {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 244, 229, 0.86);
}

.saved-card__content {
  max-height: 180px;
  overflow: auto;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.9);
  border: 1px solid rgba(143, 86, 44, 0.1);
  white-space: pre-wrap;
  color: var(--ink-soft);
  line-height: 1.72;
  font-size: 13px;
}

.plan-detail-content {
  max-height: calc(100vh - 280px);
}

.saved-poster-card__preview img {
  display: block;
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(143, 86, 44, 0.1);
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 251, 245, 0.86);
  border: 1px dashed rgba(143, 86, 44, 0.18);
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.7;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(53, 23, 10, 0.55);
  backdrop-filter: blur(8px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100vw - 24px, 840px);
  max-height: calc(100vh - 24px);
  margin: 12px auto;
  padding: 18px;
  overflow: auto;
  border-radius: 28px;
  background: rgba(255, 248, 238, 0.98);
  box-shadow: 0 30px 70px rgba(51, 20, 10, 0.24);
}

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

.studio-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.studio-generate {
  width: 100%;
}

.studio-textarea {
  min-height: 168px;
  resize: vertical;
}

.poster-grid {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.poster-card {
  padding: 14px;
  border-radius: 24px;
  background: #fffdf8;
  border: 1px solid rgba(143, 86, 44, 0.14);
  box-shadow: 0 16px 24px rgba(125, 78, 44, 0.08);
}

.poster-card__preview {
  overflow: hidden;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(246, 231, 212, 0.9), rgba(255, 249, 240, 0.98));
  border: 1px solid rgba(143, 86, 44, 0.1);
}

.poster-card__preview canvas {
  display: block;
  width: 100%;
  height: auto;
}

.poster-card__meta {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.poster-card__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.poster-card__toolbar,
.poster-card__status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(200, 66, 29, 0.08);
  color: var(--brand-deep);
  font-size: 12px;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

@media (min-width: 640px) {
  .app-shell {
    padding-inline: 18px;
  }

  .workflow,
  .idea-grid,
  .profile-cards,
  .saved-list,
  .saved-poster-list,
  .poster-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .studio-toolbar {
    grid-template-columns: 220px 1fr;
    align-items: end;
  }

  .studio-generate {
    width: auto;
  }
}
