:root {
  --ink: #20213a;
  --muted: #74758c;
  --line: #eceaf3;
  --surface: rgba(255, 255, 255, 0.88);
  --purple: #6c5ce7;
  --purple-dark: #5847d6;
  --purple-pale: #f0edff;
  --mint: #55c9a5;
  --mint-pale: #e4fbf4;
  --coral: #ff806e;
  --danger: #ef6b73;
  --shadow: 0 24px 70px rgba(56, 44, 106, 0.11);
  font-family: Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", sans-serif;
  color: var(--ink);
  background: #fbfaff;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 12%, rgba(210, 199, 255, 0.3), transparent 28%),
    radial-gradient(circle at 92% 70%, rgba(255, 222, 203, 0.35), transparent 28%),
    #fbfaff;
}

button,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:disabled,
select:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none !important;
  box-shadow: none !important;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(108, 92, 231, 0.3);
  outline-offset: 3px;
}

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

.ambient {
  position: fixed;
  z-index: -1;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.23;
  pointer-events: none;
}

.ambient--one {
  top: -180px;
  left: -100px;
  background: #cfc5ff;
}

.ambient--two {
  right: -140px;
  bottom: -200px;
  background: #ffd2bc;
}

.site-header {
  width: min(1180px, calc(100% - 40px));
  height: 86px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 25px;
  font-weight: 850;
  letter-spacing: -1.2px;
}

.brand > span:last-child span {
  color: var(--purple);
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  border-radius: 13px;
  color: white;
  background: linear-gradient(145deg, #8171ee, #6554dc);
  box-shadow: 0 9px 20px rgba(108, 92, 231, 0.3);
  transform: rotate(-4deg);
}

.brand__mark svg,
.icon-button svg,
.control-icon svg,
.text-button svg,
.next-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.header-actions,
.question-count {
  display: flex;
  align-items: center;
  gap: 12px;
}

.question-count {
  padding: 6px 7px 6px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.question-count select {
  min-width: 87px;
  padding: 7px 30px 7px 10px;
  border: 0;
  border-radius: 9px;
  color: var(--ink);
  background: var(--purple-pale);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
}

.icon-button.is-muted {
  color: #bbb8c9;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 6px auto 54px;
}

.progress-panel {
  margin-bottom: 20px;
  padding: 25px 29px 23px;
  border: 1px solid rgba(236, 234, 243, 0.9);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 15px 45px rgba(56, 44, 106, 0.06);
  backdrop-filter: blur(12px);
}

.custom-data-panel {
  margin-bottom: 20px;
  padding: 21px 24px;
  border: 1px solid rgba(225, 221, 242, 0.95);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(245, 242, 255, 0.92), rgba(255, 255, 255, 0.94));
  box-shadow: 0 14px 40px rgba(56, 44, 106, 0.06);
}

.custom-data-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.custom-data-copy .eyebrow {
  margin-bottom: 4px;
}

.custom-data-copy h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.4px;
}

.source-status {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  padding: 6px 10px;
  border-radius: 99px;
  color: #6656c8;
  background: rgba(255, 255, 255, 0.8);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.source-status::before {
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--purple);
  content: "";
}

.source-status.is-manual::before {
  background: var(--mint);
}

.source-status.is-error::before {
  background: var(--coral);
}

.custom-data-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 11px;
  align-items: stretch;
}

.custom-data-form textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  padding: 13px 15px;
  border: 1px solid #ded9f0;
  border-radius: 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
  font: 500 13px/1.55 Inter, ui-rounded, "SF Pro Rounded", "Segoe UI", sans-serif;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.custom-data-form textarea::placeholder {
  color: #aaa7b9;
}

.custom-data-form textarea:focus {
  border-color: #a79cf0;
  outline: 0;
  box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.1);
}

.load-data-button {
  display: inline-flex;
  min-width: 145px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 17px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 9px 20px rgba(32, 33, 58, 0.16);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.load-data-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(32, 33, 58, 0.2);
}

.load-data-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.custom-data-hint {
  margin: 9px 2px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.progress-copy,
.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--purple);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 1.8px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 27px;
  line-height: 1.1;
  letter-spacing: -0.8px;
}

.streak {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 99px;
  color: #9b6d31;
  background: #fff5df;
  font-size: 12px;
}

.streak strong {
  font-size: 15px;
}

.progress-map {
  margin-top: 22px;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: #efedf6;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #6c5ce7, #9a89f7);
  box-shadow: 0 2px 10px rgba(108, 92, 231, 0.35);
  transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress-meta {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.progress-meta strong {
  color: var(--ink);
}

.step-dots {
  display: flex;
  gap: 6px;
  margin-top: 14px;
}

.step-dot {
  flex: 1;
  height: 4px;
  border: 0;
  border-radius: 99px;
  background: #e9e7f0;
  transition: background 0.25s, transform 0.25s;
}

.step-dot.is-current {
  background: var(--purple);
  transform: scaleY(1.8);
}

.step-dot.is-done {
  background: var(--mint);
}

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.37fr) minmax(330px, 0.63fr);
  gap: 20px;
}

.exercise-card,
.illustration-card {
  border: 1px solid rgba(236, 234, 243, 0.95);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.exercise-card {
  display: flex;
  min-height: 564px;
  flex-direction: column;
  padding: 30px;
}

.exercise-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.type-pill,
.ai-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
}

.type-pill {
  padding: 7px 11px;
  color: #3f9d81;
  background: var(--mint-pale);
  letter-spacing: 0.8px;
}

.ai-pill {
  gap: 6px;
  padding: 7px 11px;
  color: #7363d9;
  background: #f5f2ff;
}

.sparkle {
  animation: sparkle 1.8s ease-in-out infinite;
}

@keyframes sparkle {
  50% { transform: scale(1.35) rotate(20deg); }
}

.prompt-copy {
  margin: 49px auto 36px;
  text-align: center;
}

.prompt-copy > p:first-child {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.prompt-copy h2 {
  max-width: 650px;
  margin-bottom: 10px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.16;
  letter-spacing: -1.7px;
}

.translation {
  margin-bottom: 0;
  color: #a1a0ad;
  font-size: 14px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
}

.control-button {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.control-button:hover {
  transform: translateY(-2px);
  border-color: #dcd7f5;
  box-shadow: 0 8px 20px rgba(74, 59, 126, 0.08);
}

.control-button:active {
  transform: translateY(0);
}

.control-button--mic {
  color: #fff;
  border-color: var(--purple);
  background: linear-gradient(145deg, #7666e8, #6251d8);
  box-shadow: 0 9px 22px rgba(108, 92, 231, 0.26);
}

.control-button--mic .control-icon {
  color: white;
  background: rgba(255, 255, 255, 0.16);
}

.control-button.is-active {
  animation: micPulse 1.3s ease-out infinite;
}

@keyframes micPulse {
  50% { box-shadow: 0 0 0 9px rgba(108, 92, 231, 0.12); }
}

.control-button.is-speaking .control-icon {
  animation: speakerPulse 0.7s ease-in-out infinite alternate;
}

@keyframes speakerPulse {
  to { transform: scale(1.09); }
}

.control-icon {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  color: var(--purple);
  background: var(--purple-pale);
}

.control-icon svg {
  width: 21px;
  height: 21px;
}

.control-button > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.control-button strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.control-button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.control-button--mic small {
  color: rgba(255, 255, 255, 0.72);
}

.listening-state {
  margin-top: 16px;
  color: var(--purple);
  text-align: center;
  font-size: 12px;
  font-weight: 700;
}

.listening-state:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.waveform {
  display: flex;
  height: 28px;
  align-items: center;
  gap: 3px;
}

.waveform i {
  width: 3px;
  height: 8px;
  border-radius: 99px;
  background: var(--purple);
  animation: wave 0.8s ease-in-out infinite alternate;
}

.waveform i:nth-child(2), .waveform i:nth-child(6) { animation-delay: -0.2s; }
.waveform i:nth-child(3), .waveform i:nth-child(5) { animation-delay: -0.4s; }
.waveform i:nth-child(4) { animation-delay: -0.6s; }

@keyframes wave {
  to { height: 26px; }
}

.result-card {
  margin-top: 17px;
  padding: 16px;
  border: 1px solid #f3ddde;
  border-radius: 18px;
  background: #fff8f8;
}

.result-card:not([hidden]) {
  display: flex;
  align-items: center;
  gap: 16px;
  animation: riseIn 0.35s ease-out;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(8px); }
}

.result-card.is-pass {
  border-color: #cceee3;
  background: #f3fcf9;
}

.score-ring {
  display: grid;
  flex: 0 0 68px;
  width: 68px;
  height: 68px;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--danger) var(--score, 0%), #f0e8ea 0);
  position: relative;
}

.score-ring::before {
  position: absolute;
  width: 51px;
  height: 51px;
  border-radius: 50%;
  background: white;
  content: "";
}

.score-ring strong {
  z-index: 1;
  font-size: 14px;
}

.result-copy {
  min-width: 0;
  flex: 1;
}

.result-copy h3 {
  margin-bottom: 4px;
  font-size: 15px;
}

.result-copy p {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.heard-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.heard-text q {
  color: var(--ink);
  font-weight: 650;
}

.score-bar {
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #eee8eb;
}

.score-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--danger);
  transition: width 0.55s ease-out;
}

.result-card.is-pass .score-ring {
  background: conic-gradient(var(--mint) var(--score, 0%), #e0eee9 0);
}

.result-card.is-pass .score-bar span {
  background: var(--mint);
}

.exercise-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: auto;
  padding-top: 24px;
}

.text-button,
.next-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
}

.text-button {
  padding: 9px 2px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.text-button:hover {
  color: var(--purple);
}

.text-button svg {
  width: 16px;
  height: 16px;
}

.next-button {
  padding: 13px 19px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(145deg, #7666e8, #6251d8);
  box-shadow: 0 9px 22px rgba(108, 92, 231, 0.24);
  font-size: 13px;
  font-weight: 800;
}

.next-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 25px rgba(108, 92, 231, 0.3);
}

.next-button[hidden] {
  display: none;
}

.next-button svg {
  width: 18px;
  height: 18px;
}

.illustration-card {
  position: relative;
  min-height: 564px;
  overflow: hidden;
  background: linear-gradient(155deg, #eee9ff 0%, #f7ebf5 50%, #fff1dc 100%);
}

.illustration-card::after {
  position: absolute;
  right: -30%;
  bottom: -15%;
  width: 130%;
  height: 42%;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.32);
  content: "";
  filter: blur(7px);
}

.illustration-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s ease;
}

.illustration-card:hover img {
  transform: scale(1.025);
}

.art-badge,
.topic-bubble,
.tip-card,
.sound-orbit {
  position: absolute;
  z-index: 2;
}

.art-badge {
  top: 18px;
  left: 18px;
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 99px;
  color: #5b507f;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 7px 20px rgba(83, 63, 118, 0.09);
  backdrop-filter: blur(10px);
  font-size: 11px;
  font-weight: 750;
}

.topic-bubble {
  top: 17px;
  right: 17px;
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 10px 30px rgba(83, 63, 118, 0.12);
  backdrop-filter: blur(10px);
  font-size: 27px;
  transition: transform 0.3s;
}

.topic-bubble.is-changing {
  transform: rotate(12deg) scale(0.75);
}

.tip-card {
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 13px 34px rgba(83, 63, 118, 0.11);
  backdrop-filter: blur(12px);
}

.tip-card > span {
  padding-top: 1px;
}

.tip-card p {
  display: flex;
  flex-direction: column;
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
}

.tip-card p span {
  color: var(--muted);
}

.sound-orbit {
  color: rgba(108, 92, 231, 0.5);
  font-size: 22px;
  animation: float 3s ease-in-out infinite;
}

.sound-orbit--one { top: 24%; left: 8%; }
.sound-orbit--two { top: 34%; right: 7%; animation-delay: -1.5s; }

@keyframes float {
  50% { transform: translateY(-10px) rotate(8deg); }
}

.toast {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 16px;
  border-radius: 13px;
  color: #fff;
  background: #2d2e46;
  box-shadow: 0 14px 35px rgba(32, 33, 58, 0.25);
  font-size: 13px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.completion-modal[hidden] {
  display: none;
}

.completion-modal {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 21, 48, 0.55);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(430px, 100%);
  padding: 36px;
  border-radius: 28px;
  background: white;
  box-shadow: 0 28px 80px rgba(24, 21, 48, 0.26);
  text-align: center;
  animation: modalIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(15px) scale(0.96); }
}

.confetti {
  margin-bottom: 12px;
  font-size: 42px;
}

.modal-card h2 {
  margin-bottom: 7px;
  font-size: 30px;
}

.modal-card > p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.6;
}

.modal-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 25px 0;
}

.modal-stats div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 8px;
  border-radius: 16px;
  background: var(--purple-pale);
}

.modal-stats strong {
  color: var(--purple);
  font-size: 23px;
}

.modal-stats span {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 900px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .illustration-card { min-height: 440px; }
}

@media (max-width: 620px) {
  .site-header,
  .app-shell { width: min(100% - 24px, 1180px); }
  .site-header { height: 72px; }
  .question-count > span { display: none; }
  .progress-panel { padding: 20px; border-radius: 20px; }
  .custom-data-panel { padding: 18px; border-radius: 20px; }
  .custom-data-copy { align-items: flex-start; flex-direction: column; gap: 9px; }
  .custom-data-form { grid-template-columns: 1fr; }
  .load-data-button { min-height: 46px; }
  .streak span:last-child { display: none; }
  .exercise-card { min-height: 590px; padding: 20px; border-radius: 22px; }
  .ai-pill { max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .prompt-copy { margin: 41px auto 29px; }
  .prompt-copy h2 { font-size: 31px; letter-spacing: -1.1px; }
  .controls { grid-template-columns: 1fr 1fr; }
  .control-button--mic { grid-column: 1 / -1; justify-content: center; }
  .result-card:not([hidden]) { align-items: flex-start; }
  .score-ring { flex-basis: 58px; width: 58px; height: 58px; }
  .score-ring::before { width: 44px; height: 44px; }
  .exercise-footer { align-items: stretch; flex-direction: column-reverse; }
  .next-button { width: 100%; }
  .illustration-card { min-height: 395px; border-radius: 22px; }
}

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