:root {
  --epc-green: #2d8f4e;
  --epc-green-dark: #1f6b38;
  --epc-green-light: #e8f5ec;
  --epc-orange: #f5a623;
  --epc-orange-dark: #d4890a;
  --epc-orange-light: #fff3dc;
  --epc-white: #ffffff;
  --epc-gray: #f4f6f5;
  --epc-text: #1a2e1f;
  --epc-radius: 16px;
  --epc-shadow: 0 8px 32px rgba(45, 143, 78, 0.12);
}

.epc-app {
  font-family: 'Segoe UI', system-ui, sans-serif;
  color: var(--epc-text);
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 80px;
  position: relative;
  min-height: 60vh;
}

.epc-screen { animation: epcFadeIn 0.4s ease; }
.epc-screen[hidden] { display: none !important; }

@keyframes epcFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.epc-card {
  background: var(--epc-white);
  border-radius: var(--epc-radius);
  padding: 32px;
  box-shadow: var(--epc-shadow);
  border: 2px solid var(--epc-green-light);
}

.epc-title {
  font-size: 1.75rem;
  color: var(--epc-green-dark);
  margin: 0 0 8px;
}

.epc-subtitle {
  color: #5a6b5e;
  margin: 0 0 24px;
}

.epc-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.epc-tab {
  flex: 1;
  padding: 10px;
  border: 2px solid var(--epc-green-light);
  background: var(--epc-gray);
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}

.epc-tab--active {
  background: var(--epc-green);
  color: white;
  border-color: var(--epc-green);
}

#epc-form-profession,
#epc-form-profession.epc-form,
#epc-form-profession.epc-onboarding-form {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
}

#epc-profession-input {
  display: block !important;
  width: 100% !important;
  min-height: 48px !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.epc-onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.epc-onboarding-panel[hidden] {
  display: none !important;
}

.epc-onboarding-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.epc-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-top: 6px;
}

.epc-checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
}

.epc-checkbox-option input {
  margin-top: 3px;
  min-height: auto;
  width: auto;
}

.epc-steps--5 {
  flex-wrap: wrap;
  gap: 6px;
}

.epc-steps--5 .epc-step {
  font-size: 0.78rem;
  padding: 6px 10px;
}

.epc-auth-form,
.epc-onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.epc-auth-form {
  display: none;
}

.epc-auth-form--active {
  display: flex;
}

.epc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.epc-input,
.epc-app input[type="text"],
.epc-app input[type="email"],
.epc-app input[type="password"],
.epc-app input[type="search"],
.epc-app input[type="number"],
.epc-app textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 2px solid #dde8e0;
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1.4;
  background: #ffffff;
  color: var(--epc-text);
  box-sizing: border-box;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s;
}

.epc-input:focus,
.epc-app input[type="text"]:focus,
.epc-app input[type="email"]:focus,
.epc-app input[type="password"]:focus,
.epc-app input[type="search"]:focus,
.epc-app input[type="number"]:focus,
.epc-app textarea:focus {
  outline: none;
  border-color: var(--epc-orange);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.2);
}

/* Legacy selector kept for older cached markup */
.epc-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#epc-screen-auth .epc-form {
  display: none;
}

#epc-screen-auth .epc-form--active {
  display: flex;
}

.epc-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.epc-form input {
  padding: 12px 16px;
  border: 2px solid #dde8e0;
  border-radius: 10px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.epc-form input:focus {
  outline: none;
  border-color: var(--epc-orange);
}

.epc-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s;
}

.epc-btn:hover { transform: translateY(-1px); }
.epc-btn:active { transform: translateY(0); }

.epc-btn--primary {
  background: linear-gradient(135deg, var(--epc-green), var(--epc-green-dark));
  color: white;
}

.epc-btn--primary:hover {
  background: linear-gradient(135deg, var(--epc-green-dark), #164d2a);
}

.epc-btn--secondary {
  background: var(--epc-orange);
  color: white;
}

.epc-btn--secondary:hover { background: var(--epc-orange-dark); }

.epc-btn--ghost {
  background: transparent;
  color: var(--epc-green);
  padding: 8px 0;
  margin-bottom: 16px;
}

.epc-error {
  background: #ffeaea;
  color: #c0392b;
  padding: 12px;
  border-radius: 8px;
  margin-top: 12px;
}

.epc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.epc-logo {
  font-size: 1.5rem;
  color: var(--epc-green);
  margin: 0;
}

.epc-nickname {
  color: #5a6b5e;
  font-size: 0.9rem;
}

.epc-points-badge {
  background: var(--epc-orange-light);
  color: var(--epc-orange-dark);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700;
}

.epc-course-info {
  background: linear-gradient(135deg, var(--epc-green-light), var(--epc-orange-light));
  padding: 20px 24px;
  border-radius: var(--epc-radius);
  margin-bottom: 24px;
  display: flex;
  gap: 16px;
  align-items: stretch;
}

.epc-course-info__main {
  flex: 1;
  min-width: 0;
}

.epc-course-info h2 { margin: 0 0 8px; color: var(--epc-green-dark); }
.epc-course-info p { margin: 0; color: #4a5a4e; }

.epc-course-beaver-slot {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 96px;
  position: relative;
}

.epc-course-progress {
  margin-top: 14px;
}

.epc-course-progress__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.epc-course-progress__text {
  font-weight: 600;
  color: var(--epc-green-dark);
  font-size: 0.95rem;
}

.epc-course-progress__percent {
  font-weight: 700;
  color: var(--epc-orange-dark);
  font-size: 1.1rem;
}

.epc-progress-track--course {
  height: 12px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(45, 106, 69, 0.12);
}

.epc-progress-track--course .epc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3d8b5f, #2ecc71);
  transition: width 0.4s ease;
}

.epc-course-progress-remaining {
  margin: 8px 0 0;
  font-size: 0.92rem;
  color: #4a5a4e;
}

.epc-beaver--inline {
  position: relative;
  bottom: auto;
  right: auto;
  transform: none;
}

.epc-beaver--inline .epc-beaver__body {
  width: 72px;
  height: 62px;
}

.epc-beaver--inline .epc-beaver__speech {
  bottom: calc(100% + 8px);
  right: -8px;
  max-width: 180px;
  font-size: 0.82rem;
}

.epc-beaver--inline .epc-beaver__speech::after {
  right: 28px;
}

.epc-btn--new-course {
  border: 2px dashed var(--epc-green);
  color: var(--epc-green-dark);
  background: var(--epc-green-light);
}

.epc-btn--new-course:hover {
  background: #dff3e6;
}

.epc-course-stats {
  margin: 8px 0 0;
  font-size: 0.95rem;
  color: var(--epc-green-dark);
  font-weight: 600;
}

.epc-modules-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.epc-module-view {
  margin-top: 20px;
}

#epc-screen-dashboard .epc-module-view {
  margin-top: 24px;
}

#epc-screen-dashboard .epc-course-info {
  margin-bottom: 4px;
}

.epc-module-panel {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(30, 60, 90, 0.08);
  padding: 22px 22px 26px;
  border: 1px solid #e8eef3;
}

.epc-module-panel__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.epc-module-panel__counter {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #1a2e1f;
}

.epc-module-panel__nav {
  display: flex;
  gap: 10px;
}

.epc-module-nav-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: #e8f4fc;
  color: #2f8fd4;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, opacity 0.2s;
}

.epc-module-nav-btn:hover:not(:disabled) {
  background: #d4ebfa;
  transform: scale(1.04);
}

.epc-module-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.epc-module-panel__progress {
  margin-bottom: 18px;
}

.epc-progress-track--module {
  height: 6px;
  background: #edf2f6;
  border-radius: 999px;
  overflow: hidden;
}

.epc-progress-fill--module {
  height: 100%;
  background: linear-gradient(90deg, #5bb8f0, #3d9fe8);
  transition: width 0.35s ease;
}

.epc-module-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #4daae8 0%, #3d96d9 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(61, 150, 217, 0.25);
}

.epc-module-banner__label {
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.88;
}

.epc-module-banner__title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
}

.epc-module-banner__meta {
  margin: 0;
  font-size: 0.88rem;
  opacity: 0.92;
}

.epc-module-banner__emoji {
  font-size: 2.4rem;
  line-height: 1;
  flex-shrink: 0;
}

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

.epc-lesson-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 118px;
  padding: 14px 14px 12px;
  border: 1.5px solid #e3eaf0;
  border-radius: 14px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  box-shadow: 0 2px 8px rgba(20, 40, 60, 0.04);
}

.epc-lesson-tile:hover {
  border-color: #9fd0f0;
  box-shadow: 0 6px 18px rgba(61, 150, 217, 0.12);
  transform: translateY(-2px);
}

.epc-lesson-tile--done {
  border-color: #9ed9b4;
  background: linear-gradient(180deg, #f6fff9 0%, #fff 100%);
}

.epc-lesson-tile__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf2f6;
  color: #4a5a4e;
  font-size: 0.82rem;
  font-weight: 700;
}

.epc-lesson-tile--done .epc-lesson-tile__badge {
  background: #2ecc71;
  color: #fff;
}

.epc-lesson-tile__icon {
  font-size: 1.35rem;
  line-height: 1;
}

.epc-lesson-tile__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a2e1f;
  line-height: 1.3;
}

.epc-lesson-tile__meta {
  font-size: 0.78rem;
  color: #6a7a6e;
}

.epc-module-empty {
  margin: 0;
  padding: 24px;
  text-align: center;
  color: #6a7a6e;
}

@media (max-width: 640px) {
  .epc-module-lessons-grid {
    grid-template-columns: 1fr;
  }

  .epc-module-panel {
    padding: 16px;
  }

  .epc-module-banner {
    flex-direction: column;
    align-items: flex-start;
  }
}

.epc-module {
  background: var(--epc-white);
  border: 2px solid var(--epc-green-light);
  border-radius: var(--epc-radius);
  padding: 20px;
  box-shadow: var(--epc-shadow);
}

.epc-module__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.epc-module__label {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--epc-orange-dark);
  letter-spacing: 0.04em;
}

.epc-module__title {
  margin: 0;
  font-size: 1.15rem;
  color: var(--epc-green-dark);
}

.epc-module__progress {
  background: var(--epc-green-light);
  color: var(--epc-green-dark);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.epc-module__lessons {
  margin-top: 4px;
}

.epc-flashcards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.epc-flashcards-hint {
  margin: 12px 0 0;
  font-size: 0.9rem;
  color: #5a6b5e;
}

.epc-vocab-module {
  margin-bottom: 24px;
}

.epc-vocab-module__title {
  margin: 0 0 12px;
  color: var(--epc-green-dark);
  font-size: 1.1rem;
}

.epc-lessons-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.epc-lesson-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: white;
  border: 2px solid var(--epc-green-light);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.epc-lesson-card:hover {
  border-color: var(--epc-orange);
  transform: translateX(4px);
}

.epc-lesson-card--completed {
  border-color: var(--epc-green);
  background: var(--epc-green-light);
}

.epc-lesson-card__num {
  width: 40px;
  height: 40px;
  background: var(--epc-green);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.epc-lesson-card--completed .epc-lesson-card__num {
  background: var(--epc-orange);
}

.epc-lesson-card__info { flex: 1; }
.epc-lesson-card__title { font-weight: 600; margin: 0 0 4px; }
.epc-lesson-card__meta { font-size: 0.85rem; color: #6a7a6e; margin: 0; }

.epc-exercise {
  background: white;
  border: 2px solid var(--epc-green-light);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.epc-exercise__prompt {
  font-size: 1.1rem;
  margin-bottom: 12px;
  line-height: 1.5;
}

.epc-exercise__hint {
  font-size: 0.85rem;
  color: #6a7a6e;
  margin-bottom: 8px;
}

.epc-exercise input[type="text"] {
  width: 100%;
  padding: 12px;
  border: 2px solid #dde8e0;
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

.epc-exercise input.correct { border-color: var(--epc-green); background: var(--epc-green-light); }
.epc-exercise input.incorrect { border-color: #e74c3c; background: #ffeaea; }

.epc-speech-input {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.epc-speech-input input[type="text"] {
  flex: 1;
}

.epc-speech-status {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: #6a7a6e;
}

.epc-audio-btn,
.epc-mic-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid #dde8e0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s;
}

.epc-audio-btn:hover,
.epc-mic-btn:hover:not(:disabled) {
  border-color: var(--epc-orange);
  background: #fffdf8;
}

.epc-audio-btn--loading {
  opacity: 0.6;
  animation: epc-audio-pulse 0.8s infinite;
}

@keyframes epc-audio-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

.epc-audio-btn--inline {
  width: 36px;
  height: 36px;
  margin-left: auto;
}

.epc-audio-btn--unsupported {
  width: 36px;
  height: 36px;
  margin-left: auto;
}

.epc-mic-btn--active {
  border-color: #e74c3c;
  background: #ffeaea;
  animation: epc-mic-pulse 1.2s infinite;
}

.epc-mic-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@keyframes epc-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(231, 76, 60, 0); }
}

.epc-speak-sample {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f6faf7;
  font-size: 0.95rem;
}

.epc-speak-sample__label {
  color: #6a7a6e;
}

.epc-expected-audio {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.9rem;
  color: #6a7a6e;
}

.epc-dialogue-line__header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.epc-dialogue-line__ru {
  display: block;
  margin-top: 4px;
}

.epc-vocab-item__en {
  display: flex;
  align-items: center;
  gap: 8px;
}

.epc-flashcard__term {
  text-align: center;
}

.epc-placement-option.correct,
.epc-placement-option.correct:has(input:checked) {
  border-color: var(--epc-green);
  background: var(--epc-green-light);
}

.epc-placement-option.incorrect,
.epc-placement-option.incorrect:has(input:checked) {
  border-color: #e74c3c;
  background: #ffeaea;
}

.epc-option-text {
  flex: 1;
  line-height: 1.45;
}

.epc-flashcard {
  perspective: 1000px;
  height: 180px;
  margin-bottom: 16px;
  cursor: pointer;
}

.epc-flashcard__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.epc-flashcard.flipped .epc-flashcard__inner {
  transform: rotateY(180deg);
}

.epc-flashcard__front,
.epc-flashcard__back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 600;
}

.epc-flashcard__front {
  background: var(--epc-green);
  color: white;
  flex-direction: column;
  gap: 10px;
}

.epc-flashcard__back {
  background: var(--epc-orange);
  color: white;
  transform: rotateY(180deg);
}

.epc-dialogue-line {
  padding: 12px 16px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: var(--epc-gray);
}

.epc-dialogue-line--other {
  background: var(--epc-green-light);
  border-left: 4px solid var(--epc-green);
}

.epc-fill-blank-step {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.epc-step-progress {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--epc-text-muted, #5c6b63);
}

.epc-step-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.epc-exercise--fill-blank .epc-exercise__prompt {
  font-size: 1.08rem;
  line-height: 1.55;
}

.epc-lesson-result {
  margin-top: 20px;
  padding: 20px;
  border-radius: 12px;
  font-weight: 600;
}

.epc-lesson-result__summary {
  margin: 0;
  font-size: 1.05rem;
}

.epc-lesson-result__points {
  margin: 8px 0 0;
  font-size: 0.95rem;
  opacity: 0.9;
}

.epc-lesson-result.success {
  background: var(--epc-green-light);
  color: var(--epc-green-dark);
}

.epc-lesson-result.fail {
  background: #ffeaea;
  color: #c0392b;
}

/* Lesson screen */
.epc-app:has(#epc-screen-lesson:not([hidden])) {
  max-width: 900px;
}

.epc-screen--lesson {
  animation: epcFadeIn 0.35s ease;
}

.epc-lesson-layout {
  display: block;
}

.epc-lesson-panel {
  background: #fff;
  border: 1px solid #c8ddf0;
  border-radius: 20px;
  padding: 28px 32px 24px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.epc-lesson-panel__title {
  margin: 0 0 24px;
  font-size: 1.45rem;
  font-weight: 700;
  color: #2f6fa3;
}

.epc-lesson-content {
  flex: 1;
}

.epc-lesson-panel__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding-top: 8px;
}

.epc-btn--lesson-close {
  background: #eef5fb;
  color: #2f6fa3;
  border: 1px solid #c8ddf0;
  border-radius: 12px;
  padding: 10px 22px;
  font-weight: 600;
}

.epc-btn--lesson-close:hover {
  background: #dceaf7;
}

.epc-btn--lesson-next {
  background: #eef5fb;
  color: #7a96ad;
  border: 1px solid #c8ddf0;
  border-radius: 12px;
  padding: 10px 24px;
  font-weight: 600;
}

.epc-btn--lesson-next:not(:disabled) {
  background: #5ba3d9;
  color: #fff;
  border-color: #5ba3d9;
}

.epc-btn--lesson-next:not(:disabled):hover {
  background: #4a92c8;
}

.epc-lesson-exercises-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  counter-reset: epc-lesson-exercise;
}

.epc-lesson-exercise-item {
  counter-increment: epc-lesson-exercise;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.epc-lesson-exercise-item::before {
  content: counter(epc-lesson-exercise) ".";
  flex: 0 0 1.5rem;
  font-weight: 700;
  color: #2f6fa3;
  line-height: 1.6;
}

.epc-lesson-exercise-item__body {
  flex: 1;
  min-width: 0;
}

.epc-lesson-exercises-list--fill-blank .epc-lesson-exercise-item::before {
  line-height: 2.1;
}

.epc-fill-sentence {
  margin: 0;
  font-size: 1.05rem;
  line-height: 2;
  color: #1a2e1f;
}

.epc-fill-inline {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  vertical-align: baseline;
}

.epc-fill-inline__letter {
  font-size: 1.05rem;
  font-weight: 600;
  color: #1a2e1f;
  min-width: 0.65rem;
}

.epc-fill-inline__input {
  display: inline-block;
  width: min(180px, 40vw);
  min-width: 80px;
  padding: 4px 10px;
  border: none;
  border-radius: 8px;
  background: #eef1f4;
  font-size: 1rem;
  line-height: 1.4;
  color: #1a2e1f;
  vertical-align: baseline;
}

.epc-fill-inline__input:focus {
  outline: 2px solid #5ba3d9;
  background: #fff;
}

.epc-fill-inline__input.correct {
  background: #e8f5ec;
  color: var(--epc-green-dark);
}

.epc-fill-inline__input.incorrect {
  background: #ffeaea;
  color: #c0392b;
}

.epc-fill-hint {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: #5a7a94;
}

.epc-fill-blank-batch-progress {
  margin: 0 0 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #5a7a94;
}

.epc-exercise--compact {
  padding: 0;
  margin: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.epc-exercise--compact .epc-exercise__prompt {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 500;
}

.epc-lesson-exercise-item .epc-exercise--compact .epc-placement-options {
  margin-top: 0;
}

.epc-match-sentence-endings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.epc-sentence-halves-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

.epc-sentence-halves-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.epc-sentence-half {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: none;
  border-radius: 12px;
  background: #eef1f4;
  color: #1a2e1f;
  font-size: 0.98rem;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}

.epc-sentence-half:hover:not(.epc-sentence-half--matched):not(:disabled) {
  background: #e4e9ee;
}

.epc-sentence-half--selected {
  background: #dceaf7;
  box-shadow: 0 0 0 2px rgba(91, 163, 217, 0.35);
}

.epc-sentence-half--matched {
  background: #eef5fb;
  cursor: default;
  pointer-events: none;
}

.epc-sentence-half--correct {
  background: #e8f5ec;
  color: var(--epc-green-dark);
}

.epc-sentence-half--incorrect {
  background: #ffeaea;
  color: #c0392b;
}

.epc-sentence-half--flash-error {
  animation: epc-match-flash-red 0.65s ease;
}

@media (max-width: 760px) {
  .epc-sentence-halves-columns {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (max-width: 760px) {
  .epc-lesson-panel {
    padding: 20px 18px 18px;
  }
}

.epc-vocabulary-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.epc-vocabulary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.epc-vocab-module__title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  color: var(--epc-green-dark);
}

.epc-vocab-item {
  background: white;
  border: 2px solid var(--epc-green-light);
  border-radius: 10px;
  padding: 14px 16px;
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.epc-vocab-item__en {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--epc-green-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.epc-vocab-item__ru {
  color: #5a6b5e;
  font-size: 0.95rem;
  line-height: 1.35;
}

@media (max-width: 900px) {
  .epc-vocabulary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .epc-vocabulary-grid {
    grid-template-columns: 1fr;
  }
}

.epc-screen--break {
  text-align: center;
  padding: 40px 20px;
}

.epc-break-content {
  background: linear-gradient(135deg, var(--epc-green-light), var(--epc-orange-light));
  padding: 40px;
  border-radius: var(--epc-radius);
}

/* Beaver assistant */
.epc-beaver {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  pointer-events: none;
}

.epc-beaver__body {
  position: relative;
  width: 80px;
  height: 70px;
  animation: epcBeaverBounce 2s ease-in-out infinite;
}

@keyframes epcBeaverBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.epc-beaver__head {
  width: 60px;
  height: 50px;
  background: #8B6914;
  border-radius: 50% 50% 45% 45%;
  position: absolute;
  bottom: 10px;
  left: 10px;
  box-shadow: inset -4px -4px 0 rgba(0,0,0,0.1);
}

.epc-beaver__ear {
  width: 18px;
  height: 18px;
  background: #6B4F0A;
  border-radius: 50%;
  position: absolute;
  top: 0;
}

.epc-beaver__ear--left { left: 8px; }
.epc-beaver__ear--right { right: 8px; }

.epc-beaver__eye {
  width: 10px;
  height: 10px;
  background: #1a1a1a;
  border-radius: 50%;
  position: absolute;
  top: 18px;
  animation: epcBeaverBlink 4s infinite;
}

.epc-beaver__eye--left { left: 14px; }
.epc-beaver__eye--right { right: 14px; }

@keyframes epcBeaverBlink {
  0%, 96%, 100% { transform: scaleY(1); }
  98% { transform: scaleY(0.1); }
}

.epc-beaver__nose {
  width: 16px;
  height: 12px;
  background: #2d1810;
  border-radius: 50%;
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
}

.epc-beaver__teeth {
  width: 14px;
  height: 8px;
  background: white;
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 0 0 4px 4px;
}

.epc-beaver__tail {
  width: 28px;
  height: 20px;
  background: #6B4F0A;
  border-radius: 4px;
  position: absolute;
  bottom: 20px;
  right: -8px;
  transform: rotate(-20deg);
  background-image: repeating-linear-gradient(
    90deg,
    transparent,
    transparent 3px,
    rgba(0,0,0,0.15) 3px,
    rgba(0,0,0,0.15) 5px
  );
}

.epc-beaver__speech {
  position: absolute;
  bottom: 90px;
  right: 0;
  background: white;
  border: 2px solid var(--epc-orange);
  border-radius: 16px;
  padding: 12px 16px;
  max-width: 220px;
  font-size: 0.9rem;
  box-shadow: var(--epc-shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
}

.epc-beaver__speech.visible {
  opacity: 1;
  transform: translateY(0);
}

.epc-beaver__speech::after {
  content: '';
  position: absolute;
  bottom: -10px;
  right: 24px;
  border: 10px solid transparent;
  border-top-color: var(--epc-orange);
}

.epc-beaver.celebrate .epc-beaver__body {
  animation: epcBeaverCelebrate 0.6s ease;
}

@keyframes epcBeaverCelebrate {
  0%, 100% { transform: rotate(0); }
  25% { transform: rotate(-10deg) translateY(-12px); }
  75% { transform: rotate(10deg) translateY(-12px); }
}

@media (max-width: 600px) {
  .epc-beaver:not(.epc-beaver--inline) { bottom: 16px; right: 16px; transform: scale(0.85); }
  .epc-course-info {
    flex-direction: column;
  }
  .epc-course-beaver-slot {
    align-self: flex-end;
    min-width: 0;
  }
  .epc-beaver--inline .epc-beaver__body {
    width: 64px;
    height: 56px;
  }
  .epc-card { padding: 20px; }
  .epc-header { flex-direction: column; align-items: flex-start; }
  .epc-header__right { flex-wrap: wrap; }
  .epc-leaderboard-header,
  .epc-leaderboard-row {
    grid-template-columns: 36px 1fr 56px 56px 56px;
    font-size: 0.85rem;
  }
}

.epc-auth-leaderboard-link {
  text-align: center;
  margin-top: 16px;
}

.epc-btn--leaderboard {
  width: 100%;
  justify-content: center;
}

.epc-leaderboard-desc {
  margin-top: -8px;
  margin-bottom: 20px;
}

.epc-leaderboard-current {
  background: linear-gradient(135deg, var(--epc-green-light), var(--epc-orange-light));
  border: 2px solid var(--epc-orange);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.epc-leaderboard-current__label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--epc-green-dark);
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}

.epc-leaderboard-table {
  background: white;
  border: 2px solid var(--epc-green-light);
  border-radius: 12px;
  overflow: hidden;
}

.epc-leaderboard-header,
.epc-leaderboard-row {
  display: grid;
  grid-template-columns: 44px 1fr 72px 72px 72px;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
}

.epc-leaderboard-header {
  background: var(--epc-green);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
}

.epc-leaderboard-row {
  border-top: 1px solid var(--epc-green-light);
  transition: background 0.15s;
}

.epc-leaderboard-row--top {
  background: #fffdf8;
}

.epc-leaderboard-row--current {
  background: var(--epc-green-light);
  border-left: 4px solid var(--epc-green);
}

.epc-lb-rank {
  font-weight: 700;
  font-size: 1.1rem;
  text-align: center;
}

.epc-lb-name {
  font-weight: 600;
  min-width: 0;
}

.epc-lb-profession {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: #6a7a6e;
  margin-top: 2px;
}

.epc-lb-stat {
  text-align: center;
  font-size: 0.9rem;
  color: #4a5a4e;
}

.epc-lb-points {
  font-weight: 700;
  color: var(--epc-orange-dark);
}

.epc-loading,
.epc-empty {
  text-align: center;
  color: #6a7a6e;
  padding: 32px;
}

.epc-steps {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.epc-step {
  flex: 1;
  text-align: center;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--epc-gray);
  font-size: 0.85rem;
  font-weight: 600;
  color: #6a7a6e;
}

.epc-step--active {
  background: var(--epc-green);
  color: white;
}

.epc-step--done {
  background: var(--epc-green-light);
  color: var(--epc-green-dark);
}

.epc-field-hint {
  margin: -8px 0 0;
  font-size: 0.85rem;
  color: #6a7a6e;
}

.epc-card--words {
  max-width: 100%;
}

.epc-word-select-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.epc-word-select-toolbar .epc-input {
  flex: 1;
  min-width: 180px;
}

.epc-word-select-counter {
  margin: 0 0 12px;
  font-weight: 600;
  color: #6a7a6e;
}

.epc-word-select-counter--ok {
  color: var(--epc-green-dark);
}

.epc-word-enrich-status {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--epc-orange-light);
  color: var(--epc-orange-dark);
  font-size: 0.9rem;
}

.epc-word-select-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  margin-bottom: 16px;
  padding-right: 4px;
}

.epc-word-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 2px solid #dde8e0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.epc-word-option input {
  margin: 0 0 4px;
}

.epc-word-option__en {
  font-weight: 600;
  line-height: 1.3;
}

.epc-word-option__ru {
  font-size: 0.9rem;
  color: #6a7a6e;
}

.epc-word-option__ex {
  font-size: 0.8rem;
  color: #8a9a8e;
  font-style: italic;
  line-height: 1.3;
}

.epc-word-option--selected {
  border-color: var(--epc-green);
  background: var(--epc-green-light);
}

.epc-word-option--seed {
  border-color: var(--epc-orange);
}

.epc-textarea {
  resize: vertical;
}

.epc-card--placement {
  max-width: 100%;
}

.epc-placement-profession {
  background: var(--epc-orange-light);
  color: var(--epc-orange-dark);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 600;
  margin-bottom: 12px;
}

.epc-placement-progress {
  font-size: 0.9rem;
  color: #6a7a6e;
  margin-bottom: 16px;
}

.epc-course-build-progress {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: #f6faf7;
  border: 2px solid #dde8e0;
}

.epc-course-build-label {
  margin: 0 0 10px;
  font-weight: 600;
  color: #1a2e1f;
}

.epc-course-build-step {
  margin: 10px 0 0;
  font-size: 0.9rem;
  color: #6a7a6e;
}

.epc-progress-track {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #dde8e0;
  overflow: hidden;
}

.epc-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--epc-green), #7bc96f);
  transition: width 0.35s ease;
}

.epc-placement-phrases {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  max-height: min(72vh, 780px);
  overflow-y: auto;
}

.epc-exercise__prompt--term {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--epc-green-dark);
  margin: 0 0 4px;
}

.epc-exercise--placement {
  margin-bottom: 0;
}

.epc-placement-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.epc-placement-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 2px solid #dde8e0;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.epc-placement-option input {
  flex-shrink: 0;
}

.epc-placement-option--locked,
.epc-placement-option--locked:hover {
  cursor: default;
}

.epc-placement-options[data-locked="1"] .epc-placement-option:not(.correct):not(.incorrect) {
  opacity: 0.55;
}

.epc-placement-option input:disabled {
  cursor: default;
}

.epc-placement-option .epc-option-text,
.epc-placement-option span {
  flex: 1;
  line-height: 1.45;
}

.epc-placement-option:hover {
  border-color: var(--epc-orange);
  background: #fffdf8;
}

.epc-placement-option--active,
.epc-placement-option:has(input:checked):not(.incorrect):not(.correct) {
  border-color: var(--epc-green);
  background: var(--epc-green-light);
}

.epc-placement-option.incorrect:hover,
.epc-placement-option.incorrect:has(input:checked) {
  border-color: #e74c3c;
  background: #ffeaea;
}

.epc-placement-no-options {
  margin: 0;
  color: #6a7a6e;
  font-size: 0.9rem;
}

.epc-placement-nav {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.epc-placement-recovery {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e8efe9;
}

.epc-placement-recovery-label {
  margin: 0 0 10px;
  font-size: 0.9rem;
  color: #6a7a6e;
}

.epc-placement-recovery-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.epc-btn--sm {
  padding: 8px 14px;
  font-size: 0.9rem;
}

.epc-placement-recovery--highlight {
  background: #fff8f8;
  border: 1px solid #f0d4d4;
  border-radius: 10px;
  padding: 14px 16px;
  margin-top: 12px;
}

.epc-level-result-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--epc-green-dark);
}

.epc-match-pairs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.epc-match-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

.epc-match-column__title {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--epc-green-dark);
}

.epc-match-column__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.epc-match-tile {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  border: 2px solid #dde8e0;
  border-radius: 10px;
  background: #fff;
  color: var(--epc-text);
  font-size: 1rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.epc-match-tile--en {
  font-weight: 600;
  color: var(--epc-green-dark);
}

.epc-match-tile:hover:not(.epc-match-tile--matched):not(:disabled) {
  border-color: #9ec9ad;
  background: #f8fcf9;
}

.epc-match-tile--selected {
  border-color: var(--epc-green);
  background: #eef9f1;
  box-shadow: 0 0 0 2px rgba(46, 125, 79, 0.15);
}

.epc-match-tile--matched {
  border-color: #2ecc71;
  background: #f0fff4;
  cursor: default;
  pointer-events: none;
}

.epc-match-tile--flash-error {
  animation: epc-match-flash-red 0.65s ease;
}

@keyframes epc-match-flash-red {
  0%, 100% {
    border-color: #dde8e0;
    background: #fff;
  }
  35%, 65% {
    border-color: #e74c3c;
    background: #fff0f0;
  }
}

@media (max-width: 560px) {
  .epc-match-columns {
    grid-template-columns: 1fr;
  }
}

.epc-timed-bar-wrap {
  height: 8px;
  background: #e8efe9;
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}

.epc-timed-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #3d8b5f, #2ecc71);
  transition: width 1s linear;
}

.epc-timed-counter {
  margin: 0 0 16px;
  font-weight: 600;
  color: #5a6b5e;
}

.epc-speakable {
  cursor: pointer;
  text-decoration: underline dotted;
  text-decoration-color: rgba(45, 106, 79, 0.45);
  text-underline-offset: 3px;
  transition: color 0.2s, opacity 0.2s;
}

.epc-speakable:hover {
  color: var(--epc-green-dark);
}

.epc-speakable--speaking {
  opacity: 0.65;
}

.epc-audio-word {
  display: inline-block;
  margin: 12px 0 16px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--epc-green-dark);
}

.epc-expected-answer-text {
  font-weight: 600;
}

.epc-dialogue-line__en.epc-speakable {
  margin-left: 4px;
}

.epc-level-result-score {
  font-size: 1.1rem;
  color: #5a6b5e;
  margin: 12px 0 24px;
}

.epc-card--account {
  margin-top: 12px;
}

.epc-account-profile {
  margin-bottom: 20px;
}

.epc-account-greeting {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.epc-account-email {
  margin: 0;
  color: #6a7a6e;
  font-size: 0.95rem;
}

.epc-account-totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

@media (min-width: 640px) {
  .epc-account-totals {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.epc-account-stat {
  background: #f6fbf7;
  border: 1px solid #e3eee5;
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
}

.epc-account-stat--highlight {
  background: #eef8f1;
  border-color: #c8e6d0;
}

.epc-account-stat__value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--epc-green-dark);
}

.epc-account-stat__label {
  display: block;
  margin-top: 4px;
  font-size: 0.85rem;
  color: #6a7a6e;
}

.epc-account-section-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.epc-account-courses {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.epc-account-course {
  border: 1px solid #e3eee5;
  border-radius: 14px;
  padding: 16px;
  background: #fff;
}

.epc-account-course--current {
  border-color: #9fd4b0;
  box-shadow: 0 0 0 1px #d7f0df;
}

.epc-account-course__head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.epc-account-course__title {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.epc-account-course__meta {
  margin: 0;
  color: #6a7a6e;
  font-size: 0.9rem;
}

.epc-account-course__badge {
  flex-shrink: 0;
  background: #e8f7ec;
  color: #2d6a45;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}

.epc-account-course__progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.epc-account-course__progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  color: #5a6b5e;
}

.epc-progress-fill--words {
  background: linear-gradient(90deg, #5b8def, #7aa7ff);
}

.epc-progress-track--words {
  background: #eef2fb;
}

.epc-account-actions {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e3ebe5;
}

.epc-btn--logout {
  color: #b42318;
}

.epc-btn--logout:hover,
.epc-btn--logout:focus-visible {
  color: #912018;
  background: #fef3f2;
}
