:root {
  --paper: #fbf8ef;
  --paper-deep: #f3eee3;
  --ink: #33443b;
  --muted: #758278;
  --line: #d8d9c8;
  --mint: #dceee5;
  --mint-line: #a8c6b6;
  --butter: #f7e7ad;
  --butter-line: #d7bb70;
  --coral: #f5d1c4;
  --coral-line: #d7a092;
  --sky: #d8ebef;
  --sky-line: #9bc5cb;
  --lavender: #e8e1f1;
  --lavender-line: #b9abcf;
  --success: #5f9a79;
  --retry: #cb846d;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #dfeee9;
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background: #dfeee9;
  font-family: "Nunito", "Arial Rounded MT Bold", ui-rounded, system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 3px solid #6aa99a;
  outline-offset: 3px;
}

button:disabled,
button[aria-disabled="true"] {
  cursor: default;
}

.app-stage {
  display: grid;
  min-height: 100svh;
  place-items: center;
}

.app-shell {
  position: relative;
  display: flex;
  width: 100%;
  height: 100svh;
  min-height: 100svh;
  max-height: 100svh;
  max-width: 560px;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
}

.app-shell::before,
.app-shell::after {
  position: absolute;
  z-index: 0;
  display: block;
  width: 80px;
  height: 5px;
  border-radius: 999px;
  background: #d8b6a7;
  content: "";
  opacity: 0.55;
}

.app-shell::before {
  top: 18px;
  left: 15%;
  transform: rotate(-4deg);
}

.app-shell::after {
  top: 31px;
  right: 13%;
  width: 43px;
  background: #9bc5cb;
  transform: rotate(5deg);
}

.app-content {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 26px 20px 118px;
  scrollbar-width: thin;
  scrollbar-color: #bfd7ce transparent;
}

.topbar,
.brand-lockup,
.goal-topline,
.word-card-header,
.word-title-row,
.phrase-heading,
.section-heading,
.goal-footline,
.bottom-nav,
.bottom-nav-item,
.stats-row,
.stat-card,
.word-navigation {
  display: flex;
}

.topbar {
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.brand-lockup {
  align-items: center;
  gap: 12px;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid var(--butter-line);
  border-radius: 18px 21px 17px 22px;
  background: var(--butter);
  box-shadow: 3px 4px 0 rgba(189, 151, 84, 0.16);
  transform: rotate(-4deg);
}

.brand-mark::after {
  position: absolute;
  inset: 4px;
  border: 1px dashed rgba(125, 95, 61, 0.28);
  border-radius: 13px 17px 14px 16px;
  content: "";
}

.brand-mark span {
  position: relative;
  z-index: 1;
  color: #b48749;
  font-size: 25px;
  line-height: 1;
}

.brand-eyebrow,
.eyebrow-label,
.stat-label,
.phrase-label,
.api-note,
.word-category,
.word-badge,
.record-hint,
.phrase-scribble,
.welcome-copy {
  margin: 0;
}

.brand-eyebrow,
.eyebrow-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-title {
  margin: 1px 0 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.08;
}

.header-doodle {
  position: relative;
  width: 57px;
  height: 50px;
  color: #8db7a2;
  font-size: 22px;
}

.header-spark {
  position: absolute;
  top: 1px;
  left: 5px;
  color: #d1aa5b;
  transform: rotate(-10deg);
}

.header-leaf {
  position: absolute;
  right: 4px;
  bottom: 2px;
  font-size: 36px;
  line-height: 0.65;
  transform: rotate(-24deg);
}

.welcome-copy {
  margin: 11px 2px 17px;
  color: #687970;
  font-size: 13px;
  font-weight: 700;
}

.welcome-copy span {
  margin-left: 4px;
  color: #d6aa61;
}

.soft-card {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 30px 27px 32px 25px;
  box-shadow: 0 5px 0 rgba(86, 107, 92, 0.09);
}

.soft-card::after {
  position: absolute;
  inset: 6px;
  border: 1px dashed rgba(75, 96, 82, 0.15);
  border-radius: 23px 20px 25px 18px;
  content: "";
  pointer-events: none;
}

.goal-card {
  padding: 16px 17px 14px;
  border-color: var(--mint-line);
  background: var(--mint);
  transform: rotate(-0.4deg);
}

.goal-topline {
  position: relative;
  z-index: 1;
  align-items: center;
  gap: 11px;
}

.goal-icon {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid #9dbca9;
  border-radius: 15px 13px 17px 12px;
  color: #6b9f7e;
  background: #eff7ee;
  font-size: 19px;
  transform: rotate(6deg);
}

.goal-title {
  margin: 1px 0 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.goal-count {
  display: flex;
  align-items: baseline;
  gap: 2px;
  margin-left: auto;
  color: #7a9f8c;
  font-size: 13px;
  font-weight: 800;
}

.goal-count strong {
  color: #47745e;
  font-size: 25px;
  font-weight: 900;
  line-height: 1;
}

.goal-progress {
  position: relative;
  z-index: 1;
  height: 10px;
  margin: 15px 3px 8px;
  overflow: hidden;
  border: 2px solid rgba(108, 149, 127, 0.25);
  border-radius: 99px;
  background: #c7e2d6;
}

.goal-progress-fill {
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: #78ae8c;
  transition: width 240ms ease-out;
}

.goal-footline {
  position: relative;
  z-index: 1;
  align-items: center;
  justify-content: space-between;
  color: #6d8c7d;
  font-size: 11px;
  font-weight: 800;
}

.stats-row {
  gap: 10px;
  margin: 15px 0 21px;
}

.stat-card {
  align-items: center;
  min-width: 0;
  gap: 9px;
  flex: 1;
  padding: 12px 11px;
  border-radius: 22px 20px 24px 19px;
  box-shadow: 0 4px 0 rgba(86, 107, 92, 0.07);
}

.stat-card::after {
  inset: 4px;
  border-radius: 16px 14px 18px 13px;
}

.study-card {
  border-color: var(--butter-line);
  background: #fbefc9;
  transform: rotate(0.5deg);
}

.star-card {
  border-color: var(--coral-line);
  background: var(--coral);
  transform: rotate(-0.5deg);
}

.stat-icon {
  position: relative;
  z-index: 1;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  flex: 0 0 auto;
  border: 1.5px solid rgba(116, 93, 62, 0.2);
  border-radius: 11px 9px 12px 8px;
  color: #ad8748;
  background: rgba(255, 255, 255, 0.36);
  font-size: 18px;
}

.star-card .stat-icon {
  color: #c27865;
}

.stat-label,
.stat-value {
  position: relative;
  z-index: 1;
  display: block;
  white-space: nowrap;
}

.stat-label {
  color: #887c66;
  font-size: 10px;
  font-weight: 800;
}

.stat-value {
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.section-heading {
  align-items: end;
  justify-content: space-between;
  margin: 0 2px 11px;
}

.practice-title {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
}

.step-counter {
  padding: 6px 9px 5px;
  border: 1.5px solid #b9c9c0;
  border-radius: 11px 9px 12px 10px;
  color: #6b8578;
  background: #edf4ed;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  transform: rotate(2deg);
}

.word-card {
  padding: 15px 15px 13px;
  border-color: #d8c6ae;
  background: #fffdf7;
  transform: rotate(0.25deg);
}

.word-card-header {
  position: relative;
  z-index: 1;
  align-items: center;
  justify-content: space-between;
  min-height: 22px;
}

.word-category {
  color: #927e69;
  font-size: 11px;
  font-weight: 900;
}

.word-badge {
  padding: 4px 8px 3px;
  border: 1.5px solid #e3c98e;
  border-radius: 10px 8px 11px 9px;
  color: #a27d40;
  background: #fff2c9;
  font-size: 10px;
  font-weight: 900;
  transform: rotate(-2deg);
}

.word-art {
  position: relative;
  display: grid;
  height: 126px;
  margin: 10px 0 12px;
  place-items: center;
  overflow: hidden;
  border: 2px solid #e2b9ac;
  border-radius: 25px 22px 28px 20px;
  background: #f9e4dc;
}

.word-art::before {
  position: absolute;
  inset: 7px;
  border: 1.5px dashed rgba(167, 100, 83, 0.24);
  border-radius: 18px 16px 21px 14px;
  content: "";
}

.word-art[data-tone="cat"] {
  border-color: #9bc5cb;
  background: var(--sky);
}

.word-art[data-tone="cat"]::before {
  border-color: rgba(74, 132, 143, 0.28);
}

.word-art[data-tone="sun"] {
  border-color: #dfbd73;
  background: #faedbf;
}

.word-art[data-tone="sun"]::before {
  border-color: rgba(165, 128, 51, 0.28);
}

.word-art[data-tone="ball"] {
  border-color: var(--lavender-line);
  background: var(--lavender);
}

.word-art[data-tone="ball"]::before {
  border-color: rgba(113, 91, 147, 0.25);
}

.art-emoji {
  position: relative;
  z-index: 1;
  display: block;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  font-size: 76px;
  line-height: 1;
  text-shadow: 2px 3px 0 rgba(95, 83, 61, 0.11);
  transform: rotate(-3deg);
  transition: transform 180ms ease-out;
}

.word-art[data-tone="cat"] .art-emoji {
  transform: rotate(2deg);
}

.word-art[data-tone="sun"] .art-emoji {
  transform: rotate(-1deg);
}

.word-art[data-tone="ball"] .art-emoji {
  transform: rotate(5deg);
}

.art-caption {
  position: absolute;
  right: 26%;
  bottom: 19px;
  z-index: 2;
  padding: 3px 7px;
  border: 1.5px solid #c99986;
  border-radius: 8px 7px 9px 6px;
  color: #aa705e;
  background: #fff8e8;
  font-size: 11px;
  font-weight: 900;
  transform: rotate(-5deg);
}

.word-art[data-tone="cat"] .art-caption {
  border-color: #86b2bb;
  color: #58848c;
}

.word-art[data-tone="cat"] .art-caption::before {
  content: "meow";
}

.word-art[data-tone="sun"] .art-caption {
  border-color: #d1aa5d;
  color: #a6813f;
}

.word-art[data-tone="ball"] .art-caption {
  border-color: #a797bf;
  color: #796a9b;
}

.art-stroke {
  position: absolute;
  display: block;
  border-top: 3px solid rgba(175, 113, 92, 0.42);
  border-radius: 50%;
}

.art-stroke-one {
  top: 27px;
  left: 13%;
  width: 30px;
  transform: rotate(28deg);
}

.art-stroke-two {
  right: 13%;
  bottom: 25px;
  width: 22px;
  transform: rotate(-33deg);
}

.art-spark {
  position: absolute;
  color: #d2a85c;
  font-size: 19px;
  line-height: 1;
}

.art-spark-one {
  top: 18px;
  right: 21%;
  transform: rotate(12deg);
}

.art-spark-two {
  bottom: 21px;
  left: 23%;
  font-size: 25px;
}

.word-copy {
  position: relative;
  z-index: 1;
  padding: 0 3px;
}

.word-title-row {
  align-items: center;
  justify-content: space-between;
}

.word-title {
  margin: 0;
  color: var(--ink);
  font-size: 31px;
  font-weight: 900;
  line-height: 0.95;
}

.word-phonetic {
  margin: 5px 0 0;
  color: #92978b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.word-meaning {
  margin: 3px 0 0;
  color: #a68162;
  font-size: 13px;
  font-weight: 900;
}

.listen-button {
  position: relative;
  z-index: 1;
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 2px solid #a9c8b6;
  border-radius: 18px 16px 19px 15px;
  color: #4f8b70;
  background: var(--mint);
  box-shadow: 2px 3px 0 rgba(83, 124, 99, 0.12);
  cursor: pointer;
  font-size: 21px;
  transform: rotate(2deg);
  transition: transform 150ms ease-out, box-shadow 150ms ease-out;
}

.listen-button:hover,
.listen-button.is-speaking {
  box-shadow: 1px 2px 0 rgba(83, 124, 99, 0.1);
  transform: rotate(2deg) scale(1.04);
}

.listen-button.is-speaking {
  background: #c8e7d7;
}

.phrase-box {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  padding: 11px 12px 10px;
  border: 2px solid #c7d5ca;
  border-radius: 19px 17px 21px 16px;
  background: #eff6ed;
}

.phrase-heading {
  align-items: center;
  justify-content: space-between;
}

.phrase-label {
  color: #6f8b79;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.phrase-scribble {
  color: #9cac9b;
  font-size: 10px;
  font-weight: 800;
  transform: rotate(-3deg);
}

.phrase-text {
  margin: 6px 0 8px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
}

.phrase-text strong {
  color: #c47866;
  font-weight: 900;
}

.sentence-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  color: #5d9276;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 900;
}

.sentence-arrow {
  font-size: 17px;
  line-height: 0.7;
  transition: transform 150ms ease-out;
}

.sentence-button:hover .sentence-arrow {
  transform: translateX(3px);
}

.record-area {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 1px 10px;
}

.record-button {
  display: inline-flex;
  min-width: 132px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 2px solid #d39482;
  border-radius: 18px 16px 20px 15px;
  color: #9a5c4c;
  background: #f8d6ca;
  box-shadow: 3px 4px 0 rgba(186, 116, 96, 0.15);
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
  transition: transform 150ms ease-out, box-shadow 150ms ease-out, background 150ms ease-out;
}

.record-button:hover {
  box-shadow: 1px 2px 0 rgba(186, 116, 96, 0.1);
  transform: translateY(1px);
}

.record-button.is-recording {
  border-color: #c47664;
  color: #8c4f40;
  background: #f2b9aa;
  box-shadow: 0 0 0 4px rgba(211, 148, 130, 0.17), 2px 3px 0 rgba(186, 116, 96, 0.13);
}

.record-button.is-loading {
  cursor: wait;
  opacity: 0.68;
}

.record-button:disabled {
  cursor: wait;
}

.record-button-icon {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 7px;
  line-height: 1;
}

.record-button.is-recording .record-button-icon {
  border-radius: 5px;
  font-size: 0;
}

.record-button.is-recording .record-button-icon::after {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: currentColor;
  content: "";
}

.record-hint {
  max-width: 130px;
  color: #89938b;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
}

.score-panel {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 62px;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1.5px solid #d3ddd2;
  border-radius: 19px 17px 21px 16px;
  background: #fafbf1;
}

.score-panel[data-state="speaking"],
.score-panel[data-state="recording"],
.score-panel[data-state="loading"] {
  border-color: #b7d4c1;
  background: #edf7ef;
}

.score-panel[data-state="success"] {
  border-color: #9fc6a9;
  background: #e2f2e2;
}

.score-panel[data-state="retry"],
.score-panel[data-state="error"] {
  border-color: #e0baa9;
  background: #fff0e9;
}

.score-panel-icon {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  flex: 0 0 auto;
  border: 1.5px solid #b4c6af;
  border-radius: 11px 9px 12px 8px;
  color: #77a181;
  background: #f6faec;
  font-size: 17px;
}

.score-panel[data-state="success"] .score-panel-icon {
  border-color: #8fb99a;
  color: #4e906c;
  background: #f2fae8;
}

.score-panel[data-state="retry"] .score-panel-icon,
.score-panel[data-state="error"] .score-panel-icon {
  border-color: #d2a08d;
  color: #bd755f;
  background: #fff8e7;
}

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

.score-title,
.score-detail {
  margin: 0;
}

.score-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.score-detail {
  margin-top: 2px;
  overflow: hidden;
  color: #859088;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-number {
  min-width: 32px;
  color: #6f9880;
  font-size: 20px;
  font-weight: 900;
  text-align: right;
}

.score-panel[data-state="success"] .score-number {
  color: #4e906c;
}

.score-panel[data-state="retry"] .score-number {
  color: #bd755f;
}

.api-note {
  position: relative;
  z-index: 1;
  margin: 9px 4px 0;
  color: #9d9d8c;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.api-note-mark {
  display: inline-block;
  margin-right: 4px;
  color: #c7a057;
  font-size: 15px;
  line-height: 0;
  vertical-align: -1px;
}

.word-navigation {
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 13px 0 0;
}

.nav-arrow {
  display: grid;
  width: 37px;
  height: 37px;
  place-items: center;
  border: 2px solid #b9cbc0;
  border-radius: 14px 12px 15px 11px;
  color: #628675;
  background: #edf5eb;
  box-shadow: 2px 3px 0 rgba(87, 119, 99, 0.1);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  transition: transform 150ms ease-out, opacity 150ms ease-out;
}

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

.nav-arrow:disabled {
  cursor: default;
  opacity: 0.35;
}

.dot-pagination {
  display: flex;
  align-items: center;
  gap: 7px;
}

.word-dot {
  display: block;
  width: 8px;
  height: 8px;
  padding: 0;
  border: 1.5px solid #b7c8bd;
  border-radius: 50%;
  background: #eef4ea;
  cursor: pointer;
  transition: width 150ms ease-out, border-radius 150ms ease-out, background 150ms ease-out;
}

.word-dot.is-active {
  width: 22px;
  border-color: #74a585;
  border-radius: 99px;
  background: #8fbea0;
}

.bottom-nav {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  min-height: 84px;
  align-items: center;
  justify-content: space-around;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 2px solid #e9e3d7;
  background: rgba(251, 248, 239, 0.96);
}

.bottom-nav-item {
  min-width: 0;
  min-height: 48px;
  align-items: center;
  flex: 1;
  justify-content: center;
  gap: 3px;
  padding: 4px 7px;
  border: 0;
  border-radius: 17px 15px 18px 14px;
  color: #9da49a;
  background: transparent;
  cursor: default;
  font-size: 10px;
  font-weight: 900;
}

.bottom-nav-item.is-active {
  color: #5d8d70;
  background: #e7f2e8;
}

.bottom-nav-icon {
  font-size: 22px;
  line-height: 0.9;
}

.bottom-nav-item:not(.is-active) .bottom-nav-icon {
  font-size: 19px;
}

.is-speaking .art-emoji {
  animation: gentle-bob 1000ms ease-in-out infinite alternate;
}

@keyframes gentle-bob {
  from {
    transform: translateY(0) rotate(-3deg);
  }
  to {
    transform: translateY(-3px) rotate(1deg);
  }
}

@media (min-width: 640px) {
  .app-stage {
    padding: 18px;
  }

  .app-shell {
    width: min(92vw, 540px);
    height: min(calc(100svh - 36px), 960px);
    min-height: 0;
    border: 2px solid #d5e3db;
    border-radius: 36px;
    box-shadow: 0 18px 45px rgba(71, 108, 91, 0.15);
  }

  .app-content {
    padding-right: 25px;
    padding-left: 25px;
  }
}

@media (max-width: 360px) {
  .app-content {
    padding-right: 15px;
    padding-left: 15px;
  }

  .record-area {
    gap: 8px;
  }

  .record-button {
    min-width: 124px;
    padding-right: 11px;
    padding-left: 11px;
  }

  .record-hint {
    font-size: 9px;
  }
}

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