/* SpellRight styles. Used by the site (index.html) and the spelling-rule pages. */
/* ---------- Design tokens (indigo = learning, green = progress) ---------- */
:root {
  --bg: #EEF2FF; --card: #FFFFFF; --ink: #1E1B4B; --heading: #312E81; --muted: #475569;
  --line: #C7D2FE; --soft: #EBEEF8;
  --brand: #4F46E5; --brand-deep: #3730A3; --brand-ink: #FFFFFF; --accent: #16A34A;
  --good: #166534; --good-bg: #DCFCE7; --good-line: #86EFAC;
  --bad: #B91C1C; --bad-bg: #FEE2E2; --bad-line: #FCA5A5;
  --warn-bg: #FEF3C7; --warn-ink: #78350F;
  --clay: 0 10px 24px rgba(79, 70, 229, .13), inset 0 -4px 0 rgba(79, 70, 229, .07), inset 0 2px 0 rgba(255, 255, 255, .9);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #13122B; --card: #1F1E42; --ink: #E0E7FF; --heading: #EEF2FF; --muted: #A9B4D0;
    --line: #3C3B78; --soft: #29285A;
    --brand: #818CF8; --brand-deep: #4F46E5; --brand-ink: #0F172A; --accent: #4ADE80;
    --good: #86EFAC; --good-bg: #14361F; --good-line: #166534;
    --bad: #FCA5A5; --bad-bg: #451A1A; --bad-line: #991B1B;
    --warn-bg: #3B2F0B; --warn-ink: #FDE68A;
    --clay: 0 10px 24px rgba(0, 0, 0, .35), inset 0 -4px 0 rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255, 255, 255, .06);
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--font); }
svg.icon { width: 1em; height: 1em; vertical-align: -0.12em; }

/* ---------- Layout ---------- */
header { display: flex; align-items: center; gap: 12px; padding: 14px 20px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 21px;
  letter-spacing: -.02em; cursor: pointer; color: var(--heading); }
.logo .mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px;
  background: var(--brand); color: var(--brand-ink); box-shadow: 0 3px 0 var(--brand-deep); font-size: 19px; }
.logo span.r { color: var(--brand); }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 14px; }
main { max-width: 880px; margin: 0 auto; padding: 12px 16px 72px; }
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.025em; color: var(--heading); font-weight: 800; }
h2 { font-size: 18px; margin: 32px 0 12px; color: var(--heading); font-weight: 700; }
p.sub { color: var(--muted); margin: 0 0 20px; }

/* ---------- Surfaces ---------- */
.card, .stat { background: var(--card); border: 2px solid var(--line); border-radius: 22px;
  padding: 20px; box-shadow: var(--clay); }
.banner { background: var(--warn-bg); color: var(--warn-ink); border-radius: 16px;
  padding: 12px 16px; font-size: 14px; margin-bottom: 20px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat { padding: 16px; }
.stat b { display: block; font-size: 30px; line-height: 1.1; letter-spacing: -.02em; color: var(--brand); font-weight: 800; }
.stat span { color: var(--muted); font-size: 13px; font-weight: 500; }
@media (max-width: 600px) { .stats { grid-template-columns: repeat(2, 1fr); } h1 { font-size: 25px; } }

/* ---------- Buttons: chunky, with a "press" effect ---------- */
button { font: inherit; font-weight: 600; border-radius: 14px; border: 2px solid var(--line);
  background: var(--card); color: var(--ink); padding: 9px 16px; cursor: pointer; min-height: 44px;
  box-shadow: 0 3px 0 var(--line); transition: transform .15s ease-out, box-shadow .15s ease-out, background-color .15s, filter .15s; }
button:hover { background: var(--soft); }
button:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line); }
button.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink);
  box-shadow: 0 4px 0 var(--brand-deep); }
button.primary:hover { background: var(--brand); filter: brightness(1.08); }
button.primary:active { box-shadow: 0 1px 0 var(--brand-deep); }
button.danger { color: var(--bad); }
button.small { padding: 5px 12px; font-size: 14px; min-height: 36px; border-radius: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
input, textarea, select { font: inherit; width: 100%; padding: 11px 14px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--bg); color: var(--ink); min-height: 44px;
  transition: border-color .15s, box-shadow .15s; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent); }
button:focus-visible, .logo:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .grow { flex: 1; min-width: 180px; }

/* ---------- Lists and tables ---------- */
.list-item { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 2px solid var(--soft); }
.list-item:first-child { border-top: 0; padding-top: 0; }
.list-item .name { flex: 1; font-weight: 700; cursor: pointer; color: var(--heading); }
.list-item .count { color: var(--muted); font-size: 14px; font-weight: 500; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 10px 6px; border-top: 2px solid var(--soft); }
th { font-size: 13px; color: var(--muted); font-weight: 600; border-top: 0; }
td.num, th.num { text-align: end; width: 70px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 13px; font-weight: 600;
  border: 1.5px solid transparent; margin: 2px 0; }
.pill.good { background: var(--good-bg); color: var(--good); border-color: var(--good-line); }
.pill.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.empty { color: var(--muted); padding: 6px 0; }
.back { background: none; border: 0; box-shadow: none; color: var(--muted); padding: 8px 4px 8px 0; margin-bottom: 4px; min-height: 40px; }
.back:hover { background: none; color: var(--brand); }
.back:active { transform: none; }

/* ---------- Practice screen ---------- */
.practice { text-align: center; max-width: 520px; margin: 0 auto; }
.progress { height: 12px; background: var(--card); border: 2px solid var(--line); border-radius: 99px;
  overflow: hidden; margin: 14px 0 30px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease-out; }
.speaker { width: 124px; height: 124px; border-radius: 50%; font-size: 52px; border: 0;
  background: var(--brand); color: var(--brand-ink); display: inline-grid; place-items: center;
  box-shadow: 0 8px 0 var(--brand-deep), 0 18px 30px rgba(79, 70, 229, .3), inset 0 3px 0 rgba(255, 255, 255, .25); }
.speaker:hover { background: var(--brand); filter: brightness(1.08); }
.speaker:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--brand-deep), 0 6px 12px rgba(79, 70, 229, .3); }
.hint { color: var(--muted); font-size: 14px; margin: 22px 0 0; }
.answer { font-size: 26px; font-weight: 600; text-align: center; margin-top: 22px; letter-spacing: .04em;
  background: var(--card); min-height: 60px; }
.feedback { border-radius: 22px; padding: 18px; margin-top: 22px; border: 2px solid; font-weight: 600; animation: pop .25s ease-out; }
.feedback.good { background: var(--good-bg); color: var(--good); border-color: var(--good-line); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-line); }
.feedback .word { font-size: 30px; font-weight: 800; letter-spacing: .04em; color: var(--ink); margin: 4px 0; }
.feedback s { opacity: .85; font-weight: 500; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Sign in ---------- */
.auth { max-width: 400px; margin: 36px auto; padding: 28px; }
.tabs { display: flex; gap: 6px; margin-bottom: 8px; padding: 5px; background: var(--soft); border-radius: 16px; }
.tabs button { flex: 1; border: 0; box-shadow: none; background: transparent; min-height: 38px; }
.tabs button.on { background: var(--card); color: var(--brand); box-shadow: 0 2px 6px rgba(79, 70, 229, .18); }
.tabs button:active { transform: none; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--heading); color: var(--bg); padding: 12px 18px; border-radius: 14px;
  font-size: 14px; font-weight: 600; display: none; max-width: 90vw; box-shadow: 0 10px 24px rgba(0, 0, 0, .25); }

/* ---------- Navigation, meanings, library ---------- */
nav { display: flex; gap: 6px; flex-wrap: wrap; }
nav[hidden] { display: none; }
nav .short { display: none; }
nav button { border: 0; box-shadow: none; background: transparent; color: var(--muted); min-height: 38px; padding: 6px 12px; }
nav button.on { background: var(--card); color: var(--brand); box-shadow: 0 2px 6px rgba(79, 70, 229, .18); }
nav button:active { transform: none; }
@media (max-width: 700px) {
  header { flex-wrap: wrap; padding: 10px 14px; row-gap: 6px; }
  nav { order: 3; width: 100%; flex-wrap: nowrap; gap: 2px; overflow-x: auto; }
  nav button { font-size: 14px; padding: 6px 9px; white-space: nowrap; }
  nav .long { display: none; } nav .short { display: inline; }   /* shorter menu names on phones */
  .who { display: none; }   /* the email address takes too much room on a phone */
}
.meaning { color: var(--muted); font-size: 14px; }
td .meaning { display: block; }
.clue { background: var(--card); border: 2px dashed var(--line); border-radius: 16px; padding: 12px 16px;
  margin: 18px 0 0; color: var(--ink); }
.feedback .def { color: var(--ink); font-weight: 500; margin-top: 4px; }
.pack { margin-bottom: 14px; }
.pack h2 { margin: 0 0 4px; }
.pack p { margin: 6px 0; }
.level { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brand); background: var(--soft); border-radius: 99px; padding: 2px 10px; margin-bottom: 8px; }
.rule { background: var(--soft); border-radius: 14px; padding: 12px 14px; }
.watch { color: var(--warn-ink); background: var(--warn-bg); border-radius: 14px; padding: 10px 14px; font-size: 14px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: start; padding: 10px 12px; }
.tile span { font-size: 12px; font-weight: 500; color: var(--muted); }
.tile.have { border-color: var(--good-line); }
.tile:disabled { box-shadow: none; border-style: dashed; }
h2.level-title { font-size: 22px; margin-top: 36px; }

/* ---------- "Add to a list" chooser ---------- */
.overlay { position: fixed; inset: 0; background: rgba(30, 27, 75, .45); display: grid; place-items: center; padding: 16px; z-index: 10; }
.dialog { width: 100%; max-width: 420px; max-height: 85vh; overflow: auto; text-align: start; animation: pop .2s ease-out; }
.dialog h2 { margin: 0 0 4px; }
.choice { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; text-align: start; }
.choice span { font-size: 13px; font-weight: 500; color: var(--muted); }

.reaction { display: block; max-width: 100%; max-height: 240px; margin: 0 auto 12px; border-radius: 16px; }

/* ---------- Password fields: show/hide eye and "passwords match" message ---------- */
.pw { position: relative; }
.pw input { padding-right: 54px; }
.eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 42px; min-height: 36px;
  padding: 0; border: 0; box-shadow: none; background: transparent; color: var(--muted);
  display: grid; place-items: center; font-size: 20px; }
.eye:hover { background: var(--soft); color: var(--brand); }
.eye:active { transform: translateY(-50%); box-shadow: none; }
/* Hide the browser's own reveal button (Edge on Windows) so there is only one eye. */
input::-ms-reveal, input::-ms-clear { display: none; }
.field-msg { font-size: 14px; font-weight: 600; margin: 6px 0 0; min-height: 1.4em; }
.field-msg.good { color: var(--good); }
.field-msg.bad { color: var(--bad); }

/* ---------- Trouble words list: word, score bar, points ---------- */
.trouble-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 18px; margin: 12px 0; }
.trouble-word { display: grid; grid-template-columns: minmax(0, 1fr) 70px 26px; align-items: center; gap: 8px; }
.trouble-word b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--heading); }
.tbar { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.tbar i { display: block; height: 100%; border-radius: 99px; background: var(--bad); }
.tpts { font-size: 13px; font-weight: 700; color: var(--bad); text-align: end; }

/* ---------- Account, feedback, forgot password, Google sign-in ---------- */
.narrow { max-width: 560px; margin: 0 auto; }
.card + .card { margin-top: 16px; }
.card h2 { margin-top: 0; }
.note { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.linkish { background: none; border: 0; box-shadow: none; color: var(--brand); padding: 4px 0; min-height: 32px; font-size: 14px; }
.linkish:hover { background: none; text-decoration: underline; }
.linkish:active { transform: none; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 18px 0 4px; }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: var(--soft); }
.google { width: 100%; }
.done { background: var(--good-bg); color: var(--good); border: 2px solid var(--good-line); border-radius: 16px; padding: 14px 16px; }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* hidden box that only robots fill in */
.app-foot { max-width: 880px; margin: 0 auto; padding: 0 16px 40px; text-align: center; color: var(--muted); font-size: 14px; }
.app-foot[hidden] { display: none; }

/* ---------- Home page (visitors who are not signed in) ---------- */
#home[hidden], .starting-signed-in #home { display: none; }
#guest[hidden], #app[hidden] { display: none; }
#home { max-width: 980px; margin: 0 auto; padding: 8px 16px 64px; }
.hero { text-align: center; padding: 40px 8px 28px; }
.hero h1 { font-size: 44px; line-height: 1.12; letter-spacing: -.03em; max-width: 760px; margin: 0 auto 14px; }
.hero h1 em { font-style: normal; color: var(--brand); }
.hero p.lead { font-size: 19px; color: var(--muted); max-width: 640px; margin: 0 auto 26px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta button { font-size: 17px; padding: 12px 22px; }
.hero .small-note { color: var(--muted); font-size: 14px; margin-top: 14px; }
.exams { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 26px 0 0; padding: 0; list-style: none; }
.exams li { background: var(--card); border: 2px solid var(--line); border-radius: 99px; padding: 4px 14px; font-weight: 600; font-size: 14px; color: var(--heading); }
#home section { margin-top: 44px; }
#home h2 { font-size: 26px; text-align: center; margin: 0 0 6px; letter-spacing: -.02em; }
#home .section-sub { text-align: center; color: var(--muted); margin: 0 auto 20px; max-width: 620px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid3 .card h3 { margin: 6px 0 6px; font-size: 18px; color: var(--heading); }
.grid3 .card p { margin: 0; color: var(--muted); }
.step-num { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 12px;
  background: var(--brand); color: var(--brand-ink); font-weight: 800; box-shadow: 0 3px 0 var(--brand-deep); }
.feature-icon { font-size: 26px; color: var(--brand); }
.why { display: grid; grid-template-columns: 1.2fr 1fr; gap: 18px; align-items: center; }
.why .card p { margin: 0 0 10px; }
.why .card p:last-child { margin: 0; }
.fact { background: var(--brand); color: var(--brand-ink); border-radius: 22px; padding: 22px; box-shadow: var(--clay); }
.fact b { display: block; font-size: 22px; line-height: 1.25; margin-bottom: 8px; }
.faq details { background: var(--card); border: 2px solid var(--line); border-radius: 16px; padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 700; color: var(--heading); }
.faq details p { margin: 10px 0 0; color: var(--muted); }
.final-cta { text-align: center; }
#home footer { margin-top: 48px; text-align: center; color: var(--muted); font-size: 13px; }
@media (max-width: 760px) {
  .hero h1 { font-size: 32px; } .hero p.lead { font-size: 17px; }
  .grid3, .why { grid-template-columns: 1fr; }
}

/* People who ask their device for less motion get none. */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Public spelling-rule pages (/spelling-rules/...) ---------- */
a.logo { text-decoration: none; }
a.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 16px; border-radius: 14px;
  border: 2px solid var(--line); background: var(--card); color: var(--ink); box-shadow: 0 3px 0 var(--line);
  font-weight: 600; text-decoration: none; }
a.btn:hover { background: var(--soft); }
a.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); box-shadow: 0 4px 0 var(--brand-deep); }
a.btn.primary:hover { filter: brightness(1.08); }
a.btn.small { min-height: 36px; padding: 5px 12px; font-size: 14px; border-radius: 12px; }
.static-page { max-width: 760px; margin: 0 auto; padding: 8px 16px 48px; }
.static-page .card { margin-top: 16px; }
.static-page .card h2 { margin: 18px 0 8px; }
.static-page .card h2:first-child { margin-top: 0; }
.crumbs { font-size: 14px; color: var(--muted); margin: 4px 0 18px; }
.crumbs a { color: var(--brand); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.examples { list-style: none; padding: 0; margin: 0 0 14px; display: flex; flex-wrap: wrap; gap: 6px; }
.rule-links { padding-inline-start: 20px; }
.rule-links li { margin: 6px 0; }
.rule-links a, .static-foot a { color: var(--brand); }
.rule-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 8px; }
a.rule-card { display: block; margin: 0 !important; text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
a.rule-card:hover { border-color: var(--brand); transform: translateY(-2px); }
a.rule-card h2 { font-size: 17px; margin: 0 0 6px; }
a.rule-card p { margin: 0 0 10px; color: var(--muted); font-size: 15px; }
a.rule-card .more { color: var(--brand); font-weight: 700; font-size: 14px; }
.cta-box { margin-top: 24px; padding: 22px; border-radius: 22px; background: var(--brand); color: var(--brand-ink); }
.cta-box h2 { color: var(--brand-ink); margin: 0 0 6px; }
.cta-box p { margin: 0 0 12px; }
.cta-box a.btn.primary { background: var(--card); color: var(--brand); border-color: var(--card); box-shadow: 0 4px 0 rgba(0, 0, 0, .18); }
.cta-box a.btn:not(.primary) { background: transparent; color: var(--brand-ink); border-color: currentColor; box-shadow: none; }
.static-foot { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; text-align: center; color: var(--muted); font-size: 13px; }
#home .home-rule-links { columns: 2; column-gap: 28px; margin: 0 0 16px; }
#home .home-rule-links li { break-inside: avoid; }
#home footer a { color: var(--brand); }
@media (max-width: 600px) { #home .home-rule-links { columns: 1; } }
