.question-image {
  display: block;
  width: 100%;
  max-height: 430px;
  object-fit: contain;
  background: #f3f4f1;
  border-radius: 16px;
  margin: 0 0 24px;
}

.ticket strong {
  display: block;
  margin-top: 8px;
}

.number-strip .current {
  outline: 0;
  box-shadow: inset 0 0 0 3px var(--ink);
}

.finish-exam {
  flex: 0 0 auto;
  border: 1px solid #d7aaa5;
  background: var(--red-soft);
  color: var(--red);
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  cursor: pointer;
}

.history-link {
  margin-left: auto;
  margin-right: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.bottom-nav button {
  flex: 1;
  width: auto;
}

.history-page {
  max-width: 760px;
  margin: 0 auto;
}

.history-list,
.history-review {
  display: grid;
  gap: 10px;
}

.history-list > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.history-list span,
.history-list small,
.history-question small {
  display: block;
}

.history-list b {
  font: 700 24px Georgia, serif;
}

.history-list small {
  margin-top: 3px;
  color: var(--muted);
}

.history-list strong.pass { color: var(--green); }
.history-list strong.fail { color: var(--red); }

.history-question {
  padding: 17px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 15px;
  background: white;
}

.history-question.wrong,
.history-question.unanswered { border-left-color: var(--red); }
.history-question h3 { margin: 8px 0 14px; font: 700 20px/1.25 Georgia, serif; }
.history-question p { margin: 8px 0 0; }
.history-question small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.history-question .correct-line { padding: 9px; border-radius: 9px; background: var(--green-soft); }

.restart-history {
  width: 100%;
  margin: 0 0 14px;
  padding: 13px;
  border: 0;
  border-radius: 13px;
  background: var(--ink);
  color: white;
  font-weight: 800;
  cursor: pointer;
}

.related-attempts {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  margin-bottom: 14px;
  padding-bottom: 3px;
}

.related-attempts small {
  flex: 0 0 auto;
  color: var(--muted);
}

.related-attempts button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--ink);
}

.related-attempts button.active {
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

@media (max-width: 720px) {
  body.in-session .topbar {
    height: 46px;
    min-height: 46px;
    padding-top: max(5px, env(safe-area-inset-top));
    padding-bottom: 5px;
  }

  body.in-session .lang-switch {
    margin: 0 auto;
    padding: 2px;
    border-radius: 10px;
  }

  body.in-session .lang-switch button {
    min-width: 48px;
    padding: 5px 9px;
    border-radius: 8px;
  }

  body.in-session .brand {
    display: none;
  }

  body.in-session .history-link {
    display: none;
  }

  body.in-session main {
    padding: 7px 10px calc(12px + env(safe-area-inset-bottom));
  }

  body.in-session .bottom-nav {
    display: none;
  }

  body.in-session .session-head {
    min-height: 30px;
    margin-bottom: 4px;
    gap: 7px;
  }

  body.in-session .back {
    flex: 0 1 auto;
    max-width: none;
    padding: 3px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  body.in-session .status-pill {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 4px 9px;
    font-size: 12px;
  }

  body.in-session .finish-exam {
    padding: 4px 8px;
    font-size: 11px;
  }

  body.in-session .number-strip {
    gap: 5px;
    padding: 2px 0 7px;
  }

  body.in-session .number-strip button {
    min-width: 29px;
    width: 29px;
    height: 29px;
    border-radius: 8px;
    font-size: 12px;
  }

  body.in-session .number-strip .current {
    box-shadow: inset 0 0 0 2px var(--ink);
  }

  body.in-session .question-card {
    padding: 13px;
    border-radius: 17px;
  }

  body.in-session .question-meta {
    font-size: 10px;
  }

  body.in-session .question-card h1 {
    margin: 8px 0 10px;
    font: 700 clamp(18px, 5vw, 23px)/1.12 Georgia, serif;
  }

  body.in-session .question-image {
    max-height: 25vh;
    margin-bottom: 10px;
    border-radius: 11px;
  }

  body.in-session .answers {
    gap: 6px;
  }

  body.in-session .answer {
    grid-template-columns: 29px 1fr;
    gap: 8px;
    min-height: 41px;
    padding: 6px 9px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.2;
  }

  body.in-session .answer b {
    width: 27px;
    height: 27px;
    border-radius: 8px;
  }

  body.in-session .feedback {
    padding-top: 7px;
    font-size: 13px;
  }

  body.in-session .next {
    margin-top: 7px;
    padding: 10px;
  }

  .history-page .section-head {
    align-items: center;
  }

  .history-question {
    padding: 13px;
  }

  .history-question h3 {
    font-size: 17px;
  }
}
