*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand: #0EA5E9;
  --brand-dark: #0284C7;
  --brand-light: #E0F2FE;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: #e3e8f0;
  --bg: #f7f9fc;
  --white: #FFFFFF;
  --green: #059669;
  --yellow: #b45309;
  --red: #EF4444;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===== HEADER ===== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1300px; margin: 0 auto;
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; color: var(--brand);
}
.header-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  background: var(--brand-light); color: var(--brand-dark);
  font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
}

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 28px 24px 0;
  max-width: 640px;
  margin: 0 auto;
}
.hero-sub { color: var(--text-muted); font-size: 15px; }

/* ===== APP LAYOUT ===== */
.app-layout {
  max-width: 1300px; margin: 20px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 20px;
  min-height: 520px;
}

@media (max-width: 900px) {
  .app-layout { grid-template-columns: 1fr; padding: 0 16px; }
}

/* ===== EDITOR ===== */
.editor-col {
  display: flex; flex-direction: column;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.editor-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.toolbar-title { font-weight: 600; font-size: 13px; color: var(--text-muted); }
.toolbar-actions { display: flex; gap: 6px; }

.text-editor {
  flex: 1;
  padding: 16px;
  border: none;
  resize: none;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  font-family: inherit;
  outline: none;
  min-height: 420px;
  background: var(--white);
}
.text-editor::placeholder { color: #5b6878; }

.editor-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  display: flex; gap: 16px;
  font-size: 12px; color: var(--text-muted);
  background: var(--bg);
}

/* ===== RESULTS ===== */
.results-col {
  display: flex; flex-direction: column; gap: 16px;
}

.empty-state {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 48px 24px;
  text-align: center; color: var(--text-muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }

/* ===== GRADE CARD ===== */
.grade-card {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  border-radius: var(--radius);
  padding: 24px;
  color: white;
  box-shadow: var(--shadow-md);
}
.grade-score {
  font-size: 56px; font-weight: 800; line-height: 1;
  letter-spacing: -.03em; margin-bottom: 4px;
}
.grade-label { font-size: 13px; opacity: .8; font-weight: 500; margin-bottom: 4px; }
.grade-desc { font-size: 16px; font-weight: 600; margin-bottom: 16px; }

.ease-bar-track {
  background: rgba(255,255,255,.25); border-radius: 4px; height: 8px; margin-bottom: 4px;
}
.ease-bar-fill {
  background: white; border-radius: 4px; height: 8px;
  transition: width .5s ease;
}
.ease-bar-labels {
  display: flex; justify-content: space-between;
  font-size: 10px; opacity: .7;
}

/* ===== SCORE GRID ===== */
.score-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.score-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow);
}
.score-val { font-size: 26px; font-weight: 800; color: var(--brand); line-height: 1; margin-bottom: 2px; }
.score-name { font-size: 12px; font-weight: 600; color: var(--text); }
.score-hint { font-size: 11px; color: var(--text-muted); }

/* ===== STATS ===== */
.stats-section, .issues-section, .keywords-section, .audience-section {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow);
}
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-muted); margin-bottom: 12px;
}
.stats-grid { display: flex; flex-direction: column; gap: 0; }
.stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.stat-row:last-child { border-bottom: none; }
.stat-label { color: var(--text-muted); }
.stat-val { font-weight: 700; color: var(--text); }

/* ===== ISSUES ===== */
.issue-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.issue-item:last-child { border-bottom: none; }
.issue-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; margin-top: 5px;
}
.issue-dot.warn { background: var(--yellow); }
.issue-dot.bad  { background: var(--red); }
.issue-dot.ok   { background: var(--green); }
.issue-text { flex: 1; }
.issue-title { font-weight: 600; }
.issue-desc { color: var(--text-muted); font-size: 12px; }
.no-issues { color: var(--green); font-size: 13px; font-weight: 600; }

/* ===== KEYWORDS ===== */
.keywords-list {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.kw-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 10px; font-size: 12px;
}
.kw-word { font-weight: 600; }
.kw-count { color: var(--text-muted); }

/* ===== AUDIENCE ===== */
.audience-text { font-size: 14px; color: var(--text); line-height: 1.6; }

/* ===== BUTTONS ===== */
.btn-ghost {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px;
  font-size: 12px; color: var(--text-muted);
  cursor: pointer; font-family: inherit;
  transition: border-color .12s, color .12s;
}
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { }

/* ===== GUIDE ===== */
.guide-section {
  border-top: 1px solid var(--border);
  margin-top: 40px; padding: 40px 24px;
  background: var(--white);
}
.guide-inner { max-width: 1300px; margin: 0 auto; }
.guide-inner h2 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }
.guide-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 900px) { .guide-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .guide-grid { grid-template-columns: 1fr; } }
.guide-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
}
.guide-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 8px; color: var(--brand-dark); }
.guide-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--bg); border-top: 1px solid var(--border);
  text-align: center; padding: 20px 24px;
  color: var(--text-muted); font-size: 13px; line-height: 1.8;
}
.footer-small { font-size: 11px; color: #5b6878; }
