/* WriterAI — Main stylesheet */

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-primary: #34D399;
  --c-primary-dark: #047857;
  --c-bg: #0B1220;
  --c-surface: #111B2E;
  --c-border: #1F2B42;
  --c-text: #E8ECF1;
  --c-text-muted: #8A94A6;
  --c-success: #34D399;
  --c-warning: #FBBF24;
  --c-error: #F87171;
  --c-band-high: #34D399;
  --c-band-mid: #FBBF24;
  --c-band-low: #F87171;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.4);
  --max-w: 900px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== Layout ===== */
.container { max-width: var(--max-w); margin: 0 auto; padding: 24px 16px; }
.hidden { display: none !important; }

/* ===== Header ===== */
.header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--c-text);
}
.header-logo span {
  color: var(--c-primary);
}
.header-logo img {
  vertical-align: middle;
  margin-right: 6px;
}
.header-nav { display: flex; gap: 16px; align-items: center; }
.header-nav a { font-size: 0.875rem; color: var(--c-text-muted); }
.header-nav a:hover { color: var(--c-primary); }
.header-student {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  background: var(--c-bg);
  padding: 4px 10px;
  border-radius: 12px;
}
.header-student:empty { display: none; }
.header-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-direction: column;
  gap: 4px;
}
.header-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--c-text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.header-hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.header-hamburger.open span:nth-child(2) { opacity: 0; }
.header-hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ===== Cards ===== */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--c-text);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--c-surface);
  color: var(--c-text);
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(52,211,153,.15);
}
.form-group textarea {
  min-height: 200px;
  resize: vertical;
  line-height: 1.7;
}
.form-hint {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  margin-top: 4px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #065F46; color: #D1FAE5; border: 1px solid #047857; }
.btn-primary:hover:not(:disabled) { background: #047857; }
.btn-secondary { background: var(--c-surface); color: var(--c-text); border: 1px solid var(--c-border); }
.btn-secondary:hover:not(:disabled) { background: var(--c-border); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }

/* ===== Score display ===== */
.score-hero {
  text-align: center;
  padding: 32px 16px;
}
.score-total {
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}
.score-max {
  font-size: 1.2rem;
  color: var(--c-text-muted);
  font-weight: 400;
}
.score-band {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
}
.band-high { background: var(--c-band-high); }
.band-mid { background: var(--c-band-mid); }
.band-low { background: var(--c-band-low); }

.score-sets {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 16px;
}
.score-set-item { text-align: center; }
.score-set-label {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.score-set-value {
  font-size: 1.5rem;
  font-weight: 600;
}

/* ===== Dimension cards ===== */
.dim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 640px) {
  .dim-grid { grid-template-columns: 1fr; }
}
.dim-card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
}
.dim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.dim-name { font-weight: 600; font-size: 0.9rem; }
.dim-score { font-weight: 700; font-size: 1.1rem; }
.dim-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--c-border);
  margin-bottom: 10px;
  overflow: hidden;
}
.dim-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s;
}
.dim-rationale {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  margin-bottom: 8px;
}
.dim-evidence {
  font-size: 0.82rem;
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: 0 4px 4px 0;
  font-style: italic;
  border-left: 3px solid;
}
.dim-evidence.dim-ev-strength {
  background: rgba(52, 211, 153, .1);
  border-left-color: #34D399;
  color: #34D399;
}
.dim-evidence.dim-ev-improvement {
  background: rgba(251, 146, 60, .1);
  border-left-color: #FB923C;
  color: #FB923C;
}
.dim-improvements { list-style: disc; padding-left: 18px; font-size: 0.85rem; }
.dim-improvements li { margin-bottom: 4px; }

/* ===== Strengths / Improvements / Checklist ===== */
.feedback-section { margin-top: 16px; }
.feedback-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.feedback-list { list-style: none; padding: 0; }
.feedback-list li {
  padding: 8px 12px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.feedback-list.strengths li { background: rgba(52,211,153,.08); border-left: 3px solid var(--c-success); }
.feedback-list.improvements li { background: rgba(248,113,113,.08); border-left: 3px solid var(--c-error); }
.checklist li {
  background: var(--c-bg);
  border-left: 3px solid var(--c-primary);
}
.checklist li::before { content: none; }

/* ===== Encouragement banner ===== */
.encouragement-banner { text-align: center; padding: 20px 24px; background: rgba(52,211,153,.06); border: 1px solid rgba(52,211,153,.2); }
.encourage-msg { font-size: 1.15rem; font-weight: 700; color: var(--c-primary); margin-bottom: 8px; }
.encourage-tips { font-size: 0.9rem; color: var(--c-text-muted); line-height: 1.5; }

/* ===== Essay text with evidence highlights ===== */
.essay-text {
  white-space: pre-wrap;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.95rem;
  line-height: 1.8;
  padding: 20px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
}
.essay-text mark {
  background: rgba(96, 165, 250, .18);
  color: inherit;
  border-bottom: 1.5px solid rgba(96, 165, 250, .5);
  padding: 1px 2px;
  border-radius: 2px;
}
.essay-legend {
  font-size: .8rem;
  color: var(--c-text-muted);
  margin: 0 0 12px;
}

/* ===== Loading spinner ===== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11,18,32,.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
}
.loading-overlay .spinner { width: 40px; height: 40px; }
.loading-text { font-size: 1rem; color: var(--c-text-muted); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: #fff;
  z-index: 200;
  animation: toast-in .3s;
}
.toast-error { background: var(--c-error); }
.toast-success { background: var(--c-success); }
.toast-hide { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(12px); } }

/* ===== Index page — setup wizard ===== */
.setup-step { margin-bottom: 24px; }
.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  margin-right: 8px;
}
.step-done { background: var(--c-success); }

/* ===== History list ===== */
.essay-list { list-style: none; padding: 0; }
.essay-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
}
.essay-list li:last-child { border-bottom: none; }
.essay-meta { font-size: 0.85rem; color: var(--c-text-muted); }

/* ===== Word count indicator ===== */
.word-count {
  text-align: right;
  font-size: 0.82rem;
  color: var(--c-text-muted);
  margin-top: 4px;
}

/* ===== Disclaimer ===== */
.disclaimer {
  font-size: 0.78rem;
  color: var(--c-text-muted);
  text-align: center;
  margin-top: 24px;
  padding: 12px;
  background: var(--c-bg);
  border-radius: var(--radius);
}

/* ===== Landing page ===== */
.landing-section {
  width: 100%;
  padding: 64px 16px;
}
.landing-container {
  max-width: var(--max-w);
  margin: 0 auto;
}
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.section-desc {
  color: var(--c-text-muted);
  margin-bottom: 24px;
  font-size: 0.95rem;
}

/* Hero — split layout */
.hero {
  padding: 64px 16px 56px;
}
.hero-split {
  display: flex;
  gap: 48px;
  align-items: flex-start;
}
.hero-left {
  flex: 1;
  min-width: 0;
}
.hero-right {
  flex: 1;
  min-width: 0;
}
.hero-eyebrow {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--c-primary);
  margin-bottom: 10px;
}
.hero-title {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
}
.hero-subtitle {
  font-size: 1rem;
  color: var(--c-text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}
.hero-bullets {
  list-style: none;
  padding: 0;
}
.hero-bullets li {
  position: relative;
  padding-left: 20px;
  font-size: 0.92rem;
  color: var(--c-text-muted);
  margin-bottom: 8px;
  line-height: 1.5;
}
.hero-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-primary);
}
.hero-textarea-label {
  font-size: 0.9rem;
  color: var(--c-muted);
  margin-bottom: 8px;
}
.hero-textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #2A3A56;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: inherit;
  background: #0F1A2E;
  color: var(--c-text);
  caret-color: var(--c-primary);
  resize: vertical;
  min-height: 160px;
  line-height: 1.7;
  margin-bottom: 12px;
  transition: border-color .15s;
}
.hero-textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(52,211,153,.2);
}
.hero-hints {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--c-text-muted);
}
.hero-hints span {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  padding: 3px 10px;
  border-radius: 12px;
}
.btn-lg {
  padding: 14px 32px;
  font-size: 1.05rem;
  font-weight: 600;
}

/* Demo feedback section */
.demo-container { max-width: 1100px; }
.demo-grid {
  display: flex;
  gap: 14px;
}
.demo-essay {
  flex: 1;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--c-bg);
}
.demo-feedback {
  flex: 1;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--c-bg);
}
.demo-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--c-text-muted);
  margin-bottom: 12px;
}
.demo-text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--c-text);
  white-space: pre-line;
}
.demo-text mark {
  background: rgba(96, 165, 250, .18);
  color: inherit;
  border-bottom: 1.5px solid rgba(96, 165, 250, .5);
  border-radius: 2px;
  padding: 1px 3px;
}

/* Score header */
.demo-score-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.demo-score-big {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}
.demo-score-max {
  font-size: 1rem;
  color: var(--c-text-muted);
  font-weight: 400;
}

/* Dimension bars */
.demo-dims {
  margin-bottom: 18px;
}
.demo-dim-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  font-size: 0.85rem;
}
.demo-dim-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-bar-track {
  display: inline-block;
  width: 80px;
  height: 6px;
  background: var(--c-border);
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
}
.demo-bar-fill {
  display: block;
  height: 100%;
  background: var(--c-primary);
  border-radius: 3px;
  transition: width .3s;
}
.demo-bar-fill.bar-warn {
  background: var(--c-warning);
}
.demo-dim-score {
  font-weight: 600;
  color: var(--c-primary);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* Feedback sub-sections */
.demo-section {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  line-height: 1.55;
}
.demo-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}
.demo-section-green {
  background: rgba(52,211,153,.06);
  border-left: 3px solid var(--c-primary);
}
.demo-section-green .demo-section-title { color: var(--c-primary); }
.demo-section-red {
  background: rgba(251, 146, 60, .06);
  border-left: 3px solid #FB923C;
}
.demo-section-red .demo-section-title { color: #FB923C; }
.demo-section-checklist {
  background: rgba(251,191,36,.06);
  border-left: 3px solid var(--c-warning);
}
.demo-section-checklist .demo-section-title { color: var(--c-warning); }

.demo-strength-item,
.demo-improve-item {
  padding: 3px 0 3px 18px;
  position: relative;
}
.demo-strength-item::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--c-primary);
  font-weight: 700;
}
.demo-improve-item::before {
  content: "\25CB";
  position: absolute;
  left: 0;
  color: #FB923C;
  font-weight: 700;
}
.demo-checklist-item {
  padding: 3px 0 3px 22px;
  position: relative;
}
.demo-checklist-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 13px;
  height: 13px;
  border: 2px solid var(--c-warning);
  border-radius: 2px;
}

/* Style issue highlights (blue-tinted) */
.demo-text .mark-style {
  background: rgba(96,165,250,.18);
  color: #93C5FD;
  border-radius: 2px;
  padding: 1px 3px;
}

/* Per-dimension detail cards */
.demo-dim-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 28px;
}
.demo-dim-card {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--c-bg);
}
.demo-dim-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.demo-dim-card-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.demo-dim-card-score {
  font-weight: 700;
  font-size: 1.1rem;
}
.demo-dim-card-bar {
  height: 6px;
  border-radius: 3px;
  margin-bottom: 10px;
}
.demo-dim-card-rationale {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  font-style: italic;
  margin-bottom: 8px;
  line-height: 1.5;
}
.demo-dim-card-quote {
  font-size: 0.82rem;
  padding: 6px 10px;
  margin-bottom: 6px;
  border-radius: 0 4px 4px 0;
  font-style: italic;
  border-left: 3px solid;
  /* default (no type class): strength green */
  background: rgba(52, 211, 153, .1);
  border-left-color: #34D399;
  color: #34D399;
}
.demo-dim-card-quote.demo-quote-strength {
  background: rgba(52, 211, 153, .1);
  border-left-color: #34D399;
  color: #34D399;
}
.demo-dim-card-quote.demo-quote-improvement {
  background: rgba(251, 146, 60, .1);
  border-left-color: #FB923C;
  color: #FB923C;
}
.demo-dim-card-suggestions {
  list-style: disc;
  padding-left: 18px;
  font-size: 0.85rem;
  margin-top: 8px;
}
.demo-dim-card-suggestions li {
  margin-bottom: 4px;
  line-height: 1.5;
}

/* Band callout */
.demo-band-callout {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  margin-bottom: 8px;
}

/* Dimension toggle button */
.demo-dim-toggle {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-primary);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.demo-dim-toggle:hover {
  background: rgba(52,211,153,.06);
  border-color: var(--c-primary);
}

/* Collapsed dimension cards container */
.demo-dim-collapsed {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
@media (max-width: 768px) {
  .demo-dim-collapsed { grid-template-columns: 1fr; }
}

/* Before/After transformation */
.demo-transform {
  margin-top: 40px;
}
.demo-transform-title {
  font-size: 1.35rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
}
.demo-transform-grid {
  display: flex;
  gap: 14px;
}
.demo-transform-card {
  flex: 1;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--c-bg);
}
.demo-transform-before {
  border-left: 4px solid var(--c-error);
}
.demo-transform-after {
  border-left: 4px solid var(--c-primary);
}
.demo-transform-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 12px;
}
.badge-before {
  background: rgba(248,113,113,.15);
  color: var(--c-error);
}
.badge-after {
  background: rgba(52,211,153,.15);
  color: var(--c-primary);
}
.demo-transform-traits {
  list-style: none;
  padding: 0;
  margin-bottom: 14px;
}
.demo-transform-traits li {
  font-size: 0.88rem;
  color: var(--c-text-muted);
  padding: 3px 0 3px 18px;
  position: relative;
}
.demo-transform-before .demo-transform-traits li::before {
  content: "\2212";
  position: absolute;
  left: 0;
  color: var(--c-error);
  font-weight: 700;
}
.demo-transform-after .demo-transform-traits li::before {
  content: "+";
  position: absolute;
  left: 2px;
  color: var(--c-primary);
  font-weight: 700;
}
.demo-transform-quote-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--c-text-muted);
  margin-bottom: 6px;
}
.demo-transform-quote {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--c-text-muted);
  border-left: 3px solid var(--c-border);
  padding: 10px 14px;
  margin: 0;
  background: rgba(255,255,255,.02);
  border-radius: 0 4px 4px 0;
}
.demo-transform-changes {
  margin-top: 24px;
  text-align: center;
}
.demo-transform-changes-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--c-text);
  margin-bottom: 10px;
}
.demo-transform-changes-items {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.demo-transform-change-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--c-text-muted);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  padding: 6px 16px;
  border-radius: 20px;
}
.demo-transform-change-item::before {
  content: "\2713";
  color: var(--c-primary);
  font-weight: 700;
  font-size: 0.8rem;
}
@media (max-width: 768px) {
  .demo-transform-grid { flex-direction: column; }
}

/* Level badge */
.level-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 5px 14px;
  border-radius: 4px;
}
.level-competitive {
  background: rgba(52,211,153,.12);
  color: var(--c-primary);
  border: 1px solid rgba(52,211,153,.3);
}
.level-developing {
  background: rgba(251,191,36,.12);
  color: var(--c-warning);
  border: 1px solid rgba(251,191,36,.3);
}

/* Landing tables */
.landing-table {
  width: 100%;
  border-collapse: collapse;
}
.landing-table th,
.landing-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c-border);
  font-size: 0.9rem;
}
.landing-table th {
  font-weight: 600;
  color: var(--c-text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.landing-table tr:last-child td { border-bottom: none; }

/* Practice timer */
.practice-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.timer-badge {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 4px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text);
}
.timer-total {
  background: rgba(52,211,153,.1);
  border-color: rgba(52,211,153,.3);
  color: var(--c-primary);
}
.timer-sep {
  font-size: 0.85rem;
  color: var(--c-text-muted);
}

/* Prompt tabs */
.prompt-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.prompt-tab {
  padding: 8px 18px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--c-text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s, border-color .15s;
}
.prompt-tab:hover {
  color: var(--c-text);
  border-color: var(--c-text-muted);
}
.prompt-tab.active {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

/* Prompt card */
.prompt-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px;
}
.prompt-genre {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--c-primary);
  background: rgba(52,211,153,.08);
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.prompt-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.3;
}
.prompt-instruction {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--c-text);
  margin-bottom: 14px;
}
.prompt-tips {
  list-style: none;
  padding: 0;
  margin: 0;
}
.prompt-tips li {
  position: relative;
  padding-left: 18px;
  font-size: 0.88rem;
  color: var(--c-text-muted);
  margin-bottom: 6px;
  line-height: 1.5;
}
.prompt-tips li::before {
  content: "\2022";
  position: absolute;
  left: 4px;
  color: var(--c-primary);
  font-weight: 700;
}

/* Benefit grid */
.benefit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.benefit-card {
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px;
}
.benefit-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.benefit-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.benefit-card p {
  font-size: 0.88rem;
  color: var(--c-text-muted);
  line-height: 1.5;
}

/* About section */
.about-text p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--c-text-muted);
  margin-bottom: 12px;
}
.about-text p:last-child { margin-bottom: 0; }

/* Final CTA */
.cta-section {
  padding: 80px 16px;
}

/* Footer */
.landing-footer {
  text-align: center;
  padding: 16px;
  font-size: 0.7rem;
  color: var(--c-border);
  border-top: 1px solid var(--c-border);
}
.landing-footer a {
  color: var(--c-border);
}
.landing-footer a:hover {
  color: var(--c-text-muted);
}

/* ===== Write page ===== */
.write-layout {
  display: flex;
  height: calc(100vh - 49px);
}
.write-prompt-panel {
  flex: 0 0 33.333%;
  overflow-y: auto;
  padding: 32px 40px;
  background: var(--c-bg);
  min-width: 200px;
}
.write-divider {
  flex: 0 0 5px;
  background: var(--c-border);
  cursor: col-resize;
  transition: background .15s;
}
.write-divider:hover,
.write-divider.active {
  background: var(--c-primary);
}
.write-prompt-panel .prompt-instruction {
  font-weight: 600;
  margin: 12px 0 16px;
}
.write-editor-panel {
  flex: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.write-toolbar {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  gap: 2px;
  flex-wrap: wrap;
}
.tb-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--c-text-muted);
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.tb-btn:hover {
  background: var(--c-border);
  color: var(--c-text);
}
.tb-sep {
  width: 1px;
  height: 20px;
  background: var(--c-border);
  margin: 0 6px;
}
.tb-fontsize {
  border: 1px solid var(--c-border);
  border-radius: 4px;
  background: var(--c-surface);
  color: var(--c-text);
  padding: 4px 8px;
  font-size: 0.82rem;
  cursor: pointer;
}
.write-textarea {
  flex: 1;
  width: 100%;
  padding: 24px;
  border: none;
  border-radius: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background: var(--c-surface);
  color: var(--c-text);
  overflow-y: auto;
}
.write-textarea:focus {
  outline: none;
  box-shadow: none;
}
.write-textarea:empty::before {
  content: attr(data-placeholder);
  color: var(--c-text-muted);
  pointer-events: none;
}
.write-editor-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.write-wordcount {
  font-size: 0.82rem;
  color: var(--c-text-muted);
}
.write-wordcount.wc-in-range { color: #22c55e; }
.write-wordcount.wc-over { color: #f59e0b; }
.write-timer {
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  color: var(--c-text-muted);
}
.timer-warning {
  color: #ef4444;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.write-actions {
  display: flex;
  gap: 10px;
}
.write-exam-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--c-border);
  flex-wrap: wrap;
}

/* ===== Rewrite mode panel ===== */
.rewrite-header {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.rewrite-prev-score {
  font-size: 0.9rem;
  color: var(--c-text-muted);
  margin-bottom: 16px;
}
.rewrite-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--c-text-muted);
  margin: 16px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--c-border);
}
.rewrite-checklist {
  list-style: none;
  padding: 0;
}
.rewrite-checklist li {
  padding: 6px 0;
  font-size: 0.9rem;
}
.rewrite-checklist li::before {
  content: "\2610\0020";
  color: var(--c-primary);
}
.rewrite-dim {
  margin-bottom: 12px;
}
.rewrite-dim-header {
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 4px;
}
.rewrite-dim-score {
  color: var(--c-text-muted);
  font-weight: 400;
}
.rewrite-dim li {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  padding-left: 14px;
  position: relative;
  margin-bottom: 4px;
}
.rewrite-dim li::before {
  content: "\2022";
  position: absolute;
  left: 2px;
  color: var(--c-primary);
}
.rewrite-original {
  margin-top: 16px;
  border-top: 1px solid var(--c-border);
  padding-top: 12px;
}
.rewrite-original summary {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  cursor: pointer;
}
.rewrite-original-text {
  font-family: Georgia, serif;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--c-text-muted);
  margin-top: 8px;
  max-height: 300px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ===== History page ===== */
.history-chart {
  width: 100%;
  overflow-x: auto;
}
.history-chart svg {
  display: block;
  font-family: 'Inter', sans-serif;
}
.essay-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
  text-decoration: none;
  color: var(--c-text);
  transition: background .15s;
}
.essay-card:hover {
  background: var(--c-bg);
  text-decoration: none;
}
.essay-card:last-child { border-bottom: none; }
.essay-card-score {
  display: flex;
  align-items: center;
  gap: 10px;
}
.essay-card-total {
  font-size: 1.2rem;
  font-weight: 700;
}
.essay-card-max {
  font-size: 0.8rem;
  color: var(--c-text-muted);
  font-weight: 400;
}
.essay-card-pending {
  font-size: 0.85rem;
  color: var(--c-text-muted);
  font-style: italic;
}
.essay-card-meta {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--c-text-muted);
}
.empty-state {
  text-align: center;
  padding: 64px 16px;
}
.empty-state h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.empty-state p {
  color: var(--c-text-muted);
  font-size: 0.95rem;
}

/* ===== FAQ accordion ===== */
.faq-list {
  max-width: 720px;
  margin: 0 auto;
}
.faq-item {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  background: var(--c-bg);
}
.faq-question {
  padding: 16px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-question::-webkit-details-marker { display: none; }
.faq-question::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--c-text-muted);
  flex-shrink: 0;
  margin-left: 12px;
  transition: transform .2s;
}
.faq-item[open] .faq-question::after {
  content: "\2212";
}
.faq-answer {
  padding: 0 20px 16px;
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--c-text-muted);
}
.faq-answer p { margin-bottom: 8px; }
.faq-answer p:last-child { margin-bottom: 0; }

/* ===== Guide page ===== */
.guide-content {
  max-width: 760px;
}
.guide-content h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-top: 48px;
  margin-bottom: 16px;
  padding-top: 24px;
  border-top: 1px solid var(--c-border);
}
.guide-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 12px;
}
.guide-content h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--c-primary);
}
.guide-content p {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--c-text-muted);
  margin-bottom: 14px;
}
.guide-content ul {
  padding-left: 20px;
  margin-bottom: 16px;
}
.guide-content ul li {
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--c-text-muted);
  margin-bottom: 6px;
}
.guide-toc {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 32px;
}
.guide-toc strong {
  display: block;
  margin-bottom: 10px;
  font-size: 0.9rem;
}
.guide-toc ol {
  padding-left: 20px;
  margin: 0;
}
.guide-toc li {
  font-size: 0.9rem;
  margin-bottom: 4px;
}
.guide-toc a {
  color: var(--c-primary);
}

/* Guide TL;DR / Short Answer */
.guide-tldr {
  background: var(--c-surface);
  border-left: 3px solid var(--c-primary);
  padding: 12px 16px;
  margin: 16px 0 24px;
  font-size: 1.05rem;
  color: var(--c-text-muted);
}
.guide-short-answer {
  background: var(--c-surface);
  border-left: 3px solid var(--c-border);
  padding: 10px 14px;
  margin: 8px 0 16px;
  font-size: 0.95rem;
}

/* Guide Checklist */
.guide-checklist {
  list-style: none;
  padding-left: 0;
}
.guide-checklist li {
  padding: 6px 0 6px 28px;
  position: relative;
}
.guide-checklist li::before {
  content: "\2713";
  position: absolute;
  left: 4px;
  color: var(--c-primary);
  font-weight: 700;
}

/* ===== Guide Hub ===== */
.guide-hub-section { margin-bottom: 48px; }
.guide-hub-section-title {
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--c-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-size: 0.85rem;
}
.guide-hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.guide-hub-card {
  display: block;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color .15s;
  text-decoration: none;
  color: inherit;
}
.guide-hub-card:hover { border-color: var(--c-primary); text-decoration: none; }
.guide-hub-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: var(--c-text); }
.guide-hub-card p { font-size: 0.9rem; color: var(--c-text-muted); line-height: 1.6; }
.guide-featured {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 48px;
}
.guide-featured h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 12px; }
.guide-featured p { font-size: 0.95rem; color: var(--c-text-muted); line-height: 1.7; margin-bottom: 16px; }
.guide-featured ul { padding-left: 20px; margin-bottom: 20px; }
.guide-featured li { font-size: 0.92rem; color: var(--c-text-muted); margin-bottom: 6px; line-height: 1.6; }

/* Breadcrumb */
.guide-breadcrumb {
  font-size: 0.82rem;
  color: var(--c-text-muted);
  margin-bottom: 16px;
}
.guide-breadcrumb a { color: var(--c-primary); }
.guide-breadcrumb span { margin: 0 6px; }

/* Related articles */
.guide-related {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--c-border);
}
.guide-related h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 16px;
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.guide-related-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.guide-related-grid .guide-hub-card h3 { font-size: 0.92rem; }
.guide-related-grid .guide-hub-card p { font-size: 0.85rem; }

/* ===== Bad/Good example blocks ===== */
.example-bad, .example-good {
  padding: 12px 16px;
  border-left: 4px solid;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 12px 0;
  font-size: 0.92rem;
  line-height: 1.7;
}
.example-bad { border-left-color: #ef4444; background: rgba(239,68,68,.06); }
.example-good { border-left-color: #22c55e; background: rgba(34,197,94,.06); }
.example-bad::before { content: "\2717  "; font-weight: 600; color: #ef4444; }
.example-good::before { content: "\2713  "; font-weight: 600; color: #22c55e; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header { position: relative; }
  .header-hamburger { display: flex; }
  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 8px 16px;
    gap: 0;
    z-index: 50;
  }
  .header-nav.open { display: flex; }
  .header-nav a {
    padding: 10px 0;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--c-border);
  }
  .header-nav a:last-child { border-bottom: none; }
  .header-student { margin-bottom: 4px; align-self: flex-start; }
  .hero-split { flex-direction: column; gap: 32px; }
  .demo-grid { flex-direction: column; }
  .demo-dim-grid { grid-template-columns: 1fr; }
  .benefit-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 1.7rem; }
  .hero { padding: 48px 16px 40px; }
  .landing-section { padding: 40px 16px; }
  .write-layout { flex-direction: column; height: auto; }
  .write-prompt-panel { flex: 0 0 auto !important; max-width: none; border-bottom: 1px solid var(--c-border); padding: 24px 16px; }
  .write-divider { display: none; }
  .write-editor-panel { min-height: 50vh; }
}
@media (max-width: 640px) {
  .guide-hub-grid { grid-template-columns: 1fr; }
  .guide-related-grid { grid-template-columns: 1fr; }
  .container { padding: 16px 12px; }
  .score-total { font-size: 2.4rem; }
  .score-sets { gap: 20px; }
  .landing-table th,
  .landing-table td { padding: 10px 8px; font-size: 0.82rem; }
  .essay-card { flex-direction: column; align-items: flex-start; gap: 8px; }
  .essay-card-meta { flex-wrap: wrap; gap: 8px; }
}
