@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@700;800&display=swap");

:root {
  --page-max-width: 1366px;
  --button-bg: #3aa0d8;
  --button-shadow: #1f7ab0;
  --button-shadow-soft: rgba(0, 0, 0, 0.18);
  --button-radius: 1.9rem;
  --success: #79e8a9;
  --danger: #ff8d8d;
  --safe-top: max(1rem, env(safe-area-inset-top));
  --safe-right: max(1rem, env(safe-area-inset-right));
  --safe-bottom: max(1rem, env(safe-area-inset-bottom));
  --safe-left: max(1rem, env(safe-area-inset-left));
}

body[data-theme="light"] {
  --bg: #15388d;
  --fg: #ffdc1a;
  --line: #f1d722;
  --button-fg: #ffdc1a;
  --button-icon-bg: #ffdc1a;
  --button-icon-fg: #15388d;
  --surface: rgba(58, 160, 216, 0.2);
  --surface-border: rgba(255, 220, 26, 0.22);
  --surface-strong: rgba(58, 160, 216, 0.28);
  --text-soft: rgba(255, 220, 26, 0.9);
  --input-bg: rgba(255, 255, 255, 0.12);
  --input-border: rgba(255, 220, 26, 0.24);
}

body[data-theme="dark"] {
  --bg: #050505;
  --fg: #f4f4f4;
  --line: #f4f4f4;
  --button-fg: #f4f4f4;
  --button-icon-bg: #f4f4f4;
  --button-icon-fg: #2c8fc4;
  --surface: rgba(58, 160, 216, 0.18);
  --surface-border: rgba(244, 244, 244, 0.16);
  --surface-strong: rgba(58, 160, 216, 0.24);
  --text-soft: rgba(244, 244, 244, 0.86);
  --input-bg: rgba(255, 255, 255, 0.08);
  --input-border: rgba(244, 244, 244, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Baloo 2", "Trebuchet MS", sans-serif;
  overflow: hidden;
  transition: background-color 220ms ease, color 220ms ease;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.app {
  height: 100dvh;
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
}

.app:fullscreen,
.app:-webkit-full-screen {
  background: var(--bg);
}

.screen {
  display: none;
  height: 100dvh;
  min-height: 100dvh;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  overflow: hidden;
}

.screen.is-active {
  display: block;
  animation: screen-in 260ms ease;
}

@keyframes screen-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen-shell {
  --screen-scale: 1;
  width: min(100%, var(--page-max-width));
  min-height: calc(100dvh - var(--safe-top) - var(--safe-bottom));
  margin: 0 auto;
  position: relative;
  transform: scale(var(--screen-scale));
  transform-origin: top center;
  will-change: transform;
}

.screen-shell--home {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(1.4rem, 4vw, 3rem);
  padding: clamp(2rem, 8vw, 5rem) clamp(0.6rem, 2vw, 1.4rem) clamp(2rem, 5vw, 3rem);
}

.screen-shell--settings {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: clamp(1.3rem, 3vw, 2.2rem);
  padding: clamp(1rem, 3vw, 1.6rem) clamp(0.6rem, 2vw, 1.4rem) clamp(2rem, 5vw, 3rem);
}

.screen-shell--quiz {
  display: grid;
  align-content: start;
  gap: clamp(1rem, 2vw, 1.5rem);
  padding: clamp(1rem, 3.2vw, 2.2rem) clamp(0.6rem, 2vw, 1.4rem) clamp(2rem, 4vw, 3rem);
}

.screen-shell--result {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: clamp(1rem, 2vw, 1.5rem);
  padding: clamp(1.5rem, 4vw, 2.4rem) clamp(0.6rem, 2vw, 1.4rem) clamp(2rem, 5vw, 3rem);
}

.flag-badge {
  position: absolute;
  top: clamp(0rem, 0.8vw, 0.6rem);
  left: clamp(-0.2rem, 0.3vw, 0.4rem);
  width: clamp(7rem, 18vw, 19rem);
  pointer-events: none;
}

.flag-badge__svg {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.18));
}

.title-block {
  max-width: min(92vw, 60rem);
  text-align: center;
}

.title-block--home {
  margin-top: clamp(5rem, 15vw, 8.5rem);
}

.title-block--question {
  justify-self: center;
  max-width: min(94vw, 72rem);
}

.title-block--result {
  width: min(100%, 60rem);
}

.title-block h1,
.title-block h2 {
  margin: 0;
  font-size: clamp(2.45rem, 5.3vw, 5.25rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-wrap: balance;
}

.title-block--question h2 {
  font-size: clamp(1.8rem, 4.2vw, 3.85rem);
}

.quiz-counter,
.result-kicker {
  margin: 0;
  font-size: clamp(1.2rem, 2.45vw, 2.15rem);
  line-height: 1;
}

.result-kicker {
  letter-spacing: 0.04em;
}

.chalk-line {
  position: relative;
  height: 0.9rem;
  width: min(100%, 38rem);
  margin: clamp(0.4rem, 1.3vw, 0.9rem) auto 0;
}

.chalk-line::before,
.chalk-line::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
}

.chalk-line::before {
  background:
    radial-gradient(circle at 0.35rem 50%, var(--line) 0 0.26rem, transparent 0.28rem) 0 50% / 0.9rem 100% repeat-x,
    linear-gradient(90deg, transparent 0%, var(--line) 6%, var(--line) 94%, transparent 100%);
  filter: blur(1px);
  opacity: 0.95;
}

.chalk-line::after {
  inset: 0.12rem 0.55rem 0.12rem 0.45rem;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
  mix-blend-mode: screen;
  opacity: 0.35;
}

.chalk-line--question {
  width: min(100%, 66rem);
}

.home-meta {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.home-meta__pill {
  margin: 0;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  background: var(--surface);
  border: 2px solid var(--surface-border);
  color: var(--text-soft);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  line-height: 1;
}

.resume-panel {
  width: min(100%, 44rem);
  padding: 1.15rem 1.2rem;
  border-radius: 1.8rem;
  background: var(--surface-strong);
  border: 2px solid var(--surface-border);
  text-align: center;
  animation: screen-in 220ms ease;
}

.resume-panel__title,
.resume-panel__text {
  margin: 0;
}

.resume-panel__title {
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  line-height: 1;
}

.resume-panel__text {
  margin-top: 0.35rem;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.35;
}

.resume-actions {
  display: flex;
  justify-content: center;
  margin-top: 0.95rem;
}

.menu-grid {
  width: min(100%, 72rem);
  display: grid;
  justify-content: center;
}

.menu-grid--home {
  grid-template-columns: repeat(2, minmax(16rem, 24rem));
  gap: clamp(1.2rem, 3vw, 3.4rem);
  align-items: center;
}

.menu-grid--result {
  grid-template-columns: repeat(2, minmax(16rem, 24rem));
  gap: clamp(1rem, 2.4vw, 2rem);
}

.menu-button {
  --button-font-size: clamp(1.4rem, 3vw, 3.1rem);
  appearance: none;
  border: 0;
  border-radius: var(--button-radius);
  background: var(--button-bg);
  color: var(--button-fg);
  min-height: clamp(4.5rem, 8.8vw, 5.85rem);
  padding: clamp(0.65rem, 1.2vw, 0.9rem) clamp(1rem, 1.9vw, 1.5rem);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(0.75rem, 1.5vw, 1.15rem);
  font-size: var(--button-font-size);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.01em;
  box-shadow:
    0 0.45rem 0 var(--button-shadow),
    0 1rem 2rem var(--button-shadow-soft);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease, opacity 160ms ease;
  position: relative;
  overflow: hidden;
}

.menu-button::after {
  content: "";
  position: absolute;
  inset: -30% -55%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-140%) rotate(12deg);
  transition: transform 420ms ease;
  pointer-events: none;
}

.menu-button:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.03);
}

.menu-button:hover:not(:disabled)::after {
  transform: translateX(140%) rotate(12deg);
}

.menu-button:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow:
    0 0.2rem 0 var(--button-shadow),
    0 0.55rem 1rem var(--button-shadow-soft);
}

.menu-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.menu-button:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 0.3rem rgba(255, 255, 255, 0.28),
    0 0 0 0.55rem rgba(58, 160, 216, 0.45),
    0 0.45rem 0 var(--button-shadow),
    0 1rem 2rem var(--button-shadow-soft);
}

.menu-button--home,
.menu-button--back {
  min-width: min(100%, 24rem);
}

.menu-button--wide {
  grid-column: 1 / -1;
  justify-self: center;
  min-width: min(100%, 33rem);
}

.menu-button--back {
  --button-font-size: clamp(1.5rem, 3.3vw, 2.7rem);
}

.menu-button--setting {
  min-width: min(100%, 38rem);
}

.menu-button--compact {
  --button-font-size: clamp(1.05rem, 1.8vw, 1.55rem);
  justify-content: center;
  min-width: min(100%, 15rem);
}

.menu-button--ghost {
  background: rgba(58, 160, 216, 0.25);
  box-shadow:
    0 0.35rem 0 rgba(31, 122, 176, 0.65),
    0 0.7rem 1.4rem rgba(0, 0, 0, 0.16);
}

.menu-button > * {
  position: relative;
  z-index: 1;
}

.menu-button__label {
  display: inline-block;
  transform: translateY(-0.05em);
  overflow-wrap: anywhere;
}

.icon-badge {
  width: clamp(3rem, 5.6vw, 4.35rem);
  height: clamp(3rem, 5.6vw, 4.35rem);
  border-radius: 50%;
  background: var(--button-icon-bg);
  color: var(--button-icon-fg);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}

.icon-badge svg {
  width: 62%;
  height: 62%;
  display: block;
}

.icon-glyph {
  width: clamp(2.6rem, 4vw, 3.8rem);
  height: clamp(2.6rem, 4vw, 3.8rem);
  color: currentColor;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
}

.icon-glyph--large {
  width: clamp(3rem, 5vw, 4.4rem);
  height: clamp(3rem, 5vw, 4.4rem);
}

.icon-glyph svg {
  width: 100%;
  height: 100%;
  display: block;
}

.top-bar {
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 2;
}

.settings-stack {
  width: min(100%, 38rem);
  display: grid;
  gap: clamp(1rem, 2vw, 1.35rem);
  margin-top: clamp(1.2rem, 2vw, 2rem);
}

.quiz-stage {
  display: grid;
  gap: clamp(1rem, 2vw, 1.5rem);
  transition: opacity 180ms ease, transform 180ms ease, filter 180ms ease;
}

.quiz-stage.is-transitioning {
  opacity: 0;
  transform: translateY(12px);
  filter: blur(2px);
  pointer-events: none;
}

.options-grid {
  width: min(100%, 66rem);
  justify-self: center;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 2.2vw, 1.8rem) clamp(1.4rem, 5vw, 4.5rem);
  margin-top: clamp(0.4rem, 0.8vw, 0.8rem);
}

.option-button {
  --button-font-size: clamp(1.25rem, 2.75vw, 2.65rem);
  width: 100%;
  text-align: left;
}

.option-button__marker {
  min-width: 2.15ch;
}

.option-button.is-muted {
  opacity: 0.62;
}

.option-button.is-selected {
  transform: translateY(-2px) scale(1.01);
}

.option-button.is-correct {
  box-shadow:
    0 0 0 5px rgba(121, 232, 169, 0.8),
    0 0.45rem 0 var(--button-shadow),
    0 1rem 2rem rgba(0, 0, 0, 0.22);
}

.option-button.is-wrong {
  box-shadow:
    0 0 0 5px rgba(255, 141, 141, 0.82),
    0 0.45rem 0 var(--button-shadow),
    0 1rem 2rem rgba(0, 0, 0, 0.22);
}

.feedback-panel,
.result-highlight,
.summary-item,
.review-section,
.review-card,
.modal-card {
  backdrop-filter: blur(12px);
}

.feedback-panel {
  width: min(100%, 48rem);
  justify-self: center;
  padding: 1rem 1.25rem;
  border-radius: 1.6rem;
  background: var(--surface);
  border: 2px solid var(--surface-border);
  text-align: center;
}

.feedback-panel.is-correct {
  border-color: rgba(121, 232, 169, 0.7);
}

.feedback-panel.is-wrong {
  border-color: rgba(255, 141, 141, 0.78);
}

.feedback-panel__title {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  line-height: 1.05;
}

.feedback-panel__text {
  margin: 0.35rem 0 0;
  font-size: clamp(0.94rem, 1.45vw, 1.08rem);
  line-height: 1.35;
}

.quiz-actions {
  display: flex;
  justify-content: center;
}

.result-highlight {
  width: min(100%, 46rem);
  padding: 1.2rem 1.4rem;
  border-radius: 1.9rem;
  background: var(--surface-strong);
  border: 2px solid var(--surface-border);
  text-align: center;
}

.result-highlight span,
.result-highlight strong {
  display: block;
  line-height: 1;
}

.performance-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 10rem;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.performance-label.is-excellent {
  background: rgba(121, 232, 169, 0.22);
}

.performance-label.is-good {
  background: rgba(255, 220, 26, 0.22);
}

.performance-label.is-review {
  background: rgba(255, 141, 141, 0.24);
}

.result-highlight span {
  font-size: clamp(2.6rem, 5vw, 4.8rem);
}

.result-highlight strong {
  margin-top: 0.45rem;
  font-size: clamp(1.5rem, 2.8vw, 2.3rem);
}

.result-highlight p {
  margin: 0.55rem 0 0;
  font-size: clamp(0.98rem, 1.6vw, 1.14rem);
  line-height: 1.35;
}

.review-section {
  width: min(100%, 64rem);
  padding: 1rem 1.1rem 1.15rem;
  border-radius: 1.6rem;
  background: var(--surface);
  border: 2px solid var(--surface-border);
}

.review-section h3 {
  margin: 0 0 0.8rem;
  font-size: clamp(1.35rem, 2.3vw, 1.8rem);
  line-height: 1;
}

.review-list,
.summary-list {
  width: min(100%, 64rem);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.review-list {
  width: 100%;
}

.review-card,
.summary-item {
  padding: 1rem 1.1rem;
  border-radius: 1.45rem;
  background: var(--surface);
  border: 2px solid var(--surface-border);
  height: 100%;
}

.review-card h4,
.review-card p,
.summary-item h3,
.summary-item p {
  margin: 0;
}

.review-card h4,
.summary-item h3 {
  font-size: clamp(0.95rem, 1.45vw, 1.1rem);
  line-height: 1.2;
}

.review-card p,
.summary-item p {
  margin-top: 0.35rem;
  font-size: 0.98rem;
  line-height: 1.35;
}

.summary-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.24rem 0.7rem;
  margin-bottom: 0.55rem;
  border-radius: 999px;
  font-size: 0.86rem;
  line-height: 1;
}

.summary-status.is-correct {
  background: rgba(121, 232, 169, 0.22);
  color: #d6ffe6;
}

.summary-status.is-wrong {
  background: rgba(255, 141, 141, 0.22);
  color: #ffe0e0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.55);
  z-index: 20;
  overflow: hidden;
}

.modal-card {
  --modal-scale: 1;
  width: min(100%, 34rem);
  padding: 1.4rem;
  border-radius: 1.8rem;
  background: rgba(19, 56, 141, 0.92);
  border: 2px solid rgba(255, 255, 255, 0.14);
  color: #f6f6f6;
  box-shadow: 0 1.2rem 3rem rgba(0, 0, 0, 0.25);
  transform: scale(var(--modal-scale));
  transform-origin: center top;
  will-change: transform;
}

body[data-theme="dark"] .modal-card {
  background: rgba(16, 16, 16, 0.94);
}

.modal-card--teacher {
  width: min(100%, 70rem);
  max-height: none;
  overflow: hidden;
}

.modal-card h2,
.modal-card p {
  margin: 0;
}

.modal-card h2 {
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  line-height: 1;
}

.modal-card p {
  margin-top: 0.55rem;
  font-size: 1rem;
  line-height: 1.4;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.teacher-header {
  display: flex;
  gap: 1rem;
  align-items: start;
  justify-content: space-between;
}

.teacher-note {
  color: rgba(246, 246, 246, 0.82);
}

.teacher-toolbar {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: space-between;
  align-items: center;
}

.teacher-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.teacher-toolbar__actions .menu-button {
  flex: 1 1 13rem;
}

.teacher-count {
  display: inline-flex;
  align-items: center;
  min-height: 3.2rem;
  padding: 0.55rem 0.95rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.teacher-layout {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(19rem, 0.82fr);
  gap: 1rem;
  align-items: start;
}

.teacher-panel {
  padding: 1rem 1.05rem;
  border-radius: 1.45rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.13);
}

body[data-theme="dark"] .teacher-panel {
  background: rgba(255, 255, 255, 0.05);
}

.teacher-section-title,
.teacher-bank h3 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.1;
}

.teacher-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.95rem;
  margin-top: 0.85rem;
}

.teacher-field {
  display: grid;
  gap: 0.4rem;
}

.teacher-field--full {
  grid-column: 1 / -1;
}

.teacher-field span {
  font-size: 0.98rem;
}

.teacher-field input,
.teacher-field textarea,
.teacher-field select {
  width: 100%;
  border: 2px solid var(--input-border);
  border-radius: 1rem;
  background: var(--input-bg);
  color: #f7f7f7;
  padding: 0.82rem 0.95rem;
  resize: vertical;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.teacher-field input::placeholder,
.teacher-field textarea::placeholder {
  color: rgba(255, 255, 255, 0.56);
}

.teacher-field input:focus,
.teacher-field textarea:focus,
.teacher-field select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

.teacher-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.85rem;
}

.teacher-status {
  min-height: 1.5rem;
  margin: 0.7rem 0 0;
  color: rgba(246, 246, 246, 0.82);
}

.teacher-status.is-success {
  color: #c8ffe0;
}

.teacher-status.is-error {
  color: #ffd6d6;
}

.teacher-bank {
  margin-top: 0;
}

.teacher-bank__header {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.teacher-bank__note {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(246, 246, 246, 0.74);
}

.teacher-custom-list {
  display: grid;
  gap: 0.8rem;
}

.teacher-question-card {
  padding: 0.95rem 1rem;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.teacher-question-card h4,
.teacher-question-card p {
  margin: 0;
}

.teacher-question-card h4 {
  font-size: 1rem;
  line-height: 1.3;
}

.teacher-question-card p {
  margin-top: 0.35rem;
  color: rgba(246, 246, 246, 0.82);
  font-size: 0.95rem;
  line-height: 1.35;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

body.is-modal-open {
  overflow: hidden;
}

@media (max-width: 980px) {
  .menu-grid--home,
  .menu-grid--result,
  .review-list,
  .summary-list,
  .options-grid,
  .teacher-layout,
  .teacher-form {
    grid-template-columns: 1fr;
  }

  .menu-button--wide,
  .menu-button--setting,
  .menu-button--home,
  .menu-button--back,
  .menu-button--compact {
    min-width: 100%;
  }

  .menu-grid--home,
  .menu-grid--result,
  .settings-stack,
  .summary-list,
  .review-section,
  .options-grid,
  .resume-panel {
    width: min(100%, 34rem);
  }

  .review-list {
    width: 100%;
  }

  .title-block--home {
    margin-top: clamp(5rem, 19vw, 8rem);
  }

  .teacher-header,
  .teacher-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .teacher-toolbar__actions {
    width: 100%;
  }

  .teacher-panel {
    padding: 0.95rem;
  }
}

@media (max-width: 640px) {
  .screen {
    padding: max(0.8rem, env(safe-area-inset-top)) max(0.8rem, env(safe-area-inset-right)) max(0.8rem, env(safe-area-inset-bottom)) max(0.8rem, env(safe-area-inset-left));
  }

  .screen-shell {
    min-height: calc(100dvh - 1.6rem);
  }

  .flag-badge {
    width: 7.8rem;
    top: 0;
    left: -0.25rem;
  }

  .title-block--home {
    margin-top: 5.5rem;
  }

  .title-block h1,
  .title-block h2 {
    font-size: clamp(1.95rem, 9.2vw, 3.05rem);
  }

  .title-block--question h2 {
    font-size: clamp(1.45rem, 6.7vw, 2.3rem);
  }

  .quiz-counter,
  .result-kicker {
    font-size: clamp(1rem, 4.8vw, 1.4rem);
  }

  .menu-button {
    --button-font-size: clamp(1.16rem, 5.9vw, 1.8rem);
    min-height: 4.15rem;
    border-radius: 1.5rem;
  }

  .menu-button--compact {
    --button-font-size: 1rem;
  }

  .option-button {
    --button-font-size: clamp(1.02rem, 4.6vw, 1.55rem);
    min-height: 3.75rem;
    padding: 0.65rem 0.9rem;
  }

  .options-grid {
    gap: 0.8rem 0.95rem;
  }

  .icon-badge {
    width: 3rem;
    height: 3rem;
  }

  .icon-glyph,
  .icon-glyph--large {
    width: 2.7rem;
    height: 2.7rem;
  }

  .feedback-panel,
  .result-highlight,
  .resume-panel,
  .review-section,
  .review-card,
  .summary-item,
  .modal-card {
    border-radius: 1.2rem;
  }

  .teacher-field input,
  .teacher-field textarea,
  .teacher-field select {
    border-radius: 0.9rem;
  }
}

@media (max-width: 420px) {
  .menu-button {
    gap: 0.7rem;
    padding-inline: 1rem;
  }

  .home-meta__pill {
    font-size: 0.95rem;
  }
}

@media (max-height: 740px) and (orientation: landscape) {
  .screen-shell--home,
  .screen-shell--settings {
    align-content: start;
  }

  .title-block--home {
    margin-top: 4.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
