body.dark-mode h1 {
  color: #fff;
}

body.dark-mode .nav-link {
  color: #fff !important;
}

body.dark-mode .bi-play-circle::before,
body.dark-mode .bi-pause-circle::before,
body.dark-mode .bi-arrow-repeat-circle::before {
  color: #4a93ce;
}

body.dark-mode .bi-play-circle:hover::before,
body.dark-mode .bi-pause-circle:hover::before,
body.dark-mode .bi-arrow-repeat-circle:hover::before {
  color: #fff;
}

body.dark-mode .btn-check:hover+.btn {
  color: #000;
  background-color: #fff;
}

body.dark-mode .btn-check:checked+.btn {
  color: #000;
  background-color: #4a93ce;
}

body.dark-mode .correct .btn-check:checked+.btn,
body.dark-mode input[type="number"].correct,
body.dark-mode .sequence-input.correct {
  background-color: rgb(27, 173, 46) !important;
}

body.dark-mode .wrong .btn-check:checked+.btn,
body.dark-mode input[type="number"].wrong,
body.dark-mode .sequence-input.wrong {
  background-color: rgb(253, 59, 68) !important;
}

body.dark-mode #settings-btn {
  color: #c7c7c7;
}

body.dark-mode #settings {}

body.dark-mode #settings label {
  color: #fff;
}

body.dark-mode #switch {
  color: #fff;
  font-size: 1.6em;
}

body.dark-mode #sequence input {
  background-color: #414151;
  color: #fff;
}

body.dark-mode .form-text {
  color: #303042;
}

body.dark-mode #settings .form-control:focus+.form-text {
  color: #8181a8;
}

body.dark-mode footer a {
  color: #fff;
}

#switch {
  font-size: 1.2em;
  height: 38px;
}

#switch i {
  cursor: pointer;
}

#switch .bi-moon {
  margin-left: 3px;
}

h1 {
  text-align: center;
}

.bi-play-circle::before,
.bi-pause-circle::before,
.bi-arrow-repeat-circle::before {
  font-size: 4.5em;
  color: #c7c7c7;
  transition: color 0.5s;
  cursor: pointer;
}

.bi-play-circle:hover::before,
.bi-pause-circle:hover::before,
.bi-arrow-repeat-circle:hover::before {
  color: #999;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.show {
  display: block;
}

.hide {
  display: none;
}

::placeholder {
  color: #ddd !important;
}

.active {
  border-bottom: solid 1px orange;
}

#settings-btn {
  cursor: pointer;
}

#settings-btn span {
  color: #999;
  padding-left: 3px;
}

input:focus,
button:focus,
.btn {
  box-shadow: 0 0 0 0 !important;
}

.form-check {
  padding-left: 0 !important;
}

.btn-check:hover+.btn {
  background-color: #e9e9e9;
}

.btn-check:checked+.btn {
  background-color: #c7c7c7;
}

#options button,
#sequence button {
  width: 67px !important;
}

.nav-link {
  padding-top: 5px !important;
}

br {
  margin-bottom: 7px;
}

/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Firefox */
input[type="number"] {
  -moz-appearance: textfield;
}

.form-control {
  z-index: 1;
  position: relative;
}

.form-text {
  font-size: 0.8em;
  position: relative;
  top: -20px;
  z-index: 0;
  transition: all 0.2s;
}

#settings .form-control:focus+div.form-text {
  color: #6c757d;
  top: 0;
}

#settings small {
  font-size: 0.8em;
}

a {
  text-decoration: none !important;
}

html {
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top left, rgba(53, 132, 228, 0.12), transparent 34rem),
    linear-gradient(180deg, #f6f8fb 0%, #eef3f7 100%);
  color: #172033;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

#root {
  display: flex;
  flex-direction: column;
  padding-bottom: 1rem;
  min-height: 100vh;
  min-height: 100svh;
}

body.dark-mode {
  background:
    radial-gradient(circle at top left, rgba(74, 147, 206, 0.18), transparent 34rem),
    linear-gradient(180deg, #141822 0%, #22222b 100%);
}

.app-brand .bi-ear {
  color: #1769e0;
}

body.dark-mode .app-brand h1 {
  color: #fff;
}

body.dark-mode .app-nav {
  background: rgba(48, 48, 66, 0.72);
  border-color: rgba(255, 255, 255, 0.08);
}

.app-nav .nav-link {
  border: 0;
  border-radius: 6px;
  color: #657089 !important;
  font-weight: 700;
  line-height: 1;
  padding: 12px 16px !important;
}

.app-nav .nav-link.active {
  background: #1769e0;
  color: #fff !important;
}

body.dark-mode .app-nav .nav-link {
  color: #c9d2e3 !important;
}

.practice-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(23, 32, 51, 0.08);
  border-radius: 8px;
  box-shadow: 0 26px 70px rgba(23, 32, 51, 0.12);
  overflow: hidden;
}

body.dark-mode .practice-card {
  background: rgba(48, 48, 66, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.3);
}

body.dark-mode .practice-meta {
  background: #2d2a35;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.meta-chip img {
  width: 18px;
}

body.dark-mode .meta-chip {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffe3bd;
}

.listen-copy span {
  color: #7b8498;
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.listen-copy strong {
  color: #172033;
  display: block;
  font-size: 1.45rem;
}

body.dark-mode .listen-copy strong {
  color: #fff;
}

#player-wrap {
  min-height: 142px;
}

#player {
  display: inline-block;
}

.bi-play-circle::before,
.bi-pause-circle::before,
.bi-arrow-clockwise::before {
  color: #1769e0;
  font-size: 5.5em;
}

.bi-play-circle:hover::before,
.bi-pause-circle:hover::before,
.bi-arrow-clockwise:hover::before {
  color: #0d4fb3;
}

body.dark-mode .bi-play-circle::before,
body.dark-mode .bi-pause-circle::before,
body.dark-mode .bi-arrow-clockwise::before {
  color: #66b5ff;
}

.audio-status {
  color: #7b8498;
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 6px;
}

.audio-loader {
  align-items: center;
  display: flex;
  gap: 10px;
  height: 5.5em;
  justify-content: center;
  margin: 0 auto;
  width: 5.5em;
}

.audio-loader span {
  animation: audio-dot-bounce 900ms ease-in-out infinite;
  background: #1769e0;
  border-radius: 999px;
  display: block;
  height: 13px;
  width: 13px;
}

.audio-loader span:nth-child(2) {
  animation-delay: 120ms;
}

.audio-loader span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes audio-dot-bounce {

  0%,
  80%,
  100% {
    opacity: 0.48;
    transform: translateY(0) scale(0.92);
  }

  40% {
    opacity: 1;
    transform: translateY(-10px) scale(1);
  }
}

body.dark-mode .audio-status {
  color: #9ca8bf;
}

body.dark-mode .audio-loader span {
  background: #66b5ff;
}

#audio-error {
  background: rgba(220, 53, 69, 0.08);
  border-radius: 8px;
  line-height: 1.25;
  margin-left: auto;
  margin-right: auto;
  padding: 8px 10px;
  width: min(260px, 80vw);
}

#answer {
  align-items: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(23, 105, 224, 0.12);
  border-radius: 8px;
  color: #1769e0;
  cursor: pointer;
  display: none;
  font-size: 2rem;
  font-weight: 800;
  inset: 0;
  justify-content: center;
  position: absolute;
  text-align: center;
  z-index: 2;
}

#answer.show-answer {
  display: flex;
}

body.dark-mode #answer {
  background: rgba(34, 34, 43, 0.94);
  border-color: rgba(255, 255, 255, 0.08);
  color: #66b5ff;
}

.answer-panel {
  padding: 10px 28px 28px;
}

.answer-heading {
  align-items: center;
  color: #4f5b72;
  display: flex;
  gap: 10px;
  justify-content: center;
  font-weight: 800;
  margin-bottom: 16px;
  text-align: center;
}

.answer-heading small {
  color: #7b8498;
  font-size: 0.76rem;
  font-weight: 700;
}

body.dark-mode .answer-heading {
  color: #d7deeb;
}

body.dark-mode .answer-heading small {
  color: #9ca8bf;
}

.answer-feedback {
  border-radius: 8px;
  display: none;
  font-weight: 800;
  margin: -4px auto 16px;
  max-width: 180px;
  padding: 8px 12px;
  text-align: center;
}

.answer-feedback.is-correct {
  background: rgba(24, 160, 88, 0.12);
  color: #137245;
}

.answer-feedback.is-wrong {
  background: rgba(217, 72, 95, 0.12);
  color: #a83248;
}

body.dark-mode .answer-feedback.is-correct {
  color: #7df0b1;
}

body.dark-mode .answer-feedback.is-wrong {
  color: #ff9caf;
}

#options {
  width: 100%;
}

.option-grid {
  display: grid !important;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
}

.form-check-inline {
  display: block;
  margin-right: 0 !important;
}

.btn-check:hover+.btn,
.btn-check:checked+.btn {
  background: #e7f0ff;
  border-color: #1769e0;
  color: #1769e0;
}

body.dark-mode .btn-check+.btn {
  background: #414151;
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.form-check.correct .btn-check+.btn,
input[type="number"].correct,
.sequence-input.correct {
  background: #18a058 !important;
  border-color: #18a058 !important;
  color: #fff !important;
}

.form-check.wrong .btn-check+.btn,
input[type="number"].wrong,
.sequence-input.wrong {
  background: #d9485f !important;
  border-color: #d9485f !important;
  color: #fff !important;
}

#sequence {
  margin: 0 auto;
  max-width: 460px;
}

#sequence input {
  border: 1px solid rgba(23, 32, 51, 0.1);
  border-radius: 8px;
  font-size: 1.2rem;
  min-height: 62px;
}

.action-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}

#options button,
#sequence button,
.action-row .btn {
  border-radius: 8px;
  font-weight: 800;
  min-height: 44px;
  padding-left: 16px;
  padding-right: 16px;
  width: auto !important;
}

.btn-soft {
  background: #f3f6fa;
  border-color: #dbe3ee;
  color: #4f5b72;
}

.btn-check-answer:disabled {
  background: #d8e0ea;
  border-color: #d8e0ea;
  color: #7b8498;
  cursor: not-allowed;
}

.btn-next {
  background: #1769e0;
  border-color: #1769e0;
  color: #fff;
}

.session-count {
  pointer-events: none;
}

.session-stage {
  display: flex;
  flex-direction: column;
  min-height: 455px;
}

.session-panel,
.session-results {
  margin: 0 auto;
  max-width: 720px;
  padding: 48px 28px;
  text-align: center;
}

.session-panel {
  align-items: center;
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
}

.session-kicker {
  color: #1769e0;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
  text-transform: uppercase;
}

.session-panel h2,
.session-results h2 {
  color: #172033;
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 10px;
}

.session-panel p,
.session-results p {
  color: #4f5b72;
  margin: 0 auto 18px;
  max-width: 430px;
}

.session-date {
  font-size: 0.82rem;
  opacity: 0.72;
}

.score-badge {
  align-items: center;
  border-radius: 8px;
  display: inline-flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 14px;
  padding: 10px 14px;
}

.score-badge i {
  font-size: 1.45rem;
}

.score-badge span {
  font-weight: 900;
}

.score-badge.is-gold {
  background: rgba(255, 176, 32, 0.18);
  color: #8a5200;
}

.score-badge.is-blue {
  background: rgba(23, 105, 224, 0.12);
  color: #174ea6;
}

.score-badge.is-warm {
  background: rgba(217, 119, 6, 0.12);
  color: #9a4d00;
}

.session-start-btn {
  min-width: 160px;
}

.result-list {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  text-align: left;
}

.result-row {
  align-items: center;
  background: #f7f9fc;
  border: 1px solid rgba(23, 32, 51, 0.08);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  padding: 10px 12px;
}

.result-number {
  align-items: center;
  background: #fff;
  border-radius: 999px;
  color: #4f5b72;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 900;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.result-answer {
  display: grid;
  gap: 2px;
}

.result-answer strong {
  color: #172033;
  font-size: 0.98rem;
}

.result-answer small {
  color: #7b8498;
  font-weight: 700;
}

.result-status {
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
  padding: 5px 9px;
}

.result-row.is-correct .result-status {
  background: rgba(24, 160, 88, 0.12);
  color: #137245;
}

.result-row.is-missed .result-status {
  background: rgba(217, 72, 95, 0.12);
  color: #a83248;
}

body.dark-mode .session-kicker {
  color: #66b5ff;
}

body.dark-mode .session-panel h2,
body.dark-mode .session-results h2,
body.dark-mode .result-answer strong {
  color: #fff;
}

body.dark-mode .session-panel p,
body.dark-mode .session-results p {
  color: #d7deeb;
}

body.dark-mode .score-badge.is-gold {
  background: rgba(255, 176, 32, 0.14);
  color: #ffd27a;
}

body.dark-mode .score-badge.is-blue {
  background: rgba(102, 181, 255, 0.12);
  color: #9ec5ff;
}

body.dark-mode .score-badge.is-warm {
  background: rgba(255, 176, 32, 0.1);
  color: #ffc46b;
}

body.dark-mode .result-row {
  background: rgba(20, 24, 34, 0.24);
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .result-number {
  background: rgba(255, 255, 255, 0.08);
  color: #d7deeb;
}

body.dark-mode .result-answer small {
  color: #9ca8bf;
}

body.dark-mode .result-row.is-correct .result-status {
  color: #7df0b1;
}

body.dark-mode .result-row.is-missed .result-status {
  color: #ffb0c0;
}

.settings-panel {
  background: #f8fafc;
  border-top: 1px solid rgba(23, 32, 51, 0.08);
  padding: 18px 24px 20px;
}

body.dark-mode .settings-panel {
  background: rgba(20, 24, 34, 0.32);
  border-top-color: rgba(255, 255, 255, 0.08);
}

.settings-toggle {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(23, 32, 51, 0.1);
  border-radius: 8px;
  color: #1769e0;
  display: inline-flex;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  width: 100%;
}

.settings-toggle.is-open {
  background: #1769e0;
  border-color: #1769e0;
  color: #fff;
}

body.dark-mode .settings-toggle {
  background: #303042;
  border-color: rgba(255, 255, 255, 0.08);
  color: #66b5ff;
}

body.dark-mode .settings-toggle.is-open {
  background: #66b5ff;
  border-color: #66b5ff;
  color: #141822;
}

.settings-sheet.show {
  display: block;
}

body.dark-mode .settings-sheet {
  background: transparent !important;
  border-color: transparent;
  box-shadow: none;
}

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

.settings-field.is-wide {
  grid-column: 1 / -1;
}

.settings-field .form-label,
.speed-control .form-label {
  color: #4f5b72;
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: uppercase;
}

body.dark-mode .settings-field .form-label,
body.dark-mode .speed-control .form-label {
  color: #d7deeb;
}

.settings-field .form-control,
.settings-field .form-select {
  border: 1px solid rgba(23, 32, 51, 0.12);
  border-radius: 8px;
  min-height: 46px;
}

body.dark-mode .settings-field .form-control,
body.dark-mode .settings-field .form-select {
  background-color: #414151;
  border-color: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.settings-field .form-text {
  color: #7b8498;
  font-size: 0.75rem;
  position: static;
}

body.dark-mode .settings-field .form-text {
  color: #9ca8bf;
}

.speed-control {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

body.dark-mode .speed-control {
  background: transparent;
  border: none;
}

.settings-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-actions .btn {
  background: #1769e0;
  border-color: #1769e0;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  min-height: 44px;
  width: 100%;
}

.settings-actions .settings-close-action {
  background: #eef2f7;
  border-color: rgba(23, 32, 51, 0.12);
  color: #263244;
}

body.dark-mode .settings-actions .settings-close-action {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #f7f9fc;
}

.settings-actions .btn:disabled {
  opacity: 0.72;
}

/* Shell correction pass */
.app-main {
  flex: 1 0 auto;
  min-height: auto;
  transition: margin-right 260ms ease, transform 260ms ease;
}

.app-main.settings-is-open {
  margin-right: 320px;
}

.app-container {
  max-width: 1120px;
  padding-top: 28px;
}

.app-topbar {
  align-items: center;
  display: grid;
  gap: 16px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin-bottom: 24px;
}

.app-brand {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 0;
}

.app-brand h1 {
  align-items: center;
  color: #172033;
  display: flex;
  font-size: 1.7rem;
  font-weight: 800;
  gap: 10px;
  letter-spacing: 0;
  margin: 0;
  white-space: nowrap;
}

.app-nav {
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(23, 32, 51, 0.08);
  border-radius: 8px;
  box-shadow: none;
  display: flex;
  gap: 4px;
  justify-content: center;
  margin: 0 auto;
  max-width: 410px;
  padding: 6px;
}

.top-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.icon-button {
  align-items: center;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(23, 32, 51, 0.1);
  border-radius: 8px;
  color: #1769e0;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.icon-button:hover,
.icon-button:focus {
  background: #e7f0ff;
  color: #0d4fb3;
}

body.dark-mode .icon-button {
  background: rgba(48, 48, 66, 0.9);
  border-color: rgba(255, 255, 255, 0.08);
  color: #66b5ff;
}

.practice-shell {
  align-items: start;
  padding-bottom: 48px;
}

.practice-shell.settings-is-open {
  padding-right: 0;
}

.settings-dock {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(23, 32, 51, 0.08);
  border-bottom: 0;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  border-top: 0;
  box-shadow: 0 26px 70px rgba(23, 32, 51, 0.1);
  height: 100vh;
  right: 0;
  overflow-y: auto;
  padding: 16px;
  position: fixed;
  top: 0;
  transform: translateX(100%);
  transition: transform 260ms ease, visibility 260ms ease;
  visibility: hidden;
  width: 320px;
  z-index: 20;
}

.settings-dock.is-open {
  transform: translateX(0);
  visibility: visible;
}

.settings-dock::before {
  background: #1769e0;
  content: "";
  height: 100%;
  right: 0;
  position: absolute;
  top: 0;
  width: 4px;
}

body.dark-mode .settings-dock {
  background: rgba(48, 48, 66, 0.92);
  border-color: rgba(255, 255, 255, 0.08);
}

.settings-dock-header {
  align-items: center;
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
  position: relative;
  z-index: 1;
}

.settings-control {
  margin: 0 auto;
  max-width: none;
  position: relative;
  z-index: 1;
}

.settings-sheet {
  background: #fff !important;
  border: 0;
  border-radius: 8px;
  box-shadow: none;
  display: block;
  margin-top: 0;
  padding: 0;
}

.practice-meta {
  align-items: center;
  border-bottom: 1px solid rgba(23, 32, 51, 0.08);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  padding: 18px 20px;
}

.meta-chip {
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(217, 119, 6, 0.16);
  border-radius: 8px;
  color: #7a3e00;
  cursor: pointer;
  display: inline-flex;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  gap: 7px;
  min-height: 36px;
  padding: 8px 12px;
}

.meta-chip:hover,
.meta-chip:focus {
  background: #fff;
  border-color: rgba(217, 119, 6, 0.32);
}

.meta-chip:nth-child(2) {
  border-color: rgba(23, 105, 224, 0.2);
  color: #174ea6;
}

.meta-chip:nth-child(3) {
  border-color: rgba(24, 160, 88, 0.22);
  color: #137245;
}

.meta-chip:nth-child(4) {
  border-color: rgba(217, 72, 95, 0.2);
  color: #9f2f43;
}

body.dark-mode .meta-chip:hover,
body.dark-mode .meta-chip:focus {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 227, 189, 0.22);
}

body.dark-mode .meta-chip:nth-child(2) {
  color: #9ec5ff;
}

body.dark-mode .meta-chip:nth-child(3) {
  color: #7df0b1;
}

body.dark-mode .meta-chip:nth-child(4) {
  color: #ffb0c0;
}

.meta-chip.plays-chip {
  cursor: default;
}

.meta-chip.plays-chip.is-good {
  border-color: rgba(24, 160, 88, 0.22);
  color: #137245;
}

.meta-chip.plays-chip.is-warning {
  border-color: rgba(217, 119, 6, 0.22);
  color: #7a3e00;
}

.meta-chip.plays-chip.is-danger {
  border-color: rgba(217, 72, 95, 0.2);
  color: #9f2f43;
}

body.dark-mode .meta-chip.plays-chip.is-good {
  color: #7df0b1;
}

body.dark-mode .meta-chip.plays-chip.is-warning {
  color: #ffe3bd;
}

body.dark-mode .meta-chip.plays-chip.is-danger {
  color: #ffb0c0;
}

.listen-panel {
  align-items: center;
  display: flex;
  gap: 24px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  justify-content: center;
  padding: 38px 28px 20px;
}

.listen-copy {
  display: none;
  justify-self: end;
  text-align: right;
}

.player-stage {
  min-height: 142px;
  min-width: min(240px, 100%);
  position: relative;
}

.btn-check+.btn {
  align-items: center;
  background: #f7f9fc;
  border: 1px solid rgba(23, 32, 51, 0.1);
  border-radius: 8px;
  color: #172033;
  display: flex;
  font-size: 1.25rem;
  font-weight: 800;
  justify-content: center;
  line-height: 1;
  min-height: 70px;
  width: 100%;
}

.btn-check-answer {
  background: #1769e0;
  border-color: #1769e0;
  color: #fff;
}

.btn-next.is-primary {
  background: #1769e0;
  border-color: #1769e0;
  color: #fff;
}

.app-footer {
  flex-shrink: 0;
}

#footer-content {
  color: rgba(79, 91, 114, 0.42);
  font-size: 0.76rem;
  font-weight: 500;
}

body.dark-mode #footer-content {
  color: rgba(215, 222, 235, 0.48);
}

/* Settings Tabs Styling */
.settings-tab-header {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 4px;
  margin-bottom: 20px;
}

body.dark-mode .settings-tab-header {
  background: rgba(255, 255, 255, 0.08);
}

.settings-tab-btn {
  flex: 1;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.9rem;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}

body.dark-mode .settings-tab-btn {
  color: #94a3b8;
}

.settings-tab-btn.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body.dark-mode .settings-tab-btn.is-active {
  background: #334155;
  color: #fff;
}

/* Locked settings banner */
.upgrade-inline-banner {
  background: linear-gradient(135deg, rgba(23, 105, 224, 0.05) 0%, rgba(147, 51, 234, 0.05) 100%);
  border: 1px solid rgba(23, 105, 224, 0.12);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

body.dark-mode .upgrade-inline-banner {
  background: linear-gradient(135deg, rgba(23, 105, 224, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
  border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .upgrade-inline-banner .btn {
  color: #fff !important;
}

/* User Profile Account Tab styling */
.account-panel {
  padding: 10px 0;
}

.account-login-cta h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 8px;
}

body.dark-mode .account-login-cta h3 {
  color: #fff;
}

.pro-features-list {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  text-align: left;
}

.pro-features-list li {
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: #475569;
}

body.dark-mode .pro-features-list li {
  color: #cbd5e1;
}

.pro-features-list li i {
  margin-right: 8px;
}

.google-auth-wrapper {
  min-height: 40px;
}

.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f8fafc;
  border: 1px solid rgba(23, 32, 51, 0.06);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}

body.dark-mode .profile-card {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 10px;
}

.profile-card h4 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 2px;
  color: #0f172a;
}

body.dark-mode .profile-card h4 {
  color: #fff;
}

.profile-email {
  font-size: 0.8rem;
  color: #64748b;
}

.pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}

.pro-badge.is-pro {
  background: rgba(245, 158, 11, 0.15);
  color: #d97706;
}

.pro-badge.is-basic {
  background: #e2e8f0;
  color: #475569;
}

body.dark-mode .pro-badge.is-basic {
  background: #334155;
  color: #94a3b8;
}

.btn-soft-danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.12);
  color: #ef4444;
  font-weight: 700;
}

.btn-soft-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

/* Ad Banner Styles */
.ad-container {
  display: flex;
  justify-content: center;
  width: 100%;
}

.ad-banner-mock {
  width: min(728px, 100%);
  background: rgba(255, 255, 255, 0.8);
  border: 1px dashed rgba(23, 32, 51, 0.15);
  border-radius: 8px;
  padding: 8px 12px;
  text-align: center;
}

body.dark-mode .ad-banner-mock {
  background: rgba(48, 48, 66, 0.5);
  border-color: rgba(255, 255, 255, 0.12);
}

.ad-badge {
  font-size: 0.65rem;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 4px;
}

.ad-placeholder {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(241, 245, 249, 0.5);
  border-radius: 4px;
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 600;
}

body.dark-mode .ad-placeholder {
  background: rgba(255, 255, 255, 0.03);
  color: #94a3b8;
}

/* Legal Modals Styling */
.legal-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
  animation: fadeIn 0.2s ease-out;
}

.legal-modal-content {
  background: #fff;
  border-radius: 12px;
  width: min(540px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body.dark-mode .legal-modal-content {
  background: #22222b;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.legal-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

body.dark-mode .legal-modal-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.legal-modal-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: #0f172a;
}

body.dark-mode .legal-modal-header h3 {
  color: #f1f5f9;
}

body.dark-mode .legal-modal-header .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

.legal-modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #334155;
  text-align: left;
}

body.dark-mode .legal-modal-body {
  color: #cbd5e1;
}

.legal-modal-body h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-top: 16px;
  margin-bottom: 6px;
  color: #0f172a;
}

body.dark-mode .legal-modal-body h4 {
  color: #fff;
}

.legal-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  justify-content: flex-end;
}

body.dark-mode .legal-modal-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* Footer Links */
.footer-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}

.footer-links button {
  background: transparent;
  border: 0;
  font-size: 0.78rem;
  color: #64748b;
  cursor: pointer;
  transition: color 0.2s;
  padding: 0;
}

.footer-links button:hover {
  color: #1769e0;
}

body.dark-mode .footer-links button {
  color: #94a3b8;
}

body.dark-mode .footer-links button:hover {
  color: #66b5ff;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Pro CTA Card & Grid Redesign */
.pro-cta-card {
  background: linear-gradient(135deg, rgba(23, 105, 224, 0.05) 0%, rgba(147, 51, 234, 0.05) 100%);
  border: 1px solid rgba(23, 105, 224, 0.12);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
  text-align: left;
}

body.dark-mode .pro-cta-card {
  background: linear-gradient(135deg, rgba(23, 105, 224, 0.1) 0%, rgba(147, 51, 234, 0.1) 100%);
  border-color: rgba(255, 255, 255, 0.08);
}

.pro-trial-badge {
  display: inline-block;
  background: linear-gradient(135deg, #1769e0 0%, #9333ea 100%);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.pro-cta-card h3 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

body.dark-mode .pro-cta-card h3 {
  color: #fff;
}

.pro-trial-subtitle {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.4;
  margin-bottom: 20px;
  text-transform: none !important;
}

body.dark-mode .pro-trial-subtitle {
  color: #94a3b8;
}

.pro-features-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.feature-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(23, 105, 224, 0.1);
  color: #1769e0;
  font-size: 1.05rem;
  flex-shrink: 0;
  margin-top: 2px;
}

body.dark-mode .feature-icon-wrapper {
  background: rgba(255, 255, 255, 0.08);
  color: #66b5ff;
}

.feature-text {
  display: flex;
  flex-direction: column;
}

.feature-text strong {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
}

body.dark-mode .feature-text strong {
  color: #e2e8f0;
}

.feature-text span {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.3;
}

body.dark-mode .feature-text span {
  color: #94a3b8;
}

/* Flag Selector Row */
.language-selector-row {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}

.lang-flag-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border: 1px solid rgba(23, 32, 51, 0.08);
  border-radius: 12px;
  padding: 12px 8px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
}

body.dark-mode .lang-flag-btn {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

.lang-flag-btn:hover {
  background: #f1f5f9;
  border-color: rgba(23, 32, 51, 0.15);
  transform: translateY(-1px);
}

body.dark-mode .lang-flag-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.lang-flag-btn img {
  width: 28px;
  height: 20px;
  border-radius: 3px;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.lang-flag-btn span {
  font-size: 0.78rem;
  font-weight: 700;
  color: #475569;
}

body.dark-mode .lang-flag-btn span {
  color: #cbd5e1;
}

/* Active Selected Flag Style */
.lang-flag-btn.is-selected {
  background: rgba(23, 105, 224, 0.04);
  border-color: #1769e0;
  box-shadow: 0 0 0 1px #1769e0, 0 4px 12px rgba(23, 105, 224, 0.08);
}

body.dark-mode .lang-flag-btn.is-selected {
  background: rgba(102, 181, 255, 0.06);
  border-color: #66b5ff;
  box-shadow: 0 0 0 1px #66b5ff, 0 4px 12px rgba(102, 181, 255, 0.1);
}

.lang-flag-btn.is-selected img {
  transform: scale(1.08);
}

.lang-flag-btn.is-selected span {
  color: #1769e0;
}

body.dark-mode .lang-flag-btn.is-selected span {
  color: #66b5ff;
}

/* Account Action Buttons */
.account-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  border: 1px solid transparent;
  cursor: pointer;
}

.account-action-btn.is-billing {
  background: rgba(147, 51, 234, 0.08);
  /* Soft Purple background matching Pro */
  border-color: rgba(147, 51, 234, 0.15);
  color: #9333ea;
}

.account-action-btn.is-billing:hover {
  background: rgba(147, 51, 234, 0.15);
}

.account-action-btn.is-logout {
  background: rgba(71, 85, 105, 0.08);
  /* Soft Slate background */
  border-color: rgba(71, 85, 105, 0.12);
  color: #475569;
}

.account-action-btn.is-logout:hover {
  background: rgba(71, 85, 105, 0.15);
}

.account-action-btn.is-delete {
  background: rgba(239, 68, 68, 0.08);
  /* Soft Red background */
  border-color: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.account-action-btn.is-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #dc2626;
}

/* Dark mode variations */
body.dark-mode .account-action-btn.is-billing {
  background: rgba(168, 85, 247, 0.12);
  border-color: rgba(168, 85, 247, 0.2);
  color: #c084fc;
}

body.dark-mode .account-action-btn.is-billing:hover {
  background: rgba(168, 85, 247, 0.2);
}

body.dark-mode .account-action-btn.is-logout {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

body.dark-mode .account-action-btn.is-logout:hover {
  background: rgba(148, 163, 184, 0.2);
}

body.dark-mode .account-action-btn.is-delete {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.2);
  color: #fca5a5;
}

body.dark-mode .account-action-btn.is-delete:hover {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

/* Premium Pro Brand Title styling */
.brand-logo-link {
  text-decoration: none !important;
  color: inherit !important;
  cursor: pointer;
}

.app-brand.is-pro h1 {
  position: relative;
}

.app-brand.is-pro h1 .brand-text {
  background: linear-gradient(135deg, #b45309 0%, #d97706 50%, #f59e0b 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
}

body.dark-mode .app-brand.is-pro h1 .brand-text {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 50%, #fef08a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-brand.is-pro h1 .bi-crown-svg {
  color: #fbbf24 !important;
  filter: drop-shadow(0 2px 4px rgba(217, 119, 6, 0.2));
  display: inline-block;
  position: absolute;
  top: -35%;
  right: 0;
  transform: rotate(10deg);
}

@keyframes premium-shimmer {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 2px 4px rgba(217, 119, 6, 0.2));
  }

  100% {
    transform: scale(1.05) rotate(2deg);
    filter: drop-shadow(0 4px 8px rgba(217, 119, 6, 0.4));
  }
}

/* Offline Connection Banner */
.offline-banner {
  background: rgba(239, 68, 68, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(239, 68, 68, 0.2);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 16px;
  position: sticky;
  top: 0;
  z-index: 1100;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

/* Toast Notifications */
.toast-notification {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f8fafc;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 500;
  font-size: 0.9rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  z-index: 1200;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-fade-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dark-mode .toast-notification {
  background: #0f172a;
  border-color: rgba(255, 255, 255, 0.05);
}

@keyframes toast-fade-in {
  from {
    bottom: 12px;
    opacity: 0;
  }

  to {
    bottom: 24px;
    opacity: 1;
  }
}

/* Legal text-button links inside modals */
.btn-link-legal {
  background: none !important;
  border: none;
  padding: 0 !important;
  color: #1769e0;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}

.btn-link-legal:hover {
  color: #0b4fb8;
}

body.dark-mode .btn-link-legal {
  color: #4a93ce;
}

body.dark-mode .btn-link-legal:hover {
  color: #fff;
}

.auth-legal-consent {
  font-size: 0.78rem;
  line-height: 1.45;
}

/* Modal Feature Lists & Bullet Spacing */
.auth-bullet-list {
  text-align: left;
  margin: 20px auto;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-bullet-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.92rem;
  line-height: 1.35;
  color: #475569;
}

body.dark-mode .auth-bullet-item {
  color: #cbd5e1;
}

.auth-bullet-icon {
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

/* Modal stack layering depth */
.policy-modal-overlay {
  z-index: 2100 !important;
}

.feature-icon-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(74, 147, 206, 0.1);
  color: #4a93ce;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

body.dark-mode .feature-icon-circle {
  background: rgba(74, 147, 206, 0.2);
  color: #4a93ce;
}

.pro-features-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pro-features-list .d-flex {
  gap: 14px;
}

/* ==========================================================================
   MEDIA QUERIES (Mobile responsiveness)
   ========================================================================== */

@media print {
  @page {
    margin: 0.45in;
  }

  body {
    background: #fff !important;
    color: #172033 !important;
  }

  .settings-dock,
  .app-nav,
  .top-actions,
  .practice-meta,
  .listen-panel,
  .answer-panel,
  .action-row,
  .app-footer {
    display: none !important;
  }

  .app-main,
  .app-main.settings-is-open {
    margin: 0 !important;
    min-height: auto !important;
    transform: none !important;
  }

  .app-container {
    max-width: none !important;
    padding: 0 !important;
  }

  .app-topbar {
    display: block !important;
    margin-bottom: 14px !important;
  }

  .app-brand h1 {
    color: #172033 !important;
    font-size: 1.2rem !important;
    margin: 0 !important;
    text-align: center !important;
  }

  .app-brand .bi-ear::before {
    color: #1769e0 !important;
  }

  .practice-shell {
    padding: 0 !important;
  }

  .practice-card {
    background: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
    overflow: visible !important;
  }

  .session-results {
    max-width: none !important;
    padding: 0 !important;
  }

  .session-kicker {
    color: #4f5b72 !important;
    font-size: 0.68rem !important;
    margin-bottom: 6px !important;
  }

  .score-badge {
    border: 1px solid #dbe3ee !important;
    margin-bottom: 8px !important;
    padding: 6px 10px !important;
  }

  .score-badge i {
    font-size: 1rem !important;
  }

  .session-results h2 {
    color: #172033 !important;
    font-size: 1.35rem !important;
    margin-bottom: 4px !important;
  }

  .session-results p {
    color: #4f5b72 !important;
    font-size: 0.8rem !important;
    margin-bottom: 4px !important;
  }

  .result-list {
    gap: 5px !important;
    margin-top: 12px !important;
  }

  .result-row {
    background: #fff !important;
    border-color: #dbe3ee !important;
    break-inside: avoid;
    gap: 8px !important;
    grid-template-columns: 28px minmax(0, 1fr) auto !important;
    padding: 6px 8px !important;
  }

  .result-number {
    background: #f3f6fa !important;
    color: #4f5b72 !important;
    font-size: 0.72rem !important;
    height: 22px !important;
    width: 22px !important;
  }

  .result-answer strong {
    color: #172033 !important;
    font-size: 0.82rem !important;
  }

  .result-answer small,
  .result-status {
    font-size: 0.68rem !important;
  }

  .result-status {
    border: 1px solid #dbe3ee !important;
    padding: 3px 7px !important;
  }
}

@media only screen and (max-width: 860px) {
  .app-topbar {
    grid-template-columns: 1fr auto;
  }

  .app-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    max-width: none;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .practice-shell.settings-is-open {
    padding-right: 0;
  }

  .app-main.settings-is-open {
    margin-right: 0;
    transform: translateX(calc(-1 * min(280px, 72vw)));
  }

  .settings-dock {
    border-radius: 0;
    max-width: 72vw;
    width: 280px;
  }

  .settings-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    z-index: 15;
    opacity: 0;
    visibility: hidden;
    transition: opacity 260ms ease, visibility 260ms ease;
  }

  .settings-backdrop.is-open {
    opacity: 1;
    visibility: visible;
  }
}

@media only screen and (max-width: 720px) {
  .app-container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .listen-panel {
    display: block;
    padding-top: 26px;
    text-align: center;
  }

  .listen-copy {
    margin-bottom: 14px;
    text-align: center;
  }

  .option-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .session-stage {
    min-height: 390px;
  }

  .practice-meta {
    justify-content: flex-start;
  }

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

@media only screen and (max-width: 640px) {

  html,
  body {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  #root {
    min-height: 100svh;
  }

  .app-main,
  .app-main.settings-is-open {
    display: flex;
    flex: 1 0 auto;
    margin-left: 0;
    min-height: 0;
    overflow: visible;
    transform: none;
  }

  .app-container {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 12px;
    width: 100%;
  }

  .app-topbar {
    margin-bottom: 12px;
  }

  .practice-shell {
    display: flex;
    flex: 1;
    min-height: 0;
    padding-bottom: 10px;
  }

  .practice-card {
    display: flex;
    flex: 1;
    flex-direction: column;
    height: 100%;
    overflow: visible;
    width: 100%;
  }

  .practice-meta {
    flex-wrap: nowrap;
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 10px 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .practice-meta::-webkit-scrollbar {
    display: none;
  }

  .meta-chip {
    flex: 0 0 auto;
    font-size: 0.76rem;
    gap: 5px;
    min-height: 30px;
    padding: 5px 8px;
    white-space: nowrap;
    order: 2;
  }

  .meta-chip img {
    width: 14px;
  }

  .language-chip span {
    display: none;
  }

  .plays-chip,
  .question-count-chip {
    order: 1;
  }

  .session-stage {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }

  .session-panel {
    flex: 1;
    min-height: 0;
    padding: 30px 18px;
  }

  .listen-panel {
    padding: 18px 18px 8px;
  }

  .player-stage,
  #player-wrap {
    min-height: 104px;
  }

  .bi-play-circle::before,
  .bi-pause-circle::before,
  .bi-arrow-clockwise::before {
    font-size: 4.2em;
  }

  .audio-loader {
    height: 4.2em;
    width: 4.2em;
  }

  .answer-panel {
    padding: 4px 16px 18px;
  }

  .answer-heading {
    margin-bottom: 10px;
  }

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

  .btn-check+.btn {
    font-size: 1.05rem;
    min-height: 58px;
  }

  .action-row {
    flex-direction: row;
    gap: 8px;
    margin-top: 12px;
  }

  .action-row .btn {
    flex: 1;
    min-height: 42px;
    padding-left: 10px;
    padding-right: 10px;
    width: auto !important;
  }
}

@media only screen and (max-width: 576px) {
  .nav-link {
    font-size: 0.9em;
    padding-left: 0.3rem !important;
    padding-right: 0.3rem !important;
  }

  #settings label {
    font-size: 0.9em;
  }

  .mt-5 {
    margin-top: 2rem !important;
  }

  .mb-5 {
    margin-bottom: 2rem !important;
  }

  #footer-content {
    font-size: 0.7em;
  }

  .form-text {
    font-size: 0.65em !important;
  }
}

@media only screen and (max-width: 520px) {
  .app-topbar {
    gap: 12px;
  }

  .app-brand.is-pro h1 .bi-crown-svg {
    top: -50%;
  }

  .app-brand h1 {
    font-size: 1.45rem;
  }

  .app-nav .nav-link {
    flex: 1;
    padding-left: 8px !important;
    padding-right: 8px !important;
    text-align: center;
  }

  .practice-meta {
    gap: 8px;
  }

  .meta-chip {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }

  .action-row {
    align-items: stretch;
    flex-direction: column;
  }

  .action-row .btn {
    width: 100% !important;
  }
}

@media only screen and (max-width: 400px) {

  .speed-chip i,
  .range-chip i {
    display: none;
  }

  .plays-chip .hide-mobile,
  .question-count-chip .hide-mobile {
    display: none;
  }
}