:root {
  color-scheme: light dark;
  --bg: #f6f4ef;
  --surface: #fffefb;
  --text: #1f1d2b;
  --muted: #6b6878;
  --line: #e2ded3;
  --accent: #5a48c4;
  --on-accent: #fff;
  --fail: #b3412e;
  --fail-soft: #f9e6e1;
  --succeed: #1f7a56;
  --succeed-soft: #dff3ea;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15141c;
    --surface: #1f1e29;
    --text: #ecebf2;
    --muted: #a09db0;
    --line: #34323f;
    --accent: #9d8ff5;
    --on-accent: #15141c;
    --fail: #f0907e;
    --fail-soft: #3d2420;
    --succeed: #6fd0a6;
    --succeed-soft: #1a3a2d;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 system-ui, sans-serif;
}
.top, main, footer { max-width: 46rem; margin: 0 auto; padding: 0 1rem; }
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 1.5rem; }
h1, h2, .lead { font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; }
h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: 1.3rem; margin: 0; }
#account { display: flex; align-items: baseline; gap: .75rem; color: var(--muted); font-size: .9rem; }
main { padding-bottom: 2rem; }
section { margin-top: 2.25rem; }
section > .muted { margin: .1rem 0 .9rem; }
footer { padding-bottom: 2rem; text-align: center; font-size: .85rem; }

.muted, .meta { color: var(--muted); }
.meta { font-size: .85rem; }
strong.fail, .stat.fail .value { color: var(--fail); }
strong.succeed, .stat.succeed .value { color: var(--succeed); }

.welcome { margin-top: 3rem; max-width: 34rem; }
.lead { font-size: 2rem; line-height: 1.2; margin: 0 0 1rem; }
.providers { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }

.notice {
  margin: 1.5rem 0 0;
  padding: .7rem 1rem;
  border-radius: .5rem;
  background: var(--fail-soft);
  color: var(--fail);
}

button, .button, input, textarea { font: inherit; color: inherit; }
button, .button {
  display: inline-block;
  padding: .5rem 1rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--surface);
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { border-color: var(--accent); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.primary:hover { filter: brightness(1.1); }
.quiet { padding: .25rem .7rem; font-size: .9rem; }
.link { padding: 0; border: 0; background: none; color: var(--muted); font-size: inherit; text-decoration: underline; }
.chip { padding: .15rem .65rem; border-radius: 1rem; font-size: .85rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .7rem;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-top: 4px solid var(--line);
  border-radius: .6rem;
  background: var(--surface);
}
.card.fail { border-top-color: var(--fail); }
.card.succeed { border-top-color: var(--succeed); }
.card p { margin: 0; }
.card .text { font-size: 1.1rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.due .card + .card { margin-top: 1rem; }
.actions, .chips { display: flex; flex-wrap: wrap; gap: .5rem; }

.slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; }
label { display: flex; flex-direction: column; gap: .3rem; width: 100%; font-size: .85rem; color: var(--muted); }
label .title { font-size: 1rem; font-weight: 600; color: var(--text); }
textarea, input {
  width: 100%;
  padding: .5rem .6rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  background: var(--bg);
}
textarea { resize: vertical; }
input[type=date] { width: auto; align-self: flex-start; }

.badge {
  flex: none;
  padding: .1rem .55rem;
  border-radius: 1rem;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge.fail { background: var(--fail-soft); color: var(--fail); }
.badge.succeed { background: var(--succeed-soft); color: var(--succeed); }

.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.list li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .3rem .6rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--line);
}
.list .text { flex: 1 1 14rem; overflow-wrap: anywhere; }
.list .meta { flex-basis: 100%; }
.result { font-size: .85rem; font-weight: 600; white-space: nowrap; }
.result.right { color: var(--succeed); }
.result.wrong { color: var(--fail); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin: .9rem 0 1.25rem; }
.stat {
  display: flex;
  flex-direction: column;
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--surface);
}
.stat .label { font-size: .85rem; color: var(--muted); }
.stat .value { font-size: 1.5rem; font-weight: 600; }
