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

:root {
  --ink: #0f0e0c;
  --ink2: #3a3832;
  --ink3: #7a7670;
  --paper: #faf9f6;
  --paper2: #f2f0eb;
  --paper3: #e8e4db;
  --accent: #c8622a;
  --accent2: #e8834a;
  --green: #2d6a4f;
  --green-bg: #eaf4ee;
  --border: rgba(15, 14, 12, 0.1);
  --radius: 14px;
  --shadow: 0 2px 24px rgba(15, 14, 12, 0.07), 0 1px 4px rgba(15, 14, 12, 0.05);
}

html {
  font-size: 16px;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Subtle grid background */
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.5;
}

/* ---- Header ---- */
header {
  position: static;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 249, 246, 0.85);
  backdrop-filter: blur(8px);
}

.logo {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  color: var(--ink);
  letter-spacing: -0.01em;
  text-decoration: none;
  cursor: pointer;
}

.logo:hover {
  color: var(--accent);
}

.logo span {
  color: var(--accent);
}

.usage-pill {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 14px;
  border-radius: 100px;
  background: var(--paper2);
  border: 1px solid var(--border);
  color: var(--ink2);
  transition: all 0.3s;
}

.usage-pill.pro {
  background: var(--green-bg);
  border-color: rgba(45, 106, 79, 0.2);
  color: var(--green);
}

/* ---- Main ---- */
main {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  margin-bottom: 3rem;
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
  padding: 4px 12px;
  border: 1px solid rgba(200, 98, 42, 0.25);
  border-radius: 100px;
  background: rgba(200, 98, 42, 0.06);
}

h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 1.25rem;
}

h1 em {
  font-style: italic;
  color: var(--accent);
}

.subhead {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--ink2);
  max-width: 500px;
  margin: 0 auto;
  font-weight: 300;
}

/* ---- App Card ---- */
.app-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

.input-area label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink3);
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  padding: 1rem;
  border: 1.5px solid var(--paper3);
  border-radius: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  resize: vertical;
  transition: border-color 0.2s;
  outline: none;
}

textarea:focus {
  border-color: var(--accent2);
  background: #fff;
}

textarea::placeholder {
  color: var(--ink3);
}

.char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--ink3);
  margin-top: 6px;
}

/* ---- Tone selector ---- */
.tone-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 1.25rem 0;
  flex-wrap: wrap;
}

.tone-label {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink3);
}

.tone-options {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tone-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1.5px solid var(--paper3);
  background: transparent;
  color: var(--ink2);
  cursor: pointer;
  transition: all 0.15s;
}

.tone-btn:hover {
  border-color: var(--accent2);
  color: var(--accent);
}

.tone-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---- CTA Button ---- */
.cta-btn {
  width: 100%;
  padding: 1rem;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.18s;
  margin-top: 0.25rem;
  letter-spacing: -0.01em;
}

.cta-btn:hover {
  background: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(200, 98, 42, 0.25);
}

.cta-btn:active {
  transform: translateY(0);
}

.cta-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.dots {
  display: inline-block;
  animation: blink 1.2s infinite;
}

@keyframes blink {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: 0.3
  }
}

.limit-note {
  font-size: 0.8rem;
  color: var(--ink3);
  text-align: center;
  margin-top: 10px;
  min-height: 1rem;
}

.limit-note.warning {
  color: var(--accent);
}

/* ---- Results ---- */
.results {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  animation: slideUp 0.35s ease forwards;
  opacity: 0;
  transform: translateY(12px);
}

.result-card:nth-child(2) {
  animation-delay: 0.08s;
}

.result-card:nth-child(3) {
  animation-delay: 0.16s;
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.result-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.copy-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--paper2);
  color: var(--ink2);
  cursor: pointer;
  transition: all 0.15s;
}

.copy-btn:hover {
  background: var(--green-bg);
  color: var(--green);
  border-color: rgba(45, 106, 79, 0.3);
}

.copy-btn.copied {
  background: var(--green-bg);
  color: var(--green);
  border-color: rgba(45, 106, 79, 0.3);
}

.result-text {
  font-size: 0.97rem;
  line-height: 1.65;
  color: var(--ink);
}

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 14, 12, 0.55);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal {
  background: #fff;
  border-radius: 20px;
  padding: 2.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(15, 14, 12, 0.2);
  animation: popUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popUp {
  from {
    transform: scale(0.92);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(200, 98, 42, 0.08);
  border: 1px solid rgba(200, 98, 42, 0.2);
  padding: 4px 12px;
  border-radius: 100px;
  margin-bottom: 1rem;
}

.modal h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.5rem;
  line-height: 1.2;
  margin-bottom: 0.75rem;
  color: var(--ink);
}

.modal p {
  font-size: 0.93rem;
  color: var(--ink2);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.modal strong {
  color: var(--ink);
  font-weight: 500;
}

.modal-price {
  background: var(--paper);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.price-amount {
  display: block;
  font-family: 'DM Serif Display', serif;
  font-size: 2.5rem;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 4px;
}

.price-label {
  font-size: 0.8rem;
  color: var(--ink3);
}

.modal-cta {
  width: 100%;
  padding: 0.9rem;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.18s;
  margin-bottom: 0.75rem;
}

.modal-cta:hover {
  background: var(--accent);
}

.modal-dismiss {
  background: none;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--ink3);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.modal-dismiss:hover {
  color: var(--ink);
}

/* ---- Footer ---- */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
  font-size: 0.82rem;
  color: var(--ink3);
  border-top: 1px solid var(--border);
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}