:root {
  --page: #ffffff;
  --surface: #f7f8fb;
  --ink: #0f1728;
  --muted: #5f6675;
  --line: rgba(15, 23, 40, 0.08);
  --line-strong: rgba(15, 23, 40, 0.13);
  --shadow: 0 20px 60px rgba(15, 23, 40, 0.05);
  --shadow-soft: 0 6px 18px rgba(15, 23, 40, 0.04);

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 48px;
  --space-2xl: 88px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

button,
input,
textarea {
  font: inherit;
}

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

/* ─── PAGE SHELL ─────────────────────────────────────── */

.page {
  min-height: 100vh;
  padding: var(--space-md) var(--space-lg) var(--space-xl);
  display: flex;
  flex-direction: column;
}

.shell {
  flex: 1;
  width: min(1100px, 100%);
  margin: 0 auto;
  display: grid;
  gap: var(--space-2xl);
}

/* ─── SITE FOOTER ────────────────────────────────────── */

.site-footer {
  text-align: center;
  padding: var(--space-xl) 0 var(--space-md);
  color: var(--muted);
  font-size: 0.76rem;
  opacity: 0.5;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.site-footer a:hover {
  opacity: 1;
}

/* ─── TOPBAR ─────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-xs) var(--space-sm);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  min-width: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 35%, #7fb5ff 0, #7fb5ff 15%, transparent 16%),
    linear-gradient(135deg, #111827, #2c3d7a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.brand-mark span {
  width: 16px;
  height: 16px;
  display: block;
  border-radius: 50%;
  border: 3.5px solid rgba(255, 255, 255, 0.92);
  border-right-color: transparent;
  transform: rotate(32deg);
}

.brand-name {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

/* ─── BUTTONS ────────────────────────────────────────── */

.primary,
.ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 var(--space-lg);
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.primary {
  background: #16181f;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(21, 24, 35, 0.18);
}

.ghost {
  background: var(--page);
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(21, 24, 35, 0.24);
}

.ghost:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(15, 23, 40, 0.09);
}

.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── HERO ───────────────────────────────────────────── */

.hero {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: var(--space-lg);
  padding-top: var(--space-2xl);
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.08;
  letter-spacing: -0.025em;
  font-weight: 500;
}

.hero-copy {
  margin: 0;
  max-width: 580px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

/* ─── HERO FORM ──────────────────────────────────────── */

.hero-form {
  width: 100%;
  max-width: 460px;
  display: grid;
  gap: var(--space-md);
}

.url-input {
  width: 100%;
  min-height: 56px;
  padding: 0 var(--space-lg);
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--page);
  color: var(--ink);
  font-size: 0.98rem;
  box-shadow: inset 0 1px 2px rgba(15, 23, 40, 0.03);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.url-input::placeholder {
  color: var(--muted);
  opacity: 0.65;
}

.url-input:focus {
  outline: none;
  border-color: rgba(64, 110, 255, 0.35);
  box-shadow: 0 0 0 4px rgba(73, 112, 255, 0.08);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
}

/* ─── STATUS ─────────────────────────────────────────── */

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status.good {
  color: #2b6b53;
}

.status.error {
  color: #8f4a33;
}

/* ─── RESULT SECTION ─────────────────────────────────── */

.result {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  display: grid;
  gap: var(--space-lg);
}

.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.result-title-wrap {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 var(--space-xs);
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.result-title {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52ch;
}

.result-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}

/* ─── CONTEXT PREVIEW ────────────────────────────────── */

.context-preview {
  padding: var(--space-sm) var(--space-md);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.context-preview:empty {
  display: none;
}

/* ─── TAB BAR ────────────────────────────────────────── */

.tab-bar {
  display: flex;
  gap: var(--space-xs);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-item {
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
  margin-bottom: -1px;
}

.tab-item:hover {
  color: var(--ink);
}

.tab-item.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ─── TAB PANELS ─────────────────────────────────────── */

.tab-panel {
  display: none;
  animation: fadeIn 0.2s ease;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel-content {
  display: grid;
  gap: var(--space-lg);
}

.panel-content:empty {
  display: none;
}

/* ─── AI LOADING ─────────────────────────────────────── */

.ai-loading {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-lg);
  color: var(--muted);
  font-size: 0.9rem;
}

.ai-loading.hidden {
  display: none;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── SUMMARY PANEL ──────────────────────────────────── */

.summary-section {
  display: grid;
  gap: var(--space-sm);
}

.summary-section h3 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.summary-section ul {
  margin: 0;
  padding-left: var(--space-lg);
  display: grid;
  gap: var(--space-xs);
}

.summary-section li {
  font-size: 0.95rem;
  line-height: 1.6;
}

.summary-text {
  font-size: 0.95rem;
  line-height: 1.72;
  color: var(--ink);
  white-space: pre-line;
}

.topics-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.topic-tag {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--line);
}

/* ─── SOCIAL PANEL ───────────────────────────────────── */

.social-card {
  display: grid;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--page);
}

.social-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.social-card-label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
}

.social-card-copy {
  padding: var(--space-xs) var(--space-md);
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--page);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.social-card-copy:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.social-card-copy.copied {
  color: #2b6b53;
  border-color: #2b6b53;
}

.social-card-text {
  font-size: 0.92rem;
  line-height: 1.65;
  white-space: pre-line;
  color: var(--ink);
}

/* ─── IDEAS PANEL ────────────────────────────────────── */

.ideas-section {
  display: grid;
  gap: var(--space-sm);
}

.ideas-section h3 {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ideas-section ol {
  margin: 0;
  padding-left: var(--space-lg);
  display: grid;
  gap: var(--space-xs);
}

.ideas-section li {
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ─── FIELD ──────────────────────────────────────────── */

.field {
  display: grid;
  gap: var(--space-sm);
}

.field textarea {
  width: 100%;
  min-height: 380px;
  padding: var(--space-lg);
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.72;
  resize: vertical;
}

.field textarea:focus {
  outline: none;
  border-color: rgba(64, 110, 255, 0.28);
  box-shadow: 0 0 0 4px rgba(73, 112, 255, 0.07);
}

/* ─── UTILITY ────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* ─── RESPONSIVE ─────────────────────────────────────── */

@media (max-width: 768px) {
  .page {
    padding: var(--space-md) var(--space-md) var(--space-xl);
  }

  .shell {
    gap: var(--space-xl);
  }

  .hero {
    padding-top: var(--space-xl);
    gap: var(--space-md);
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 2.8rem);
  }

  .hero-copy {
    font-size: 1rem;
  }

  .url-input {
    min-height: 52px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .result-head {
    flex-direction: column;
    gap: var(--space-md);
  }

  .result-actions {
    width: 100%;
  }

  .result-actions .primary,
  .result-actions .ghost {
    flex: 1;
  }

  .result-title {
    max-width: 100%;
    white-space: normal;
  }

  .tab-bar {
    gap: 0;
  }

  .tab-item {
    padding: var(--space-sm) var(--space-sm);
    font-size: 0.84rem;
  }
}
