:root {
  color-scheme: light;
  --bg: #0e3875;
  --surface: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d8dee6;
  --teal: #2fb7ff;
  --teal-dark: #2086ff;
  --coral: #d95d39;
  --gold: #b98500;
  --green: #21875b;
  --shadow: 0 18px 45px rgba(31, 41, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background:
    radial-gradient(circle at -10% 0%, rgba(24, 84, 166, 0.72) 0 22%, transparent 23%),
    radial-gradient(circle at 110% 100%, rgba(8, 39, 87, 0.9) 0 26%, transparent 27%),
    linear-gradient(135deg, #0e3875 0%, #092a59 100%);
  color: var(--ink);
}

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

button {
  min-height: 44px;
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

body.logged-out .app-shell {
  grid-template-rows: 1fr;
}

.app-header {
  display: grid;
  grid-template-columns: minmax(210px, auto) 1fr auto;
  align-items: center;
  gap: 22px;
  padding: 20px 30px;
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.brand-mark,
.avatar {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--coral);
  color: #ffffff;
  font-weight: 800;
}

.brand span,
.profile-panel .muted {
  display: block;
  font-size: 0.88rem;
}

.brand span {
  color: rgba(255, 255, 255, 0.74);
}

.app-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.nav-button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: #ffffff;
  font-weight: 700;
  padding: 0 16px;
}

.nav-button:hover,
.nav-button.active {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.panel,
.workspace,
.feedback-panel,
.history-panel,
.ranking-panel,
.teacher-panel,
.login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
  color: var(--ink);
}

.panel h1,
.panel h2,
.topbar h2,
.workspace h3,
.feedback-panel h3,
.history-panel h3 {
  margin: 0;
  line-height: 1.15;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.form-stack,
.prompt-editor {
  display: grid;
  gap: 8px;
  font-weight: 700;
  color: var(--ink);
}

.form-stack {
  gap: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
}

textarea {
  resize: vertical;
  min-height: 128px;
  line-height: 1.55;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.16);
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  padding-right: 74px;
}

.password-visibility-button {
  position: absolute;
  top: 50%;
  right: 8px;
  min-width: 58px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--teal-dark);
  font-weight: 700;
  transform: translateY(-50%);
}

.password-visibility-button:hover,
.password-visibility-button:focus-visible {
  background: #e8f6f7;
  outline: none;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border-radius: 8px;
  font-weight: 700;
}

.primary-button {
  background: var(--teal);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.secondary-button {
  border: 1px solid var(--teal);
  background: #e8f6f7;
  color: var(--teal-dark);
}

.ghost-button {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  color: inherit;
}

.profile-panel .ghost-button,
.history-panel .ghost-button {
  border-color: var(--line);
  color: var(--ink);
}

.icon-button {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--coral);
  color: #ffffff;
}

.icon-button span {
  display: block;
  width: 0;
  height: 0;
  margin-left: 15px;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid #ffffff;
}

.main-content {
  display: grid;
  gap: 22px;
  align-content: start;
  padding: 24px min(6vw, 72px) 56px;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}

.header-actions span {
  color: rgba(255, 255, 255, 0.86);
  font-weight: 700;
}

.header-actions .ghost-button {
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
  padding: 0 16px;
}

.language-selector select {
  width: auto;
  min-width: 112px;
  height: 44px;
  padding: 0 34px 0 12px;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 700;
}

.language-selector option {
  background: #ffffff;
  color: var(--ink);
}

.login-language-selector {
  position: fixed;
  top: 20px;
  right: 30px;
  z-index: 10;
}

.login-language-selector select {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.12);
}

body:not(.logged-out) .login-language-selector {
  display: none;
}

.page {
  display: grid;
  gap: 22px;
}

.login-page {
  min-height: calc(100vh - 48px);
  align-content: center;
  justify-items: center;
}

.login-card {
  width: min(100%, 520px);
  padding: 34px;
}

.login-card h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.08;
}

.login-heading {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-bottom: 24px;
  text-align: center;
}

.login-heading .brand-mark {
  width: 54px;
  height: 54px;
}

.login-heading p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.topbar h2 {
  max-width: 820px;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.topbar h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.practice-page {
  justify-items: center;
}

.practice-card {
  width: min(100%, 780px);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 28px 72px rgba(8, 4, 36, 0.3);
  overflow: hidden;
}

.task-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid #c6bdf7;
  text-align: center;
  color: #050a33;
}

.task-header strong {
  grid-column: 1;
  padding-left: 160px;
}

.standard-source-controls {
  grid-column: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.standard-source-controls select {
  max-width: 190px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  padding: 7px 10px;
  color: var(--ink);
  font: inherit;
  font-size: 0.8rem;
}

.settings-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  min-height: 38px;
  border-radius: 50%;
  border: 1px solid #c6bdf7;
  background: #ffffff;
  color: #0e3875;
  font-size: 1.1rem;
}

.settings-button:hover {
  background: #eef6ff;
}

.settings-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr);
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.settings-panel label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
}

.sentence-block,
.recording-block {
  padding: 26px 34px;
}

.sentence-block {
  position: relative;
}

.read-score-badge {
  position: absolute;
  top: 14px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #bdebd4;
  border-radius: 999px;
  background: #eef9f3;
  color: #166b48;
  padding: 6px 10px;
  font-weight: 900;
}

.read-score-badge span {
  font-size: 0.75rem;
}

.read-score-badge strong {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #28d678;
  color: #ffffff;
}

.inline-feedback {
  margin: 0 34px 8px;
  padding: 14px;
  border-radius: 8px;
  box-shadow: none;
}

.inline-score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.inline-score-header h2 {
  margin: 0;
}

.recording-block {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 10px;
  min-height: 170px;
  overflow: hidden;
}

.recording-block::before {
  content: "";
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: 0;
  height: 82px;
  background: #eef9ff;
  border-radius: 50% 50% 0 0 / 42% 42% 0 0;
}

.record-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.recording-block > * {
  position: relative;
  z-index: 1;
}

.workspace,
.feedback-panel,
.history-panel,
.ranking-panel {
  padding: 20px;
}

.feedback-panel,
.history-panel,
.ranking-panel,
.profile-panel {
  width: min(100%, 900px);
  justify-self: center;
}

.section-heading,
.profile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.display-name-form {
  display: grid;
  gap: 7px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfd;
  color: var(--ink);
  font-weight: 700;
}

.display-name-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.display-name-controls .primary-button {
  white-space: nowrap;
}

.display-name-form p {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 400;
}

@media (max-width: 520px) {
  .display-name-controls { grid-template-columns: 1fr; }
}

.sentence-display {
  min-height: 136px;
  padding: 10px 8px 14px;
  font-size: clamp(1.7rem, 4vw, 2.25rem);
  line-height: 1.42;
  font-weight: 800;
  text-align: center;
}

.sentence-display.text-medium {
  font-size: clamp(1.45rem, 3.4vw, 1.95rem);
}

.sentence-display.text-long {
  font-size: clamp(1.2rem, 2.8vw, 1.6rem);
}

.sentence-display.text-extra-long {
  font-size: clamp(1rem, 2.2vw, 1.28rem);
}

.sentence-switcher {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
}

.sentence-nav-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid #c6bdf7;
  background: #ffffff;
  color: #2f84ff;
  padding: 0;
}

.sentence-nav-button span {
  width: 12px;
  height: 12px;
  border-top: 4px solid #2f84ff;
  border-right: 4px solid #2f84ff;
}

.sentence-nav-button.prev span {
  transform: translateX(2px) rotate(-135deg);
}

.sentence-nav-button.next span {
  transform: translateX(-2px) rotate(45deg);
}

.sentence-nav-button:hover {
  background: #eef6ff;
}

.listen-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  padding: 0 22px;
  border-radius: 999px;
  background: #2fb7ff;
  color: #ffffff;
  font-weight: 900;
}

.listen-button i {
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid #ffffff;
}

.listen-button.playing {
  background: #e45f43;
}

.listen-button.playing i {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 2px;
  background: #ffffff;
}

.word-mark {
  display: inline-block;
  margin: 3px 4px 3px 0;
  border-bottom: 4px solid transparent;
  border-radius: 6px;
  padding: 1px 3px;
}

.word-result {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: top;
  margin: 3px 4px 3px 0;
}

.word-result .word-mark {
  margin: 0;
}

.word-note {
  max-width: 110px;
  margin-top: 2px;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 0.68rem;
  line-height: 1.35;
  font-weight: 800;
  white-space: nowrap;
}

.word-note-error {
  background: #ffe1d8;
  color: #a52c12;
}

.word-note-warning {
  background: #fff0bd;
  color: #7a5200;
}

.word-omission {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.assessment-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 16px;
  margin: 0 auto 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.assessment-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.legend-good { background: var(--green); }
.legend-warning { background: var(--gold); }
.legend-error { background: var(--coral); }

.word-good {
  background: #eef9f3;
  border-color: var(--green);
}

.word-warning {
  background: #fff6dd;
  border-color: var(--gold);
}

.word-error {
  background: #fff1ec;
  border-color: var(--coral);
}

.recorder {
  display: grid;
  align-content: start;
}

.meter,
.button-row {
  display: none;
}

.recording-copy {
  margin: 0;
  min-height: 22px;
  color: #667085;
  font-weight: 700;
  text-align: center;
}

.mic-record-button {
  display: inline-flex;
  place-items: center;
  align-items: center;
  justify-content: center;
  min-width: 142px;
  min-height: 58px;
  padding: 0 26px;
  border-radius: 999px;
  background: #28d678;
  color: #ffffff;
  font-weight: 900;
  font-size: 1.05rem;
  box-shadow: 0 16px 34px rgba(40, 214, 120, 0.28);
}

.mic-record-button.recording {
  background: #ff7a00;
}

.recording-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 4px;
}

.recording-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  animation: dotFloat 0.8s ease-in-out infinite alternate;
}

.recording-dots i:nth-child(2) {
  animation-delay: 0.14s;
}

.recording-dots i:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes dotFloat {
  from { transform: translateY(3px); opacity: 0.55; }
  to { transform: translateY(-3px); opacity: 1; }
}

.practice-footer {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(150px, 0.9fr);
  gap: 12px;
  justify-content: end;
  align-items: center;
  padding: 18px 24px;
  border-top: 1px solid #c6bdf7;
  background: #ffffff;
}

.footer-secondary-button,
.footer-primary-button {
  border-radius: 999px;
  font-weight: 700;
  padding: 0 22px;
}

.footer-secondary-button {
  border: 2px solid #2f84ff;
  background: #ffffff;
  color: #2f84ff;
}

.footer-primary-button {
  background: linear-gradient(180deg, #62d4ff, #2f84ff);
  color: #ffffff;
}

.footer-primary-button:disabled {
  background: #dedede;
  color: #ffffff;
  opacity: 1;
}

.audio-player {
  width: 100%;
  height: 42px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  background: rgba(247, 244, 238, 0.82);
  backdrop-filter: blur(3px);
  text-align: center;
}

.spinner {
  width: 54px;
  height: 54px;
  border: 5px solid rgba(0, 124, 137, 0.18);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.score-badge {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #0e3875;
  color: #ffffff;
  font-size: 1.2rem;
}

.feedback-panel .score-badge {
  width: 44px;
  height: 44px;
  font-size: 1rem;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 210px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.6;
  padding: 24px;
  text-align: center;
}

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

.score-grid div,
.stats-grid div,
.history-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.score-grid span,
.stats-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
}

.score-grid strong,
.stats-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 1.5rem;
}

.feedback-panel .score-grid div {
  padding: 9px 11px;
}

.feedback-panel .score-grid strong {
  margin-top: 2px;
  font-size: 1.15rem;
}

.tips-list {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.tip {
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: #eef9f3;
  padding: 12px;
  line-height: 1.5;
}

.tip strong,
.tip span {
  display: block;
}

.tip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.tip-omission {
  border-left-color: var(--coral);
  background: #fff4ef;
}

.tip-phoneme,
.tip-syllable {
  border-left-color: var(--gold);
  background: #fff9e8;
}

.feedback-group {
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 10px;
  background: #ffffff;
}

.feedback-group h4 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 11px 14px;
  font-size: 0.98rem;
}

.feedback-group h4 span {
  display: grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 0.78rem;
}

.feedback-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.feedback-group li {
  padding: 10px 14px;
  border-top: 1px solid rgba(15, 45, 80, 0.09);
  line-height: 1.45;
}

.feedback-group li strong,
.feedback-group li span {
  display: block;
}

.feedback-group li span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.feedback-group-error {
  border-left-color: var(--coral);
  background: #fff9f6;
}

.feedback-group-error h4 { background: #ffe9e1; }

.feedback-group-warning {
  border-left-color: var(--gold);
  background: #fffdf5;
}

.feedback-group-warning h4 { background: #fff2c9; }

.feedback-group-prosody {
  border-left-color: #7b61d1;
  background: #fbf9ff;
}

.feedback-group-prosody h4 { background: #eee9ff; }

.feedback-group-general h4 { background: #eaf8f1; }

.history-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.teacher-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding: 20px;
}

.teacher-panel h2 { margin: 0; }
.table-wrap { overflow-x: auto; }
.teacher-table { border-collapse: collapse; min-width: 680px; width: 100%; }
.teacher-table th, .teacher-table td { border-bottom: 1px solid var(--line); padding: 11px 10px; text-align: left; }
.teacher-table th { color: var(--muted); font-size: 0.82rem; }
.teacher-content-form { display: grid; gap: 10px; }
.teacher-content-list { display: grid; gap: 10px; }
.teacher-content-item { align-items: start; border: 1px solid var(--line); border-radius: 8px; display: flex; gap: 14px; justify-content: space-between; padding: 12px; }
.teacher-content-item p { color: var(--muted); line-height: 1.45; margin: 6px 0; }
.teacher-content-item span { color: var(--muted); font-size: 0.86rem; }
.teacher-recording-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; min-width: 220px; }
.teacher-recording-actions audio { width: 100%; max-width: 280px; height: 34px; }
.teacher-recording-actions button { padding: 7px 10px; }
.comparison-note { color: var(--muted); font-size: 0.88rem; }

.test-account-panel { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 18px; }
.test-account-panel h2, .progress-chart-card h3 { margin: 0; font-size: 1rem; }
.test-account-panel p { color: var(--muted); font-size: 0.85rem; line-height: 1.45; }
.test-account-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.test-account-button { border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; color: var(--ink); cursor: pointer; font: inherit; padding: 9px; }
.test-account-button:hover, .test-account-button:focus-visible { border-color: #2f84ff; background: #eff7ff; }
.progress-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.progress-chart-card { border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; padding: 12px; }
.progress-chart { display: block; height: auto; margin-top: 8px; overflow: visible; width: 100%; }
.chart-axis { stroke: #c9d2df; stroke-width: 1; }
.chart-line { fill: none; stroke: #2f84ff; stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.chart-dot { fill: #ffffff; stroke: #2f84ff; stroke-width: 2; }
.chart-label, .chart-value, .chart-empty { fill: #718096; font-size: 10px; }

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

.ranking-section + .ranking-section {
  border-top: 1px solid var(--line);
  margin-top: 24px;
  padding-top: 24px;
}

.ranking-section h3 {
  margin: 0;
}

.ranking-section p,
.ranking-empty {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 6px 0 14px;
}

.ranking-item {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  padding: 12px 14px;
}

.ranking-item:nth-child(1) {
  border-color: #ffd166;
  background: #fff9e8;
}

.ranking-item:nth-child(2) {
  border-color: #cfd8e3;
}

.ranking-item:nth-child(3) {
  border-color: #f0b28c;
}

.ranking-rank {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #2f84ff;
  color: #ffffff;
  font-weight: 900;
}

.ranking-score {
  justify-self: end;
  color: #0e3875;
  font-size: 1.35rem;
  font-weight: 900;
}

.history-item {
  display: grid;
  gap: 8px;
}

.history-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.history-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.history-item audio {
  width: 100%;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 1100px) {
  .app-header {
    grid-template-columns: 1fr auto;
  }

  .app-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .main-content {
    padding: 16px;
  }

  .app-header {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .app-nav,
  .header-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .task-header strong {
    padding-left: 0;
    text-align: left;
  }

  .standard-source-controls select {
    max-width: 145px;
  }

  .teacher-content-item {
    flex-direction: column;
  }

  .teacher-recording-actions {
    justify-content: flex-start;
    min-width: 0;
    width: 100%;
  }

  .practice-footer {
    grid-template-columns: 1fr;
  }

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

  .section-heading {
    align-items: flex-start;
  }

  .topbar h2 {
    font-size: 2rem;
  }

  .login-language-selector {
    top: 16px;
    right: 16px;
  }
}

@supports (padding: max(0px)) {
  .main-content {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }
}
