:root {
  --bg: #f6f4ed;
  --surface: #fffdf7;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #dedbd1;
  --teal: #147c79;
  --teal-dark: #0d5f5d;
  --coral: #e2634f;
  --yellow: #f3c84b;
  --mint: #d9f3eb;
  --sky: #d8ecff;
  --lavender: #e8defd;
  --shadow: 0 18px 50px rgba(33, 42, 54, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background: #1f2933;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--yellow);
  color: #1f2933;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #bdc6d1;
  margin-top: 3px;
}

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

.nav-item {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #dbe4ed;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-note span,
.eyebrow {
  color: var(--coral);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 12px;
  font-weight: 800;
  margin: 0 0 6px;
}

.sidebar-note strong {
  display: block;
  font-size: 15px;
  line-height: 1.5;
}

.sidebar-create {
  width: 100%;
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 22px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.08;
}

h2 {
  margin-bottom: 10px;
  font-size: 26px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.user-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 8px;
}

.user-stats div,
.profile-stats div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.user-stats span,
.profile-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.user-stats strong,
.profile-stats strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 42%);
  gap: 22px;
  align-items: stretch;
  margin-bottom: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-copy {
  align-self: center;
  max-width: 720px;
}

.hero-copy p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.75;
  max-width: 620px;
}

.hero-band img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: 8px;
}

.create-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 38%);
  gap: 22px;
  align-items: stretch;
  min-height: 500px;
}

.magic-console {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(24px, 5vw, 54px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(217, 243, 235, 0.96), rgba(255, 253, 247, 0.96)),
    var(--surface);
  box-shadow: var(--shadow);
}

.magic-console h2 {
  font-size: clamp(34px, 6vw, 66px);
  line-height: 1;
  margin-bottom: 20px;
}

.magic-console textarea {
  min-height: 82px;
  font-size: 16px;
  background: #ffffff;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.choice-card {
  min-height: 96px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 14px;
  text-align: left;
}

.choice-card span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  background: var(--sky);
  color: #24425f;
  font-size: 12px;
  font-weight: 900;
}

.choice-card strong {
  display: block;
  margin-top: 10px;
  font-size: 20px;
}

.choice-card.selected,
.template-row button.selected {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 124, 121, 0.14);
}

.create-hero img {
  width: 100%;
  height: 100%;
  min-height: 420px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.giant {
  min-height: 58px;
  margin-top: 14px;
  font-size: 19px;
}

.hint-text {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.recent-band {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.compact-heading {
  margin-bottom: 10px;
}

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

.empty-work {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fffefa;
}

.empty-work span {
  color: var(--muted);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.button-row.tight {
  justify-content: flex-end;
}

.primary-action,
.secondary-action,
.text-action,
.template-row button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  border: 1px solid transparent;
  font-weight: 800;
}

.primary-action {
  background: var(--teal);
  color: #ffffff;
}

.primary-action:hover {
  background: var(--teal-dark);
}

.secondary-action,
.template-row button {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line);
}

.secondary-action:hover,
.template-row button:hover {
  border-color: var(--teal);
}

.text-action {
  background: transparent;
  color: var(--teal);
  padding-inline: 6px;
}

.full {
  width: 100%;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.panel,
.creator-panel,
.preview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}

.panel-heading,
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.panel-heading.compact {
  margin-bottom: 10px;
}

.mini-list {
  display: grid;
  gap: 10px;
}

.mini-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.mini-item strong {
  display: block;
}

.mini-item span {
  color: var(--muted);
  font-size: 13px;
}

.progress-track {
  height: 12px;
  border-radius: 999px;
  background: #e8e2d2;
  overflow: hidden;
  margin: 18px 0 12px;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--teal), var(--yellow), var(--coral));
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.creator-world {
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
}

.creator-panel,
.preview-panel {
  min-height: 680px;
}

.creator-panel {
  display: flex;
  flex-direction: column;
}

.field-label {
  display: block;
  margin: 14px 0 7px;
  font-size: 13px;
  font-weight: 800;
}

.subtle-label {
  color: var(--muted);
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefa;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

textarea:focus,
input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(20, 124, 121, 0.14);
}

.conversation-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 210px;
  max-height: 280px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf8;
}

.chat-message {
  display: grid;
  gap: 4px;
  max-width: 90%;
  padding: 10px 12px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.chat-message span {
  color: var(--coral);
  font-size: 12px;
  font-weight: 900;
}

.chat-message p {
  margin: 0;
  line-height: 1.55;
}

.chat-message.user {
  align-self: flex-end;
  background: var(--mint);
  border-color: rgba(20, 124, 121, 0.25);
}

.chat-message.ai {
  align-self: flex-start;
}

.template-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.template-row button {
  min-height: 40px;
  padding: 0 12px;
  font-size: 14px;
}

.structured-brief,
.assistant-box,
.inspiration-panel {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf3;
}

.inspiration-panel {
  background: #fff8df;
}

.brief-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.brief-list li {
  display: grid;
  gap: 2px;
}

.brief-list span {
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--sky);
  color: #24425f;
  font-weight: 800;
  font-size: 13px;
}

.preview-frame-wrap {
  position: relative;
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

iframe {
  display: block;
  width: 100%;
  height: 620px;
  border: 0;
  background: white;
}

.empty-preview {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  background:
    linear-gradient(135deg, rgba(20, 124, 121, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(226, 99, 79, 0.14), transparent 36%),
    #fffefa;
}

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

.reward-strip {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--mint);
  color: #165d50;
  font-weight: 800;
}

.section-heading {
  margin-bottom: 16px;
}

.project-grid,
.task-grid,
.achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.project-card,
.task-card,
.achievement-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.project-card h3,
.task-card h3,
.achievement-card h3 {
  margin-bottom: 8px;
}

.project-meta,
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  background: #f2efe5;
  color: #51483a;
  font-size: 12px;
  font-weight: 800;
}

.tag.done {
  background: var(--mint);
  color: #165d50;
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.profile-card {
  background: #fff8df;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 20px;
}

.achievement-card.locked {
  opacity: 0.62;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 16px;
  border-radius: 8px;
  background: #1f2933;
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 0.2s ease;
}

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

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .nav-item {
    text-align: center;
  }

  .workspace,
  .hero-band,
  .create-hero,
  .profile-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 700px) {
  .main,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .section-heading,
  .panel-heading {
    display: grid;
  }

  .user-stats,
  .nav-list,
  .profile-stats {
    grid-template-columns: 1fr;
  }

  .hero-band img {
    height: 210px;
  }

  .create-hero img {
    min-height: 240px;
    height: 260px;
  }

  .magic-console textarea {
    font-size: 17px;
  }

  .creator-panel,
  .preview-panel {
    min-height: auto;
  }

  iframe,
  .preview-frame-wrap {
    height: 500px;
    min-height: 500px;
  }
}
