:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #1e2a2a;
  background: #f6fbf8;
  --ink: #1e2a2a;
  --muted: #667574;
  --line: #dce8e3;
  --surface: rgba(255, 255, 255, 0.86);
  --green: #1f9d76;
  --teal: #0b8fa3;
  --blue: #4c70c8;
  --violet: #8564d8;
  --amber: #e2a73a;
  --shadow: 0 18px 50px rgba(29, 80, 67, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(31, 157, 118, 0.18), transparent 28rem),
    linear-gradient(135deg, #fbfdfb 0%, #f4faf6 52%, #eef7f8 100%);
}

button,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 2rem));
  min-height: calc(100vh - 2rem);
  margin: 1rem auto;
}

.page {
  min-height: calc(100vh - 2rem);
}

.story-panel,
.output-panel {
  border: 1px solid rgba(220, 232, 227, 0.9);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.story-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem;
  border-radius: 1.3rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-main {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 3rem;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 1rem;
  box-shadow: 0 10px 22px rgba(29, 80, 67, 0.16);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

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

h1 {
  font-size: clamp(2rem, 6vw, 3.6rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.brand p,
.eyebrow,
.card-label,
figcaption,
label {
  color: var(--muted);
}

.en,
.zh {
  display: block;
  color: inherit;
  line-height: 1.35;
}

body[data-lang="en"] .zh,
body[data-lang="zh"] .en {
  display: none;
}

body[data-lang="zh"] .zh {
  font-size: 1em;
}

.scene {
  position: relative;
  flex: 1;
  min-height: 17rem;
  margin: 0;
  overflow: hidden;
  border-radius: 1rem;
  background: #d7ece5;
}

.scene img {
  width: 100%;
  height: 100%;
  min-height: 17rem;
  object-fit: cover;
  display: block;
}

figcaption {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  width: fit-content;
  max-width: calc(100% - 2rem);
  padding: 0.55rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 0.8rem;
  color: #f7fffc;
  background: rgba(18, 53, 46, 0.6);
  backdrop-filter: blur(12px);
}

.input-card {
  display: grid;
  gap: 0.75rem;
}

label {
  font-size: 0.86rem;
  font-weight: 750;
}

textarea {
  width: 100%;
  min-height: 11rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.95rem;
  color: var(--ink);
  background: #fff;
  outline: none;
  line-height: 1.5;
}

textarea:focus {
  border-color: rgba(11, 143, 163, 0.85);
  box-shadow: 0 0 0 4px rgba(11, 143, 163, 0.12);
}

.actions {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  justify-content: space-between;
}

button {
  min-height: 2.9rem;
  border: 0;
  border-radius: 0.85rem;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.15;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.ghost-button {
  padding: 0 1rem;
  color: var(--teal);
  background: #e7f5f3;
}

.language-toggle {
  display: block;
  min-height: 2.4rem;
  margin: 0 0 0.75rem auto;
  padding: 0 0.95rem;
  border: 1px solid var(--line);
  color: #0b735d;
  background: #fff;
  box-shadow: 0 8px 20px rgba(29, 80, 67, 0.09);
}

.primary-button {
  flex: 1;
  padding: 0 1.15rem;
  color: #fff;
  background: linear-gradient(135deg, var(--green), var(--teal) 52%, var(--blue));
  box-shadow: 0 12px 28px rgba(31, 157, 118, 0.26);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.75;
  transform: none;
}

.output-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 1040px;
  margin: 0 auto;
  padding: 1rem;
  border-radius: 1.3rem;
}

.output-header {
  display: flex;
  gap: 1rem;
  align-items: start;
  justify-content: space-between;
}

.eyebrow,
.card-label {
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

h2 {
  max-width: 36rem;
  font-size: clamp(1.5rem, 3vw, 2.35rem);
  line-height: 1.05;
}

.status-pill {
  flex: 0 0 auto;
  max-width: 12rem;
  padding: 0.5rem 0.72rem;
  border: 1px solid #cfe4df;
  border-radius: 999px;
  color: #0b735d;
  background: #e9f7f2;
  font-size: 0.82rem;
  font-weight: 850;
  text-align: center;
}

.loading-state {
  align-items: center;
  gap: 1rem;
  min-height: 8.6rem;
  padding: 1rem;
  border: 1px solid rgba(11, 143, 163, 0.25);
  border-radius: 1rem;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.75), rgba(239, 250, 248, 0.88)),
    repeating-linear-gradient(90deg, transparent 0 1.9rem, rgba(11, 143, 163, 0.05) 1.9rem 2rem);
}

.loading-state:not([hidden]) {
  display: flex;
}

.scan-ring {
  width: 4.6rem;
  aspect-ratio: 1;
  border: 0.5rem solid #d7eee9;
  border-top-color: var(--teal);
  border-right-color: var(--violet);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-state strong {
  display: block;
  margin-bottom: 0.35rem;
}

.loading-state p {
  color: var(--muted);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.identity-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.result-card,
.order-alert {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 10px 24px rgba(29, 80, 67, 0.08);
}

.result-card {
  min-height: 13.8rem;
  padding: 1rem;
  opacity: 0;
  transform: translateY(14px);
}

.result-card.show,
.order-alert.show,
.closing-line.show {
  animation: rise 520ms ease forwards;
}

.inner-identity {
  border-top: 0.26rem solid var(--green);
}

.passport {
  border-top: 0.26rem solid var(--blue);
}

.delivery {
  border-top: 0.26rem solid var(--amber);
}

.market {
  border-top: 0.26rem solid var(--violet);
}

h3 {
  margin-bottom: 0.75rem;
  font-size: 1.18rem;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.skill-tags span {
  opacity: 0;
  transform: translateY(10px);
  padding: 0.44rem 0.62rem;
  border-radius: 999px;
  color: #09634d;
  background: #e8f7f2;
  font-size: 0.84rem;
  font-weight: 800;
  animation: rise 380ms ease forwards;
}

.translation {
  padding: 0.75rem;
  border-radius: 0.8rem;
  background: #f7fbf9;
}

.translation p,
dd,
li,
.content-tabs p,
.order-alert p {
  color: #475655;
  line-height: 1.45;
}

.resume-list {
  display: grid;
  gap: 0.62rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.resume-list li {
  padding-left: 0.85rem;
  border-left: 3px solid rgba(31, 157, 118, 0.38);
}

.resume-list.compact {
  gap: 0.48rem;
}

.identity-title,
.offer-name {
  margin-bottom: 0.75rem;
  color: #0b735d;
  font-size: 1.15rem;
  font-weight: 850;
}

dl,
ul {
  margin: 0;
  padding: 0;
}

dt {
  margin-top: 0.72rem;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 850;
}

dd {
  margin: 0.2rem 0 0;
}

ul {
  display: grid;
  gap: 0.7rem;
  list-style: none;
}

li {
  padding-left: 0.85rem;
  border-left: 3px solid rgba(226, 167, 58, 0.55);
}

.market {
  grid-column: 1 / -1;
}

.content-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.content-tabs section {
  padding: 0.78rem;
  border-radius: 0.8rem;
  background: #f8f9fe;
}

h4 {
  margin: 0 0 0.45rem;
  color: #5643a5;
}

.order-alert {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.8rem;
  align-items: start;
  padding: 1rem;
  opacity: 0;
  transform: translateY(14px);
  border-color: rgba(31, 157, 118, 0.42);
  background: #effaf4;
}

.alert-dot {
  flex: 0 0 auto;
  width: 0.8rem;
  aspect-ratio: 1;
  margin-top: 0.3rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(31, 157, 118, 0.45);
  animation: pulse 1.5s ease-out infinite;
}

.closing-line {
  margin-top: auto;
  padding: 0.9rem 1rem;
  border-radius: 1rem;
  color: #fff;
  background: linear-gradient(135deg, #1f9d76, #0b8fa3 50%, #8564d8);
  font-weight: 850;
  text-align: center;
  opacity: 0;
  transform: translateY(14px);
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}

.page-actions .primary-button {
  flex: 0 1 16rem;
}

[hidden] {
  display: none !important;
}

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

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 0.65rem rgba(31, 157, 118, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(31, 157, 118, 0);
  }
}

@media (max-width: 860px) {
  .scene {
    min-height: 14rem;
  }

  .output-header,
  .actions {
    align-items: stretch;
    flex-direction: column;
  }

  .results-grid,
  .identity-grid,
  .content-tabs {
    grid-template-columns: 1fr;
  }

  .market,
  .order-alert {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }
}
