:root {
  --bg: #050505;
  --bg2: #0c0c0e;
  --panel: rgba(18,18,20,.78);
  --panel2: rgba(30,18,10,.82);
  --stroke: rgba(255,132,18,.24);
  --stroke2: rgba(255,255,255,.08);
  --text: #fff8f0;
  --soft: rgba(255,248,240,.68);
  --muted: rgba(255,248,240,.48);
  --accent: #ff7a00;
  --accent2: #ffb156;
  --accent3: #ff4d00;
  --green: #60e69a;
  --red: #ff5b4d;
  --blue: #6ab8ff;
  --shadow: rgba(255,98,0,.28);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; overflow-x: hidden; }
html { min-height: var(--tg-vh, 100dvh); scroll-behavior: smooth; }
body { min-height: var(--tg-vh, 100dvh); overscroll-behavior-y: none; touch-action: pan-y; }
button, input, select, textarea { font: inherit; }
button { border: 0; color: inherit; cursor: pointer; }
input, select, textarea { width: 100%; border: 1px solid var(--stroke2); color: var(--text); background: rgba(255,255,255,.055); border-radius: 16px; outline: none; padding: 13px 14px; transition: .22s ease; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: rgba(255,122,0,.72); box-shadow: 0 0 0 4px rgba(255,122,0,.12); }

body::before { content: ""; position: fixed; inset: 0; z-index: -4; background: radial-gradient(circle at 18% 5%, rgba(255,122,0,.28), transparent 27%), radial-gradient(circle at 86% 9%, rgba(255,177,86,.16), transparent 30%), radial-gradient(circle at 50% 110%, rgba(255,77,0,.2), transparent 42%), linear-gradient(180deg, #111 0%, #050505 45%, #020202 100%); }
body::after { content: ""; position: fixed; inset: 0; z-index: -3; background-image: linear-gradient(rgba(255,122,0,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,122,0,.045) 1px, transparent 1px), radial-gradient(circle, rgba(255,122,0,.09) 1px, transparent 1.8px); background-size: 36px 36px, 36px 36px, 22px 22px; mask-image: linear-gradient(to bottom, rgba(0,0,0,.92), rgba(0,0,0,.38) 70%, transparent 100%); }
.ambient { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: -2; }
.ambient span { position: absolute; width: 190px; height: 190px; border-radius: 50%; background: rgba(255,122,0,.12); filter: blur(32px); animation: floatOrb 9s ease-in-out infinite; }
.ambient span:nth-child(1) { left: -60px; top: 12%; animation-delay: 0s; }
.ambient span:nth-child(2) { right: -80px; top: 7%; width: 260px; height: 260px; animation-delay: -3s; }
.ambient span:nth-child(3) { left: 20%; bottom: -120px; width: 230px; height: 230px; animation-delay: -5s; }
.ambient span:nth-child(4) { right: 18%; bottom: 10%; width: 150px; height: 150px; background: rgba(255,177,86,.09); animation-delay: -7s; }

.app-shell { width: min(620px, calc(100vw - 0px)); max-width: 620px; min-height: var(--tg-vh, 100dvh); margin: 0 auto; padding: 16px 14px calc(108px + var(--safe-bottom) + var(--safe-bottom-runtime, 0px)); }
.screen { animation: screenIn .28s ease both; }
.card { position: relative; overflow: hidden; border-radius: 28px; background: linear-gradient(145deg, rgba(255,255,255,.065), rgba(255,255,255,.02)), var(--panel); border: 1px solid var(--stroke); box-shadow: 0 22px 60px rgba(0,0,0,.58), 0 0 36px rgba(255,122,0,.06); backdrop-filter: blur(18px); }
.card.pad { padding: 18px; }
.card::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .72; background: radial-gradient(circle at 15% 10%, rgba(255,122,0,.13), transparent 28%), radial-gradient(circle at 90% 0%, rgba(255,177,86,.11), transparent 32%); }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }

.top-card { min-height: 232px; padding: 18px; display: grid; grid-template-columns: 1fr minmax(170px, 42%); gap: 12px; align-items: center; }
.brand { position: relative; z-index: 1; }
.kicker { display: inline-flex; align-items: center; gap: 8px; color: var(--accent2); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 900; opacity: .92; }
.kicker::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 18px var(--green); }
h1,h2,h3,p { margin: 0; }
h1 { margin-top: 6px; font-size: clamp(30px, 7vw, 44px); line-height: .94; letter-spacing: -.06em; }
h2 { font-size: 23px; letter-spacing: -.035em; }
h3 { font-size: 17px; letter-spacing: -.02em; }
p { color: var(--soft); line-height: 1.45; }
.hero-illustration { width: 100%; max-height: 220px; overflow: visible; animation: floatHero 5.6s ease-in-out infinite; }
.svg-line { stroke-dasharray: 18 12; animation: dash 5s linear infinite; }
.orb-a { animation: blink 2.4s ease-in-out infinite; }
.orb-b { animation: blink 2.4s ease-in-out infinite .5s; }
.chip { animation: pulseChip 2.8s ease-in-out infinite; }
.sparkles { animation: sparkle 2.7s ease-in-out infinite; }

.metric { position: relative; z-index: 1; padding: 13px 12px; border-radius: 19px; background: rgba(0,0,0,.32); border: 1px solid var(--stroke2); }
.metric span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.metric b { color: var(--accent2); font-size: 19px; }
.progress-line { position: relative; z-index: 1; margin-top: 12px; }
.progress-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--soft); font-size: 13px; margin-bottom: 8px; }
.track { height: 10px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.05); border-radius: 999px; overflow: hidden; }
.fill { height: 100%; width: 0%; border-radius: inherit; background: linear-gradient(90deg, var(--accent3), var(--accent), var(--accent2)); box-shadow: 0 0 22px var(--shadow); transition: width .65s cubic-bezier(.2,.9,.2,1); }

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 999px; background: rgba(255,122,0,.13); border: 1px solid rgba(255,122,0,.24); color: var(--accent2); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.badge { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 10px; border-radius: 12px; background: rgba(255,122,0,.13); color: var(--accent2); font-weight: 950; border: 1px solid rgba(255,122,0,.24); }

.action-card { position: relative; overflow: hidden; display: grid; min-height: 112px; align-content: start; text-align: left; padding: 16px; border-radius: 24px; background: linear-gradient(145deg, rgba(255,255,255,.06), rgba(255,255,255,.018)); border: 1px solid var(--stroke2); box-shadow: 0 12px 34px rgba(0,0,0,.28); transition: transform .18s ease, border-color .18s ease, background .18s ease; }
.action-card:active { transform: scale(.985); }
.action-card:hover { border-color: rgba(255,122,0,.38); background: linear-gradient(145deg, rgba(255,122,0,.15), rgba(255,255,255,.018)); }
.action-card.accent { background: linear-gradient(145deg, rgba(255,122,0,.28), rgba(255,255,255,.025)); border-color: rgba(255,122,0,.42); }
.action-card .icon { font-size: 28px; margin-bottom: 14px; filter: drop-shadow(0 0 10px rgba(255,122,0,.35)); }
.action-card b { font-size: 17px; }
.action-card small { color: var(--muted); margin-top: 7px; line-height: 1.35; }
.action-card::after { content: ""; position: absolute; width: 80px; height: 80px; border-radius: 50%; right: -36px; bottom: -38px; background: rgba(255,122,0,.11); transition: .2s ease; }
.action-card:hover::after { transform: scale(1.35); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 12px 16px; border-radius: 17px; background: rgba(255,255,255,.07); border: 1px solid var(--stroke2); color: var(--text); font-weight: 900; transition: .18s ease; }
.btn:active { transform: scale(.985); }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #170e07; box-shadow: 0 16px 36px rgba(255,122,0,.22); border-color: rgba(255,177,86,.42); }
.btn.soft { background: rgba(255,122,0,.12); color: var(--accent2); border-color: rgba(255,122,0,.26); }
.btn.danger { background: rgba(255,91,77,.12); color: #ff9389; border-color: rgba(255,91,77,.25); }
.btn.full { width: 100%; }
.btn.small { min-height: 38px; padding: 9px 12px; border-radius: 13px; font-size: 13px; }

.lesson-card { padding: 18px; display: grid; gap: 16px; }
.word-focus { padding: 18px; border-radius: 24px; background: linear-gradient(135deg, rgba(255,122,0,.18), rgba(255,255,255,.04)); border: 1px solid rgba(255,122,0,.28); text-align: center; }
.word-focus .en { font-size: 36px; font-weight: 950; letter-spacing: -.04em; color: var(--accent2); }
.word-focus .ua { margin-top: 6px; color: var(--soft); }
.quiz-options { display: grid; gap: 10px; }
.option { min-height: 50px; border-radius: 17px; background: rgba(255,255,255,.06); border: 1px solid var(--stroke2); font-weight: 800; }
.option.good { background: rgba(96,230,154,.12); border-color: rgba(96,230,154,.45); color: #baffe0; }
.option.bad { background: rgba(255,91,77,.12); border-color: rgba(255,91,77,.42); color: #ffaaa3; }
.result-box { border-radius: 18px; padding: 14px; background: rgba(0,0,0,.24); border: 1px solid var(--stroke2); color: var(--soft); }
.result-box.good { border-color: rgba(96,230,154,.32); color: #c7ffdf; }
.result-box.bad { border-color: rgba(255,91,77,.32); color: #ffd0cb; }

.word-list { display: grid; gap: 10px; }
.word-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 12px; border-radius: 19px; background: rgba(255,255,255,.055); border: 1px solid var(--stroke2); animation: rowIn .22s ease both; }
.word-row input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--accent); }
.word-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.word-fields input { padding: 10px 11px; border-radius: 13px; }
.word-status { width: auto; min-width: 112px; padding: 10px; border-radius: 13px; }

.table { display: grid; gap: 8px; }
.table-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 17px; background: rgba(255,255,255,.055); border: 1px solid var(--stroke2); }
.table-row.head { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; background: transparent; border-color: transparent; }
.table-row b { color: var(--accent2); }

.tabs-mini { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.tabs-mini::-webkit-scrollbar { display: none; }
.tabs-mini .btn { white-space: nowrap; min-height: 40px; border-radius: 999px; font-size: 13px; }
.tabs-mini .btn.active { background: rgba(255,122,0,.18); color: var(--accent2); border-color: rgba(255,122,0,.38); }

.bottom-nav { position: fixed; left: max(10px, calc(50% - 310px)); right: max(10px, calc(50% - 310px)); bottom: calc(10px + var(--safe-bottom)); z-index: 20; display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; padding: 8px; border-radius: 26px; background: rgba(10,10,11,.88); border: 1px solid rgba(255,122,0,.25); backdrop-filter: blur(20px); box-shadow: 0 18px 55px rgba(0,0,0,.72), 0 0 30px rgba(255,122,0,.09); }
.nav-btn { min-height: 56px; border-radius: 20px; background: transparent; color: var(--muted); display: grid; place-items: center; gap: 2px; font-weight: 850; font-size: 11px; transition: .18s ease; }
.nav-btn b { font-size: 18px; line-height: 1; }
.nav-btn.active { color: var(--text); background: linear-gradient(135deg, rgba(255,122,0,.32), rgba(255,122,0,.11)); box-shadow: inset 0 0 0 1px rgba(255,177,86,.17); }

.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-bottom)); transform: translateX(-50%); z-index: 40; max-width: min(520px, calc(100vw - 24px)); padding: 12px 15px; border-radius: 999px; background: rgba(16,16,18,.94); border: 1px solid rgba(255,122,0,.28); color: var(--text); box-shadow: 0 20px 50px rgba(0,0,0,.55); animation: toastIn .22s ease both; }
.hidden { display: none !important; }
.fade-up { animation: screenIn .25s ease both; }

.boot-screen { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: #050505; transition: opacity .22s ease, visibility .22s ease; }
.boot-screen.hide { opacity: 0; visibility: hidden; pointer-events: none; }
.boot-screen > div { display: grid; gap: 10px; text-align: center; padding: 22px 24px; border-radius: 24px; color: var(--accent2); background: rgba(22,13,7,.92); border: 1px solid rgba(255,122,0,.28); box-shadow: 0 20px 70px rgba(0,0,0,.75); }
.boot-screen b { font-size: 22px; }
.boot-screen span { color: var(--soft); }

.mobile-lite .ambient { display: none; }
.mobile-lite body::after { opacity: .34; background-size: 52px 52px, 52px 52px, 32px 32px; }
.mobile-lite .card { backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 16px 38px rgba(0,0,0,.54), 0 0 18px rgba(255,122,0,.04); }
.mobile-lite .bottom-nav { backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: 0 10px 30px rgba(0,0,0,.72); }
.mobile-lite .hero-illustration, .mobile-lite .svg-line, .mobile-lite .orb, .mobile-lite .chip, .mobile-lite .sparkles { animation: none !important; }
.mobile-lite .screen, .mobile-lite .word-row, .mobile-lite .toast { animation-duration: .001s !important; }


@media (max-width: 520px) {
  .app-shell { padding-left: 10px; padding-right: 10px; padding-top: 10px; padding-bottom: calc(92px + var(--safe-bottom) + var(--safe-bottom-runtime, 0px)); }
  .top-card { grid-template-columns: 1fr; min-height: 0; }
  .hero-illustration { display: none; }
  h1 { font-size: 31px; line-height: 1; }
  .grid2 { grid-template-columns: 1fr 1fr; gap: 9px; }
  .grid3 { grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
  .action-card { min-height: 104px; padding: 13px; border-radius: 21px; }
  .action-card b { font-size: 15px; }
  .word-fields { grid-template-columns: 1fr; }
  .word-row { grid-template-columns: 30px 1fr; }
  .word-status { grid-column: 2; width: 100%; }
  .bottom-nav { left: 7px; right: 7px; bottom: calc(6px + var(--safe-bottom)); gap: 3px; padding: 6px; border-radius: 21px; }
  .nav-btn { min-height: 50px; border-radius: 16px; font-size: 10px; }
  .nav-btn b { font-size: 17px; }
  .card.pad, .lesson-card { padding: 15px; }
  .word-focus .en { font-size: 31px; }
  .top-card { border-radius: 24px; }
}

@media (max-width: 380px) {
  .bottom-nav { grid-template-columns: repeat(3, 1fr); }
  .app-shell { padding-bottom: calc(150px + var(--safe-bottom) + var(--safe-bottom-runtime, 0px)); }
  .nav-btn { min-height: 45px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

@keyframes screenIn { from { opacity: 0; transform: translateY(14px) scale(.992); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes rowIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes floatOrb { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(18px,-24px,0) scale(1.08); } }
@keyframes floatHero { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes dash { to { stroke-dashoffset: -90; } }
@keyframes blink { 0%,100% { opacity: .9; transform: scale(1); } 50% { opacity: .55; transform: scale(.96); } }
@keyframes pulseChip { 0%,100% { opacity: 1; } 50% { opacity: .65; } }
@keyframes sparkle { 0%,100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
