@font-face {
  font-family: 'Karla';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/karla.ttf) format('truetype');
}

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

body {
  font-family: 'Karla', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #e8ecef;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

/* --- Layout --- */

.container {
  max-width: 680px;
  width: 100%;
}

h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: #097C87;
  text-align: center;
  margin-bottom: 6px;
}

.subtitle {
  color: #666;
  font-size: 17px;
  text-align: center;
  margin-bottom: 28px;
}

/* --- Neumorphic Card --- */

.card {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 20px;
}

.card-inset {
  background: #f4f5f7;
  border-radius: 12px;
  padding: 20px;
}

/* --- Buttons --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
  color: #333;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.btn:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

.btn:active {
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transform: translateY(1px);
}

.btn-primary {
  background: #F04E23;
  color: #fff;
  box-shadow: 0 3px 8px rgba(240, 78, 35, 0.3);
}

.btn-primary:hover {
  background: #d94420;
  box-shadow: 0 4px 12px rgba(240, 78, 35, 0.4);
}

.btn-accent {
  background: #097C87;
  color: #fff;
  box-shadow: 0 3px 8px rgba(9, 124, 135, 0.3);
}

.btn-accent:hover {
  background: #0a8d99;
  box-shadow: 0 4px 12px rgba(9, 124, 135, 0.4);
}

.btn-wide {
  width: 100%;
}

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

/* --- Landing Screen --- */

#screen-landing .mode-cards {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.mode-card {
  flex: 1;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.mode-card.selected {
  outline: 3px solid #F04E23;
  outline-offset: -3px;
}

.mode-card h3 {
  color: #097C87;
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.mode-card .price {
  font-size: 1.4rem;
  font-weight: 800;
  color: #F04E23;
  margin-bottom: 8px;
}

.mode-card .price.free {
  color: #097C87;
}

.mode-card ul {
  list-style: none;
  text-align: left;
  font-size: 14px;
  color: #666;
}

.mode-card ul li {
  padding: 3px 0;
}

.mode-card ul li::before {
  content: "- ";
  color: #F04E23;
}

/* --- Level Picker --- */

.level-picker {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.level-btn {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
}

.level-btn.selected {
  background: #F04E23;
  color: #fff;
}

/* --- Progress Bar --- */

.progress-bar-wrap {
  margin-bottom: 20px;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #888;
  margin-bottom: 6px;
}

.progress-bar {
  height: 8px;
  background: #e0e1e4;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #F04E23;
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* --- Question Screen --- */

.phase-label {
  font-size: 13px;
  font-weight: 700;
  color: #F04E23;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.question-text {
  font-size: 20px;
  font-weight: 600;
  color: #097C87;
  margin-bottom: 20px;
  line-height: 1.4;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  text-align: left;
  padding: 14px 20px;
  font-size: 17px;
  border-radius: 12px;
  border: 2px solid #e0e1e4;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
}

.key-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f4f5f7;
  color: #999;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.option-btn:hover {
  border-color: #F04E23;
  box-shadow: 0 3px 10px rgba(240, 78, 35, 0.15);
}

.option-btn.correct {
  background: #A1CCA6;
  color: #1a4d1a;
  border-color: #6aad6a;
}

.option-btn.incorrect {
  background: #f5a5a5;
  color: #6b1a1a;
  border-color: #e07070;
}

.explanation {
  margin-top: 14px;
  padding: 12px 16px;
  font-size: 14px;
  color: #555;
  background: rgba(9, 124, 135, 0.06);
  border-radius: 8px;
}

/* --- Cloze Input --- */

.cloze-input {
  display: inline-block;
  width: 160px;
  padding: 8px 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  font-size: 18px;
  background: #fff;
  color: #097C87;
  font-weight: 600;
  text-align: center;
}

.cloze-input:focus {
  outline: none;
  border-color: #F04E23;
}

/* --- Audio Player --- */

.audio-area {
  text-align: center;
  margin: 20px 0;
}

.play-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 24px;
  padding: 0;
}

.play-btn svg {
  width: 28px;
  height: 28px;
}

/* --- Recording --- */

.record-area {
  text-align: center;
  margin: 20px 0;
}

.sentence-display {
  font-size: 22px;
  font-weight: 600;
  color: #097C87;
  padding: 20px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.record-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #F04E23;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(240, 78, 35, 0.35);
  transition: all 0.2s ease;
}

.record-btn.recording {
  background: #cc3318;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 78, 35, 0.4); }
  50% { box-shadow: 0 0 0 15px rgba(240, 78, 35, 0); }
}

.record-hint {
  font-size: 13px;
  color: #888;
  margin-top: 10px;
}

/* --- Speaking Prompt --- */

.prompt-text {
  font-size: 18px;
  color: #333;
  line-height: 1.5;
  margin-bottom: 8px;
}

.prompt-hint {
  font-size: 13px;
  color: #888;
  margin-bottom: 20px;
}

/* --- Results Screen --- */

.result-level {
  text-align: center;
  margin-bottom: 24px;
}

.result-level .level-badge {
  display: inline-block;
  font-size: 3rem;
  font-weight: 800;
  color: #fff;
  background: #F04E23;
  border-radius: 20px;
  padding: 16px 40px;
  margin-bottom: 8px;
}

.result-level .result-label {
  font-size: 15px;
  color: #888;
}

.skill-bars {
  margin: 20px 0;
}

.skill-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.skill-name {
  width: 130px;
  font-size: 14px;
  font-weight: 600;
  color: #555;
  text-align: right;
}

.skill-bar-wrap {
  flex: 1;
  height: 24px;
  background: #e0e1e4;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.skill-bar-fill {
  height: 100%;
  border-radius: 12px;
  transition: width 0.8s ease;
}

.skill-bar-fill.grammar { background: #097C87; }
.skill-bar-fill.listening { background: #F04E23; }
.skill-bar-fill.pronunciation { background: #FCA47C; }
.skill-bar-fill.speaking { background: #F9D779; }

.skill-level {
  width: 36px;
  font-size: 14px;
  font-weight: 700;
  color: #097C87;
}

.skill-pct {
  width: 40px;
  font-size: 13px;
  color: #888;
  text-align: right;
}

.result-summary {
  font-size: 16px;
  line-height: 1.6;
  color: #444;
  margin: 16px 0;
}

.result-recommendation {
  padding: 16px;
  background: rgba(9, 124, 135, 0.06);
  border-radius: 10px;
  font-size: 15px;
  color: #097C87;
  font-weight: 500;
}

/* --- Upsell --- */

.upsell-card {
  text-align: center;
  margin-top: 24px;
}

.upsell-card h3 {
  color: #097C87;
  margin-bottom: 10px;
}

.upsell-card p {
  font-size: 14px;
  color: #666;
  margin-bottom: 16px;
}

/* --- Timer --- */

.timer {
  position: fixed;
  top: 12px;
  right: 16px;
  font-size: 13px;
  color: #888;
  font-weight: 600;
}

.timer.warning {
  color: #F04E23;
}

/* --- Loading / Processing --- */

.loading {
  text-align: center;
  padding: 40px;
  color: #888;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e0e1e4;
  border-top: 4px solid #F04E23;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* --- Feedback after audio --- */

.audio-feedback {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
}

.audio-feedback .score-badge {
  display: inline-block;
  font-size: 1.4rem;
  font-weight: 800;
  color: #097C87;
  margin-bottom: 8px;
}

.audio-feedback .feedback-text {
  font-size: 14px;
  color: #555;
  line-height: 1.5;
}

/* --- Hide/show screens --- */

.screen {
  display: none;
}

.screen.active {
  display: block;
}

/* --- C-test inputs --- */

.ctest-input {
  display: inline-block;
  width: 60px;
  padding: 2px 4px;
  border: none;
  border-bottom: 2px solid #F04E23;
  font-family: inherit;
  font-size: 18px;
  background: transparent;
  color: #097C87;
  font-weight: 600;
}

.ctest-input:focus {
  outline: none;
  border-bottom-color: #097C87;
}

/* --- Writing textarea --- */

textarea:focus {
  outline: none;
  border-color: #F04E23;
}

/* --- Selected option --- */

.option-btn.selected {
  border-color: #F04E23;
  background: #fff5f2;
}

/* --- Responsive --- */

@media (max-width: 600px) {
  body { padding: 12px; }
  h1 { font-size: 1.4rem; }
  .card { padding: 20px; }
  .question-text { font-size: 18px; }
  .sentence-display { font-size: 19px; }
  .mode-cards { flex-direction: column; }
  .skill-name { width: 100px; font-size: 13px; }
  .result-level .level-badge { font-size: 2.4rem; padding: 12px 28px; }
}
