:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --panel: #ffffff;
  --ink: #1e2722;
  --muted: #65706a;
  --line: #dbe2dc;
  --accent: #0f766e;
  --accent-strong: #0b5f58;
  --accent-soft: #e1f4ef;
  --gold: #af7a1f;
  --shadow: 0 18px 45px rgba(32, 45, 40, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(15, 118, 110, 0.14), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(245, 247, 244, 0.96)),
    repeating-linear-gradient(
      45deg,
      rgba(15, 118, 110, 0.045) 0,
      rgba(15, 118, 110, 0.045) 1px,
      transparent 1px,
      transparent 18px
    );
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
  color: var(--ink);
  font-family:
    Inter, "Noto Sans SC", "Hiragino Sans", "Yu Gothic", system-ui, -apple-system, sans-serif;
}

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

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.site-nav a {
  border: 1px solid rgba(219, 226, 220, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  padding: 11px 12px;
  text-decoration: none;
}

.site-nav a:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(360px, 0.78fr);
  gap: 18px;
  min-height: calc(100vh - 64px);
}

.editor-pane,
.preview-pane {
  background: rgba(255, 255, 255, 0.93);
  border: 1px solid rgba(219, 226, 220, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.editor-pane {
  padding: 28px;
}

.preview-pane {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
}

.brand-row,
.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

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

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.05;
}

h2 {
  font-size: 25px;
}

h3 {
  font-size: 16px;
}

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

.full-width {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

input,
select {
  min-height: 46px;
  padding: 0 13px;
}

textarea {
  min-height: 140px;
  resize: vertical;
  padding: 13px;
  line-height: 1.7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  min-width: 160px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
}

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

.secondary-button,
.ghost-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.mail-card {
  display: grid;
  gap: 12px;
}

.subject-row {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

#bodyOutput {
  min-height: 420px;
  background: #fbfcfb;
}

.tips {
  border-left: 4px solid var(--accent);
  padding: 12px 14px;
  background: var(--accent-soft);
  border-radius: 6px;
}

.tips p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.seo-panel {
  margin-top: 18px;
  padding: 22px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(219, 226, 220, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.seo-panel h2 {
  font-size: 22px;
}

.seo-panel p,
.seo-panel li {
  color: var(--muted);
  line-height: 1.75;
}

.seo-panel ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.tool-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  font-weight: 800;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100vw - 20px, 720px);
    padding: 10px 0;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .editor-pane,
  .preview-pane {
    padding: 18px;
  }

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

  h1 {
    font-size: 36px;
  }
}

@media (max-width: 520px) {
  .brand-row,
  .preview-header {
    align-items: stretch;
    flex-direction: column;
  }

  .actions button,
  .ghost-button {
    width: 100%;
  }
}
