.aae-app,
.aae-app * {
  box-sizing: border-box;
}

.aae-app {
  --aae-bg: #fff8e7;
  --aae-cream: #f5d095;
  --aae-green: #99ca61;
  --aae-purple: #7048ff;
  --aae-pink: #c90d5b;
  --aae-text: #806f5d;
  --aae-card: rgba(255, 255, 255, 0.58);

  position: relative;
  width: 100%;
  min-height: 680px;
  overflow: hidden;
  padding: 46px 76px;
  border-radius: 30px;
  background: var(--aae-bg);
  outline: none;
  isolation: isolate;
}

.aae-app:focus-visible {
  box-shadow: 0 0 0 4px rgba(112, 72, 255, 0.2);
}

.aae-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 42px;
  align-items: center;
  min-height: 588px;
}

.aae-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  min-width: 0;
}

.aae-right {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 500px;
}

.aae-example-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--aae-text);
  font-family: "Mada", sans-serif;
}

.aae-example-title {
  font-size: clamp(21px, 2vw, 30px);
  font-weight: 700;
}

.aae-example-count {
  direction: ltr;
  font-size: 14px;
  font-weight: 700;
  opacity: 0.72;
}

.aae-learning-card {
  width: 100%;
  padding: 24px 30px 28px;
  border: 1px solid rgba(128, 111, 93, 0.12);
  border-radius: 24px;
  background: var(--aae-card);
  backdrop-filter: blur(4px);
}

.aae-section {
  min-width: 0;
}

.aae-label {
  margin-bottom: 4px;
  color: var(--aae-text);
  font-family: "Mada", sans-serif;
  font-size: clamp(18px, 1.6vw, 24px);
  font-weight: 600;
  line-height: 1.7;
}

.aae-word {
  width: 100%;
  overflow: visible;
  font-family: "Mada", sans-serif;
  font-size: clamp(60px, 7vw, 116px);
  font-weight: 700;
  line-height: 1.55;
  text-align: center;
  white-space: nowrap;
  unicode-bidi: isolate;
  font-variant-ligatures: normal;
}

.aae-word--separated {
  color: var(--aae-pink);
  word-spacing: 0.16em;
}

.aae-word--attached {
  color: var(--aae-purple);
}

.aae-divider {
  width: 100%;
  height: 1px;
  margin: 12px 0 14px;
  background: rgba(128, 111, 93, 0.12);
}

.aae-example-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 52px;
}

.aae-example-button {
  appearance: none;
  border: 1px solid rgba(112, 72, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #625b54;
  cursor: pointer;
  padding: 7px 17px 9px;
  font-family: "Mada", sans-serif;
  font-size: clamp(22px, 2vw, 30px);
  font-weight: 600;
  line-height: 1.45;
  transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.aae-example-button:hover,
.aae-example-button:focus-visible {
  transform: translateY(-1px);
  outline: none;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.08);
}

.aae-example-button.is-active {
  background: var(--aae-purple);
  color: #fff;
  border-color: transparent;
}

.aae-letter {
  position: relative;
  z-index: 2;
  color: var(--aae-green);
  font-family: "Mada", sans-serif;
  font-size: clamp(230px, 24vw, 430px);
  font-weight: 700;
  line-height: 1.22;
  text-align: center;
  unicode-bidi: isolate;
}

.aae-letter-name {
  margin-top: -24px;
  color: var(--aae-text);
  font-family: "Mada", sans-serif;
  font-size: clamp(25px, 2.8vw, 42px);
  font-weight: 600;
  line-height: 1.6;
}

.aae-progress {
  position: absolute;
  top: 6px;
  right: 0;
  direction: ltr;
  color: var(--aae-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 700;
  opacity: 0.7;
}

.aae-keyboard-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  color: #7d7369;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
}

.aae-keyboard-help span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.aae-keyboard-help kbd {
  min-width: 29px;
  padding: 3px 7px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-bottom-width: 2px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.76);
  color: #554d45;
  font: inherit;
  font-weight: 700;
  text-align: center;
}

.aae-nav {
  position: absolute;
  z-index: 4;
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  color: var(--aae-green);
  cursor: pointer;
  box-shadow: 0 7px 20px rgba(0, 0, 0, 0.09);
  font-family: Arial, sans-serif;
  font-size: 42px;
  font-weight: 400;
  line-height: 42px;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.aae-nav:hover,
.aae-nav:focus-visible {
  transform: translateY(-50%) scale(1.06);
  outline: none;
  box-shadow: 0 9px 25px rgba(0, 0, 0, 0.13);
}

.aae-nav--prev {
  left: 16px;
}

.aae-nav--next {
  right: 16px;
}

.aae-mobile-counter {
  display: none;
}

.aae-decoration {
  position: absolute;
  z-index: 0;
  width: 210px;
  height: 210px;
  pointer-events: none;
  opacity: 0.8;
}

.aae-decoration::before,
.aae-decoration::after {
  content: "";
  position: absolute;
  border-radius: 48% 52% 55% 45%;
  background: var(--aae-cream);
}

.aae-decoration--top {
  top: -86px;
  left: -72px;
}

.aae-decoration--top::before {
  inset: 28px 28px 36px 22px;
  transform: rotate(22deg);
}

.aae-decoration--top::after {
  width: 95px;
  height: 36px;
  right: -30px;
  bottom: 18px;
  transform: rotate(24deg);
}

.aae-decoration--bottom {
  right: -74px;
  bottom: -90px;
}

.aae-decoration--bottom::before {
  inset: 30px 20px 24px 30px;
  transform: rotate(-20deg);
}

.aae-decoration--bottom::after {
  width: 90px;
  height: 35px;
  left: -28px;
  top: 20px;
  transform: rotate(-24deg);
}

.aae-error {
  padding: 16px;
  border-radius: 10px;
  background: #fff4f4;
  color: #8a1f1f;
}

@media (max-width: 900px) {
  .aae-app {
    min-height: auto;
    padding: 42px 28px 28px;
    border-radius: 22px;
  }

  .aae-content {
    grid-template-columns: 1fr;
    gap: 20px;
    min-height: auto;
  }

  .aae-right {
    order: 1;
    min-height: 270px;
  }

  .aae-left {
    order: 2;
  }

  .aae-progress {
    display: none;
  }

  .aae-letter {
    font-size: clamp(180px, 48vw, 300px);
  }

  .aae-letter-name {
    margin-top: -22px;
  }

  .aae-word {
    font-size: clamp(48px, 13vw, 84px);
  }

  .aae-learning-card {
    padding: 18px 18px 20px;
  }

  .aae-keyboard-help {
    display: none;
  }

  .aae-nav {
    top: 210px;
    width: 42px;
    height: 42px;
    font-size: 36px;
    line-height: 36px;
  }

  .aae-nav--prev {
    left: 9px;
  }

  .aae-nav--next {
    right: 9px;
  }

  .aae-mobile-counter {
    display: block;
    position: absolute;
    z-index: 3;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--aae-text);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 13px;
    font-weight: 700;
    opacity: 0.7;
  }
}

@media (max-width: 480px) {
  .aae-app {
    padding-left: 18px;
    padding-right: 18px;
  }

  .aae-example-button {
    font-size: 21px;
    padding: 6px 12px 8px;
  }

  .aae-word {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .aae-example-button,
  .aae-nav {
    transition: none;
  }
}
