/* Hangeul Path — Баардык түзмөктөр үчүн толук адаптивдүү (Responsive) CSS системасы */

:root {
  --paper: #F7F3EC;
  --side: #FBF8F2;
  --card: #FFFFFF;
  --sand: #EFE8DA;
  --line: #E2DACB;
  --line-soft: #EFE8DA;
  --ink: #14213D;
  --muted: #5C6479;
  --coral: #C8421C;
  --coral-soft: #FBE0D6;
  --coral-bg: #FFF8F3;
  --jade: #2B7F72;
  --jade-2: #3FA796;
  --jade-soft: #E1F5EE;
  
  --font-ui: Manrope, 'Noto Sans KR', sans-serif;
  --font-hangul: 'Noto Serif KR', serif;
  
  --r-pill: 999px;
  --r-card: 24px;
  --r-card-lg: 32px;
  --r-input: 14px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

img, svg {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

input, button, select, textarea {
  font-family: inherit;
  font-size: 100%;
}

/* ========================================================
   КОМПЬЮТЕР ЖАНА ТЕЛЕФОН МАКЕТТЕРИН БӨЛҮҮ
   (Десктопто телефондук блок көрүнбөйт, телефондо десктоп жашырылат)
   ======================================================== */
.hp-mob {
  display: none !important;
}
.hp-desk {
  display: block;
}

@media (max-width: 900px) {
  body:has(.hp-mob) .hp-desk {
    display: none !important;
  }
  .hp-mob {
    display: block !important;
    width: 100% !important;
    max-width: 640px;
    margin: 0 auto;
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    box-sizing: border-box;
  }
  .hp-mob > div {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}
@media (max-width: 600px) {
  .hp-mob {
    max-width: 100%;
  }
}
@media (min-width: 1200px) {
  .hp-desk {
    display: flex;
    width: 100%;
    min-height: 100vh;
  }
  .hp-main {
    flex: 1;
    max-width: 1200px;
    padding: 36px 48px;
  }
  .grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
  .grid-cols-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
  .grid-cols-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

/* ========================================================
   2. НОУТБУК ЖАНА КИЧИ КОМПЬЮТЕРЛЕР (Laptop: 992px - 1199px)
   ======================================================== */
@media (max-width: 1199px) and (min-width: 900px) {
  .hp-desk {
    display: flex;
    width: 100%;
  }
  .hp-main {
    flex: 1;
    padding: 28px 32px !important;
  }
  .grid-cols-4 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
  .grid-cols-3 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* ========================================================
   3. ПЛАНШЕТТЕР (Tablets: 768px - 899px)
   ======================================================== */
@media (max-width: 899px) and (min-width: 600px) {
  .hp-bar {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 40;
    height: 64px;
    background: var(--side);
    border-bottom: 1.5px solid var(--line);
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
  }

  .hp-main {
    flex: 1 1 100% !important;
    padding: 24px 24px 80px !important;
    max-width: 100% !important;
  }
  .grid-cols-4, .grid-cols-3 {
    display: grid;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
  }
}

/* ========================================================
   4. ТЕЛЕФОНДОР ЖАНА СМАРТФОНДОР (Mobile: <= 599px, 390px, 375px)
   ======================================================== */
@media (max-width: 599px) {
  html {
    font-size: 15px;
  }
  body {
    padding-bottom: 84px; /* Төмөнкү TabBar үчүн орун */
  }

  /* Жогорку тилке */
  .hp-bar {
    display: flex !important;
    position: sticky;
    top: 0;
    z-index: 40;
    height: 60px;
    background: var(--side);
    border-bottom: 1.5px solid var(--line);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
  }



  /* Негизги мазмун аймагы */
  .hp-main {
    flex: 1 1 100% !important;
    padding: 18px 16px 36px !important;
    max-width: 100% !important;
  }

  /* Карточкалар жана контейнерлер */
  .hp-main h1 {
    font-size: 24px !important;
    line-height: 1.25 !important;
  }
  .hp-main h2 {
    font-size: 20px !important;
  }

  /* Гриддер толук 1 колонкага өтөт */
  .grid-cols-4, .grid-cols-3, .grid-cols-2 {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
  }

  /* Баскычтар мобилдикке ылайык толук туурасы менен */
  .btn, button[type="submit"] {
    min-height: 50px !important;
    font-size: 15px !important;
  }

  /* Төмөнкү мобилдик TabBar */
  .mobile-tabbar {
    display: flex !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 72px;
    background: var(--side);
    border-top: 1.5px solid var(--line);
    z-index: 40;
    align-items: center;
    justify-content: space-around;
    padding: 6px 12px 14px;
    box-sizing: border-box;
  }

  .mobile-tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    flex: 1;
  }

  .mobile-tab-item.active {
    color: var(--coral);
    font-weight: 800;
  }
}

/* ========================================================
   5. ӨТӨ КИЧИ ТЕЛЕФОНДОР (iPhone SE, 320px - 360px)
   ======================================================== */
@media (max-width: 360px) {
  html {
    font-size: 14px;
  }
  .hp-main {
    padding: 14px 12px 32px !important;
  }
}

/* ========================================================
   6. ЖАЛПЫ АНИМАЦИЯЛАР ЖАНА ИНТЕРАКТИВДҮҮЛҮК (Transitions & Effects)
   ======================================================== */
@keyframes hpFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hp-fade-up, .hp-main, .hp-mob > div {
  /* "backwards" (not "both"): a retained end-state transform would turn the
     element into the containing block for position:fixed descendants (bottom nav). */
  animation: hpFadeUp 250ms ease-out backwards;
}

/* Бардык баскычтарга жана шилтемелерге hover/active анимациясы */
button, .btn, a.btn, .opt-btn, .chip, [role="button"] {
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease, opacity 150ms ease;
}

button:hover, .btn:hover, a.btn:hover, .opt-btn:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 4px 14px rgba(20, 33, 61, 0.08);
}

button:active, .btn:active, a.btn:active, .opt-btn:active, .chip:active {
  transform: scale(0.97) !important;
}

/* Прогресс-барлар 600ms ичинде жайбаракат толот */
.progress-bar-fill, [style*="width:"][style*="border-radius: 99"] {
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Тост (Toast) кабарламасы */
#hpToast, .hp-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(24px);
  opacity: 0;
  background: #14213D;
  color: #F7F3EC;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 10px 30px rgba(20, 33, 61, 0.25);
  z-index: 99999;
  transition: transform 250ms cubic-bezier(0.16, 1, 0.3, 1), opacity 250ms ease;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
#hpToast.show, .hp-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

/* ========================================================
   7. КАЙТАЛОО (REVIEW) 3D ФЛИП ЖАНА КАРТОЧКА АНИМАЦИЯЛАРЫ
   ======================================================== */
.card-scene {
  perspective: 1000px;
  width: 100%;
}

.flashcard-3d {
  position: relative;
  width: 100%;
  min-height: 380px;
  transform-style: preserve-3d;
  transition: transform 500ms cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.flashcard-3d.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 36px 24px;
  box-sizing: border-box;
  background: #FFFFFF;
  border: 1.5px solid #E2DACB;
  overflow: hidden;
}

.card-face-back {
  transform: rotateY(180deg);
  background: #FDFBF7;
  border-color: #C8421C;
}

@keyframes cardFlyLeft {
  0% {
    transform: translateX(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateX(-120%) rotate(-12deg);
    opacity: 0;
  }
}

@keyframes cardSlideIn {
  0% {
    transform: translateX(80px) scale(0.96);
    opacity: 0;
  }
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
  }
}

.card-fly-out {
  animation: cardFlyLeft 280ms forwards ease-in !important;
}

.card-enter {
  animation: cardSlideIn 320ms forwards cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* ========================================================
   8. САБАК ОЙНОТКУЧУ ЖАНА КӨНҮГҮҮЛӨРДҮН АНИМАЦИЯСЫ
   ======================================================== */
@keyframes feedbackSlideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.feedback-slide {
  animation: feedbackSlideUp 250ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.shake-it {
  animation: shakeError 400ms ease-in-out;
}

/* Конфетти анимациясы */
@keyframes confettiFall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(450px) rotate(720deg); opacity: 0; }
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 14px;
  border-radius: 3px;
  pointer-events: none;
  animation: confettiFall 1.5s forwards ease-out;
}

/* Үн жазуу толкуну */
@keyframes waveAnim {
  0%, 100% { transform: scaleY(0.3); }
  50% { transform: scaleY(1); }
}
.audio-wave-bar {
  width: 4px;
  height: 32px;
  background: #C8421C;
  border-radius: 99px;
  display: inline-block;
  animation: waveAnim 1s ease-in-out infinite;
}

/* prefers-reduced-motion болсо бардык кыймылдарды өчүрүү */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Ичке, тыкан scrollbar (Slim scrollbars) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(20, 33, 61, 0.2);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(20, 33, 61, 0.4);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(20, 33, 61, 0.2) transparent;
}

/* Горизонталдык пилл тизмектеринен scrollbar'ды толук жашыруу */
.no-scrollbar,
.box-34,
.dict-pills,
.cat-pills {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}
.no-scrollbar::-webkit-scrollbar,
.box-34::-webkit-scrollbar,
.dict-pills::-webkit-scrollbar,
.cat-pills::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}


