:root {
  --primary: #2e69ff;
  --bg: #f4f7fd;
  --card: #ffffff;
  --text: #12203a;
  --muted: #61708a;
  --line: #d9e3f4;
  --ok: #10a36f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at top right, #dbe7ff 0%, #f4f7fd 40%);
  color: var(--text);
  font-family: 'Lexend', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: #cfe0ff;
  color: #0e2142;
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: 18px 16px 95px;
}

.app-header h1 {
  margin: 0;
  font-size: 1.6rem;
}

.app-header p {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.screen {
  display: none;
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.screen.active {
  display: grid;
  opacity: 1;
  transform: translateY(0);
}

.card {
  background: var(--card);
  border: 1px solid #e3ebf9;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 12px 28px rgba(22, 40, 74, 0.07);
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.between {
  justify-content: space-between;
}

.center {
  align-items: center;
}

h2,
h3 {
  margin: 0;
}

h2 {
  font-size: 1.15rem;
}

h3 {
  font-size: 1.02rem;
}

.muted {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 8px 0 0;
}

.progress-track {
  margin-top: 10px;
  height: 10px;
  border-radius: 999px;
  background: #e3ecff;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2e69ff, #4a8aff);
  transition: width 240ms ease;
}

.actions-card {
  display: grid;
  gap: 10px;
}

.pill-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-list li {
  padding: 8px 10px;
  border-radius: 999px;
  background: #ecf3ff;
  border: 1px solid #d7e5ff;
  color: #234ea9;
  font-size: 0.8rem;
}

.badge {
  background: #e9f1ff;
  color: #1f4fb8;
  border: 1px solid #cfe0ff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.76rem;
  font-weight: 600;
}

.prompt-box {
  margin-top: 10px;
  margin-bottom: 10px;
  background: #eff4ff;
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.95rem;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
  -webkit-appearance: none;
  appearance: none;
}

textarea {
  min-height: 108px;
  resize: vertical;
}

textarea::placeholder,
input::placeholder {
  color: #8b9ab2;
}

textarea:focus,
input:focus {
  border-color: #9bbcff;
  outline: 2px solid rgba(46, 105, 255, 0.16);
}

.btn {
  border: none;
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-lg {
  min-height: 50px;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(145deg, #2e69ff, #1d59f4);
  color: #fff;
}

.btn-secondary {
  width: 100%;
  background: #e8f0ff;
  color: #204cae;
  border: 1px solid #cedfff;
}

.btn-small {
  font-size: 0.8rem;
  padding: 8px 10px;
  background: #eef2f8;
  color: #20314f;
}

.audio-btn {
  width: auto;
  min-width: 92px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.audio-btn .material-icons {
  font-size: 18px;
}

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

.flow-step {
  display: none;
  animation: fadein 180ms ease;
}

.flow-step.active {
  display: block;
}

.result-box {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbff;
  padding: 10px;
}

.result-box p {
  margin: 8px 0;
  font-size: 0.92rem;
}

.success-check {
  margin-top: 12px;
  display: flex;
  justify-content: center;
}

.success-check .material-icons {
  color: var(--ok);
  font-size: 42px;
  animation: pop 280ms ease;
}

.mistakes-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.mistake-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #f8fbff;
}

.mistake-item p {
  margin: 6px 0;
  font-size: 0.9rem;
}

.mistake-item .btn {
  margin-top: 8px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-width: 520px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 10px 14px 14px;
  border-top: 1px solid #dce6f7;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.nav-btn {
  border: 0;
  background: transparent;
  display: grid;
  justify-items: center;
  color: var(--muted);
  gap: 3px;
  font-size: 0.72rem;
  cursor: pointer;
}

.nav-btn.active {
  color: var(--primary);
}

.global-loader {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(244, 247, 253, 0.75);
  backdrop-filter: blur(4px);
}

.loader-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #cdddff;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.toast-container {
  position: fixed;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 90;
  display: grid;
  gap: 8px;
}

.toast {
  border-radius: 10px;
  padding: 10px 12px;
  color: #fff;
  font-size: 0.84rem;
  box-shadow: 0 8px 18px rgba(14, 28, 52, 0.17);
}

.toast-success {
  background: #0a9b69;
}

.toast-error {
  background: #cf3c5f;
}

.onboarding {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: radial-gradient(circle at top right, #dbe7ff 0%, #f2f6ff 50%);
}

.onboarding-card {
  max-width: 520px;
  width: 100%;
  background: #fff;
  border: 1px solid #e3ebf9;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 18px 34px rgba(24, 45, 80, 0.1);
}

.onboarding-card h1 {
  margin: 0;
  font-size: 1.35rem;
}

.onboarding-card .subtitle {
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.onboarding-card ol {
  margin: 0 0 14px;
  padding-left: 18px;
  color: #2b3d5f;
  line-height: 1.5;
}

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

@keyframes pop {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

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