:root {
  --paper: #f2f0ec;
  --paper-shade: #e4e1da;
  --ink: #171614;
  --ink-soft: #4c4a45;
  --ink-faint: #8b8880;
  --line: #21201d;
  --shadow: rgba(33, 32, 29, 0.16);
  --shadow-small: rgba(33, 32, 29, 0.12);
  --right: #3f7a4a;
  --wrong: #b03a2e;
  --highlight: #1f5f7a;
  --radius: 14px 8px 16px 6px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14130f;
    --paper-shade: #1e1d19;
    --ink: #ece9e2;
    --ink-soft: #b6b2a9;
    --ink-faint: #75726b;
    --line: #d8d5cd;
    --shadow: rgba(0, 0, 0, 0.35);
    --shadow-small: rgba(0, 0, 0, 0.26);
    --right: #7fb98a;
    --wrong: #e0796b;
    --highlight: #d9b74a;
  }
}

:root[data-theme="dark"] {
  --paper: #14130f;
  --paper-shade: #1e1d19;
  --ink: #ece9e2;
  --ink-soft: #b6b2a9;
  --ink-faint: #75726b;
  --line: #d8d5cd;
  --shadow: rgba(0, 0, 0, 0.35);
  --shadow-small: rgba(0, 0, 0, 0.26);
  --right: #7fb98a;
  --wrong: #e0796b;
  --highlight: #d9b74a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1.5rem clamp(1rem, 6vw, 5rem) 3rem;
  font-family: var(--serif);
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.125rem);
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(
      115deg,
      transparent 0 7px,
      rgba(128, 128, 128, 0.045) 7px 8px
    ),
    repeating-linear-gradient(
      15deg,
      transparent 0 11px,
      rgba(128, 128, 128, 0.035) 11px 12px
    );
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  width: 100%;
  max-width: 54rem;
  margin: 0 auto;
}

h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  margin: 0 0 0.4em;
}

h1 {
  font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.4rem);
}

h2 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 0.9rem;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-skip-ink: none;
}

a:hover {
  text-decoration-style: wavy;
}

.reel {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 54rem;
  margin: 0 auto;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--line);
}

.mark {
  font-family: var(--mono);
  font-size: 1.15rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-decoration: none;
}

.reel nav {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.reel nav a[aria-current="page"] {
  color: var(--highlight);
  font-weight: 700;
}

.theme-toggle {
  align-self: center;
  display: inline-flex;
  align-items: center;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
}

.theme-toggle svg {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

.theme-toggle .sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .moon {
    display: none;
  }
}

:root[data-theme="dark"] .theme-toggle .sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .moon {
  display: none;
}

footer {
  width: 100%;
  max-width: 54rem;
  margin: 0 auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: none;
  color: var(--ink-faint);
}

footer a {
  color: inherit;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}

.crumbs a {
  color: var(--ink-soft);
}

.crumbs > * + *::before {
  content: ">";
  margin-right: 0.4rem;
  color: var(--ink-faint);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.page-head h1 {
  margin: 0;
}

.page-head .meta {
  margin: 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.card {
  padding: 1.5rem 1.6rem;
  background: var(--paper-shade);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--shadow);
}

.card.small {
  padding: 1rem 1.1rem;
  border-width: 1.5px;
  box-shadow: 3px 3px 0 var(--shadow-small);
}

.card.narrow {
  max-width: 26rem;
}

.cue .question {
  font-size: clamp(1.3rem, 1.1rem + 1vw, 1.9rem);
  line-height: 1.25;
  margin-bottom: 1rem;
}

.study-layout {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: minmax(0, 1fr) minmax(13rem, 17rem);
  align-items: start;
}

.study-filter {
  position: sticky;
  top: 1rem;
}

.study-filter summary {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  list-style: none;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.study-filter summary::-webkit-details-marker {
  display: none;
}

.study-filter summary::before {
  content: "+";
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 400;
}

.study-filter[open] summary {
  margin-bottom: 0.8rem;
}

.study-filter[open] summary::before {
  content: "\2212";
}

.study-filter form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.study-answer input[name="answer"] {
  min-height: 2.5rem;
  font-family: var(--mono);
  font-size: 1.05rem;
}

.answer {
  font-family: var(--mono);
  font-size: 0.95rem;
}

.lead {
  color: var(--ink-soft);
  font-size: 1.1rem;
}

.note {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.meta {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.verdict {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0.4rem 0 1.2rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.verdict::before {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.45em;
  height: 1.45em;
  border: 1.5px solid currentColor;
  border-radius: 999px;
}

.right {
  border-color: var(--right);
}

.right .verdict {
  color: var(--right);
}

.right .verdict::before {
  content: "\2713";
}

.right .answer {
  color: var(--right);
}

.wrong {
  border-color: var(--wrong);
  border-style: dashed;
}

.wrong .verdict {
  color: var(--wrong);
}

.wrong .verdict::before {
  content: "!";
  border-style: dashed;
}

.wrong .answer {
  color: var(--wrong);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 42rem) {
  .study-layout {
    grid-template-columns: 1fr;
  }

  .study-filter {
    position: static;
  }
}

dl {
  display: grid;
  grid-template-columns: minmax(6rem, max-content) 1fr;
  gap: 0.35rem 1rem;
  margin: 0 0 1rem;
}

dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-top: 0.15rem;
}

dd {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 0 1rem;
  border: 1.5px solid var(--line);
  border-radius: 10px 6px 12px 5px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.columns {
  display: grid;
  gap: 1.4rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  align-items: start;
}

.bank-additions {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.bank-additions summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  list-style: none;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

.bank-additions summary::-webkit-details-marker {
  display: none;
}

.bank-additions summary::before {
  content: "+";
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 400;
}

.bank-additions details[open] summary::before {
  content: "\2212";
}

.bank-additions details[open] summary {
  margin-bottom: 1.2rem;
}

.labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.6rem 0;
  padding: 0;
  list-style: none;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.labels li {
  padding: 0.15rem 0.55rem;
  border: 1.5px solid var(--ink-faint);
  border-radius: 999px;
  color: var(--ink-soft);
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin: 0;
}

.reel form,
.page-head form,
.actions form,
.card.small form {
  display: inline;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

label.inline {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.85rem;
}

fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  margin: 0;
  padding: 0.8rem 1rem;
  border: 1.5px dashed var(--ink-faint);
  border-radius: var(--radius);
}

legend {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0 0.4rem;
}

input,
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--line);
  border-radius: 0;
  padding: 0.35rem 0.2rem;
  text-transform: none;
  letter-spacing: normal;
}

textarea {
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem;
  resize: vertical;
}

input[type="checkbox"] {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--ink);
  border-bottom: none;
}

input[type="file"] {
  border-bottom: none;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px dashed var(--ink);
  outline-offset: 3px;
}

input:user-invalid,
select:user-invalid,
textarea:user-invalid {
  outline: 2px dashed var(--wrong);
  outline-offset: 3px;
}

button,
.button {
  align-self: flex-start;
  display: inline-block;
  padding: 0.45rem 1.1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--line);
  border-radius: 13px 11px 14px 12px;
  cursor: pointer;
}

button.ghost,
.button.ghost {
  color: var(--ink);
  background: transparent;
}

button.danger,
.button.danger {
  color: var(--ink);
  background: transparent;
  border-style: dashed;
}

button:not(:disabled):not([aria-disabled="true"]):hover,
.button:hover {
  translate: -1px -1px;
}

button:disabled,
button[aria-disabled="true"] {
  color: var(--ink-faint);
  background: transparent;
  border-color: var(--ink-faint);
  cursor: not-allowed;
}

[data-tip] {
  position: relative;
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 0.45rem);
  left: 50%;
  translate: -50% 0;
  z-index: 1;
  width: max-content;
  max-width: 15rem;
  padding: 0.4rem 0.6rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.4;
  letter-spacing: 0;
  text-transform: none;
  color: var(--paper);
  background: var(--ink);
  border-radius: 7px 4px 8px 3px;
  pointer-events: none;
}

button.plain {
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: none;
  color: var(--ink);
  background: transparent;
  border: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}

.alert {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  color: var(--wrong);
  border: 2px dashed var(--wrong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.alert::before {
  content: "!";
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3em;
  height: 1.3em;
  font-weight: 700;
  line-height: 1;
  border: 1.5px solid currentColor;
  border-radius: 999px;
}

.alert.good::before {
  content: "\2713";
  font-weight: 400;
}

.alert.good {
  color: var(--right);
  border-style: solid;
  border-color: var(--right);
}

.notice {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  color: var(--ink-soft);
  border: 1.5px solid var(--ink-faint);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.82rem;
}

.notice::before {
  content: "i";
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3em;
  height: 1.3em;
  font-weight: 700;
  line-height: 1;
  border: 1.5px solid currentColor;
  border-radius: 999px;
}

pre {
  overflow-x: auto;
  padding: 0.9rem 1rem;
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.5;
  border: 1.5px solid var(--ink-faint);
  border-radius: var(--radius);
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
}

.copyable {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.actions > .copyable {
  flex: 1;
  min-width: 12rem;
}

.copyable .answer {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.copy {
  display: none;
  flex: none;
  align-self: center;
  padding: 0.35rem;
  color: var(--ink-soft);
  background: transparent;
  border: 1.5px solid var(--ink-faint);
  border-radius: 6px 4px 7px 3px;
  cursor: pointer;
}

:root.js .copy {
  display: inline-flex;
}

.copy:hover {
  color: var(--ink);
  border-color: var(--line);
}

.copy svg {
  display: block;
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy .tick,
.copy.copied .clip {
  display: none;
}

.copy.copied .tick {
  display: block;
}

.copy.copied {
  color: var(--right);
  border-color: var(--right);
}
