/* ---------------------------------------------------------------
   /learn/einstufungstest/ — the level test (js/level.js), and its card
   on the trainer overview. Loaded after artikel.css and trainer.css.

   Level colours as in the grammar guide: A1 green, A2 blue, B1 gold,
   B2 red, C1 violet.
   --------------------------------------------------------------- */

[data-level="a1"] { --lv: var(--green); --lv-soft: var(--green-soft); }
[data-level="a2"] { --lv: var(--blue); --lv-soft: var(--blue-soft); }
[data-level="b1"] { --lv: var(--gold-ink); --lv-soft: var(--gold-soft); }
[data-level="b2"] { --lv: var(--accent); --lv-soft: var(--accent-soft); }
[data-level="c1"] { --lv: var(--violet); --lv-soft: var(--violet-soft); }

/* --- The start ------------------------------------------------------------ */

.level--intro {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.level-lead {
  margin: 0;
  font-family: var(--font-display-latin);
  font-size: 1.45rem;
  font-weight: 600;
  line-height: 1.25;
}

.level-facts {
  margin: 8px 0 18px;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
}

.level-facts li {
  padding-left: 1.3em;
  position: relative;
  line-height: 1.8;
}

.level-facts li::before {
  content: "·";
  position: absolute;
  left: 0.4em;
  font-weight: 700;
  color: var(--ink);
}

.level-last {
  margin: 14px 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
}

/* --- A question -------------------------------------------------------------- */

.level .quiz-bar i {
  background: var(--ink);
}

.level-body {
  min-height: 15rem;
  padding-top: 26px;
}

.level-task {
  margin: 0 0 14px;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.level-sentence {
  margin: 0 0 24px;
  max-width: none;
  text-align: left;
  text-wrap: pretty;
}

.level-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.level-options.is-stacked {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.level-option {
  padding: 14px 12px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display-latin);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
}

.is-stacked .level-option {
  padding: 13px 16px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  text-align: left;
}

.level-option:hover {
  border-color: var(--ink-soft);
}

.level-option.is-picked {
  border-color: var(--ink);
  background: var(--surface-2);
}

.level-skip {
  display: block;
  margin: 18px 0 0 auto;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.level-skip:hover {
  color: var(--ink);
}

/* Type the missing word */
.level-input {
  width: auto;
  max-width: 100%;
  margin: 0 0.1em;
  padding: 2px 8px;
  border: 0;
  border-bottom: 3px solid var(--ink-soft);
  border-radius: 6px 6px 0 0;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  text-align: center;
}

.level-input:focus {
  outline: 0;
  border-bottom-color: var(--accent);
}

.level-hint {
  margin: -14px 0 20px;
  color: var(--ink-soft);
}

.level-type .btn[disabled],
.level-body > .btn[disabled] {
  opacity: 0.4;
  cursor: default;
}

/* Put the words in order */
.level-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 3.4rem;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  font-family: var(--font-display-latin);
  font-size: 1.25rem;
  font-weight: 600;
}

.level-built {
  display: contents;
}

.level-end {
  margin-left: -4px;
}

.level-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 3rem;
  margin-bottom: 20px;
}

.level-tile {
  padding: 8px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-display-latin);
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
}

.level-line .level-tile {
  border-color: var(--ink);
  background: var(--surface-2);
}

.level-tile:hover {
  border-color: var(--ink-soft);
}

/* --- The very short texts, each dressed as what it is ------------------------ */

.level-text {
  max-width: 30rem;
  margin: 0 0 18px;
}

.level-text p {
  margin: 0;
}

.level-from {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}

.level-words {
  font-size: 1.08rem;
  line-height: 1.55;
}

/* A chat message */
.level-text--msg {
  width: fit-content;
  padding: 10px 16px 12px;
  border-radius: 18px 18px 18px 4px;
  background: var(--blue-soft);
}

.level-text--msg .level-from {
  color: var(--blue);
}

/* A sign */
.level-text--sign {
  padding: 16px 20px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

.level-text--sign .level-from {
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.level-text--sign .level-words {
  font-weight: 700;
}

/* A note stuck to the fridge */
.level-text--note {
  width: fit-content;
  padding: 16px 20px 18px;
  background: var(--gold-soft);
  border-radius: 2px;
  transform: rotate(-1.2deg);
  box-shadow: 0 1px 0 var(--line);
}

.level-text--note .level-words {
  font-family: var(--font-display-latin);
  font-style: italic;
  font-size: 1.2rem;
}

.level-text--note .level-from {
  margin-bottom: 4px;
}

/* A small ad */
.level-text--ad {
  padding: 12px 16px;
  border: 1px solid var(--ink-soft);
  background: var(--surface);
}

.level-text--ad .level-from {
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* A headline */
.level-text--news {
  padding-left: 16px;
  border-left: 4px solid var(--accent);
}

.level-text--news .level-words {
  font-family: var(--font-display-latin);
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
}

/* A mail */
.level-text--mail {
  padding: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}

.level-text--mail .level-from {
  padding: 9px 16px;
  margin-bottom: 12px;
  background: var(--surface-2);
  font-size: 0.85rem;
  letter-spacing: 0;
  color: var(--ink);
}

.level-text--mail .level-words {
  padding: 0 16px;
}

/* A review */
.level-text--review {
  padding: 12px 16px 14px;
  border-radius: 12px;
  background: var(--surface-2);
}

.level-text--review .level-from {
  margin-bottom: 4px;
  font-size: 1rem;
  letter-spacing: 0.1em;
  color: var(--gold);
}

.level-question {
  margin: 0 0 12px;
  font-family: var(--font-display-latin);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
}

/* --- The result ------------------------------------------------------------------ */

.level--result {
  border-top-color: var(--lv, var(--blue));
}

.level-big {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 6px 0 0;
}

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

.level-big strong {
  font-family: var(--font-display-latin);
  font-size: clamp(3.4rem, 14vw, 5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--lv);
}

.level-shade {
  margin: 6px 0 22px;
  font-family: var(--font-display-latin);
  font-size: 1.25rem;
  font-weight: 600;
}

.level-scale {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-bottom: 26px;
}

.level-scale span {
  padding: 8px 0;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
}

.level-scale span.is-here {
  background: var(--lv-soft);
  color: var(--lv);
}

.level-mark {
  position: absolute;
  bottom: -10px;
  width: 0;
  height: 0;
  margin-left: -6px;
  border: 6px solid transparent;
  border-bottom-color: var(--ink);
}

.level-means {
  margin: 0 0 22px;
  font-size: 1.05rem;
  line-height: 1.6;
}

.level-rows {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.level-row {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.level-row .quiz-dots {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.level-row-n {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.level-note {
  margin: 0 0 26px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.6;
}

.level-next h2 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.level-links {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.level-links li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.level-links a {
  font-family: var(--font-display-latin);
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.level-links a::after {
  content: " →";
  color: var(--ink-soft);
}

.level-links a:hover {
  color: var(--accent);
}

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

.level-cta {
  margin-bottom: 22px;
  padding: 18px 20px 20px;
  border-radius: 14px;
  background: var(--green-soft);
}

.level-cta p {
  margin: 0 0 14px;
  line-height: 1.6;
}

.level-review {
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.level-review summary {
  padding: 12px 16px;
  font-weight: 600;
  cursor: pointer;
}

.level-review-list {
  margin: 0;
  padding: 0 16px 6px;
  list-style: none;
}

.level-review-list li {
  position: relative;
  padding: 12px 0 12px 3rem;
  border-top: 1px solid var(--line);
}

.level-review-list p {
  margin: 0;
}

.level-review-l {
  position: absolute;
  left: 0;
  top: 13px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.level-review-text {
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.level-review-q {
  font-size: 0.92rem;
  font-weight: 600;
}

.level-review-right {
  font-family: var(--font-display-latin);
  font-size: 1.05rem;
  font-weight: 600;
}

.level-review-given {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* --- Plain cells in the level table under the test ------------------------------ */

.drill-table td.plain {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink-soft);
}

/* --- The card on the trainer overview --------------------------------------------- */

.train-level {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 22px;
  margin-top: 16px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.train-level:hover {
  border-color: var(--ink-soft);
}

.train-level-scale {
  display: flex;
  gap: 4px;
}

.train-level-scale i {
  padding: 9px 9px;
  border-radius: 8px;
  background: var(--lv-soft);
  color: var(--lv);
  font-style: normal;
  font-size: 0.85rem;
  font-weight: 700;
}

.train-level-text {
  display: grid;
  gap: 2px;
}

.train-level-text b {
  font-family: var(--font-display-latin);
  font-size: 1.3rem;
  line-height: 1.2;
}

.train-level-text span {
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.train-level-text .train-level-last {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
}

.train-level-last[hidden] {
  display: none;
}

.train-level-go {
  font-weight: 600;
  white-space: nowrap;
  color: var(--accent);
}

@media (max-width: 760px) {
  .train-level {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-top: 12px;
    padding: 18px;
  }
}

@media (max-width: 600px) {
  .level-body {
    min-height: 0;
    padding-top: 20px;
  }

  .level-options {
    gap: 8px;
  }

  .level-option {
    padding: 13px 6px;
    font-size: 1.1rem;
  }

  .level-line,
  .level-tile {
    font-size: 1.08rem;
  }

  .level-review-list li {
    padding-left: 2.4rem;
  }
}
