:root {
  color: #173a32;
  background: #eaf4f0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: wait;
  opacity: 0.5;
}

.hidden {
  display: none !important;
}

.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-shell {
  width: min(100%, 760px);
  min-height: 100vh;
  margin: 0 auto;
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
  background: #fbfdfc;
  box-shadow: 0 0 42px rgb(18 58 50 / 10%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(11px + env(safe-area-inset-top)) 14px 11px;
  color: white;
  background: linear-gradient(135deg, #075744, #0b7d60);
  box-shadow: 0 5px 18px rgb(18 58 50 / 20%);
}

.logo {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  font-size: 26px;
  background: #effff3;
  border-radius: 50%;
}

.brand {
  min-width: 0;
  margin-right: auto;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
  font-weight: 900;
}

.brand span {
  margin-top: 2px;
  overflow: hidden;
  color: #d8eee7;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  color: white;
  background: rgb(255 255 255 / 14%);
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 13px;
}

.test-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 12px;
  color: #49675e;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.09em;
  background: #edf8f3;
  border-bottom: 1px solid #d8e9e2;
}

.live-dot,
.record-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #28a879;
  border-radius: 50%;
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 16px 12px 30px;
}

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

.row.me {
  justify-content: flex-end;
}

.mini-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  place-items: center;
  background: #e7f6ef;
  border-radius: 50%;
}

.bubble {
  max-width: 90%;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  line-height: 1.5;
  background: white;
  border: 1px solid #edf3f0;
  border-radius: 18px 18px 18px 5px;
  box-shadow: 0 5px 18px rgb(18 58 50 / 7%);
}

.me .bubble {
  color: white;
  background: #0b765c;
  border-color: #0b765c;
  border-radius: 18px 18px 5px 18px;
}

.vi {
  display: block;
  margin-top: 6px;
  color: #647a72;
  font-size: 13px;
}

.me .vi {
  color: #d5eee5;
}

.feedback-box {
  margin-top: 9px;
  padding: 10px;
  border-radius: 13px;
}

.heard {
  background: #f2f6f4;
}

.original {
  background: #fff0ed;
  border: 1px solid #efcec6;
}

.corrected {
  background: #e9f7f0;
  border: 1px solid #cce7da;
}

.natural {
  background: #eef3ff;
  border: 1px solid #d5def7;
}

.teacher-reply {
  background: #fff8e9;
  border-left: 4px solid #e77a32;
}

.exercise {
  background: #f5f0ff;
  border: 1px solid #e2d7f5;
}

.pronunciation {
  background: #eaf7ff;
  border: 1px solid #c8e3f2;
}

.listen-button {
  display: block;
  margin-top: 9px;
  padding: 7px 10px;
  color: #264d85;
  font-size: 12px;
  font-weight: 800;
  background: white;
  border: 1px solid #cdd9ee;
  border-radius: 10px;
}

.feedback-label {
  display: block;
  margin-bottom: 4px;
  color: #516c63;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.chip {
  display: inline-block;
  padding: 5px 9px;
  color: #075f4b;
  font-size: 12px;
  font-weight: 800;
  background: #e8f6ef;
  border-radius: 999px;
}

.vocabulary-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.vocabulary-item {
  padding: 8px;
  font-size: 13px;
  background: rgb(255 255 255 / 62%);
  border-radius: 10px;
}

.retry-button {
  margin-top: 10px;
  padding: 8px 11px;
  color: #075f4b;
  font-weight: 800;
  background: white;
  border: 1px solid #bcd8ce;
  border-radius: 11px;
}

.typing i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 2px;
  background: #87a69d;
  border-radius: 50%;
  animation: typing-bounce 1s infinite;
}

.typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing i:nth-child(3) {
  animation-delay: 0.3s;
}

.composer {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 12;
  width: min(760px, 100%);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: white;
  border-top: 1px solid #dce8e3;
  box-shadow: 0 -8px 24px rgb(18 58 50 / 10%);
  transform: translateX(-50%);
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1;
  min-width: 0;
  padding: 12px;
  font-size: 16px;
  color: #173a32;
  background: #fbfdfc;
  border: 1px solid #cfded8;
  border-radius: 15px;
  outline: none;
}

.input-row input:focus {
  border-color: #0b765c;
  box-shadow: 0 0 0 3px rgb(11 118 92 / 10%);
}

.mic-button,
.send-button {
  min-height: 47px;
  padding: 11px 14px;
  color: white;
  font-weight: 900;
  border: 0;
  border-radius: 15px;
}

.mic-button {
  min-width: 50px;
  font-size: 20px;
  background: #e77a32;
}

.send-button {
  background: #075f4b;
}

.status {
  min-height: 17px;
  margin: 6px 3px 0;
  color: #60756f;
  font-size: 12px;
}

.overlay,
.sheet {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  padding: 20px;
}

.onboarding {
  place-items: center;
  background: linear-gradient(160deg, rgb(6 60 49 / 97%), rgb(11 118 92 / 97%));
}

.start-card {
  width: min(440px, 100%);
  padding: 25px;
  text-align: center;
  background: white;
  border-radius: 25px;
  box-shadow: 0 30px 70px rgb(0 0 0 / 20%);
}

.start-logo {
  font-size: 58px;
}

.eyebrow {
  margin: 8px 0;
  color: #c66e32;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.start-card h1 {
  margin: 8px 0 12px;
  color: #123d32;
  font: 750 30px/1.08 Georgia, serif;
}

.start-card > p:not(.eyebrow) {
  color: #60756f;
  line-height: 1.5;
}

.start-card label {
  display: block;
  margin: 20px 0 6px;
  color: #3f5e55;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.start-card select {
  width: 100%;
  padding: 12px;
  color: #173a32;
  background: #f8fbf9;
  border: 1px solid #cfded8;
  border-radius: 14px;
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.profile-grid label {
  margin-top: 12px;
}

.primary-button {
  width: 100%;
  margin-top: 13px;
  padding: 14px;
  color: white;
  font-size: 16px;
  font-weight: 900;
  background: #087058;
  border: 0;
  border-radius: 16px;
}

.privacy-note {
  margin-bottom: 0;
  font-size: 11px;
}

.listening {
  place-items: center;
  color: white;
  background: rgb(6 37 31 / 96%);
}

.listening-card {
  width: min(440px, 100%);
  text-align: center;
}

.record-dot {
  width: 13px;
  height: 13px;
  margin-right: 8px;
  background: #ff5954;
  animation: pulse 1s infinite;
}

.wave {
  display: flex;
  height: 82px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin: 22px 0;
}

.wave i {
  width: 6px;
  height: 20px;
  background: #80d7bd;
  border-radius: 99px;
  animation: wave 0.8s ease-in-out infinite alternate;
}

.wave i:nth-child(2n) {
  animation-delay: 0.18s;
}

.wave i:nth-child(3n) {
  animation-delay: 0.34s;
}

.live-transcript {
  min-height: 54px;
  font-size: 19px;
  line-height: 1.45;
}

.ghost-button {
  padding: 11px 18px;
  color: white;
  font-weight: 800;
  background: rgb(255 255 255 / 12%);
  border: 1px solid rgb(255 255 255 / 24%);
  border-radius: 14px;
}

.listening-tip {
  color: #badbd0;
  font-size: 12px;
}

.sheet {
  align-items: end;
  padding: 0;
  background: rgb(0 28 22 / 35%);
}

.sheet-panel {
  max-height: 82vh;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  overflow: auto;
  background: white;
  border-radius: 24px 24px 0 0;
}

.sheet-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.sheet-head h2 {
  margin: 0 0 16px;
}

.close-button,
.reset-button {
  padding: 9px 12px;
  border-radius: 12px;
}

.progress-note {
  margin-top: 10px;
  padding: 12px;
  color: #526b63;
  font-size: 13px;
  background: #f7faf8;
  border-radius: 12px;
}

.close-button {
  color: #075f4b;
  background: #edf7f2;
  border: 0;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}

.progress-stat {
  padding: 13px;
  background: #f7faf8;
  border: 1px solid #dce8e3;
  border-radius: 14px;
}

.progress-stat b,
.progress-stat span {
  display: block;
}

.progress-stat b {
  color: #075f4b;
  font-size: 22px;
}

.progress-stat span {
  margin-top: 3px;
  color: #6d817a;
  font-size: 11px;
}

.reset-button {
  width: 100%;
  margin-top: 14px;
  color: #a44435;
  background: white;
  border: 1px solid #e8cfc9;
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@keyframes wave {
  from {
    height: 13px;
  }
  to {
    height: 54px;
  }
}

@keyframes typing-bounce {
  50% {
    transform: translateY(-4px);
  }
}

@media (max-width: 390px) {
  .test-banner {
    gap: 5px;
    padding-inline: 6px;
    font-size: 9px;
    letter-spacing: 0.04em;
  }

  .brand span {
    max-width: 150px;
  }

  .bubble {
    max-width: 94%;
  }

  .send-button {
    padding-inline: 11px;
  }

  .start-card {
    padding: 18px;
  }

  .start-card h1 {
    font-size: 26px;
  }
}

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