:root {
  --ink: #201d19;
  --muted: #746d63;
  --body: #f4f0e8;
  --card: #fffdf8;
  --card-soft: #faf6ee;
  --field: #f7f2ea;
  --border: #e5ded2;
  --border-soft: #eee7dc;
  --accent: #c95a38;
  --accent-hover: #ad482b;
  --accent-soft: rgba(201, 90, 56, 0.1);
  --dark: #191816;
  --shadow-sm: 0 1px 2px rgba(32, 29, 25, 0.06);
  --shadow-lg: 0 18px 45px rgba(32, 29, 25, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  padding-bottom: 80px;
  color: var(--ink);
  background: var(--body);
  font-family: "Inter", "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.page-shell {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding-top: 48px;
}

.hero {
  padding-bottom: 24px;
  background: transparent;
}

h1 {
  max-width: 980px;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 48px;
  font-weight: 900;
  line-height: 1.16;
  letter-spacing: -0.045em;
}

.hero p {
  max-width: 672px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.65;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 32px;
  align-items: start;
  margin-top: 16px;
}

.composer {
  position: sticky;
  top: 32px;
}

.composer-card {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.control-section {
  display: block;
}

.section-heading,
.section-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 12px;
}

.field-label,
.section-title > span {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.25;
}

.section-heading #char-count,
.section-title small {
  color: rgba(116, 109, 99, 0.68);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
}

.section-heading #char-count.is-warning {
  color: var(--accent-hover);
}

.section-icon {
  display: inline-grid;
  width: 16px;
  height: 16px;
  place-items: center;
  font-size: 15px;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--ink);
  background: var(--field);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

textarea {
  height: 128px;
  padding: 16px;
  resize: none;
  font-size: 14px;
  line-height: 1.65;
}

input {
  padding: 10px 16px;
  font-size: 14px;
  line-height: 1.5;
}

textarea::placeholder,
input::placeholder {
  color: rgba(116, 109, 99, 0.48);
}

textarea:focus,
input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(201, 90, 56, 0.16);
}

.input-hint {
  margin-top: 8px;
  color: rgba(116, 109, 99, 0.72);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}

.input-hint.is-warning {
  color: var(--accent-hover);
}

.sample-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  color: rgba(116, 109, 99, 0.72);
  font-size: 12px;
  font-weight: 600;
}

.sample-row button {
  padding: 4px 10px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  background: rgba(32, 29, 25, 0.055);
  font-size: 11px;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease;
}

.sample-row button:hover {
  color: var(--ink);
  background: rgba(32, 29, 25, 0.1);
}

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

.style-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.choice {
  position: relative;
  display: flex;
  min-height: 86px;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
  border: 2px solid var(--border-soft);
  border-radius: 12px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.choice:hover {
  border-color: var(--border);
  background: var(--card-soft);
}

.choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 1px 2px rgba(201, 90, 56, 0.1), 0 0 0 1px rgba(201, 90, 56, 0.08);
}

.choice strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.choice small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.025em;
  line-height: 1.65;
}

.checkmark {
  position: absolute;
  top: 8px;
  right: 8px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 900;
  opacity: 0;
}

.choice[aria-pressed="true"] .checkmark {
  opacity: 1;
}

.style-grid .choice {
  min-height: 40px;
  align-items: center;
  padding: 8px;
  border-width: 1px;
  text-align: center;
}

.style-grid .choice strong {
  margin: 0;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
}

.style-grid .choice[aria-pressed="true"] {
  border-color: var(--dark);
  color: #fffdf8;
  background: var(--dark);
  box-shadow: var(--shadow-sm);
}

.style-grid .choice small,
.style-grid .checkmark {
  display: none;
}

.clear-style-button {
  border: 0;
  color: rgba(116, 109, 99, 0.72);
  background: transparent;
  font-size: 11px;
  font-weight: 600;
  transition: color 0.18s ease;
}

.clear-style-button:hover {
  color: var(--ink);
}

.generate-button {
  display: flex;
  width: 100%;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: 0;
  border-radius: 999px;
  color: #fffdf8;
  background: var(--accent);
  box-shadow: 0 4px 14px rgba(201, 90, 56, 0.32);
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
  transition: background 0.18s ease, opacity 0.18s ease, transform 0.18s ease;
}

.generate-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--accent-hover);
}

.generate-button:active:not(:disabled) {
  transform: translateY(0);
}

.generate-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.action-section {
  padding-top: 8px;
}

.error-message {
  margin-top: -24px;
  color: var(--accent-hover);
  font-size: 13px;
  font-weight: 700;
}

.error-message:empty {
  display: none;
}

.results-column {
  display: grid;
  gap: 24px;
}

.results-area {
  display: flex;
  min-height: 600px;
  flex-direction: column;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.results-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.results-head h2 {
  color: var(--ink);
  font-size: 24px;
  font-weight: 800;
  line-height: 1.25;
}

.results-head p {
  color: rgba(116, 109, 99, 0.72);
  font-size: 12px;
  font-weight: 700;
}

.empty-state {
  display: flex;
  min-height: 400px;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  border: 1px dashed rgba(116, 109, 99, 0.34);
  border-radius: 24px;
  text-align: center;
  background: rgba(247, 242, 234, 0.54);
}

.empty-mark {
  display: grid;
  width: 112px;
  height: 112px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0 auto 24px;
  opacity: 0.42;
}

.empty-mark span {
  border-radius: 12px;
  background: var(--accent);
}

.empty-mark span:nth-child(1) {
  opacity: 0.58;
}

.empty-mark span:nth-child(2) {
  border-top-right-radius: 32px;
  opacity: 0.72;
}

.empty-mark span:nth-child(3) {
  border-bottom-left-radius: 32px;
  opacity: 0.38;
}

.empty-mark span:nth-child(4) {
  opacity: 0.86;
}

.empty-state strong {
  margin-bottom: 8px;
  color: color-mix(in srgb, var(--ink) 78%, white);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.4;
}

.empty-state span {
  max-width: 320px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.result-grid {
  display: grid;
  gap: 0;
}

.result-card {
  overflow: hidden;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.result-card--error {
  border-color: rgba(201, 90, 56, 0.3);
}

.result-card--pending {
  border-style: dashed;
}

.result-card__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 246, 238, 0.62);
}

.result-card__head h3 {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid rgba(201, 90, 56, 0.16);
  border-radius: 999px;
  color: var(--accent-hover);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
}

.copy-button {
  flex: 0 0 auto;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  transition: background 0.18s ease;
}

.copy-button:hover {
  background: var(--card-soft);
}

.stream-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--accent-hover);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 700;
}

.stream-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 20px;
}

.stream-body strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 800;
}

.stream-body p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.65;
}

.stream-loader {
  display: flex;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.stream-loader span {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--accent);
  animation: pulse-dot 1s infinite ease-in-out;
}

.stream-loader span:nth-child(2) {
  animation-delay: 0.15s;
}

.stream-loader span:nth-child(3) {
  animation-delay: 0.3s;
}

.stream-preview {
  grid-column: 1 / -1;
  max-height: 150px;
  overflow: hidden;
  margin: 2px 0 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  white-space: pre-wrap;
  color: var(--ink);
  background: var(--field);
  font-size: 13px;
  line-height: 1.65;
}

@keyframes pulse-dot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.field-list {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.field-item {
  position: relative;
  margin: 0 -8px;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.18s ease;
}

.field-item:hover {
  background: var(--card-soft);
}

.field-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 4px;
}

.field-title span {
  color: rgba(116, 109, 99, 0.72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.field-copy {
  border: 0;
  color: rgba(116, 109, 99, 0.72);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.18s ease, color 0.18s ease;
}

.field-item:hover .field-copy {
  opacity: 1;
}

.field-copy:hover {
  color: var(--ink);
}

.field-value {
  white-space: pre-wrap;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
}

.tag::before {
  content: "#";
}

.highlight-field {
  padding: 16px;
  border: 2px solid rgba(201, 90, 56, 0.34);
  border-radius: 8px;
  white-space: pre-wrap;
  color: var(--ink);
  background: rgba(201, 90, 56, 0.08);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

.platform-error {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(201, 90, 56, 0.24);
  border-radius: 12px;
  color: var(--accent-hover);
  background: rgba(201, 90, 56, 0.08);
}

.platform-error strong {
  font-size: 14px;
  font-weight: 800;
}

.platform-error span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.case-entry {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  overflow: hidden;
  padding: 32px;
  border-radius: 24px;
  color: #fffdf8;
  background: var(--dark);
  box-shadow: var(--shadow-lg);
}

.case-entry::after {
  content: "";
  position: absolute;
  top: -32px;
  right: -32px;
  width: 192px;
  height: 192px;
  border-radius: 999px;
  background: rgba(201, 90, 56, 0.14);
  filter: blur(32px);
  pointer-events: none;
  transition: background 0.18s ease;
}

.case-entry:hover::after {
  background: rgba(201, 90, 56, 0.24);
}

.case-entry > div,
.case-entry a {
  position: relative;
  z-index: 1;
}

.case-entry h3 {
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.35;
}

.case-entry p {
  max-width: 384px;
  color: rgba(255, 253, 248, 0.62);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.7;
}

.case-entry a {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  color: #fffdf8;
  background: var(--accent);
  box-shadow: var(--shadow-sm);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease;
}

.case-entry a::before {
  content: "▤";
  font-size: 15px;
}

.case-entry a:hover {
  transform: scale(1.05);
  background: var(--accent-hover);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  transform: translateY(16px);
  padding: 12px 15px;
  border-radius: 999px;
  color: #fffdf8;
  background: var(--dark);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: end;
}

.hero-card,
.panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.hero-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 22px;
}

.hero-card span {
  padding: 12px;
  border-radius: 12px;
  color: var(--muted);
  background: var(--field);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.panel {
  display: grid;
  gap: 20px;
  padding: 28px;
}

@media (min-width: 768px) {
  .page-shell {
    width: min(1280px, calc(100% - 96px));
  }
}

@media (min-width: 1280px) {
  .page-shell {
    width: min(1280px, calc(100% - 160px));
  }
}

@media (max-width: 1020px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .composer {
    position: static;
  }

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

@media (max-width: 767px) {
  body {
    padding-bottom: 48px;
  }

  .page-shell {
    width: min(100% - 48px, 1280px);
    padding-top: 48px;
  }

  h1 {
    font-size: 30px;
    line-height: 1.2;
  }

  .workspace {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .composer-card,
  .results-area {
    padding: 24px;
  }

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

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

  .results-area {
    min-height: auto;
    border: 0;
    background: transparent;
    box-shadow: none;
    padding-inline: 0;
  }

  .case-entry {
    align-items: center;
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 24px, 1280px);
  }

  .platform-grid,
  .style-grid {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .section-title {
    align-items: flex-start;
  }
}
