:root {
  --bg: #f5efe2;
  --bg-deep: #ead9bb;
  --card: rgba(255, 252, 246, 0.88);
  --card-border: rgba(92, 61, 24, 0.12);
  --text: #2f2417;
  --muted: #7c6953;
  --accent: #c65d2e;
  --accent-deep: #8d3815;
  --assistant: #fff4e7;
  --user: #efe4ff;
  --shadow: 0 30px 90px rgba(97, 68, 24, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  font-family: "Avenir Next", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.75), transparent 30%),
    radial-gradient(circle at right 20%, rgba(198, 93, 46, 0.18), transparent 22%),
    linear-gradient(135deg, var(--bg), var(--bg-deep));
  overflow: hidden;
}

.page-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 460px) minmax(320px, 720px);
  gap: 32px;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  overflow: hidden;
}

.hero-copy {
  padding: 16px;
}

.eyebrow {
  margin: 0 0 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(36px, 5vw, 72px);
  line-height: 0.95;
}

.subcopy {
  max-width: 34rem;
  margin: 20px 0 0;
  font-size: 17px;
  line-height: 1.7;
  color: var(--muted);
}

.agent-stage {
  display: flex;
  justify-content: center;
  min-height: 0;
}

.agent-card {
  position: relative;
  width: min(100%, 720px);
  height: min(820px, calc(100vh - 80px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--card-border);
  border-radius: 30px;
  background: var(--card);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.agent-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.agent-topbar h2 {
  margin: 4px 0 0;
  font-size: 28px;
}

.ghost-button,
.send-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.small-button {
  padding: 10px 14px;
  font-size: 13px;
}

.icon-button {
  padding: 8px 12px;
  font-size: 12px;
}

.ghost-button {
  background: rgba(47, 36, 23, 0.07);
  color: var(--text);
}

.send-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  font-weight: 700;
}

.ghost-button:hover,
.send-button:hover {
  transform: translateY(-1px);
}

.chat-log {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-right: 6px;
}

.video-config-panel {
  position: absolute;
  top: 88px;
  right: 24px;
  z-index: 20;
  width: min(420px, calc(100% - 48px));
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(255, 248, 238, 0.88);
  border: 1px solid rgba(92, 61, 24, 0.1);
  box-shadow: 0 18px 42px rgba(67, 42, 8, 0.16);
  backdrop-filter: blur(12px);
}

.video-config-panel.hidden {
  display: none;
}

.video-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.video-config-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.video-config-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}

.video-config-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.mini-config-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.mini-config-field input {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(47, 36, 23, 0.12);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
}

.video-config-status {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.bubble {
  max-width: 85%;
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.bubble.assistant {
  align-self: flex-start;
  background: var(--assistant);
}

.bubble.user {
  align-self: flex-end;
  background: var(--user);
}

.bubble.meta {
  align-self: center;
  max-width: 92%;
  background: rgba(47, 36, 23, 0.06);
  color: var(--muted);
  font-size: 14px;
}

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

.composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 92px;
  border: 1px solid rgba(47, 36, 23, 0.12);
  border-radius: 20px;
  padding: 16px;
  font: inherit;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
}

.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.action-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.video-bubble {
  width: min(100%, 520px);
}

.video-label {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text);
}

.generated-video {
  width: 100%;
  border-radius: 14px;
  display: block;
  background: rgba(0, 0, 0, 0.12);
}

.video-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent-deep);
  text-decoration: none;
  font-size: 14px;
}

@media (max-width: 960px) {
  .page-shell {
    grid-template-columns: 1fr;
    padding: 24px 16px 24px;
  }

  .hero-copy {
    padding: 0;
  }

  .agent-card {
    height: calc(100vh - 48px);
    padding: 18px;
    border-radius: 24px;
  }

  .composer-row {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .video-config-panel {
    top: 96px;
    right: 18px;
    width: calc(100% - 36px);
  }

  .video-config-row {
    grid-template-columns: 1fr;
  }

  .video-config-actions {
    justify-content: stretch;
  }

  .video-config-actions button {
    flex: 1;
  }

  .action-group {
    width: 100%;
  }

  .action-group button {
    flex: 1;
  }

  .bubble {
    max-width: 100%;
  }
}
