:root {
  --bg: #0b0f19;
  --bg-panel: #121826;
  --bg-input: #1a2234;
  --border: #2a3548;
  --text: #e8eef7;
  --text-muted: #8b9bb4;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --success: #22c55e;
  --error: #ef4444;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.header-badge {
  font-size: 0.75rem;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-hover);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

/* Main layout */
.main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 900px) {
  .main {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel h2 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.hint {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* Textarea */
textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 14px 16px;
  resize: vertical;
  min-height: 220px;
  transition: border-color 0.2s;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
}

textarea::placeholder {
  color: #5a6a85;
}

.char-count {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 8px;
  margin-bottom: 20px;
}

/* Goals */
.goals h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.goal-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.goal-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  transition: all 0.2s;
}

.goal-btn:hover {
  border-color: #3b4a66;
}

.goal-btn.active {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.1);
}

.goal-icon {
  font-size: 1.25rem;
  line-height: 1.2;
}

.goal-title {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.goal-desc {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Buttons */
.primary-btn {
  width: 100%;
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-btn:hover:not(:disabled) {
  opacity: 0.95;
}

.primary-btn:active:not(:disabled) {
  transform: scale(0.99);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.secondary-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 16px;
  transition: border-color 0.2s;
}

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

.hidden {
  display: none !important;
}

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 360px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state h3 {
  color: var(--text);
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.empty-state p {
  max-width: 280px;
  font-size: 0.9rem;
}

/* Result */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.stored-badge {
  font-size: 0.75rem;
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.result-content {
  background: var(--bg-input);
  border-radius: 10px;
  padding: 20px;
  font-size: 0.95rem;
  line-height: 1.65;
  white-space: pre-wrap;
  max-height: 480px;
  overflow-y: auto;
}

.result-content h3,
.result-content strong {
  color: var(--accent-hover);
}

/* Error */
.error-area {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  padding: 16px;
  color: #fca5a5;
  font-size: 0.9rem;
}

/* Footer */
.footer {
  margin-top: 40px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-note {
  margin-top: 4px;
  opacity: 0.7;
}
