@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Tajawal:wght@400;500;600;700;800&display=swap');

:root {
  color-scheme: light;
  font-family: "Tajawal", "DM Sans", sans-serif;
  color: #30251f;
  background: #fff8ef;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --orange: #f27b35;
  --orange-dark: #d65b21;
  --ink: #30251f;
  --muted: #82766f;
  --blue: #74b7d5;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 85% 4%, rgba(255, 215, 169, .35), transparent 34rem),
    #fff8ef;
}

button, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible { outline: 3px solid #4d9ec2; outline-offset: 3px; }

.app-shell { width: min(100% - 32px, 620px); margin: 0 auto; padding: 18px 0 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 52px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.brand img { border-radius: 14px; }
.brand strong { display: block; color: var(--orange-dark); font: 800 1.15rem "DM Sans", sans-serif; direction: ltr; text-align: right; }
.brand small { display: block; margin-top: 1px; color: var(--muted); font-size: .73rem; }
.install-button { border: 0; border-radius: 12px; padding: 9px 13px; background: #fff; color: var(--orange-dark); font-weight: 700; box-shadow: 0 3px 14px #63300e12; }

.lesson-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 224px;
  margin-top: 16px;
  padding: 26px 28px;
  overflow: hidden;
  border: 1px solid #f8e9da;
  border-radius: 28px;
  background: linear-gradient(120deg, #fff 16%, #fff8ef 100%);
  box-shadow: 0 12px 35px #81491a0b;
}
.lesson-copy { position: relative; z-index: 1; max-width: 60%; }
.eyebrow { margin: 0 0 7px; color: var(--orange-dark); font-size: .82rem; font-weight: 700; }
h1 { margin: 0; font-size: clamp(1.55rem, 6vw, 2rem); line-height: 1.3; }
.intro { max-width: 290px; margin: 8px 0 0; color: var(--muted); font-size: .98rem; line-height: 1.7; }

.fox-wrap { position: relative; width: 164px; height: 190px; flex: 0 0 164px; }
.fox { position: absolute; inset: 14px 0 0; transform-origin: 50% 90%; }
.fox-ear { position: absolute; z-index: 0; top: 10px; width: 58px; height: 78px; background: #e9682d; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.ear-left { right: 17px; transform: rotate(-12deg); }
.ear-right { left: 17px; transform: rotate(12deg); }
.fox-ear::after { position: absolute; inset: 13px 15px 7px; background: #ffcfad; content: ""; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.fox-face { position: absolute; z-index: 1; top: 39px; left: 14px; width: 136px; height: 112px; overflow: hidden; border-radius: 48% 48% 45% 45%; background: linear-gradient(145deg, #ff9951, #ed6d32 72%); box-shadow: inset -7px -8px 0 #d9572580; }
.fox-face::after { position: absolute; right: 20px; bottom: -34px; left: 20px; height: 78px; border-radius: 50% 50% 0 0; background: #fff5e8; content: ""; }
.fox-eye { position: absolute; z-index: 2; top: 43px; width: 9px; height: 12px; border-radius: 50%; background: #38241d; }
.eye-left { right: 35px; }
.eye-right { left: 35px; }
.fox-muzzle { position: absolute; z-index: 3; top: 61px; left: 42px; width: 52px; height: 32px; border-radius: 50%; background: #fff; }
.fox-nose { position: absolute; top: 2px; left: 21px; width: 10px; height: 7px; border-radius: 50%; background: #49332c; }
.fox-cheek { position: absolute; z-index: 2; top: 69px; width: 14px; height: 7px; border-radius: 50%; background: #ffb49a; }
.cheek-left { right: 12px; }.cheek-right { left: 12px; }
.fox-body { position: absolute; top: 133px; left: 39px; width: 86px; height: 54px; border-radius: 45% 45% 22% 22%; background: #f27b35; }
.fox-body::after { position: absolute; top: 2px; left: 29px; width: 29px; height: 49px; border-radius: 50% 50% 20% 20%; background: #fff3e4; content: ""; }
.fox-spark { position: absolute; color: #edac58; font-size: 1.2rem; }
.spark-one { top: 15px; right: 4px; }.spark-two { top: 79px; left: 0; font-size: .85rem; }
.sound-waves { position: absolute; z-index: 2; right: -5px; bottom: 38px; display: flex; gap: 3px; align-items: center; height: 24px; opacity: 0; }
.sound-waves i { width: 3px; height: 8px; border-radius: 5px; background: var(--blue); }
.fox-wrap[data-state="listening"] .sound-waves { opacity: 1; }
.fox-wrap[data-state="listening"] .sound-waves i { animation: wave .65s ease-in-out infinite alternate; }
.sound-waves i:nth-child(2), .sound-waves i:nth-child(4) { animation-delay: .2s; }
.sound-waves i:nth-child(3) { animation-delay: .4s; }
.fox-wrap[data-state="thinking"] .fox { animation: think 1s ease-in-out infinite alternate; }
.fox-wrap[data-state="speaking"] .fox { animation: speak .32s ease-in-out infinite alternate; }
.fox-wrap[data-state="speaking"] .fox-muzzle { animation: mouth .32s ease-in-out infinite alternate; }
@keyframes wave { to { height: 22px; } }
@keyframes think { to { transform: translateY(-5px) rotate(3deg); } }
@keyframes speak { to { transform: translateY(-3px) rotate(-2deg); } }
@keyframes mouth { to { transform: scaleY(.72); } }

.practice-card { margin-top: 18px; padding: 22px; border: 1px solid #f5e8dc; border-radius: 26px; background: #fff; box-shadow: 0 14px 40px #81491a0c; }
.practice-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .91rem; font-weight: 600; }
.practice-toolbar select { max-width: 57%; padding: 10px 12px; border: 1px solid #efe3d8; border-radius: 12px; background: #fffaf5; color: var(--ink); font-weight: 700; }
.minutes-panel { margin-top: 19px; }
.minutes-copy { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; color: var(--muted); font-size: .81rem; }
.minutes-copy strong { color: #4a7562; font-variant-numeric: tabular-nums; }
.minutes-track { height: 7px; overflow: hidden; border-radius: 9px; background: #f5eee7; }
.minutes-track span { display: block; width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #f8b25e, #f27b35); transition: width .3s ease; }
.conversation { display: flex; flex-direction: column; gap: 12px; min-height: 144px; max-height: 250px; margin-top: 18px; padding: 5px 1px; overflow-y: auto; }
.message { display: flex; align-items: flex-start; gap: 9px; max-width: 90%; }
.message p { margin: 0; padding: 11px 14px; border-radius: 16px 16px 4px 16px; background: #fff6eb; font-size: .94rem; line-height: 1.6; overflow-wrap: anywhere; }
.message-avatar { display: grid; width: 32px; height: 32px; flex: 0 0 32px; place-items: center; border-radius: 50%; background: #fff2df; }
.user-message { align-self: flex-start; flex-direction: row-reverse; margin-right: auto; }
.user-message p { border-radius: 16px 16px 16px 4px; background: #edf7fb; }
.status { min-height: 22px; margin: 8px 0 10px; color: var(--muted); text-align: center; font-size: .86rem; }
.mic-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: min(100%, 300px); min-height: 58px; margin: 0 auto; border: 0; border-radius: 18px; background: var(--orange); color: #fff; box-shadow: 0 8px 20px #ed74374a; font-size: 1.05rem; font-weight: 800; transition: background .2s, transform .2s; }
.mic-button:hover { background: var(--orange-dark); transform: translateY(-1px); }
.mic-button[aria-pressed="true"] { background: #d9533f; animation: mic-pulse 1.3s ease-out infinite; }
.mic-icon svg { display: block; width: 24px; height: 24px; fill: currentColor; }
@keyframes mic-pulse { 50% { box-shadow: 0 0 0 11px #d9533f20, 0 8px 20px #ed74374a; } }
.privacy-note { margin: 13px 0 0; color: #998f88; text-align: center; font-size: .74rem; line-height: 1.6; }
footer { padding: 19px 0 0; color: #a19489; text-align: center; font-size: .82rem; }
.app-dialog { width: min(92vw, 390px); padding: 0; border: 0; border-radius: 24px; color: var(--ink); box-shadow: 0 20px 70px #31241f40; }
.app-dialog::backdrop { background: #30251f70; backdrop-filter: blur(3px); }
.dialog-content { position: relative; display: flex; flex-direction: column; align-items: center; padding: 32px 26px 26px; text-align: center; }
.dialog-close { position: absolute; top: 10px; left: 13px; border: 0; background: transparent; color: var(--muted); font-size: 1.7rem; }
.dialog-emoji { font-size: 2.5rem; }
.dialog-content h2 { margin: 12px 0 5px; font-size: 1.35rem; }
.dialog-content p { margin: 6px 0 20px; color: var(--muted); line-height: 1.8; }
.primary-button { width: 100%; padding: 12px; border: 0; border-radius: 13px; background: var(--orange); color: white; font-weight: 800; }
[hidden] { display: none !important; }

@media (max-width: 480px) {
  .app-shell { width: min(100% - 24px, 620px); padding-top: 12px; }
  .lesson-card { min-height: 203px; padding: 19px 15px; border-radius: 23px; }
  .lesson-copy { max-width: 62%; }
  .fox-wrap { width: 140px; height: 172px; flex-basis: 140px; transform: scale(.88); transform-origin: center right; margin-left: -10px; }
  .practice-card { padding: 18px 15px; border-radius: 22px; }
  .conversation { min-height: 130px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
