* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: #d8d8d8;
  color: #212121;
}

.screen {
  display: none;
  min-height: 100vh;
}

.screen.visible {
  display: block;
}

.topbar {
  height: 88px;
  background: #2f3b5a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) 16px 0;
}

.topbar h1 {
  margin: 0;
  font-size: 40px;
  font-weight: 600;
}

.exam-topbar {
  justify-content: space-between;
}

.red-line {
  height: 3px;
  background: #ef3f43;
}

.content {
  padding: 16px 12px 84px;
}

.card {
  background: #f7f7f7;
  border-radius: 6px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  margin-bottom: 14px;
}

.question-card {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.question-card p,
.review-item .question {
  white-space: pre-line;
}

.question-image {
  display: block;
  margin: 12px auto 0;
  max-width: 100%;
  border-radius: 6px;
}

.answers {
  display: grid;
  gap: 10px;
}

.answer-btn {
  width: 100%;
  border: none;
  border-radius: 6px;
  background: #f7f7f7;
  padding: 14px;
  text-align: left;
  font-size: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.answer-btn.selected {
  background: #cfe8ff;
  color: #1f2d3d;
  font-weight: 600;
  border: 1px solid #8fc5ff;
}

.answer-btn.correct {
  background: #43a047;
  color: #fff;
  font-weight: 600;
}

.answer-btn.wrong {
  background: #e53935;
  color: #fff;
  font-weight: 600;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  border-top: 2px solid #ef3f43;
  background: #f2f2f2;
}

.nav-btn {
  flex: 1;
  border: none;
  background: #f2f2f2;
  color: #ef3f43;
  font-size: 30px;
  padding: 14px 8px;
}

.nav-btn:disabled {
  color: #bdbdbd;
  background: #ededed;
}

.icon-btn {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 34px;
}

.icon-btn:disabled {
  color: #96a0ba;
}

#timer,
#counter {
  font-size: 38px;
  font-weight: 700;
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 600;
}

#shuffle-answers {
  width: 24px;
  height: 24px;
}

.btn {
  width: 100%;
  border: none;
  border-radius: 40px;
  padding: 16px 12px;
  margin-top: 12px;
  font-size: 32px;
  color: #fff;
  background: #ef3f43;
}

.card input[type="number"] {
  width: 100%;
  margin-top: 10px;
  border: 1px solid #bbb;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 18px;
}

.warning {
  margin: 10px 0 0;
  padding: 10px;
  border-radius: 6px;
  background: #fff3cd;
  color: #7a4f00;
  border: 1px solid #ffdd99;
  font-size: 14px;
}

.hidden {
  display: none;
}

.result-card h2 {
  margin: 0 0 8px;
  text-align: center;
  color: #2f3b5a;
}

.result-grid {
  display: flex;
  justify-content: space-around;
  text-align: center;
  margin: 18px 0;
}

.result-grid span {
  display: block;
  color: #666;
}

.result-grid strong,
#elapsed-time {
  font-size: 46px;
  color: #2f3b5a;
}

.result-card p {
  text-align: center;
  color: #666;
  margin: 6px 0;
}

#elapsed-time {
  display: block;
  text-align: center;
}

#pass-fail {
  margin: 10px -16px -16px;
  padding: 8px 0;
  text-align: center;
  font-size: 42px;
  font-weight: 700;
  color: #fff;
}

.status-pass {
  background: #55a84d;
}

.status-fail {
  background: #ef3f43;
}

.review-item .question {
  font-weight: 700;
  margin-bottom: 10px;
}

.review-list {
  padding-bottom: 24px;
}

@media (max-width: 480px) {
  .topbar h1 {
    font-size: 22px;
  }

  .answer-btn {
    font-size: 15px;
  }

  .nav-btn,
  .btn {
    font-size: 30px;
  }

  #timer,
  #counter {
    font-size: 34px;
  }
}
