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

:root {
  --red: #ef4444;
  --rose: #f43f5e;
  --red-light: #fecdd3;
  --red-dark: #991b1b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

header {
  background: linear-gradient(135deg, var(--red), var(--rose));
  color: var(--white);
  padding: 3rem 0;
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.tagline {
  font-size: 1.1rem;
  opacity: 0.9;
}

main {
  padding: 2rem 0 4rem;
}

.analyzer-section {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
}

.input-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.input-wrapper textarea {
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1.1rem;
  font-family: inherit;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  resize: vertical;
  transition: border-color 0.2s;
}

.input-wrapper textarea:focus {
  outline: none;
  border-color: var(--red);
}

.btn-primary {
  background: linear-gradient(135deg, var(--red), var(--rose));
  color: var(--white);
  border: none;
  padding: 0.875rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--white);
  color: var(--red);
  border: 2px solid var(--red);
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-secondary:hover {
  background: var(--red);
  color: var(--white);
}

.btn-link {
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 0.85rem;
  text-decoration: underline;
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.results-section {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
}

.overall-score {
  text-align: center;
  margin-bottom: 2rem;
}

.score-circle {
  position: relative;
  width: 150px;
  height: 150px;
  margin: 0 auto;
}

.score-circle svg {
  transform: rotate(-90deg);
}

.score-bg {
  fill: none;
  stroke: var(--gray-200);
  stroke-width: 8;
}

.score-fill {
  fill: none;
  stroke: url(#scoreGradient);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 283;
  transition: stroke-dashoffset 1s ease-out;
}

.score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -60%);
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--red);
}

.score-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, 40%);
  font-size: 0.8rem;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.scores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.score-card {
  background: var(--gray-50);
  padding: 1.25rem;
  border-radius: 12px;
}

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

.score-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-700);
}

.score-num {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--red);
}

.progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--rose));
  border-radius: 4px;
  width: 0%;
  transition: width 1s ease-out;
}

.score-desc {
  font-size: 0.8rem;
  color: var(--gray-500);
}

.word-analysis, .suggestions {
  margin-bottom: 1.5rem;
}

.word-analysis h3, .suggestions h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--gray-800);
}

.word-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.word-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.word-tag.common { background: #dbeafe; color: #1e40af; }
.word-tag.uncommon { background: #fef3c7; color: #92400e; }
.word-tag.emotional { background: #fce7f3; color: #9d174d; }
.word-tag.power { background: #ede9fe; color: #5b21b6; }

.suggestions ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.suggestions li {
  padding: 0.75rem 1rem;
  background: var(--gray-50);
  border-radius: 8px;
  font-size: 0.9rem;
  border-left: 3px solid var(--red);
}

.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.comparison-section {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
}

.comparison-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.comparison-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.comparison-inputs textarea {
  width: 100%;
  padding: 0.875rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  resize: vertical;
}

.comparison-inputs textarea:focus {
  outline: none;
  border-color: var(--red);
}

.comparison-results {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--gray-50);
  border-radius: 12px;
}

.comparison-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--gray-200);
}

.comparison-row:last-child {
  border-bottom: none;
}

.comparison-label {
  font-weight: 600;
  font-size: 0.9rem;
}

.comparison-scores {
  display: flex;
  gap: 1rem;
}

.comparison-score {
  text-align: center;
  min-width: 60px;
}

.comparison-score .score {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--red);
}

.comparison-score .label {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.winner {
  background: #dcfce7;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
}

.templates-section {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
}

.templates-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.template-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.template-tab {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  background: var(--gray-100);
  color: var(--gray-600);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.template-tab.active {
  background: var(--red);
  color: var(--white);
}

.templates-grid {
  display: grid;
  gap: 0.75rem;
}

.template-card {
  padding: 1rem;
  background: var(--gray-50);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.template-card:hover {
  border-color: var(--red-light);
  background: var(--white);
}

.template-card .template-text {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.template-card .template-category {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.history-section {
  background: var(--white);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  margin-bottom: 2rem;
}

.history-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1rem;
  background: var(--gray-50);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}

.history-item:hover {
  background: var(--gray-100);
}

.history-headline {
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 1rem;
}

.history-score {
  font-weight: 700;
  color: var(--red);
  font-size: 1.1rem;
}

.history-time {
  font-size: 0.75rem;
  color: var(--gray-400);
  margin-left: 1rem;
  min-width: 60px;
  text-align: right;
}

.history-empty {
  text-align: center;
  color: var(--gray-400);
  padding: 2rem;
  font-size: 0.9rem;
}

.ad-placeholder {
  background: var(--gray-200);
  text-align: center;
  padding: 1.5rem;
  margin: 0 auto 2rem;
  max-width: 900px;
  border-radius: 12px;
  color: var(--gray-500);
  font-size: 0.85rem;
}

footer {
  text-align: center;
  padding: 2rem 0;
  color: var(--gray-500);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  header h1 { font-size: 1.75rem; }
  .comparison-inputs { grid-template-columns: 1fr; }
  .scores-grid { grid-template-columns: 1fr; }
  .history-item { flex-wrap: wrap; }
  .history-time { margin-left: 0; margin-top: 0.25rem; }
}
