/* Profile modal and level picker styles. */

.guest-native-level-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.profile-level-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.profile-level-control select {
  min-width: 150px;
  max-width: 210px;
  height: 36px;
  padding: 0 10px;
  font-size: 0.82rem;
  color: var(--text);
}

.profile-modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  z-index: 100000;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.profile-modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border-radius: 20px;
  background: #fff;
  padding: 20px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  margin: auto 0;
}

.profile-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.profile-modal-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.profile-modal-close {
  border: none;
  background: transparent;
  font-size: 1.6rem;
  cursor: pointer;
  color: #64748b;
}

.profile-field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--text);
  font-weight: 800;
}

.profile-field input,
.profile-field select {
  width: 100%;
  min-height: 40px;
}

.profile-name-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(99, 91, 255, 0.16);
  border-radius: 16px;
  background:
    radial-gradient(circle at 18% 12%, rgba(124, 92, 255, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(247,249,255,0.96), rgba(255,255,255,0.98));
}

.profile-name-avatar {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255,255,255,0.82);
  border: 1px solid rgba(130,148,190,0.18);
  box-shadow: 0 10px 22px rgba(36,48,84,0.08);
  font-size: 1.55rem;
  cursor: pointer;
  padding: 0;
}

.profile-name-avatar:hover,
.profile-name-avatar:focus-visible {
  border-color: rgba(99, 91, 255, 0.38);
  outline: none;
  box-shadow: 0 0 0 4px rgba(99,91,255,0.10), 0 10px 22px rgba(36,48,84,0.08);
}

.profile-name-avatar span {
  line-height: 1;
}

.profile-name-field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text);
}

.profile-name-field span {
  color: #596783;
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.profile-name-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(130,148,190,0.20);
  border-radius: 14px;
  background: rgba(255,255,255,0.88);
  color: #17213b;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 850;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
}

.profile-name-field input:focus {
  outline: none;
  border-color: rgba(99, 91, 255, 0.48);
  box-shadow: 0 0 0 4px rgba(99,91,255,0.10);
}

.profile-name-field small {
  color: rgba(89,103,131,0.82);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.25;
}

.profile-compact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 10px;
  align-items: stretch;
  margin-bottom: 6px;
}

.profile-level-field {
  margin-bottom: 0;
  padding: 12px;
  border: 1px solid rgba(99, 91, 255, 0.18);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(247,249,255,0.96), rgba(255,255,255,0.96));
}

.profile-level-current {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
}

.profile-level-current small {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
}

.profile-level-preview {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  padding: 10px 12px;
  border: 1px solid rgba(99, 91, 255, 0.26);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 10px 24px rgba(99, 91, 255, 0.1);
  cursor: pointer;
}

.profile-level-preview strong,
.profile-level-preview span {
  min-width: 0;
}

.profile-level-preview strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.98rem;
}

.profile-level-preview span {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 800;
}

.profile-level-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 100002;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.34);
}

.profile-level-picker {
  width: min(860px, 100%);
  max-height: min(82vh, 650px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(141, 152, 186, 0.28);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(20, 30, 60, 0.25);
}

.profile-level-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
}

.profile-level-picker-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
}

.profile-level-picker-header span {
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.profile-level-picker-close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(141, 152, 186, 0.24);
  background: rgba(248, 250, 252, 0.92);
  color: #64748b;
  font-size: 1.4rem;
  font-weight: 900;
}

.profile-level-picker-list {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  padding: 4px 18px 18px;
}

.profile-level-group {
  display: grid;
  gap: 8px;
}

.profile-level-group h5 {
  margin: 0;
  padding: 0 2px;
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.profile-level-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.profile-level-option {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 88px;
  padding: 10px 10px 15px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 14px;
  background: #42526b;
  color: #fff;
  text-align: left;
  box-shadow: 0 8px 20px rgba(24, 39, 67, 0.14);
}

.profile-level-option::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(90deg, rgba(10, 20, 40, 0.88) 0%, rgba(15, 28, 50, 0.7) 58%, rgba(18, 31, 50, 0.36) 100%);
}

.profile-level-option-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1.015);
}

.profile-level-option.selected {
  border-color: #fff;
  box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.7), 0 12px 28px rgba(36, 43, 94, 0.24);
}

.profile-level-option-main,
.profile-level-option-main strong,
.profile-level-option-main span,
.profile-level-option-side {
  display: block;
}

.profile-level-option-main,
.profile-level-option-side,
.profile-level-meter {
  position: relative;
  z-index: 2;
}

.profile-level-option-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.86rem;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.profile-level-option-main span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.7rem;
  font-weight: 800;
}

.profile-level-option-main .profile-level-option-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
  color: #fff;
}

.profile-level-option-stats b {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1.15;
}

.profile-level-option-side {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.profile-level-status,
.profile-level-badge {
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 900;
  white-space: nowrap;
}

.profile-level-status.complete {
  background: rgba(220, 252, 231, 0.92);
  color: #2f8a5b;
}

.profile-level-status.partial {
  background: rgba(254, 243, 199, 0.94);
  color: #9a650b;
}

.profile-level-status.not-started {
  background: rgba(241, 245, 249, 0.92);
  color: #64748b;
}

.profile-level-badge {
  background: rgba(238, 242, 255, 0.94);
  color: #5247d8;
}

.profile-level-meter {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 7px;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
}

.profile-level-meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6f64ff, #2fbf8f);
}

.profile-level-callout {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(79, 107, 255, 0.07);
  color: var(--text);
}

.profile-level-callout strong,
.profile-level-callout span {
  display: block;
}

.profile-level-callout strong {
  font-size: 0.86rem;
  margin-bottom: 3px;
}

.profile-level-callout span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-learning-result {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(141, 152, 186, 0.24);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.86);
  color: var(--text);
}

.profile-learning-result > strong {
  display: block;
  margin-bottom: 9px;
  font-size: 0.9rem;
}

.profile-learning-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px 12px;
  align-items: baseline;
}

.profile-learning-result-grid span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.profile-learning-result-grid b {
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 900;
  text-align: right;
}

.profile-learning-result p {
  margin: 9px 0 0;
  color: #74809b;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-learning-result-note {
  margin: 6px 2px 12px;
  color: #74809b;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-i18n-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 210px);
  gap: 12px;
  align-items: center;
  margin: 10px 0 6px;
  padding: 12px;
  border: 1px dashed rgba(99, 91, 255, 0.26);
  border-radius: 14px;
  background: rgba(247, 249, 255, 0.74);
  color: var(--text);
}

.profile-i18n-panel strong,
.profile-i18n-panel span,
.profile-i18n-panel small {
  display: block;
}

.profile-i18n-panel strong {
  font-size: 0.9rem;
}

.profile-i18n-panel span,
.profile-i18n-panel small {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-i18n-panel small {
  margin-top: 5px;
  color: #4f46e5;
}

.profile-i18n-select-wrap {
  display: grid;
  gap: 6px;
}

.profile-i18n-select-wrap span {
  color: #64748b;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.profile-i18n-select-wrap select {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(141, 152, 186, 0.35);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  padding: 0 10px;
}

.profile-avatar-current {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(141, 152, 186, 0.28);
  border-radius: 14px;
  background: rgba(248, 250, 252, 0.82);
}

.profile-avatar-current strong,
.profile-avatar-current span {
  display: block;
}

.profile-avatar-current strong {
  color: var(--text);
  font-size: 0.92rem;
}

.profile-avatar-current div span {
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-avatar-preview {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  border: 1px solid rgba(99, 91, 255, 0.34);
  background: #fff;
  box-shadow: 0 10px 24px rgba(99, 91, 255, 0.12);
  cursor: pointer;
}

.profile-avatar-preview span {
  font-size: 1.55rem;
  line-height: 1;
}

.profile-avatar-picker-overlay {
  position: fixed;
  inset: 0;
  z-index: 100002;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.34);
}

.profile-avatar-picker {
  width: min(620px, 100%);
  max-height: min(76vh, 620px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(141, 152, 186, 0.28);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(20, 30, 60, 0.25);
}

.profile-avatar-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 10px;
}

.profile-avatar-picker-header h4 {
  margin: 0;
  color: var(--text);
  font-size: 1.05rem;
}

.profile-avatar-picker-header span {
  color: #64748b;
  font-size: 0.8rem;
  font-weight: 700;
}

.profile-avatar-picker-close {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(141, 152, 186, 0.24);
  background: rgba(248, 250, 252, 0.92);
  color: #64748b;
  font-size: 1.4rem;
  font-weight: 900;
}

.profile-avatar-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 9px;
  overflow-y: auto;
  padding: 8px 18px 18px;
}

.profile-avatar-option {
  min-width: 48px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(141, 152, 186, 0.35);
  background: rgba(248, 250, 252, 0.95);
  box-shadow: none;
  font-size: 1.2rem;
  cursor: pointer;
}

.profile-avatar-option.selected {
  border-color: #635bff;
  background: rgba(99, 91, 255, 0.12);
}

@media (max-width: 560px) {
  .profile-modal {
    padding: 18px;
  }

  .profile-name-card,
  .profile-compact-grid,
  .profile-i18n-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-name-card {
    align-items: stretch;
  }

  .profile-name-avatar {
    width: 58px;
    height: 58px;
  }

  .profile-level-picker-overlay,
  .profile-avatar-picker-overlay {
    padding: 0;
  }

  .profile-level-picker,
  .profile-avatar-picker {
    width: 100%;
    max-height: 82vh;
    border-radius: 22px 22px 0 0;
  }

  .profile-level-group-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-level-option {
    grid-template-columns: 1fr;
    min-height: 88px;
  }

  .profile-level-option-side {
    justify-content: flex-start;
  }
}

@media (min-width: 561px) and (max-width: 820px) {
  .profile-level-group-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.profile-offline-panel {
  display: grid;
  gap: 10px;
  margin: 10px 0 6px;
  padding: 12px;
  border: 1px solid rgba(99, 91, 255, 0.16);
  border-radius: 14px;
  background: rgba(247, 249, 255, 0.82);
  color: var(--text);
}

.profile-offline-panel strong,
.profile-offline-panel span {
  display: block;
}

.profile-offline-panel strong {
  font-size: 0.9rem;
}

.profile-offline-panel span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-sync-panel {
  display: grid;
  gap: 6px;
  margin: 10px 0 6px;
  padding: 12px;
  border: 1px solid rgba(50, 171, 109, 0.2);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(240, 253, 244, 0.92), rgba(255, 255, 255, 0.94));
}

.profile-sync-panel strong,
.profile-sync-panel span {
  display: block;
}

.profile-sync-panel strong {
  font-size: 0.9rem;
}

.profile-sync-panel span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-sync-pill {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(50, 171, 109, 0.24);
  background: rgba(237, 250, 244, 0.92);
  color: #32805a !important;
}

.profile-sync-pill.warn {
  border-color: rgba(214, 80, 80, 0.24);
  background: rgba(255, 244, 244, 0.94);
  color: #a33a3a !important;
}

.profile-offline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-offline-btn {
  margin: 0;
}

.profile-offline-status:empty {
  display: none !important;
}

.profile-modal-actions {
  position: sticky;
  bottom: -22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 12px;
  padding-bottom: 2px;
  background: linear-gradient(180deg, rgba(255,255,255,0.78), #fff 42%);
}

.profile-save-btn {
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
  cursor: pointer;
  background: #635bff;
  color: #fff;
}

.auth-native-level-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.auth-level-preview {
  grid-column: 1 / -1;
  min-height: 50px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 9px 14px !important;
  border-radius: 18px !important;
  border: 1px solid rgba(99, 91, 255, 0.22) !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: #18233f !important;
  box-shadow: 0 10px 24px rgba(99, 91, 255, 0.10) !important;
  text-align: left !important;
}

.auth-level-preview span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.auth-level-preview strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.98rem;
  line-height: 1.15;
}

.auth-level-preview small {
  color: #64748b;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.1;
}

.auth-level-preview b {
  flex: 0 0 auto;
  color: #635bff;
  font-size: 1.2rem;
  line-height: 1;
}

.profile-learning-language-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 10px 0;
  padding: 12px;
  border: 1px solid rgba(99, 91, 255, 0.2);
  border-radius: 8px;
  background: rgba(248, 250, 255, 0.96);
}

.profile-learning-language-copy {
  min-width: 0;
}

.profile-learning-language-copy strong,
.profile-learning-language-copy span {
  display: block;
}

.profile-learning-language-copy strong {
  color: #18233f;
  font-size: 0.9rem;
}

.profile-learning-language-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-learning-language-segments {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(108px, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(99, 91, 255, 0.16);
  border-radius: 8px;
  background: #fff;
}

.profile-learning-language-segments button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #33415f;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}

.profile-learning-language-segments button[aria-pressed="true"] {
  border-color: rgba(99, 91, 255, 0.3);
  background: rgba(99, 91, 255, 0.11);
  color: #4f46e5;
}

.profile-learning-language-segments button span {
  margin-right: 6px;
}

.profile-spanish-level-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(99, 91, 255, 0.14);
  color: #33415f;
  font-size: 0.82rem;
}

.profile-spanish-level-row[hidden] {
  display: none;
}

.profile-spanish-level-segments {
  display: inline-grid;
  grid-template-columns: repeat(2, 64px);
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(99, 91, 255, 0.16);
  border-radius: 8px;
  background: #fff;
}

.profile-spanish-level-segments button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #33415f;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}

.profile-spanish-level-segments button[aria-pressed="true"] {
  border-color: rgba(99, 91, 255, 0.3);
  background: rgba(99, 91, 255, 0.11);
  color: #4f46e5;
}

.profile-level-preview--fixed {
  opacity: 0.78;
  cursor: default;
}

.profile-account-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 6px;
  padding: 12px;
  border: 1px solid rgba(214, 80, 80, 0.2);
  border-radius: 8px;
  background: rgba(255, 249, 249, 0.92);
}

.profile-account-panel strong,
.profile-account-panel span {
  display: block;
}

.profile-account-panel strong {
  font-size: 0.9rem;
}

.profile-account-panel span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.35;
}

.profile-account-delete-link {
  flex: 0 0 auto;
  margin: 0;
  border-color: rgba(214, 80, 80, 0.28);
  color: #a33a3a;
  text-decoration: none;
}

@media (max-width: 460px) {
  .profile-learning-language-panel {
    grid-template-columns: 1fr;
  }

  .profile-learning-language-segments {
    display: grid;
    width: 100%;
  }

  .profile-spanish-level-row {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-spanish-level-segments {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .profile-account-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-account-delete-link {
    text-align: center;
  }
}

/* ===== Ordered profile course and technical sections ===== */
.profile-modal {
  width: min(610px, 100%);
}

.profile-course-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin: 0 0 12px;
  padding: 14px 0;
  border-top: 1px solid rgba(116, 132, 178, 0.18);
  border-bottom: 1px solid rgba(116, 132, 178, 0.18);
}

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

.profile-course-field {
  min-width: 0;
  display: grid;
  gap: 6px;
  margin: 0;
}

.profile-course-field > span {
  color: #596783;
  font-size: 0.76rem;
  font-weight: 850;
}

.profile-course-field select,
.profile-course-field .profile-level-preview {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 0 12px;
  border: 1px solid rgba(116, 132, 178, 0.24);
  border-radius: 8px;
  background: #fff;
  color: #18233f;
  box-shadow: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;
}

.profile-course-field select:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.profile-course-field .profile-level-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
}

.profile-level-preview-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.profile-level-preview-copy strong,
.profile-level-preview-copy small {
  display: block;
  min-width: 0;
}

.profile-level-preview-copy strong {
  overflow: hidden;
  color: #18233f;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-level-preview-copy small {
  overflow: hidden;
  color: #72809a;
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-course-field .profile-level-preview b {
  flex: 0 0 auto;
  color: #4f46e5;
}

.profile-course-level-control {
  display: grid;
  gap: 4px;
}

.profile-course-level-meta {
  min-height: 0.85rem;
  padding: 0 2px;
  overflow: hidden;
  color: #72809a;
  font-size: 0.68rem;
  font-weight: 750;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-course-level-control[hidden],
.profile-level-preview[hidden] {
  display: none !important;
}

.profile-learning-result {
  min-width: 0;
  margin: 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid rgba(116, 132, 178, 0.14);
  border-radius: 0;
  background: transparent;
}

.profile-learning-result > strong {
  display: block;
  margin-bottom: 8px;
  color: #18233f;
  font-size: 0.82rem;
}

.profile-learning-result-grid {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto minmax(110px, 1fr) auto;
  gap: 7px 12px;
  align-items: baseline;
}

.profile-learning-result-grid span {
  color: #69758e;
  font-size: 0.74rem;
  font-weight: 750;
}

.profile-learning-result-grid b {
  color: #18233f;
  font-size: 0.9rem;
}

.profile-learning-result-note {
  margin: 9px 0 0;
  color: #74809a;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.3;
}

.profile-i18n-panel {
  display: block;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.profile-i18n-select-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.7fr);
  gap: 12px;
  align-items: center;
}

.profile-i18n-select-wrap strong {
  color: #596783;
  font-size: 0.78rem;
}

.profile-i18n-select-wrap select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(116, 132, 178, 0.22);
  border-radius: 8px;
  background: #fff;
  color: #18233f;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
}

.profile-data-details,
.profile-account-details {
  margin-top: 8px;
  border-top: 1px solid rgba(116, 132, 178, 0.16);
}

.profile-data-details > summary,
.profile-account-details > summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 2px;
  color: #52607a;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 850;
  list-style: none;
}

.profile-data-details > summary::-webkit-details-marker,
.profile-account-details > summary::-webkit-details-marker {
  display: none;
}

.profile-data-details[open] > summary b,
.profile-account-details[open] > summary b {
  transform: rotate(180deg);
}

.profile-data-details > summary b,
.profile-account-details > summary b {
  transition: transform 0.2s ease;
}

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

.profile-details-body .profile-offline-panel,
.profile-details-body .profile-sync-panel,
.profile-account-details .profile-account-panel {
  margin: 0 0 8px;
}

.profile-modal-actions {
  bottom: -20px;
  margin-top: 12px;
  padding: 12px 0 2px;
}

.profile-save-btn:disabled {
  background: #d7dbea;
  color: #7b849b;
  cursor: default;
  box-shadow: none;
}

.profile-save-btn[aria-busy="true"] {
  opacity: 0.72;
  cursor: wait;
}

@media (max-width: 620px) {
  .profile-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .profile-modal {
    width: 100%;
    max-height: 94dvh;
    margin: 0;
    padding: 16px;
    border-radius: 18px 18px 0 0;
  }

  .profile-course-panel {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .profile-course-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-learning-result {
    padding: 10px 0 0;
    border-top: 1px solid rgba(116, 132, 178, 0.14);
    border-left: 0;
  }

  .profile-learning-result-grid {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .profile-i18n-select-wrap {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .profile-details-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .profile-modal-actions {
    bottom: -16px;
  }
}

@media (max-width: 420px) {
  .profile-name-card {
    grid-template-columns: 52px minmax(0, 1fr);
    padding: 10px;
  }

  .profile-name-avatar {
    width: 50px;
    height: 50px;
  }

  .profile-name-field small {
    display: none;
  }
}
