/* Essays — friendly design system
   tokens: primary #F2D9DC · secondary #D9F2D8 · success #16A34A ·
   warning #D97706 · danger #DC2626 · surface #FFFFFF · text #111827
   type: Noto Serif Display (display+body) · Space Mono (labels/numbers)
   scale: 14/16/18/24/32/40 · compact rhythm · generous rounding */

:root {
  --primary: #F2D9DC;
  --primary-strong: #E7BFC4;
  --secondary: #D9F2D8;
  --secondary-strong: #BFE6BD;
  --success: #16A34A;
  --warning: #D97706;
  --danger: #DC2626;
  --surface: #FFFFFF;
  --paper: #FDFAF8;
  --text: #111827;
  --text-soft: #4B5563;
  --line: #EDE4E5;
  --radius: 18px;
  --radius-sm: 12px;
  --serif: 'Noto Serif Display', Georgia, 'Times New Roman', serif;
  --mono: 'Space Mono', ui-monospace, 'Courier New', monospace;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  font-family: var(--serif);
  color: var(--text);
  background:
    radial-gradient(circle at 12% -4%, var(--primary) 0%, transparent 34%),
    radial-gradient(circle at 96% 0%, var(--secondary) 0%, transparent 30%),
    var(--paper);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
}

a { color: var(--text); text-decoration-thickness: 2px; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--primary-strong); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------- topbar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: rgba(255,255,255,.82);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand {
  font-size: 24px; font-weight: 700; text-decoration: none;
  letter-spacing: .02em;
}
.brand::after { content: ""; display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary-strong); margin-left: 8px; }
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
  text-decoration: none; padding: 8px 14px; border-radius: 999px;
  font-size: 16px; color: var(--text-soft); transition: background .15s;
}
.nav-links a:hover { background: var(--secondary); color: var(--text); }
.nav-links a.active { background: var(--primary); color: var(--text); font-weight: 600; }
.nav-meta { display: flex; align-items: center; gap: 10px; }
.grade-chip {
  font-family: var(--mono); font-size: 13px; padding: 4px 10px;
  background: var(--secondary); border-radius: 999px;
}
.inline { display: inline; }

/* ------------------------------------------------------------ page */
.page { flex: 1; width: 100%; max-width: 880px; margin: 0 auto; padding: 32px 24px 64px; }
.footer { text-align: center; padding: 18px; color: var(--text-soft); font-size: 13px; }
.mono { font-family: var(--mono); }

h1 { font-size: 32px; line-height: 1.25; margin: 0 0 8px; font-weight: 700; }
h2 { font-size: 24px; margin: 0 0 12px; font-weight: 600; }
.sub { color: var(--text-soft); margin: 0 0 24px; font-size: 16px; }

/* ------------------------------------------------------------ card */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 2px 10px rgba(17,24,39,.04);
}
.card.tint-pink { background: linear-gradient(180deg, #FFF7F8, var(--surface) 70%); }
.card.tint-green { background: linear-gradient(180deg, #F6FCF5, var(--surface) 70%); }

/* ---------------------------------------------------------- button */
.btn {
  font-family: var(--serif); font-size: 16px; font-weight: 600;
  border: 2px solid var(--text); border-radius: 999px;
  padding: 10px 24px; cursor: pointer;
  background: var(--primary); color: var(--text);
  transition: transform .12s, background .15s, box-shadow .12s;
  text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--primary-strong); box-shadow: 0 3px 0 var(--text); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn-green { background: var(--secondary); }
.btn-green:hover { background: var(--secondary-strong); }
.btn-ghost { background: transparent; border-color: var(--line); font-weight: 500; }
.btn-ghost:hover { border-color: var(--text); box-shadow: none; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn-lg { font-size: 18px; padding: 14px 34px; }
.btn[disabled] { opacity: .55; cursor: wait; transform: none; box-shadow: none; }

/* ------------------------------------------------------------ form */
label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=password], select {
  width: 100%; font-family: var(--serif); font-size: 16px;
  padding: 12px 14px; border: 2px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
}
input:focus, select:focus { border-color: var(--primary-strong); outline: none;
  box-shadow: 0 0 0 3px rgba(231,191,196,.45); }

/* ------------------------------------------------------------ login */
.login-wrap { max-width: 400px; margin: 8vh auto 0; }
.login-brand { text-align: center; font-size: 40px; font-weight: 700; margin-bottom: 4px; }
.login-tag { text-align: center; color: var(--text-soft); margin-bottom: 28px; }

/* ---------------------------------------------------------- alerts */
.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin: 0 0 18px; font-size: 15px; }
.alert-error { background: #FDE8E8; color: #991B1B; border: 1px solid #F5C6C6; }
.alert-ok { background: var(--secondary); color: #14532D; }

/* ------------------------------------------------------- score bar */
.score-row { display: flex; align-items: center; gap: 14px; margin: 10px 0; }
.score-letter {
  font-family: var(--mono); font-weight: 700; font-size: 18px;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); flex: none;
}
.score-track { flex: 1; height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 999px; background: var(--success); transition: width .8s ease; }
.score-num { font-family: var(--mono); font-size: 15px; width: 36px; text-align: right; }
.score-crit { font-size: 14px; color: var(--text-soft); width: 130px; }
.total-badge {
  font-family: var(--mono); font-size: 18px; font-weight: 700;
  background: var(--secondary); border-radius: var(--radius-sm);
  padding: 10px 18px; display: inline-block; margin-top: 8px;
}

/* ---------------------------------------------------------- write */
.task-card { border-left: 6px solid var(--primary-strong); }
.gq li { margin: 6px 0; }
.essay-box {
  width: 100%; min-height: 340px; resize: vertical;
  font-family: var(--serif); font-size: 17px; line-height: 1.8;
  padding: 18px; border: 2px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
}
.essay-box:focus { border-color: var(--primary-strong); outline: none;
  box-shadow: 0 0 0 3px rgba(231,191,196,.45); }
.write-meta { display: flex; align-items: center; gap: 16px; margin: 12px 2px; flex-wrap: wrap; }
.save-state { font-family: var(--mono); font-size: 13px; color: var(--text-soft); }

/* ---------------------------------------------------------- lists */
.item-list { list-style: none; padding: 0; margin: 0; }
.item-list li {
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  margin-bottom: 10px; background: var(--surface);
  display: flex; justify-content: space-between; gap: 14px; align-items: center;
  flex-wrap: wrap;
}
.item-list .meta { font-family: var(--mono); font-size: 13px; color: var(--text-soft); }
.chip {
  font-family: var(--mono); font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--primary); text-transform: capitalize;
}
.chip-green { background: var(--secondary); }
.chip-mono { background: #EDE9FE; }

/* -------------------------------------------------------- mistakes */
.mistake-card { padding: 14px 16px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--surface); }
.mistake-orig { text-decoration: line-through; color: var(--danger); font-style: italic; }
.mistake-fix { color: var(--success); font-weight: 600; }
.mistake-note { font-size: 14px; color: var(--text-soft); margin-top: 4px; }
.mastered-toggle { margin-top: 8px; }
.done { opacity: .55; }
.done .mistake-orig, .done .mistake-fix { text-decoration: line-through; }

/* --------------------------------------------------------- assess */
.assess-wrap { text-align: center; padding: 10vh 0; }
.dots { display: inline-flex; gap: 10px; margin: 24px 0; }
.dots span { width: 14px; height: 14px; border-radius: 50%; background: var(--primary-strong);
  animation: bounce 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .15s; background: var(--secondary-strong); }
.dots span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-10px); } }

/* -------------------------------------------------------- history */
.trend-box { text-align: center; }
.trend-box svg { width: 100%; max-width: 560px; height: auto; }

/* --------------------------------------------------------- proverbs */
.proverb {
  font-style: italic; border-left: 4px solid var(--secondary-strong);
  padding: 10px 16px; background: #F6FCF5; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 10px;
}
.proverb .meaning { font-style: normal; font-size: 14px; color: var(--text-soft); display: block; }

.essay-review { white-space: pre-wrap; font-size: 16.5px; line-height: 1.85;
  background: var(--paper); padding: 20px; border-radius: var(--radius-sm);
  border: 1px dashed var(--line); }

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
  .nav-links { order: 3; width: 100%; justify-content: space-between; }
  .page { padding: 20px 14px 48px; }
  h1 { font-size: 24px; }
}
