* {
  margin: 0;
  box-sizing: border-box;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

*:not(input) {
  user-select: none;
  -webkit-user-select: none;
}

body {
  --bg-l0: #fff;
  --bg-l1: #f1f1f1;
  --bg-l2: #e4e4e4;

  --txt-c0: #111;
  --txt-c1: #333;
  --txt-c2: #777;
  --txt-inv: #f5f5f5;

  --txt-xs: 0.7em;
  --txt-s: 0.85em;
  --txt-m: 1em;
  --txt-l: 1.1em;
  --txt-xl: 2em;

  --btn-bg: #3d6dff;
  --btn-bgh: #1d4ee1;
  --btn-rad: var(--rad-m);

  --rad-m: 12px;
  --rad-l: calc(var(--rad-m) * 2);

  --light-border: rgba(0, 0, 0, 0.2);
  --shadowh: 0 5px 10px rgba(0, 0, 0, 0.2);
  --tr: 0.2s;
  --tr-l: 0.4s;

  --wrong-bg: rgba(255, 0, 0, 0.2);
  --wrong-border: 1px solid rgba(255, 0, 0, 0.6);
  --correct-bg: rgba(0, 255, 0, 0.2);
  --correct-border: 1px solid rgba(0, 255, 0, 0.6);
  --partial-correct-bg: rgba(255, 205, 0, 0.2);
  --partial-correct-border: 1px solid rgba(255, 205, 0, 0.6);
}

body {
  background: var(--bg-l0);
  color: var(--txt-c1);
  font-size: var(--txt-m);
}

h2 {
  font-size: var(--txt-xl);
  color: var(--txt-c0);
}

h3 {
  font-weight: 300;
}

h4 {
  text-transform: uppercase;
  font-weight: 300;
  position: relative;
  color: var(--txt-c2);
  font-size: var(--txt-l);
  padding-bottom: 3px;
  margin-bottom: 3px;
  margin-top: 2px;
  border-bottom: 1px solid var(--light-border);
}

small {
  font-style: italic;
  color: var(--txt-c2);
}

header {
  position: fixed;
  top: 10px;
  text-align: center;
  width: 100vw;
  color: var(--txt-c2);
  font-size: 14px;
  z-index: 2;
}

header a {
  color: var(--txt-c2);
}

header a:hover {
  color: var(--txt-c1);
}

#app {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100vw;
  height: 100vh;
}

input[type="number"],
input[type="text"] {
  padding: 8px 15px;
  margin: 2px;
  border: 1px solid var(--light-border);
  background: var(--bg-l0);
  border-radius: var(--rad-m);
}
input::placeholder,
input::-webkit-input-placeholder {
  color: var(--txt-c2)
}
input, select {
  color: var(--txt-c1);
}

button {
  border: 0;
  background: 0;
}

.btn {
  background: var(--btn-bg);
  border-radius: var(--rad-m);
  padding: 8px 15px;
  font-weight: 700;
  font-size: var(--txt-m);
  cursor: pointer;
  color: var(--txt-inv);
  transition: var(--tr);
  margin: 5px;
}

.btn:not([disabled]):hover {
  box-shadow: var(--shadowh);
  background: var(--btn-bgh);
}

.btn[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-gray {
  background: var(--bg-l1);
  color: var(--txt-c1);
}

.btn-gray:not([disabled]):hover {
  background: var(--bg-l2);
}

.back {
  font-size: var(--txt-s);
  color: var(--txt-c2);
  cursor: pointer;
  transition: var(--tr);
}

.back:hover {
  color: var(--txt-c0);
}

.back::before {
  content: "← ";
  transition: var(--tr);
  display: inline-block;
  translate: -2px 0;
}

.back:hover::before {
  translate: -4px 0;
}

.flex {
  display: flex;
}

.pane {
  position: absolute;
  transition: var(--tr-l) all;
  opacity: 0;
  scale: 0.98;
  padding: 20px;
  max-width: min(500px, 100vw);
  min-width: 300px;
  max-height: 450px;
  overflow-y: auto;
  box-shadow: 0 40px 70px rgba(0, 0, 0, 0.2);
  border-radius: 20px;
  pointer-events: none;
  translate: 0px 1px;
  border: 1px solid var(--light-border);
  background: var(--bg-l1);
}

.pane#begin {
  min-width: 200px;
}

.pane#quiz {
  overflow: hidden;
}

.pane#quiz-start {
  width: 600px;
}

.showing {
  opacity: 1;
  scale: 1;
  translate: 0;
  pointer-events: all;
}

.quiz-option-select {
  display: flex;
  padding: 2px;
}

.quiz-option {
  padding: 3px 6px;
  transition: var(--tr-l);
  cursor: pointer;
  margin: 2px;
  min-width: 45px;
  text-align: center;
  border: 1px solid var(--light-border);
  border-radius: var(--rad-m);
  animation: scale-smaller var(--tr-l);
}

.quiz-option.selected {
  background: var(--btn-bg);
  color: var(--txt-inv);
  animation: scale-bigger var(--tr-l);
  font-weight: bold;
}

fieldset {
  border: 1px solid var(--light-border);
  border-radius: var(--rad-l);
  padding: 10px;
  margin: 6px 3px;
  background: var(--bg-l2)
}

[construction] {
  position: relative;
}

[construction]::after {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  height: 100%;
  width: 100%;
  background: rgba(255, 255, 255, 0.01);
  backdrop-filter: blur(15px);
  content: "w.i.p.";
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--txt-l);
  font-style: italic;
  z-index: 3;
  border-radius: var(--rad-l)
}

@keyframes scale-bigger {
  50% {
    scale: 1.1;
    rotate: 2deg;
    box-shadow: 0 0 20px -3px rgba(43, 0, 255, 0.2);
  }
}

@keyframes scale-smaller {
  50% {
    scale: 0.9;
    rotate: -2deg;
  }
}

.quiz-content-outer {
  opacity: 1;
  min-width: 300px;
  transition: var(--tr-l);
}

.quiz-content-outer.hidden {
  opacity: 0;
  translate: 0px 3px;
}

.quiz-content-outer h3 {
  font-size: 17px;
  min-width: 300px;
}

.animator-inner {
  display: inline-block;
  width: fit-content;
}

.quiz-grade {
  display: inline-block;
  color: var(--txt-c2);
  font-size: var(--txt-s);
  text-decoration: underline;
  margin-left: 5px;
}

.quiz-grade:hover {
  color: var(--txt-c1);
  text-decoration: none;
  cursor: pointer;
}

.quiz-question-title {
  font-weight: 500;
}

.quiz-question-super {
  margin-bottom: 3px;
  border-bottom: 0 !important;
  padding-bottom: 0;
}

.quiz-question-input {
  width: 100%;
}

.quiz-question-input.correct {
  background: var(--correct-bg);
  border: var(--correct-border);
}

.quiz-question-input.wrong {
  background: var(--wrong-bg);
  border: var(--wrong-border);
  color: red;
}

.quiz-question-input.partial-correct {
  background: var(--partial-correct-bg);
  border: var(--partial-correct-border);
}

.invisible {
  opacity: 0;
  pointer-events: none;
  position: fixed;
}

.quiz-correct-answer {
  padding: 3px;
  margin: 2px;
  animation: correct-answer-load 0.5s;
  background: var(--bg-l1);
  border-radius: var(--rad-m);
}

.quiz-correct-answer::before {
  content: "Correct answer: ";
  color: var(--txt-c2);
  font-style: italic;
  font-size: var(--txt-s);
}

.quiz-results-q-wrong {
  color: red;
  font-weight: 300;
  text-decoration: line-through;
  margin-right: 4px;
  display: inline-block;
}

.quiz-results-q-correct {
  color: green;
  font-weight: 600;
}

.quiz-results-q-correct::after {
  content: "✓";
}

@keyframes correct-answer-load {
  from {
    opacity: 0;
    translate: -4px 0;
  }
}

/* Custom checkbox styles! */
input[type="checkbox"]+label {
  cursor: pointer;
  font-size: 90%;
}

input[type="checkbox"] {
  /* Remove most all native input styles */
  appearance: none;
  /* Not removed via appearance */
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  color: white;
  width: 1.15em;
  height: 1.15em;
  border: 1px solid var(--light-border);
  margin-right: 5px;
  border-radius: 0.15em;
  transform: translateY(-0.075em);
  transition: var(--tr);
}

input[type="checkbox"]::before {
  content: "";
  width: 0.65em;
  height: 0.65em;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  box-shadow: inset 0.5em 0.5em white;
  /* Windows High Contrast Mode */
  background-color: CanvasText;
}

input[type="checkbox"]:checked::before {
  transform: scale(1);
}

input[type="checkbox"]:checked {
  border: 1px solid var(--light-border);
  background: var(--btn-bg)
}

input[type="checkbox"]:focus {
  outline: 1px solid currentColor;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100vw;
  display: flex;
  justify-content: center;
}

.toast {
  width: fit-content;
  margin-bottom: 15px;
  padding: 7px 14px;
  background: var(--bg-l1);
  border: 1px solid var(--light-border);
  border-radius: var(--rad-m);
  transform-origin: bottom center;
  transition: var(--tr);
  animation: toast-come-in var(--tr);
}

.toast.hidden {
  scale: 0.9;
  opacity: 0;
}

.toast.error {
  background: var(--wrong-bg);
  border: var(--wrong-border);
}

.toast.success {
  background: var(--correct-bg);
  border: var(--correct-border);
}

.toast-description.smaller {
  font-size: var(--txt-s);
  color: var(--txt-c2);
}

@keyframes toast-come-in {
  from {
    scale: 0.9;
    opacity: 0;
  }
}


/*******
View 
*******/
select {
  padding: 4px 9px;
  border: 1px solid var(--light-border);
  background: var(--bg-l1);
  border-radius: var(--rad-m);
  margin: 3px;
  transition: 0.2s;
  cursor: pointer;
}

select.hidden {
  scale: 0.96;
  opacity: 0;
  pointer-events: none;
}

td,
th {
  border: 1px solid var(--light-border);
  padding: 5px 9px;
}

th {
  padding: 5px;
}

table {
  background: var(--bg-l1);
  border-radius: var(--rad-l);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px;
  overflow: hidden;
  padding: 5px 0;
}

.view-decl-super {
  border-bottom: 0;
  margin-top: 12px;
  margin-bottom: 0;
}

.view-vocab-word {
  margin: 1px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--light-border)
}

.view-vocab-word:last-child {
  border-bottom: 0;
}

.view-vocab-word .rendered-answer {
  margin-left: 10px;
}


.rendered-answer {
  opacity: 0.6;
  margin-left: 3px;
  display: inline-block;
}

.quiz-content-outer .rendered-answer {
  font-size: 13px;
  opacity: 1;
}

.answer-note {
  font-style: italic;
  font-size: 12px;
  opacity: 0.7;
}

@media (prefers-color-scheme: dark) {
  body {
    --bg-l0: rgb(19, 19, 19);
    --bg-l1: rgb(29, 29, 29);
    --bg-l2: rgb(39, 39, 39);

    --txt-c0: #eee;
    --txt-c1: rgb(195, 195, 195);
    --txt-c2: #777;

    --light-border: rgb(84, 84, 84);
  }
}