:root {
  --color-primary: #3157f4;
  --color-primary-dark: #2444cc;
  --color-primary-soft: #eef2ff;
  --color-cyan: #0ea5e9;
  --color-text: #172033;
  --color-muted: #667085;
  --color-subtle: #98a2b3;
  --color-border: #e5e9f2;
  --color-surface: #ffffff;
  --color-page: #f6f8fc;
  --shadow-card: 0 12px 36px rgba(16, 24, 40, 0.07);
  --radius-lg: 20px;
  --radius-md: 14px;
  --content-width: 1440px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  color: var(--color-text);
  background: var(--color-page);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 9% 8%, rgba(49, 87, 244, 0.07), transparent 27rem),
    var(--color-page);
}

button,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid rgba(229, 233, 242, 0.9);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
}

.header-inner,
.site-main,
.footer-inner {
  width: min(calc(100% - 64px), var(--content-width));
  margin-inline: auto;
}

.header-inner {
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: 36px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: max-content;
}

.brand-logo {
  display: block;
  width: 132px;
  height: 44px;
  object-fit: contain;
}

.brand-divider {
  width: 1px;
  height: 22px;
  margin: 0 14px 0 10px;
  background: var(--color-border);
}

.brand-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 10px 14px;
  color: var(--color-muted);
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

.header-action {
  padding: 10px 18px;
  color: #fff;
  border: 0;
  border-radius: 10px;
  background: var(--color-primary);
  box-shadow: 0 7px 18px rgba(49, 87, 244, 0.2);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.site-main {
  flex: 1;
  padding-block: 26px 60px;
}

.workspace-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 7px;
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.workspace-heading h1 {
  margin: 0;
  font-size: clamp(26px, 2.6vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.heading-description {
  margin: 7px 0 0;
  color: var(--color-muted);
  font-size: 15px;
  line-height: 1.55;
}

.privacy-summary {
  width: min(42%, 510px);
  margin: 0 0 2px;
  color: var(--color-subtle);
  font-size: 11px;
  line-height: 1.7;
  text-align: right;
}

.privacy-summary a {
  color: var(--color-primary);
  font-weight: 650;
}

.privacy-summary a:hover {
  text-decoration: underline;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(0, 55fr) minmax(420px, 45fr);
  gap: 24px;
  align-items: stretch;
}

.embed-panel,
.prompt-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.prompt-panel {
  position: relative;
}

.panel-titlebar {
  min-height: 78px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--color-border);
}

.panel-titlebar h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.panel-kicker {
  margin-bottom: 4px;
  font-size: 9px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  color: #18794e;
  border-radius: 999px;
  background: #ecfdf3;
  font-size: 11px;
  font-weight: 650;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}

.embedded-page {
  display: block;
  width: 100%;
  height: 780px;
  border: 0;
  background: #f8fafc;
}

.panel-tip {
  margin: 0;
  color: var(--color-subtle);
  font-size: 12px;
}

.prompt-list {
  padding: 20px;
  display: grid;
  gap: 18px;
}

.prompt-card {
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #fbfcff;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.prompt-panel.has-expanded-card .prompt-card:not(.is-expanded) {
  visibility: hidden;
}

.prompt-card.is-expanded {
  position: absolute;
  z-index: 6;
  inset: 78px 0 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  background: var(--color-surface);
  box-shadow: none;
}

.prompt-card.is-expanded .prompt-toolbar {
  flex: none;
}

.prompt-card.is-expanded .editor {
  min-height: 0;
  height: auto;
  flex: 1;
}

.prompt-card:focus-within {
  border-color: #b8c5ff;
  box-shadow: 0 0 0 3px rgba(49, 87, 244, 0.08);
}

.prompt-toolbar {
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  align-items: center;
  gap: 8px;
}

.template-select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 34px 0 12px;
  color: var(--color-text);
  border: 1px solid #d7ddea;
  border-radius: 9px;
  outline: none;
  background: #fff;
  font-size: 13px;
  font-weight: 620;
  cursor: pointer;
}

.template-select:focus-visible {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(49, 87, 244, 0.1);
}

.tool-button {
  height: 38px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--color-muted);
  border: 1px solid #d7ddea;
  border-radius: 9px;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.tool-button:hover {
  color: var(--color-primary);
  border-color: #b8c5ff;
  background: var(--color-primary-soft);
}

.tool-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.char-count {
  min-width: 47px;
  color: var(--color-subtle);
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.editor {
  width: 100%;
  height: 176px;
  overflow-y: auto;
  padding: 13px 14px;
  color: #344054;
  border: 1px solid #dfe4ed;
  border-radius: 10px;
  outline: none;
  background: #fff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", "Microsoft YaHei", monospace;
  font-size: 12px;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  caret-color: var(--color-primary);
}

.editor:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(49, 87, 244, 0.08);
}

.editor-hint {
  color: #aab2c0;
  font-style: normal;
}

.site-footer {
  border-top: 1px solid var(--color-border);
  background: #fff;
}

.footer-inner {
  padding-block: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}

.footer-brand {
  margin: 0 0 6px;
  font-weight: 750;
}

.footer-copy,
.copyright {
  margin: 0;
  color: var(--color-subtle);
  font-size: 12px;
}

.footer-links {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 22px;
  color: var(--color-muted);
  font-size: 13px;
}

.footer-link-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.footer-links a:hover {
  color: var(--color-primary);
}

.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 28px;
  padding: 11px 17px;
  color: #fff;
  border-radius: 10px;
  background: #172033;
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.2);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-centered {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, calc(-50% + 12px));
}

.toast.is-centered.is-visible {
  transform: translate(-50%, -50%);
}

.dialog-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  padding: 20px;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(4px);
}

.dialog-backdrop[hidden] {
  display: none;
}

.dialog {
  width: min(100%, 390px);
  padding: 28px;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(16, 24, 40, 0.24);
  text-align: center;
}

.dialog-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 15px;
  display: grid;
  place-items: center;
  color: #b54708;
  border-radius: 50%;
  background: #fffaeb;
  font-size: 20px;
  font-weight: 800;
}

.dialog h2 {
  margin: 0 0 9px;
  font-size: 20px;
}

.dialog p {
  margin: 0;
  color: var(--color-muted);
  font-size: 14px;
  line-height: 1.65;
}

.dialog-actions {
  margin-top: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button {
  height: 42px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.button-secondary {
  color: var(--color-text);
  border: 1px solid var(--color-border);
  background: #fff;
}

.button-primary {
  color: #fff;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
}

@media (max-width: 1080px) {
  .header-inner,
  .site-main,
  .footer-inner {
    width: min(calc(100% - 40px), var(--content-width));
  }

  .workspace-layout {
    grid-template-columns: minmax(0, 1fr) minmax(390px, 0.9fr);
    gap: 18px;
  }

  .workspace-heading {
    align-items: flex-start;
  }

  .privacy-summary {
    width: min(44%, 420px);
  }

  .site-nav {
    display: none;
  }

  .embedded-page {
    height: 820px;
  }

  .prompt-toolbar {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
  }

  .char-count {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@media (max-width: 767px) {
  body {
    background: #fff;
  }

  .header-inner,
  .site-main,
  .footer-inner {
    width: 100%;
  }

  .site-header {
    position: static;
  }

  .header-inner {
    min-height: 62px;
    padding: 0 16px;
  }

  .brand-logo {
    width: 108px;
    height: 38px;
  }

  .brand-divider,
  .brand-name,
  .header-action,
  .workspace-heading,
  .embed-panel,
  .site-footer {
    display: none;
  }

  .site-main {
    padding: 0;
  }

  .workspace-layout {
    display: block;
  }

  .prompt-panel {
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .panel-titlebar {
    min-height: 68px;
    padding: 14px 16px;
  }

  .prompt-list {
    padding: 14px 12px 28px;
    gap: 14px;
  }

  .prompt-card {
    padding: 13px;
  }

  .prompt-toolbar {
    grid-template-columns: minmax(0, 1fr) 38px 38px 38px;
  }

  .prompt-card.is-expanded {
    inset: 68px 0 0;
    padding: 14px 12px;
  }

  .tool-button {
    width: 38px;
    padding: 0;
  }

  .tool-button span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .editor {
    height: 190px;
    font-size: 13px;
  }
}

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