body {
  background:
    linear-gradient(90deg, rgba(246, 250, 248, 0.94), rgba(246, 250, 248, 0.72)),
    url("./assets/background/schoolroom_01.png") center / cover fixed;
}

button {
  font: inherit;
}

.pages-nav {
  width: min(1120px, calc(100% - 32px));
  min-height: 58px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.pages-brand,
.pages-nav-links button {
  border: 0;
  background: transparent;
  color: #1f2a32;
  font-weight: 800;
}

.pages-brand {
  padding: 8px 0;
  font-size: 1.15rem;
}

.pages-nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pages-nav-links button {
  padding: 8px 4px;
}

.pages-brand:hover,
.pages-nav-links button:hover {
  color: #2e8b57;
}

.network-status {
  min-width: 5.4em;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e7f4ec;
  color: #28613e;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.network-status.offline {
  background: #fff2d5;
  color: #795213;
}

.loading-panel,
.error-panel {
  max-width: 680px;
  margin: 0 auto;
}

.loading-panel h1,
.error-panel h1 {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

.home-screen .main-panel {
  min-height: 610px;
}

.course-picker-panel select {
  width: 100%;
}

.level-status-list {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.level-status-item {
  min-height: 78px;
}

.study-mode-grid input,
.character-option-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.study-mode-grid input:focus-visible + label,
.character-option-card input:focus-visible + .character-choice-content {
  outline: 3px solid rgba(42, 124, 255, 0.45);
  outline-offset: 3px;
}

.study-mode-grid input:checked + label {
  border-color: #2e8b57;
  background: #f4fbf6;
  box-shadow: 0 8px 18px rgba(46, 139, 87, 0.14);
}

.choice-button[disabled] {
  cursor: default;
}

.question-actions {
  min-height: 68px;
}

.character-stage[hidden],
.dialogue-bubble[hidden] {
  display: none;
}

.settings-section {
  display: grid;
  gap: 16px;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid rgba(31, 42, 50, 0.12);
}

.settings-section h2,
.word-list-section h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 900;
}

.toggle-row {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 42, 50, 0.12);
  border-radius: 8px;
  background: #fff;
}

.toggle-row span,
.field-stack > span {
  display: grid;
  gap: 3px;
}

.toggle-row small,
.field-stack small,
.muted-text {
  color: #60707a;
}

.toggle-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
}

.field-stack {
  display: grid;
  gap: 12px;
}

.character-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.character-option-card {
  position: relative;
  cursor: pointer;
}

.character-choice-content {
  min-height: 170px;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 12px;
  border: 2px solid rgba(65, 136, 96, 0.2);
  border-radius: 10px;
  background: #fff;
  font-weight: 900;
}

.character-choice-content img {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

.character-option-card input:checked + .character-choice-content {
  border-color: #2e8b57;
  background: #f4fbf6;
  box-shadow: 0 8px 18px rgba(46, 139, 87, 0.14);
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.word-list {
  display: grid;
  gap: 10px;
}

.word-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(31, 42, 50, 0.12);
  border-radius: 8px;
  background: #fff;
}

.word-list-item > div {
  display: grid;
  gap: 2px;
}

.word-list-item strong {
  color: #37684a;
  font-weight: 900;
}

.word-list-item small {
  color: #60707a;
}

.mistake-count {
  flex: 0 0 auto;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fde8e5;
  color: #8a2d26;
  font-size: 0.84rem;
  font-weight: 800;
}

.data-status-card {
  padding: 16px;
  border: 1px solid rgba(55, 104, 74, 0.2);
  border-radius: 8px;
  background: #f4fbf6;
}

.data-status-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
}

.data-status-card dt {
  color: #37684a;
  font-weight: 900;
}

.data-status-card dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.settings-message {
  margin: 0 0 18px;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.noscript-message {
  margin: 24px;
  padding: 16px;
  border-radius: 8px;
  background: #fde8e5;
  color: #8a2d26;
  font-weight: 800;
}

@media (max-width: 767.98px) {
  .pages-nav {
    width: min(100% - 24px, 1120px);
    min-height: 54px;
  }

  .pages-nav-links {
    gap: 8px;
  }

  .pages-nav-links button {
    min-height: 44px;
    font-size: 0.92rem;
  }

  .network-status {
    display: none;
  }

  .home-screen .main-panel {
    min-height: 0;
  }

  .study-mode-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .character-option-grid {
    grid-template-columns: 1fr;
  }

  .character-choice-content {
    min-height: 120px;
    grid-template-columns: 92px 1fr;
    justify-items: start;
  }

  .character-choice-content img {
    width: 92px;
    height: 92px;
  }

  .question-header {
    align-items: flex-start;
  }

  .progress-pill {
    min-width: 96px;
    padding: 9px 12px;
  }

  .question-prompt {
    min-height: 82px;
    padding: 14px;
    font-size: clamp(1.8rem, 9vw, 2.5rem);
  }

  .word-list-item {
    align-items: flex-start;
  }

  .data-status-card dl {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .data-status-card dd:not(:last-child) {
    margin-bottom: 8px;
  }
}

@media (max-width: 430px) {
  .pages-brand {
    font-size: 1rem;
  }

  .pages-nav-links button {
    font-size: 0.86rem;
  }

  .level-status-list {
    grid-template-columns: 1fr 1fr;
  }

  .level-status-item {
    display: grid;
    align-content: center;
  }

  .level-status-item small {
    text-align: left;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .typing-answer-form {
    grid-template-columns: 1fr;
  }
}
