*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
 
:root {
  --bg:       #0a0a0a;
  --surface:  #111111;
  --surface2: #181818;
  --border:   rgba(255,255,255,0.07);
  --border2:  rgba(255,255,255,0.14);
  --text:     #f5f0e8;
  --muted:    #555;
  --accent:   #c8f04a;
  --accent2:  #a8d03a;
  --danger:   #ff5555;
  --success:  #4adb8a;
}
 
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 32px 16px 60px;
  overflow-x: hidden;
}
 
/* Grain overlay */
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}
 
.container {
  max-width: 640px;
  margin: 0 auto;
}
 
/* Header */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 52px;
  gap: 16px;
  flex-wrap: wrap;
}
 
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
 
.logo-dot {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}
 
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
 
.api-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
 
.api-wrap input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  padding: 7px 12px;
  outline: none;
  width: 220px;
  transition: border-color 0.2s;
}
 
.api-wrap input:focus { border-color: var(--border2); }
.api-wrap input::placeholder { color: var(--muted); }
 
.key-saved {
  font-size: 0.72rem;
  color: var(--success);
  display: none;
  white-space: nowrap;
}
 
.key-saved.show { display: inline; }
 
/* Hero */
.hero { margin-bottom: 36px; }
 
h1 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(4rem, 14vw, 8rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  color: var(--text);
  margin-bottom: 16px;
}
 
h1 span { color: var(--accent); }
 
.tagline {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 300;
  max-width: 400px;
  line-height: 1.6;
}
 
/* Mode buttons */
.mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
 
.mode-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 16px;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.18s;
}
 
.mode-btn:hover { border-color: var(--border2); color: var(--text); }
 
.mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}
 
/* Input card */
.input-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  transition: border-color 0.2s;
}
 
.input-card:focus-within { border-color: rgba(200,240,74,0.25); }
 
.char-count {
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
 
textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 300;
  line-height: 1.6;
  resize: none;
  outline: none;
  min-height: 120px;
}
 
textarea::placeholder { color: #333; }
 
.input-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
 
.clear-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.8rem;
  padding: 9px 16px;
  cursor: pointer;
  transition: all 0.18s;
}
 
.clear-btn:hover { border-color: var(--border2); color: var(--text); }
 
.generate-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #000;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 22px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
  letter-spacing: 0.02em;
}
 
.generate-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(200,240,74,0.25);
  background: #d4f55a;
}
 
.generate-btn:active:not(:disabled) { transform: translateY(0); }
.generate-btn:disabled { opacity: 0.4; cursor: not-allowed; }
 
/* Loader dots */
.dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
 
.dots span {
  width: 5px; height: 5px;
  background: #000;
  border-radius: 50%;
  animation: dotBounce 0.9s ease-in-out infinite;
}
 
.dots span:nth-child(2) { animation-delay: 0.15s; }
.dots span:nth-child(3) { animation-delay: 0.3s; }
 
@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}
 
/* Result */
.result-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  display: none;
  animation: fadeUp 0.35s ease;
}
 
.result-wrap.show { display: block; }
 
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
 
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
 
.result-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
 
.result-actions { display: flex; gap: 8px; }
 
.action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.75rem;
  padding: 5px 12px;
  cursor: pointer;
  transition: all 0.18s;
}
 
.action-btn:hover { border-color: var(--border2); color: var(--text); }
 
#result {
  font-size: 0.93rem;
  line-height: 1.8;
  color: var(--text);
  font-weight: 300;
  white-space: pre-wrap;
  word-break: break-word;
}
 
.word-count {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--muted);
  text-align: right;
}
 
/* Error */
.error-box {
  background: rgba(255,85,85,0.07);
  border: 1px solid rgba(255,85,85,0.2);
  border-radius: 12px;
  padding: 14px 18px;
  color: #ff8080;
  font-size: 0.85rem;
  margin-top: 12px;
  display: none;
}
 
.error-box.show { display: block; }
 
/* Footer */
footer {
  margin-top: 48px;
  text-align: center;
  font-size: 0.75rem;
  color: #333;
}
 
footer strong { color: #555; }
 
/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 100px; }