:root {
  --red: #cd0808;
  --red-dark: #a30606;
  --navy: #05055f;
  --bg: #f3f4f8;
  --ink: #16161d;
  --muted: #4b4e5c;
  --line: #eadfdf;
  --card: #fff;
  --shadow: 0 10px 30px rgba(5, 5, 95, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, "Nirmala UI", sans-serif;
  background:
    radial-gradient(900px 280px at 100% -40px, rgba(205, 8, 8, .08), transparent 60%),
    var(--bg);
  color: var(--ink);
  line-height: 1.55;
}
a { color: var(--navy); }
.top { background: linear-gradient(90deg, #b40707, var(--red) 42%, #9a0707); color: #fff; }
.top-inner, .nav-row, main, .foot-inner { max-width: 1120px; margin: 0 auto; }
.top-inner { padding: .95rem 1.1rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.brand { color: #fff; text-decoration: none; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; font-size: clamp(1.05rem, 2.4vw, 1.4rem); line-height: 1.05; }
.brand small { display: block; margin-top: .15rem; letter-spacing: .12em; text-transform: uppercase; font-size: .68rem; font-weight: 700; opacity: .9; }
.main-link { color: #fff; border: 1px solid rgba(255,255,255,.75); border-radius: 999px; padding: .4rem .8rem; text-decoration: none; font-weight: 700; font-size: .85rem; white-space: nowrap; }
.main-link:hover, .main-link:focus-visible { background: #fff; color: var(--red); }
.nav { background: var(--navy); position: sticky; top: 0; z-index: 5; }
.nav-row { display: flex; flex-wrap: wrap; gap: .15rem; padding: .35rem .4rem; }
.nav a { color: #fff; text-decoration: none; padding: .55rem .75rem; font-weight: 650; font-size: .88rem; border-radius: 999px; }
.nav a:hover, .nav a:focus-visible, .nav a[aria-current="page"] { background: #fff; color: var(--navy); }
main { padding: 1.4rem 1rem 3rem; }
h1 { margin: 0 0 .35rem; font-size: clamp(1.7rem, 3.2vw, 2.35rem); letter-spacing: -.03em; line-height: 1.15; }
.lede { margin: 0 0 1.15rem; max-width: 42rem; color: var(--muted); font-size: 1.05rem; }
.intro {
  display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end;
  margin-bottom: 1.1rem;
}
.eyebrow { margin: 0 0 .35rem; color: var(--red); font-weight: 800; letter-spacing: .14em; text-transform: uppercase; font-size: .75rem; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card {
  display: flex; flex-direction: column; gap: .45rem;
  background: var(--card); color: inherit; text-decoration: none;
  border-radius: 18px; padding: 1.05rem 1.05rem 1rem;
  box-shadow: var(--shadow); border: 1px solid rgba(5, 5, 95, .06);
  min-height: 210px; transition: transform .16s ease, box-shadow .16s ease;
}
.card:hover, .card:focus-visible { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(5, 5, 95, .14); }
.icon {
  width: 64px; height: 64px; border-radius: 18px;
  display: grid; place-items: center; color: #fff; margin-bottom: .25rem;
}
.icon svg { width: 34px; height: 34px; }
.icon.navy { background: linear-gradient(160deg, #1a1a8a, var(--navy)); }
.icon.red { background: linear-gradient(160deg, #e23a3a, var(--red)); }
.card strong { color: var(--navy); font-size: 1.12rem; letter-spacing: -.02em; }
.card-copy { color: var(--muted); font-size: .95rem; }
.card-go { margin-top: auto; color: var(--red); font-weight: 800; font-size: .86rem; }
.panel, .preview-doc {
  background: #fff; border-radius: 18px; box-shadow: var(--shadow);
  border: 1px solid rgba(5, 5, 95, .06); padding: 1.2rem 1.15rem 1.3rem;
}
.tool-head { display: flex; gap: .9rem; align-items: flex-start; margin-bottom: 1rem; }
.tool-head .icon { flex: 0 0 auto; }
.tool-head h1 { margin-bottom: .25rem; }
.tool-head .lede { margin: 0; }
label { display: block; font-weight: 700; margin: .95rem 0 .35rem; color: var(--navy); }
input, select, textarea {
  width: 100%; max-width: 40rem; font: inherit; color: var(--ink);
  padding: .7rem .8rem; border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px rgba(205, 8, 8, .12); }
input[type="file"] { background: #fff7f7; border-style: dashed; }
label.check { display: flex; align-items: center; gap: .55rem; font-weight: 650; }
label.check input { width: 1.05rem; height: 1.05rem; max-width: none; accent-color: var(--red); }
button {
  background: var(--red); color: #fff; border: 0; font: inherit; font-weight: 800;
  padding: .72rem 1.15rem; border-radius: 999px; cursor: pointer;
}
button:hover, button:focus-visible { background: var(--red-dark); }
button.navy { background: var(--navy); }
.row { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; margin-top: 1rem; }
.note, .status { font-size: .95rem; color: var(--muted); }
.status { min-height: 1.4em; font-weight: 700; color: var(--navy); }
canvas, .sheet { max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-top: 1rem; }
.stats { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1rem 0; }
.stat { background: #fff; border-radius: 14px; box-shadow: var(--shadow); padding: .7rem .9rem; min-width: 7.2rem; }
.stat b { display: block; font-size: 1.55rem; color: var(--navy); letter-spacing: -.03em; }
.passage { background: #fafafa; border: 1px solid var(--line); border-radius: 14px; padding: 1rem; font-size: 1.16rem; line-height: 1.75; }
.passage .ok { background: #e5f6e8; border-radius: 3px; }
.passage .bad { background: #ffe1e1; border-radius: 3px; }
#typed { min-height: 7.5rem; font-size: 1.08rem; }
.preview-doc h2 { margin: 0 0 .2rem; color: var(--navy); letter-spacing: -.02em; }
.preview-doc h3 { margin: 1rem 0 .25rem; color: var(--red); font-size: 1rem; }
.preview-doc p { margin: .2rem 0; }
.preview-doc table { width: 100%; border-collapse: collapse; }
.preview-doc th, .preview-doc td { text-align: left; border-bottom: 1px solid #eee; padding: .5rem .3rem; vertical-align: top; }
.preview-doc th { width: 9rem; color: var(--navy); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.foot { background: var(--navy); color: #fff; }
.foot-inner { padding: 1.1rem 1rem 1.3rem; font-size: .92rem; }
.foot a { color: #fff; }
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .grid, .intro { grid-template-columns: 1fr; display: block; }
  .intro { margin-bottom: .4rem; }
  .nav-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav-row::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
  .card { min-height: 0; }
  .tool-head { flex-direction: column; }
  main { padding: 1rem .8rem 2.4rem; }
}
@media print {
  .top, .nav, .foot, .no-print, button { display: none !important; }
  body, .preview-doc { background: #fff; box-shadow: none; }
  main { max-width: none; padding: 0; }
}
