:root {
  --bg: #FAFAF9;
  --surface: #FFFFFF;
  --surface-alt: #F4F3EE;
  --border: #E7E5E0;
  --text: #1F2937;
  --text-muted: #6B7280;
  --accent: #4F46E5;
  --accent-soft: #EEF2FF;
  --amber: #F59E0B;
  --amber-soft: #FFFBEB;
  --success: #059669;
  --danger: #DC2626;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 4px 12px rgba(17, 24, 39, 0.08);
  --max-width: 960px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s;
}

.site-nav a:hover { color: var(--accent); }
.site-nav .nav-out::after {
  content: "→";
  margin-left: 4px;
}

.hero {
  padding: 56px 0 24px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.lede {
  margin: 0;
  max-width: 640px;
  color: var(--text-muted);
  font-size: 1.05rem;
}

.ranker-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.ranker-controls {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 24px;
}

.control label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.control select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  font-size: 0.95rem;
  color: var(--text);
  font-family: inherit;
}

.btn-secondary {
  padding: 10px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

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

.formality-scale {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.scale-track {
  flex: 1;
  height: 4px;
  background: linear-gradient(to right, #A5B4FC, #4F46E5, #1E1B4B);
  border-radius: 999px;
}

.phrase-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  counter-reset: phrase;
}

.phrase-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 14px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  position: relative;
  counter-increment: phrase;
}

.phrase-card::before {
  content: counter(phrase);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.phrase-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.phrase-card:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.phrase-card .phrase-text {
  display: block;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--text);
}

.phrase-card .phrase-level {
  display: block;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.phrase-detail {
  margin-top: 20px;
  padding: 20px;
  background: var(--amber-soft);
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
}

.phrase-detail h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.phrase-detail p {
  margin: 0 0 10px;
  color: var(--text);
}

.phrase-detail .mistake {
  color: var(--danger);
  font-size: 0.92rem;
}

.reference-section,
.mistakes-section,
.saved-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-sm);
}

.reference-section h2,
.mistakes-section h2,
.saved-section h2 {
  margin-top: 0;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
}

.level-guide,
.mistake-list {
  padding-left: 20px;
  margin: 12px 0;
}

.level-guide li,
.mistake-list li {
  margin-bottom: 10px;
  color: var(--text);
}

.level-guide strong {
  color: var(--accent);
}

.saved-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: grid;
  gap: 8px;
}

.saved-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
}

.saved-item button {
  background: transparent;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
}

.empty-state {
  color: var(--text-muted);
  font-style: italic;
  margin: 12px 0;
}

.site-footer {
  margin-top: 40px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

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

@media (max-width: 720px) {
  .site-header .container { flex-wrap: wrap; height: auto; padding: 12px 24px; }
  .site-nav { flex-wrap: wrap; gap: 12px; }
  .ranker-controls { grid-template-columns: 1fr; }
  .phrase-list { grid-template-columns: 1fr; }
  .hero { padding-top: 32px; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .ranker-section,
  .reference-section,
  .mistakes-section,
  .saved-section { padding: 20px; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
