:root {
  color-scheme: light;
  --bg: #f6f2ea;
  --surface: rgba(255, 252, 246, 0.9);
  --surface-strong: #fffdf8;
  --surface-soft: #fbf7ef;
  --text: #1f1b18;
  --muted: #6a6258;
  --line: rgba(31, 27, 24, 0.12);
  --accent: #d3643f;
  --accent-strong: #b74d2b;
  --accent-soft: rgba(211, 100, 63, 0.12);
  --success: #027a48;
  --warning: #b54708;
  --danger: #b42318;
  --shadow: 0 24px 60px rgba(120, 84, 54, 0.14);
  --radius: 24px;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 213, 167, 0.9), transparent 28%),
    radial-gradient(circle at top right, rgba(204, 229, 255, 0.9), transparent 22%),
    linear-gradient(180deg, #faf5eb 0%, #f6f2ea 100%);
}

a {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
}

.site-header,
.sub-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 32px 0;
  align-items: flex-start;
}

.brand h1,
.header-copy h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
}

.brand p,
.header-copy p,
.lede,
.helper-text,
.message {
  color: var(--muted);
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 32px 0;
}

.app-nav a {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
}

.app-nav a.active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
  box-shadow: 0 8px 22px rgba(120, 84, 54, 0.08);
}

.page-layout {
  display: grid;
  gap: 20px;
  padding: 20px 32px 36px;
}

.page-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.card,
.hero-card,
.card-section,
.detail-card,
.play-frame-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-card {
  padding: 28px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(560px, calc(100vw - 32px));
}

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

.hero-card h2,
.card-section h2,
.detail-card h2,
.auth-card h1,
.play-shell h1 {
  margin: 0;
}

.stack-form,
.form-grid {
  display: grid;
  gap: 14px;
}

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

.field-wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

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

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

button,
.primary-link,
.secondary-link,
.ghost-button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

button,
.primary-link {
  background: var(--accent);
  color: white;
}

button:hover,
.primary-link:hover {
  background: var(--accent-strong);
}

.secondary-link,
.ghost-button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border: 1px solid var(--line);
}

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

.meta-row,
.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  margin-top: 10px;
}

.meta-list,
.muted-list {
  flex-direction: column;
  align-items: flex-start;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.status-draft,
.status-created,
.status-queued,
.status-dsl_generated {
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
}

.status-active,
.status-completed,
.status-preview_ready,
.status-emailed,
.status-sent {
  background: rgba(2, 122, 72, 0.12);
  color: var(--success);
}

.status-processing,
.status-pending {
  background: rgba(181, 71, 8, 0.12);
  color: var(--warning);
}

.status-failed,
.status-error,
.error {
  color: var(--danger);
}

.status-failed,
.status-cancelled,
.status-disabled {
  background: rgba(180, 35, 24, 0.12);
}

.panel-stack {
  display: grid;
  gap: 14px;
}

.panel-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface-soft);
}

.panel-item h3 {
  margin: 0;
}

.panel-item-header,
.section-title,
.play-shell-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.5);
}

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

.notice-success {
  background: rgba(2, 122, 72, 0.09);
  border-color: rgba(2, 122, 72, 0.2);
}

.notice-warning {
  background: rgba(181, 71, 8, 0.09);
  border-color: rgba(181, 71, 8, 0.2);
}

.notice-danger {
  background: rgba(180, 35, 24, 0.09);
  border-color: rgba(180, 35, 24, 0.2);
}

.notice-info {
  background: rgba(31, 122, 140, 0.09);
  border-color: rgba(31, 122, 140, 0.18);
}

.notice-neutral {
  background: rgba(31, 27, 24, 0.04);
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
}

.timeline-marker {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: rgba(31, 27, 24, 0.08);
  color: var(--muted);
}

.timeline-step.done .timeline-marker {
  background: rgba(2, 122, 72, 0.14);
  color: var(--success);
}

.timeline-step.active .timeline-marker {
  background: rgba(181, 71, 8, 0.14);
  color: var(--warning);
}

.timeline-step.failed .timeline-marker {
  background: rgba(180, 35, 24, 0.14);
  color: var(--danger);
}

.timeline-copy strong,
.result-highlight strong {
  display: block;
  margin-bottom: 4px;
}

.timeline-copy span,
.muted-list {
  color: var(--muted);
  font-size: 14px;
}

.message {
  min-height: 22px;
}

.message.success {
  color: var(--success);
}

.message.warning {
  color: var(--warning);
}

.loading-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.loading-inline::before,
.loading-block::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(31, 27, 24, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.loading-block {
  min-height: 220px;
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.button-disabled,
button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.form-footer {
  color: var(--muted);
}

.required {
  color: var(--accent);
}

.play-shell {
  display: grid;
  gap: 18px;
}

.play-shell-note {
  margin-top: 12px;
}

.assist-toolbar {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.45);
}

.assist-toolbar-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.assist-toolbar-head h3 {
  margin: 0;
}

.assist-toolbar-block {
  display: grid;
  gap: 10px;
}

.assist-toolbar-label {
  margin: 0;
  font-weight: 700;
}

.assist-mode-group,
.assist-apply-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.assist-mode-button,
.assist-apply-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  padding: 10px 14px;
  font-weight: 700;
}

.assist-mode-button.active,
.assist-apply-button.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(211, 100, 63, 0.28);
}

.assist-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(211, 100, 63, 0.18);
  background: rgba(211, 100, 63, 0.08);
}

.assist-panel[hidden] {
  display: none;
}

.assist-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.assist-panel h3 {
  margin: 0;
}

.assist-preview {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  line-height: 1.7;
  white-space: pre-wrap;
}

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

.assist-column {
  display: grid;
  gap: 10px;
}

.assist-column h3 {
  margin: 0;
  font-size: 16px;
}

.assist-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.play-frame-wrapper {
  margin-top: 12px;
  min-height: 680px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #101418;
  position: relative;
}

.play-frame-wrapper iframe {
  width: 100%;
  min-height: 680px;
  border: 0;
  background: #101418;
}

.play-frame-card.is-loading .play-frame-wrapper::before {
  content: "试玩内容加载中...";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, rgba(16, 20, 24, 0.84), rgba(16, 20, 24, 0.72));
  z-index: 1;
}

.play-frame-card.is-ready .play-frame-wrapper::before {
  display: none;
}

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

@media (max-width: 720px) {
  .site-header,
  .sub-header,
  .app-nav,
  .page-layout {
    padding-left: 18px;
    padding-right: 18px;
  }

  .site-header,
  .sub-header {
    flex-direction: column;
  }
}
