*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0b100e;
  --bg-raised: #101713;
  --surface: #141c17;
  --surface-hover: #18221c;

  --text: #e7eee9;
  --white: #f4f7f5;
  --muted: #829089;
  --muted-2: #64716a;

  --line: #26322b;
  --line-strong: #34423a;

  --green: #55d6a9;
  --green-dark: #2d9f7b;
  --green-soft: rgba(85, 214, 169, 0.08);

  --success: #63d391;
  --success-bg: rgba(99, 211, 145, 0.08);

  --error: #ed7279;
  --error-bg: rgba(237, 114, 121, 0.08);

  --orange: #e9a26e;

  --radius: 8px;
  --small-radius: 5px;

  --nav-height: 64px;
  --sidebar-width: 224px;

  --font: Arial, Helvetica, sans-serif;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

body::before {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: var(--line);
  content: "";
  pointer-events: none;
}

body::after {
  display: none;
  content: "";
}

/* Motion */

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

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

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-2px);
  }
}

@keyframes glow {
  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }
}

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

@keyframes pageIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Accessibility */

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

/* App */

#app {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  display: none;
}

.main {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 26px 18px 96px;
}

.page {
  display: none;
}

.page.active {
  display: block;
  animation: pageIn 0.18s ease both;
}

/* Header */

.page-header {
  position: relative;
  margin-bottom: 24px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.page-header::after {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 24px;
  height: 1px;
  background: var(--green);
  content: "";
}

.page-title {
  color: var(--white);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.page-subtitle {
  max-width: 520px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Cards */

.card {
  position: relative;
  padding: 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card::before {
  display: none;
  content: "";
}

.card:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  transform: translateY(-1px);
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.card-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-value {
  color: var(--green);
  font-size: 1.55rem;
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 16px;
}

.dashboard-grid .card {
  animation: none;
}

.card-daily {
  grid-column: 1 / -1;
}

.daily-progress {
  margin-top: 11px;
}

/* Progress */

.progress-bar {
  height: 6px;
  overflow: hidden;
  background: #202a24;
  border-radius: 2px;
}

.progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.progress-fill::after {
  display: none;
  content: "";
}

.daily-text {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.78rem;
}

.card-next-lesson {
  margin-top: 16px;
  border-left: 2px solid var(--green);
}

.next-title {
  margin: 4px 0 2px;
  font-size: 1.28rem;
  font-weight: 700;
}

.next-level {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.84rem;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: var(--small-radius);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

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

.btn-primary {
  background: var(--green);
  color: #07130f;
}

.btn-primary:hover:not(:disabled),
.btn-primary:focus-visible {
  background: #69dfb5;
}

.btn-secondary {
  background: var(--green-soft);
  border-color: #315849;
  color: var(--green);
}

.btn-secondary:hover:not(:disabled),
.btn-secondary:focus-visible {
  background: rgba(85, 214, 169, 0.13);
}

.btn-ghost {
  min-width: 42px;
  min-height: 42px;
  padding: 7px;
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.btn-lg {
  width: 100%;
  min-height: 49px;
  padding: 13px 20px;
  font-size: 1rem;
}

.btn-icon svg {
  width: 22px;
  height: 22px;
}

/* Learning path */

.learning-path {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.path-item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
  padding: 12px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

.path-item::after {
  display: none;
  content: "";
}

.path-item:hover,
.path-item:focus-visible {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  transform: translateX(2px);
  outline: none;
}

.path-item.completed {
  background: var(--success-bg);
  border-color: rgba(99, 211, 145, 0.25);
}

.path-item.current {
  background: var(--green-soft);
  border-color: rgba(85, 214, 169, 0.42);
}

.path-item.locked {
  opacity: 0.42;
}

.path-number {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  background: #1c2721;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.path-item.completed .path-number {
  background: var(--success);
  border-color: var(--success);
  color: #07130f;
}

.path-item.current .path-number {
  background: var(--green);
  border-color: var(--green);
  color: #07130f;
  animation: pulse 3.5s ease-in-out infinite;
}

.path-info {
  flex: 1;
  min-width: 0;
}

.path-title {
  overflow: hidden;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.path-meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.73rem;
}

.path-check {
  flex-shrink: 0;
  width: 19px;
  height: 19px;
  color: var(--success);
}

/* Lesson */

.lesson-header {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 23px;
}

.lesson-progress-wrap {
  flex: 1;
}

.lesson-progress-text {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: right;
}

.lesson-body {
  max-width: 600px;
  margin: 0 auto;
}

.exercise-question {
  margin-bottom: 17px;
  color: var(--white);
  font-size: 1.15rem;
  font-weight: 700;
}

.exercise-area {
  margin-bottom: 17px;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.choice-btn {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.96rem;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.choice-btn:hover:not(:disabled),
.choice-btn:focus-visible {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  transform: translateX(2px);
  outline: none;
}

.choice-btn.selected {
  background: var(--green-soft);
  border-color: var(--green);
}

.choice-btn.correct {
  background: var(--success-bg);
  border-color: var(--success);
}

.choice-btn.wrong {
  background: var(--error-bg);
  border-color: var(--error);
}

.choice-btn:disabled {
  cursor: default;
}

.exercise-input {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.96rem;
}

.exercise-input::placeholder,
.search-input::placeholder,
.form-input::placeholder {
  color: var(--muted-2);
}

.exercise-input:focus {
  outline: none;
  border-color: var(--green);
}

.exercise-input.correct {
  background: var(--success-bg);
  border-color: var(--success);
}

.exercise-input.wrong {
  background: var(--error-bg);
  border-color: var(--error);
}

/* Word ordering */

.order-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 46px;
  margin-bottom: 11px;
}

.order-token {
  padding: 8px 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  font-size: 0.91rem;
  cursor: pointer;
  user-select: none;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.order-token:hover,
.order-token:focus-visible {
  background: var(--surface-hover);
  border-color: var(--green);
  transform: translateY(-1px);
}

.order-token.used {
  opacity: 0.25;
  pointer-events: none;
}

.order-answer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 54px;
  margin-bottom: 8px;
  padding: 8px;
  background: #0b120f;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
}

/* Hints */

.hints-area {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 17px;
}

.hint-btn {
  display: block;
  width: 100%;
  padding: 11px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.hint-btn:hover,
.hint-btn:focus-visible {
  background: var(--surface);
  border-color: var(--line-strong);
  outline: none;
}

.hint-label {
  color: var(--green);
  font-weight: 700;
}

.hint-content {
  display: block;
  margin-top: 6px;
  color: var(--text);
  line-height: 1.45;
}

.hint-content[hidden] {
  display: none;
}

/* Feedback */

.feedback {
  margin-bottom: 17px;
  padding: 13px 14px;
  border-radius: 5px;
  font-size: 0.91rem;
  line-height: 1.45;
  animation: pageIn 0.16s ease;
}

.feedback.correct {
  background: var(--success-bg);
  border: 1px solid rgba(99, 211, 145, 0.3);
  color: var(--success);
}

.feedback.wrong {
  background: var(--error-bg);
  border: 1px solid rgba(237, 114, 121, 0.3);
  color: var(--error);
}

.feedback-xp {
  display: block;
  margin-top: 4px;
  font-weight: 700;
}

.lesson-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Dictionary */

.search-wrap {
  position: relative;
  margin-bottom: 16px;
}

.search-input {
  min-height: 47px;
  padding: 11px 14px;
  border-radius: 6px;
  font-size: 0.95rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--green);
}

.dict-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.dict-item {
  padding: 13px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.dict-item:hover {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

.dict-de {
  color: var(--text);
  font-size: 1.03rem;
  font-weight: 700;
}

.dict-pl {
  margin-top: 2px;
  color: var(--green);
  font-size: 0.92rem;
}

.dict-example {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* Profile */

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.profile-card {
  max-width: 420px;
}

.form-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.055em;
}

.form-input {
  min-height: 47px;
  margin-bottom: 11px;
  padding: 11px 13px;
  border-radius: 6px;
  font-size: 0.95rem;
}

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

.profile-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.profile-stat .card-value {
  font-size: 1.25rem;
}

/* Mobile navigation */

.bottom-nav {
  position: fixed;
  right: 8px;
  bottom: 8px;
  left: 8px;
  z-index: 100;
  display: flex;
  height: var(--nav-height);
  padding: 4px;
  background: #0d1511;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

.bottom-nav-item {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  padding: 6px 4px;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.68rem;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item svg {
  width: 21px;
  height: 21px;
}

.bottom-nav-item.active {
  background: var(--green-soft);
  color: var(--green);
}

.bottom-nav-item.active::after {
  position: absolute;
  bottom: 4px;
  width: 3px;
  height: 3px;
  background: var(--green);
  border-radius: 50%;
  content: "";
}

.bottom-nav-item:hover {
  color: var(--green);
}

.bottom-nav-item:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

/* Desktop */

@media (min-width: 768px) {
  .sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    width: var(--sidebar-width);
    min-height: 100dvh;
    background: #0d1511;
    border-right: 1px solid var(--line);
  }

  .sidebar-header {
    position: relative;
    padding: 23px 20px;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-header::after {
    position: absolute;
    right: 20px;
    bottom: -1px;
    width: 25px;
    height: 1px;
    background: var(--green);
    content: "";
  }

  .logo-mark {
    display: none;
  }

  .logo-text {
    color: var(--white);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
  }

  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 11px 8px;
  }

  .nav-item {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 10px;
    padding: 11px 12px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--muted);
    font-family: inherit;
    font-size: 0.91rem;
    text-align: left;
    cursor: pointer;
    transition:
      background 0.15s ease,
      color 0.15s ease;
  }

  .nav-item:hover,
  .nav-item:focus-visible {
    background: var(--surface);
    color: var(--text);
    outline: none;
  }

  .nav-item.active {
    background: var(--green-soft);
    border-color: rgba(85, 214, 169, 0.12);
    color: var(--green);
    font-weight: 700;
  }

  .nav-item.active::before {
    position: absolute;
    left: -1px;
    width: 2px;
    height: 18px;
    background: var(--green);
    content: "";
  }

  .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  .bottom-nav {
    display: none;
  }

  .main {
    max-width: none;
    padding: 34px 36px;
  }

  .page-title {
    font-size: 1.9rem;
  }

  .dashboard-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .card-daily {
    grid-column: auto;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .main {
    padding: 40px 46px;
  }

  .dashboard-grid {
    gap: 13px;
  }

  .learning-path {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
  }
}

@media (min-width: 1440px) {
  .main {
    max-width: 1160px;
  }
}

/* Focus */

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

button:focus:not(:focus-visible) {
  outline: none;
}

/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}