:root {
  --ground: #e8eeea;
  --paper: #fbfcfb;
  --edge: #c9d6cf;
  --ink: #16302b;
  --soft: #4b625b;
  --pine: #0f5c49;
  --on-pine: #ffffff;
  --miss: #a4341f;
  --got: #0f5c49;
  --serif: "Iowan Old Style", "Palatino Linotype", Charter, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #10201c;
    --paper: #1b2f2a;
    --edge: #35504a;
    --ink: #e7f0ec;
    --soft: #a7bdb5;
    --pine: #7fd8bb;
    --on-pine: #0c1f1a;
    --miss: #f2a08e;
    --got: #7fd8bb;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
  padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right));
}
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  max-width: 40rem; width: 100%; margin: 0 auto;
  padding-block: calc(12px + env(safe-area-inset-top)) 12px;
}
.brand { font-family: var(--serif); font-size: 1.125rem; color: var(--ink); text-decoration: none; }
nav a, .link { color: var(--ink); background: none; border: 0; padding: 8px 0; font: inherit; text-decoration: underline; cursor: pointer; }
nav { display: flex; gap: 16px; }
main { flex: 1; max-width: 40rem; width: 100%; margin: 0 auto; padding-block: 24px 48px; outline: none; }
h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.75rem, 6vw, 2.25rem); line-height: 1.15; margin: 0 0 12px; }
h2 { font-size: 1rem; margin: 32px 0 8px; }
p { margin: 0 0 16px; }
.lede { color: var(--soft); max-width: 34rem; }
.small { font-size: .875rem; color: var(--soft); }
label { display: block; font-weight: 600; margin: 16px 0 4px; }
input[type=email], input[type=text], input[type=url], textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--paper);
  border: 1px solid var(--soft); border-radius: 6px; padding: 12px;
}
textarea { min-height: 14rem; resize: vertical; line-height: 1.45; }
input[inputmode=numeric] { letter-spacing: .3em; font-size: 1.25rem; }
.btn {
  display: inline-block; min-height: 48px; padding: 12px 20px; border-radius: 6px;
  font: 600 1rem var(--sans); text-decoration: none; text-align: center; cursor: pointer;
  background: var(--pine); color: var(--on-pine); border: 1px solid var(--pine);
}
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--soft); }
.btn[disabled] { opacity: .6; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; align-items: center; }
:focus-visible { outline: 3px solid var(--pine); outline-offset: 2px; }
.error { color: var(--miss); margin-top: 8px; }
.status { position: fixed; bottom: calc(16px + env(safe-area-inset-bottom)); left: 16px; right: 16px; text-align: center; pointer-events: none; }
.status span { display: inline-block; background: var(--ink); color: var(--ground); padding: 8px 12px; border-radius: 6px; }
.status:empty { display: none; }

.decks { list-style: none; margin: 16px 0 0; padding: 0; }
.decks li { border-top: 1px solid var(--edge); }
.decks li:last-child { border-bottom: 1px solid var(--edge); }
.decks a { display: block; padding: 16px 0; color: inherit; text-decoration: none; }
.decks .row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 0; }
.decks strong { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.1875rem; }
.decks a:hover strong { text-decoration: underline; }

.choice { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.choice button { min-height: 44px; padding: 8px 14px; font: inherit; color: var(--ink); background: none; border: 1px solid var(--edge); border-radius: 6px; cursor: pointer; }
.choice button[aria-pressed=true] { border-color: var(--pine); box-shadow: inset 0 0 0 1px var(--pine); font-weight: 600; }

/* The card and the paper stack behind it, which thins as the session goes. */
.stage { position: relative; margin-top: 8px; }
.stack-1 { padding-bottom: 5px; }
.stack-2 { padding-bottom: 10px; }
.stack-3 { padding-bottom: 15px; }
.sheet-1 { transform: translateY(5px) scale(.988); }
.sheet-2 { transform: translateY(10px) scale(.976); }
.sheet-3 { transform: translateY(15px) scale(.964); }
.sheet { position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: var(--paper); border: 1px solid var(--edge); border-radius: 10px; }
.card {
  position: relative; display: block; width: 100%; min-height: min(56dvh, 26rem); padding: 24px;
  text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--paper); border: 1px solid var(--edge); border-radius: 10px;
}
.card-q { font-family: var(--serif); font-size: clamp(1.375rem, 5vw, 1.75rem); line-height: 1.25; margin: 0 0 16px; }
.card-a { margin: 0; line-height: 1.55; font-size: 1.0625rem; }
.card .kind { font-size: .875rem; color: var(--soft); margin-bottom: 8px; }
.flip { animation: turn .22s ease-out; }
@keyframes turn { from { transform: rotateX(8deg) translateY(4px); opacity: .55; } }
details { margin-top: 16px; }
summary { cursor: pointer; padding: 8px 0; }
.grade { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.grade .again { background: transparent; color: var(--miss); border-color: var(--miss); }
.progress { display: flex; justify-content: space-between; font-size: .875rem; color: var(--soft); margin-bottom: 8px; }
.notice { background: var(--paper); border-left: 4px solid var(--pine); padding: 12px 16px; margin-bottom: 16px; }
.preview-card { background: var(--paper); border: 1px solid var(--edge); border-radius: 10px; padding: 20px; margin-bottom: 12px; }
.preview-card h2 { font-family: var(--serif); font-weight: 500; font-size: 1.1875rem; margin: 0 0 8px; }
.wait { display: flex; gap: 12px; align-items: center; color: var(--soft); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pine); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (hover: none) { .btn, .link, nav a { min-height: 44px; } }
@media (prefers-reduced-motion: reduce) { .flip, .dot { animation: none; } }
