:root {
  --ink: #1f2933;
  --muted: #627d98;
  --paper: #eef2f6;
  --card: #fff;
  --line: #d9e2ec;
  --theme: #1e4d7b;
  --bio: #2f6b3a;
  --chem: #7c3a6b;
  --phys: #1e4d7b;
  --alg: #155e75;
  --geo: #5b3d14;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", Calibri, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
}
header {
  background: var(--theme);
  color: #fff;
  padding: 14px 16px 12px;
}
header h1 { margin: 0; font-size: 1.15rem; }
header p { margin: 4px 0 0; opacity: .88; font-size: .88rem; line-height: 1.3; overflow-wrap: break-word; }
header .site { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
header .site a, header > a {
  color: #fff; text-decoration: none; font-weight: 700; font-size: .86rem;
  border: 1px solid rgba(255,255,255,.45); padding: 5px 10px; border-radius: 9px;
  display: inline-block;
}
header .site a.on, header > a.on { background: rgba(255,255,255,.18); }
.menu .stat { background: #0f5f6b; }
.wrap { max-width: 640px; margin: 0 auto; padding: 12px 14px 28px; width: 100%; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.filters.hidden { display: none; }
.filters button {
  border: 1px solid #9fb3c8;
  background: #fff;
  color: #334e68;
  border-radius: 999px;
  padding: 6px 11px;
  font: inherit;
  font-size: .86rem;
  font-weight: 700;
  cursor: pointer;
}
.filters button.on { color: #fff; border-color: transparent; background: var(--theme); }
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 10px; font-size: .9rem; color: var(--muted);
  flex-wrap: wrap;
}
.toolbar button {
  border: 1px solid #9fb3c8; background: #fff; border-radius: 9px;
  padding: 6px 10px; font: inherit; font-weight: 700; cursor: pointer; color: var(--theme);
}
.flash {
  display: grid;
  cursor: pointer;
  min-height: 240px;
}
.face {
  grid-area: 1 / 1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 16px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .08);
  display: flex; flex-direction: column;
}
.face.back { visibility: hidden; }
.flash.flip .front { visibility: hidden; }
.flash.flip .back { visibility: visible; }
.tag {
  display: inline-block;
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  width: fit-content;
  background: var(--theme);
}
.tag.bio { background: var(--bio); }
.tag.chem { background: var(--chem); }
.tag.phys { background: var(--phys); }
.tag.alg { background: var(--alg); }
.tag.geo { background: var(--geo); }
.q {
  margin: 16px 0 12px;
  font-size: 1.22rem;
  line-height: 1.32;
  font-weight: 700;
  overflow-wrap: break-word;
  word-break: break-word;
}
.a {
  margin: 12px 0 10px;
  font-size: 1.06rem;
  line-height: 1.4;
  overflow-wrap: break-word;
}
.hint { margin-top: auto; font-size: .82rem; color: var(--muted); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.actions button {
  border: 0; border-radius: 12px; padding: 12px 10px;
  font: inherit; font-weight: 800; cursor: pointer; font-size: 1rem;
}
.again { background: #fff3d6; color: #8a5a00; }
.know { background: #e8f6ee; color: #1b7a45; }
.done {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 18px; text-align: center;
}
.done h2 { margin: 0 0 8px; color: var(--theme); }
.keys { margin-top: 14px; font-size: .8rem; color: var(--muted); }
.menu { display: grid; gap: 10px; margin-top: 8px; }
.menu a {
  display: block;
  text-decoration: none;
  color: #fff;
  border-radius: 16px;
  padding: 18px 16px;
  font-weight: 800;
  font-size: 1.15rem;
}
.menu a span { display: block; font-size: .88rem; font-weight: 600; opacity: .9; margin-top: 4px; }
.menu .bio { background: var(--bio); }
.menu .chem { background: var(--chem); }
.menu .phys { background: var(--phys); }
.menu .math { background: var(--alg); }
.pdfs { margin-top: 18px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.pdfs h2 { margin: 0 0 8px; font-size: 1rem; color: var(--theme); }
.pdfs a { display: block; margin: 6px 0; color: var(--theme); font-weight: 700; }
@media (max-width: 720px) {
  .wrap { padding: 10px 10px 24px; }
  .q { font-size: 1.05rem; }
  .actions button { padding: 11px 6px; font-size: .95rem; }
}
.print-sheet { display: none; }
@media print {
  header, .wrap { display: none !important; }
  .print-sheet { display: block; }
  @page { size: A4; margin: 9mm 8mm; }
  body { background: #fff; }
  .sheet { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .pcard {
    border: 1.5px solid #9fb3c8;
    border-radius: 8px;
    padding: 7px 8px 6px;
    break-inside: avoid;
    page-break-inside: avoid;
    min-height: 58mm;
  }
  .pcard .pq { font-weight: 800; font-size: 10.2pt; margin: 6px 0; }
  .pcard .pa {
    border-top: 1px dashed #bcccdc;
    padding-top: 5px;
    font-size: 9.6pt;
    line-height: 1.32;
  }
  .print-head {
    display: flex; justify-content: space-between; align-items: baseline;
    border-bottom: 2px solid var(--theme); margin-bottom: 7px; padding-bottom: 4px;
  }
  .print-head h1 { font-size: 13pt; color: var(--theme); margin: 0; }
  .print-head span { font-size: 8.5pt; color: #627d98; }
}
