*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d0f;
  --bg2: #141417;
  --bg3: #1c1c21;
  --border: rgba(255,255,255,0.08);
  --border2: rgba(255,255,255,0.14);
  --text: #f0ede8;
  --text2: #9a9690;
  --text3: #5c5a56;
  --accent: #e8c87a;
  --accent2: #c9a84c;
  --green: #4ade80;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Instrument Sans', sans-serif;
}

/* Light theme overrides */
[data-theme="light"] {
  --bg: #faf8f3;
  --bg2: #ffffff;
  --bg3: #f1ece1;
  --border: rgba(0,0,0,0.08);
  --border2: rgba(0,0,0,0.16);
  --text: #1a1a1c;
  --text2: #5c5a56;
  --text3: #9a9690;
  --accent: #b9892b;
  --accent2: #8d6612;
  --green: #16a34a;
}
body { transition: background-color .25s ease, color .25s ease; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Header ── */
header {
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
}
.logo {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: -0.3px;
  color: var(--text);
}
.logo em { color: var(--accent); font-style: normal; }
nav { display: flex; gap: 6px; }
nav a {
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 6px;
  transition: all .15s;
}
nav a:hover { background: var(--bg3); color: var(--text); }
.header-right { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  font-family: var(--sans);
  line-height: 1;
  padding: 0;
}
.icon-btn:hover { background: var(--bg3); border-color: var(--border2); }
@media (max-width: 600px) {
  nav a { padding: 5px 8px; font-size: 12px; }
  .header-right { gap: 4px; }
}

/* ── Ad: Top Banner ── */
.ad-top {
  border-bottom: 1px solid var(--border);
  padding: 8px 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 72px;
  background: var(--bg2);
}
.ad-box {
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  color: var(--text3);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ad-label {
  font-size: 9px;
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text3);
  letter-spacing: 0.1em;
}

/* ── Layout ── */
.page {
  max-width: 1160px;
  margin: 0 auto;
  padding: 48px 28px 80px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 36px;
  align-items: start;
}
@media (max-width: 800px) {
  .page { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ── Hero ── */
.hero {
  margin-bottom: 36px;
  animation: fadeUp .4s ease both;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(232,200,122,0.1);
  border: 1px solid rgba(232,200,122,0.2);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 16px;
  letter-spacing: 0.04em;
}
.hero-badge::before { content: '✦'; font-size: 9px; }
h1 {
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -1.5px;
  margin-bottom: 14px;
  font-weight: 600;
}
h1 em { color: var(--accent); font-style: italic; }
.hero p {
  font-size: 15px;
  color: var(--text2);
  max-width: 520px;
  line-height: 1.7;
}
.stats {
  display: flex;
  gap: 28px;
  margin-top: 20px;
}
.stat { font-size: 13px; color: var(--text2); }
.stat strong { color: var(--text); font-weight: 600; display: block; font-size: 20px; line-height: 1.2; }

/* ── Form Card ── */
.form-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  animation: fadeUp .45s ease both;
}
.form-header {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.step-dots {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border2);
  transition: background .3s;
}
.dot.active { background: var(--accent); }
.dot.done { background: var(--green); }

.form-body { padding: 24px 28px; }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 7px;
}
label .req { color: var(--accent); margin-left: 2px; }

input, textarea, select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  padding: 10px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  resize: none;
  appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--text3); }
input:focus, textarea:focus, select:focus {
  border-color: rgba(232,200,122,0.4);
  box-shadow: 0 0 0 3px rgba(232,200,122,0.07);
}
select option { background: var(--bg3); }
textarea { line-height: 1.6; }

.tone-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 2px;
}
.tone-btn {
  padding: 9px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg3);
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
  font-family: var(--sans);
  line-height: 1.3;
}
.tone-btn:hover { border-color: var(--border2); color: var(--text); }
.tone-btn.selected {
  border-color: rgba(232,200,122,0.5);
  background: rgba(232,200,122,0.08);
  color: var(--accent);
}
.tone-btn .tone-icon { display: block; font-size: 16px; margin-bottom: 3px; }

.generate-btn {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: #0d0d0f;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  letter-spacing: 0.01em;
}
.generate-btn:hover { background: #f0d48a; transform: translateY(-1px); }
.generate-btn:active { transform: translateY(0); }
.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.generate-btn .spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #0d0d0f;
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: none;
}
.generate-btn.loading .spinner { display: block; }
.generate-btn.loading .btn-text { display: none; }

/* ── Ad: In-content ── */
.ad-mid {
  margin: 28px 0;
}

/* ── Result ── */
.result-section {
  margin-top: 4px;
  display: none;
  animation: fadeUp .4s ease both;
}
.result-section.visible { display: block; }

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.result-header h2 {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: -0.5px;
}

.action-row {
  display: flex;
  gap: 8px;
}
.action-btn {
  padding: 7px 14px;
  border-radius: 7px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  font-family: var(--sans);
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.action-btn:hover { background: var(--bg3); color: var(--text); }
.action-btn.primary {
  background: rgba(232,200,122,0.1);
  border-color: rgba(232,200,122,0.3);
  color: var(--accent);
}
.action-btn.primary:hover { background: rgba(232,200,122,0.18); }

.result-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  font-size: 14px;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 200px;
  position: relative;
}
.result-box.streaming::after {
  content: '▌';
  color: var(--accent);
  animation: blink .7s step-end infinite;
}

.copy-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--green);
  color: #0d0d0f;
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: all .3s;
  pointer-events: none;
  z-index: 999;
}
.copy-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Tips below result ── */
.tips-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 24px;
}
@media (max-width: 600px) { .tips-grid { grid-template-columns: 1fr; } }
.tip-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.tip-card .tip-icon { font-size: 18px; margin-bottom: 6px; }
.tip-card h4 { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.tip-card p { font-size: 12px; color: var(--text2); line-height: 1.5; }

/* ── SEO section ── */
.seo-section {
  margin-top: 48px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}
.seo-section h2 {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}
.seo-section p {
  font-size: 14px;
  color: var(--text2);
  line-height: 1.8;
  margin-bottom: 12px;
  max-width: 640px;
}
.faq-item {
  border-top: 1px solid var(--border);
  padding: 14px 0;
}
.faq-q {
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  color: var(--text);
}
.faq-q::after { content: '+'; color: var(--text3); font-size: 20px; transition: transform .2s; }
.faq-q.open::after { transform: rotate(45deg); }
.faq-a {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.7;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease, margin-top .3s;
}
.faq-a.open { max-height: 200px; margin-top: 8px; }

/* ── Sidebar ── */
.sidebar {}
.ad-sidebar {
  width: 100%;
  height: 250px;
  margin-bottom: 20px;
}
.sidebar-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}
.sidebar-card h3 { font-size: 13px; font-weight: 600; margin-bottom: 10px; color: var(--text); }
.slink {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text2);
  text-decoration: none;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  transition: color .15s;
}
.slink:last-child { border-bottom: none; }
.slink:hover { color: var(--accent); }
.slink::before { content: '→'; color: var(--text3); font-size: 12px; transition: transform .15s; }
.slink:hover::before { transform: translateX(3px); color: var(--accent); }

.checklist { list-style: none; }
.checklist li {
  font-size: 12px;
  color: var(--text2);
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 7px;
  line-height: 1.4;
}
.checklist li:last-child { border-bottom: none; }
.checklist li::before { content: '✓'; color: var(--green); font-size: 11px; flex-shrink: 0; margin-top: 1px; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity:0; transform: translateY(14px); }
  to   { opacity:1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blink { 50% { opacity: 0; } }

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 24px 28px;
  text-align: center;
  font-size: 12px;
  color: var(--text3);
}
footer a { color: var(--text3); text-decoration: none; }
footer a:hover { color: var(--text2); }
