:root {
  --bg: #f7f8f4;
  --surface: #ffffff;
  --ink: #10140f;
  --muted: #747b70;
  --line: rgba(16, 20, 15, 0.09);
  --neon: #d8ff3f;
  --dark: #0f130e;
  --radius: 8px;
  --shadow: 0 18px 45px rgba(16, 20, 15, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 80px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.78fr);
  gap: 24px;
  align-items: stretch;
  min-height: 420px;
  padding: 34px;
  color: #fff;
  background: var(--dark);
  border-radius: 12px;
  overflow: hidden;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  color: var(--neon);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  max-width: 620px;
  margin-top: 18px;
  font-size: clamp(42px, 6.2vw, 76px);
  line-height: 1.02;
  letter-spacing: 0;
}

h1 span {
  display: block;
  white-space: nowrap;
}

.hero p {
  max-width: 460px;
  margin-top: 20px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 20px;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}

.hero-link,
#quotaBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-weight: 900;
  text-decoration: none;
}

.hero-link {
  color: var(--ink);
  background: var(--neon);
}

#quotaBadge {
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.9fr) minmax(160px, 0.78fr);
  gap: 14px;
  align-items: center;
}

.hero-photo-stack {
  position: relative;
  min-height: 340px;
  overflow: hidden;
  border-radius: var(--radius);
  background: #1c211a;
}

.hero-photo-stack img {
  width: 100%;
  height: 100%;
  min-height: 340px;
  object-fit: cover;
  filter: saturate(0.95) contrast(1.05);
}

.hero-photo-stack::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(15, 19, 14, 0.02), rgba(15, 19, 14, 0.66));
}

.hero-photo-copy {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 1;
}

.hero-photo-copy span,
.hero-stage-list span {
  color: var(--neon);
  font-size: 13px;
  font-weight: 900;
}

.hero-photo-copy strong {
  display: block;
  margin-top: 6px;
  font-size: 34px;
}

.hero-stage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hero-stage-list div {
  min-height: 106px;
  padding: 18px;
  border: 1px solid rgba(216, 255, 63, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.hero-stage-list strong {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 20px;
  line-height: 1.25;
}

.section {
  margin-top: 32px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-head h2,
.generate-cta h2 {
  margin-top: 10px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
}

.section-head p,
.generate-cta p {
  max-width: 360px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 13px;
  border-radius: var(--radius);
  background: var(--neon);
  font-size: 13px;
  font-weight: 900;
}

.gender-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.gender-row > span {
  color: #3d4439;
  font-size: 15px;
  font-weight: 900;
}

.gender-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(84px, 1fr));
  gap: 6px;
  padding: 5px;
  background: #eef1e8;
  border-radius: var(--radius);
}

.gender-option {
  min-height: 38px;
  padding: 0 18px;
  color: #596052;
  background: transparent;
  border-radius: 6px;
  font-weight: 900;
}

.gender-option.active {
  color: var(--ink);
  background: var(--neon);
}

.goal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.goal-card {
  position: relative;
  min-height: 430px;
  padding: 0;
  color: #fff;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  text-align: left;
}

.goal-card.active {
  border-color: var(--neon);
  box-shadow: 0 0 0 4px rgba(216, 255, 63, 0.28), var(--shadow);
}

.goal-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.goal-card::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(16, 20, 15, 0.08), rgba(16, 20, 15, 0.78));
}

.goal-index,
.goal-name,
.goal-desc {
  position: absolute;
  z-index: 1;
  left: 20px;
  right: 20px;
}

.goal-index {
  top: 20px;
  width: fit-content;
  padding: 8px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 900;
}

.goal-name {
  bottom: 76px;
  font-size: 30px;
  font-weight: 900;
}

.goal-desc {
  bottom: 28px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 15px;
  line-height: 1.45;
}

.flow-btn {
  width: 100%;
  min-height: 58px;
  margin-top: 18px;
  color: var(--ink);
  background: var(--neon);
  border-radius: var(--radius);
  font-weight: 900;
}

.upload-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(280px, 0.28fr);
  gap: 22px;
}

.upload-box,
.upload-rules,
.generate-cta,
.timeline-card,
.poster-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.upload-box {
  position: relative;
  min-height: 520px;
  overflow: hidden;
}

.upload-box input {
  display: none;
}

#previewImage {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: cover;
}

.upload-box.has-image #previewImage {
  display: block;
}

.upload-box.has-image .upload-empty {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: auto;
  min-height: 0;
  padding: 12px 16px;
  color: #fff;
  background: rgba(16, 20, 15, 0.78);
  border-radius: var(--radius);
}

.upload-box.has-image .upload-empty span,
.upload-box.has-image .upload-empty small {
  display: none;
}

.upload-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 520px;
  color: var(--muted);
}

.upload-empty span {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  margin-bottom: 18px;
  color: var(--ink);
  background: var(--neon);
  border-radius: var(--radius);
  font-size: 48px;
  font-weight: 300;
}

.upload-empty strong {
  color: var(--ink);
  font-size: 24px;
}

.upload-empty small {
  margin-top: 8px;
  font-size: 14px;
}

.upload-rules {
  padding: 26px;
}

.upload-rules h3 {
  font-size: 24px;
}

.upload-rules label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 18px;
  color: #3f473b;
  line-height: 1.5;
}

.upload-rules input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--ink);
}

.upload-rules p {
  margin-top: 28px;
  padding: 16px;
  color: #526000;
  background: #f2ffd0;
  border-radius: var(--radius);
  line-height: 1.55;
}

.generate-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-top: 34px;
  padding: 28px;
}

.generate-actions {
  display: grid;
  grid-template-columns: minmax(220px, 300px) max-content;
  gap: 14px;
  align-items: end;
}

.invite-gate {
  min-width: 0;
}

.invite-gate label {
  display: block;
  margin-bottom: 8px;
  color: #3d4439;
  font-size: 13px;
  font-weight: 900;
}

.invite-gate input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  color: var(--ink);
  background: #f7f8f4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 900;
  letter-spacing: 0;
  outline: none;
  text-transform: uppercase;
}

.invite-gate input:focus {
  border-color: rgba(90, 118, 0, 0.48);
  box-shadow: 0 0 0 3px rgba(216, 255, 63, 0.32);
}

.invite-gate p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.invite-gate p[data-tone="success"] {
  color: #4f6500;
}

.invite-gate p[data-tone="error"] {
  color: #b42318;
}

.primary-btn,
.secondary-btn {
  min-height: 56px;
  padding: 0 28px;
  border-radius: var(--radius);
  font-weight: 900;
}

.primary-btn {
  color: var(--ink);
  background: var(--neon);
}

.secondary-btn {
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.timeline-card {
  position: relative;
  padding: 12px;
  overflow: hidden;
  border: 2px solid transparent;
  text-align: left;
}

.timeline-card.selected {
  border-color: var(--neon);
}

.timeline-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: transparent;
}

.timeline-stage img,
.timeline-stage canvas {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.timeline-meta {
  min-height: 156px;
  padding: 16px 4px 4px;
}

.timeline-kicker {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 10px;
  color: var(--ink);
  background: #eef6d8;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 900;
}

.timeline-meta strong {
  display: block;
  margin-top: 12px;
  font-size: 20px;
}

.timeline-meta p {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.poster-actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 20px;
}

.poster-wrap {
  display: flex;
  justify-content: center;
  padding: 18px;
}

#posterCanvas {
  width: 100%;
  max-width: 450px;
  height: auto;
  border-radius: var(--radius);
  background: #fff;
}

.poster-download {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.poster-download .primary-btn {
  min-width: min(100%, 450px);
}

.hidden {
  display: none !important;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(420px, calc(100% - 48px));
  padding: 14px 18px;
  color: #fff;
  background: rgba(16, 20, 15, 0.9);
  border-radius: var(--radius);
  opacity: 0;
  transform: translateY(12px);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.loading {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #fff;
  background: rgba(15, 19, 14, 0.86);
}

.loading span {
  color: rgba(255, 255, 255, 0.68);
}

.loader {
  width: 86px;
  height: 86px;
  border-radius: 50%;
  background: var(--neon);
  animation: pulse 1.4s infinite ease-in-out;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.86);
    opacity: 0.58;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-panel {
    grid-template-columns: 1fr 1fr;
  }

  .goal-grid,
  .timeline {
    grid-template-columns: repeat(2, 1fr);
  }

  .upload-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 12px;
  }

  .hero {
    padding: 26px 22px;
    border-radius: 10px;
  }

  .hero-panel {
    display: none;
  }

  h1 {
    font-size: 33px;
    line-height: 1.12;
  }

  .hero p {
    font-size: 17px;
  }

  .section-head {
    display: block;
  }

  .section-head p {
    margin-top: 10px;
  }

  .gender-row {
    display: block;
  }

  .gender-toggle {
    margin-top: 12px;
  }

  .goal-grid {
    grid-auto-columns: minmax(250px, 78vw);
    grid-auto-flow: column;
    grid-template-columns: none;
    gap: 12px;
    margin-right: -12px;
    overflow-x: auto;
    padding: 2px 12px 8px 0;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }

  .goal-grid::-webkit-scrollbar {
    display: none;
  }

  .goal-card {
    min-height: 390px;
    scroll-snap-align: start;
  }

  .upload-box,
  #previewImage,
  .upload-empty {
    min-height: 420px;
  }

  .generate-cta {
    display: block;
  }

  .generate-actions {
    grid-template-columns: 1fr;
    margin-top: 22px;
  }

  .generate-cta .primary-btn {
    width: 100%;
  }

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

  .poster-actions {
    flex-direction: column;
  }

  .poster-actions button {
    width: 100%;
  }

  .toast {
    right: 12px;
    bottom: 12px;
  }
}
