:root {
  --bg: #fff8e7; --ink: #2b2d42; --muted: #6c6f85; --card: #ffffff; --line: #f0e3c4;
  --l1: #19c37d; --l2: #3a86ff; --l3: #ff5a4d; --l4: #2fb36d; --l5: #7b5cff;
  --r: 22px; --shadow: 0 8px 0 rgba(43, 45, 66, 0.08), 0 14px 30px -12px rgba(43, 45, 66, 0.25);
  --font: "Fredoka", "Nunito", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); font-size: 17px; color: var(--ink); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
body.mode-adult { font-size: 19px; }
body.big { font-size: 22px; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 4px solid #ff922b; outline-offset: 3px; border-radius: 12px; }

.sky { position: fixed; inset: 0; z-index: -1; background:
  radial-gradient(circle at 12% 8%, #ffe3a3 0 90px, transparent 91px),
  radial-gradient(circle at 90% 20%, #c5f6fa 0 140px, transparent 141px),
  radial-gradient(circle at 80% 90%, #ffd6e7 0 160px, transparent 161px),
  radial-gradient(circle at 5% 85%, #d3f9d8 0 120px, transparent 121px), var(--bg); }

.bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 18px; background: rgba(255, 248, 231, 0.92); backdrop-filter: blur(10px); border-bottom: 3px dashed var(--line); }
.logo { font-weight: 700; font-size: 1.3rem; margin: 0 auto 0 0; }
.back, .tool { background: #fff; border: 3px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 600; }
.bar-tools { display: flex; gap: 8px; }
.tool[aria-pressed="true"] { background: #ffd43b; border-color: #fab005; }
.back:hover, .tool:hover { transform: translateY(-2px); }

main { max-width: 1100px; margin: 0 auto; padding: 22px 16px 40px; }
.crumb { display: inline-block; margin-bottom: 12px; font-weight: 600; color: var(--muted); }
.crumb:hover { color: var(--ink); }

.hero { text-align: center; padding: 28px 10px 18px; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 4rem); line-height: 1.05; margin: 8px 0; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, #ff6b6b, #ffa94d, #51cf66, #339af0, #9775fa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { max-width: 640px; margin: 0 auto; color: var(--muted); }
.hero-emojis { font-size: 2.6rem; display: flex; justify-content: center; gap: 14px; }
.hero-emojis span { animation: hop 2.4s ease-in-out infinite; }
.hero-emojis span:nth-child(2) { animation-delay: .2s; } .hero-emojis span:nth-child(3) { animation-delay: .4s; }
.hero-emojis span:nth-child(4) { animation-delay: .6s; } .hero-emojis span:nth-child(5) { animation-delay: .8s; }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px) rotate(8deg); } }

.panel { background: var(--card); border: 3px solid var(--line); border-radius: var(--r); padding: 22px; margin: 18px 0; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 12px; font-size: 1.35rem; display: flex; align-items: center; gap: 10px; }
.panel h2:not(:first-child) { margin-top: 26px; }
.panel h2 b { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #ff922b; color: #fff; }
.sub { color: var(--muted); margin: -6px 0 14px; }

.chips, .pills, .modes { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { background: #fff; border: 3px solid var(--line); border-radius: 999px; padding: 8px 18px; font-weight: 600; transition: transform .15s; }
.chip:hover { transform: translateY(-3px); }
.chip.on { background: #ffd43b; border-color: #fab005; }
.pill { padding: 6px 14px; border-radius: 999px; background: color-mix(in srgb, var(--c) 18%, #fff); border: 2px solid var(--c); font-weight: 600; }
.mode { flex: 1 1 240px; display: grid; gap: 2px; text-align: left; background: #fff; border: 3px solid var(--line); border-radius: 18px; padding: 14px 18px; }
.mode .mode-i { font-size: 2rem; }
.mode small { color: var(--muted); }
.mode.on { border-color: #51cf66; background: #ebfbee; }

.lang-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.lang-card { display: grid; gap: 4px; justify-items: center; text-align: center; padding: 18px 12px; border-radius: 20px; border: 3px solid var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); transition: transform .2s; }
.lang-card:hover { transform: translateY(-6px) rotate(-1deg); }
.fimg { display: inline-block; width: 1.5em; height: auto; vertical-align: -0.2em; border-radius: 4px; box-shadow: 0 0 0 1px rgba(43, 45, 66, 0.15); }
.lang-card .flag .fimg { width: 64px; border-radius: 8px; box-shadow: 0 3px 8px rgba(43, 45, 66, 0.25); }
.flag.big .fimg { width: 84px; border-radius: 10px; box-shadow: 0 4px 10px rgba(43, 45, 66, 0.25); }
.lang-card em { font-style: normal; color: var(--muted); }
.meter { display: block; width: 100%; height: 12px; border-radius: 999px; background: #fff; border: 2px solid var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #ffd43b, #51cf66); border-radius: 999px; transition: width .6s; }
.meter.wide { max-width: 420px; margin: 8px 0 4px; }

.langhead, .studyhead { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 20px 24px; border-radius: var(--r); background: color-mix(in srgb, var(--c) 18%, #fff); border: 3px solid var(--c); box-shadow: var(--shadow); }
.langhead h1, .studyhead h1 { margin: 0; font-size: clamp(1.4rem, 3.5vw, 2.1rem); }
.langhead p, .studyhead p { margin: 4px 0 0; color: var(--muted); }
.flag.big { font-size: 4rem; } .s-i { font-size: 3.4rem; }
.langhead > div:nth-child(2), .studyhead > div { flex: 1 1 280px; }
.head-actions { display: flex; flex-direction: column; gap: 8px; }

.btn { display: inline-block; border: 0; border-radius: 999px; padding: 10px 22px; font-weight: 700; color: #fff; background: #ff6b6b; box-shadow: 0 5px 0 #c92a2a; transition: transform .1s, box-shadow .1s; text-align: center; }
.btn:hover { transform: translateY(-2px); } .btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #c92a2a; }
.btn.ghost { background: #fff; color: var(--ink); border: 3px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.done { background: #51cf66; box-shadow: 0 5px 0 #2b8a3e; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.topic { display: grid; gap: 4px; padding: 16px; border-radius: 20px; border: 3px solid var(--c); background: color-mix(in srgb, var(--c) 14%, #fff); transition: transform .2s; }
.topic:hover { transform: translateY(-6px) rotate(1deg); }
.t-i { font-size: 2.6rem; } .topic small { color: var(--muted); }
.stars { color: #fab005; letter-spacing: 2px; }

.group-title { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 12px; font-size: 1.2rem; padding-bottom: 6px; border-bottom: 3px dashed var(--line); }
.group-title:first-of-type { margin-top: 6px; }
.group-title small { color: var(--muted); font-weight: 500; font-size: .85rem; }
.pgroup { margin: 12px 0; } .pgroup > strong { display: block; margin-bottom: 6px; }

.method { background: color-mix(in srgb, var(--c) 8%, #fff); border-color: var(--c); }
.method .sub { margin: 0 0 16px; }
.msteps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.mstep { display: flex; gap: 12px; padding: 14px; background: #fff; border: 2px solid var(--line); border-radius: 18px; }
.mstep .mi { font-size: 2.2rem; line-height: 1; }
.mstep p { margin: 4px 0 8px; color: var(--muted); }
.mlink { display: inline-block; font-weight: 700; color: #1971c2; }
.mlink:hover { text-decoration: underline; }
.method h3 { margin: 6px 0 12px; }

.weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.week { border: 3px solid var(--line); border-radius: 20px; padding: 14px; background: #fffdf5; }
.week summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; list-style: none; }
.week summary::-webkit-details-marker { display: none; }
.week summary::before { content: "▸"; margin-right: 8px; transition: transform .2s; }
.week[open] summary::before { transform: rotate(90deg); }
.week summary h3 { margin: 0; flex: 1; }
.wprog { font-size: .85rem; font-weight: 700; color: var(--muted); }
.week[open] summary { margin-bottom: 10px; }
.week h3 { margin: 0 0 8px; }
.days { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.days li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 14px; background: #fff; border: 2px solid var(--line); }
.days li small { display: block; color: var(--muted); }
.days li.ok { background: #ebfbee; border-color: #8ce99a; }
.days li.next { border-color: #ff922b; background: #fff4e6; }
.go { background: #339af0; color: #fff; border-radius: 999px; padding: 4px 14px; font-weight: 600; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.tab { background: #fff; border: 3px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; padding: 10px 18px; font-weight: 700; }
.tab.on { background: #ffd43b; border-color: #fab005; }
.stage { margin-top: 0; border-top-left-radius: 0; min-height: 320px; }
.stage-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tip { margin: 0; font-weight: 600; }
.score { background: #fff4e6; border-radius: 999px; padding: 4px 14px; font-weight: 700; }

.fc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.fc { position: relative; }
.fc-main { width: 100%; display: grid; gap: 4px; justify-items: center; padding: 18px 10px; background: #fff; border: 3px solid var(--line); border-radius: 22px; box-shadow: 0 6px 0 var(--line); transition: transform .15s; }
.fc-main:hover { transform: translateY(-5px) scale(1.03); border-color: #ffa94d; }
.fc-main:active { transform: scale(.97); }
.fc .e { font-size: 3.6rem; line-height: 1.1; }
.fc strong { font-size: 1.25rem; } .fc small { color: var(--muted); }
.letter { font-size: 1.8rem; font-weight: 700; color: #f03e3e; }
.slow { position: absolute; top: 8px; right: 8px; width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--line); background: #fff; }

.mem-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; max-width: 700px; margin: 0 auto; }
.mc { aspect-ratio: 1; border-radius: 18px; border: 3px solid #339af0; background: #d0ebff; display: grid; place-items: center; padding: 6px; font-weight: 700; transition: transform .2s; }
.mc .c { display: none; font-size: 2.6rem; text-align: center; overflow-wrap: anywhere; }
.mc.wd .c { font-size: 1.1rem; }
.mc .q { font-size: 2.4rem; }
.mc.up, .mc.ok { background: #fff; transform: rotateY(0); }
.mc.up .q, .mc.ok .q { display: none; } .mc.up .c, .mc.ok .c { display: block; }
.mc.ok { background: #ebfbee; border-color: #51cf66; }

.qbox { max-width: 640px; margin: 0 auto; text-align: center; display: grid; gap: 14px; justify-items: center; }
.qcount { color: var(--muted); margin: 0; font-weight: 600; }
.q-e { font-size: 6rem; line-height: 1; } .qask { margin: 0; font-weight: 700; font-size: 1.2rem; }
.big-say { font-size: 1.4rem; padding: 18px 30px; border-radius: 24px; border: 3px solid #339af0; background: #d0ebff; font-weight: 700; }
.opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: 100%; }
.opt { padding: 16px; border-radius: 18px; border: 3px solid var(--line); background: #fff; font-weight: 700; font-size: 1.15rem; box-shadow: 0 5px 0 var(--line); }
.opts.emo .opt { font-size: 3rem; }
.opt:hover:not(:disabled) { border-color: #ffa94d; transform: translateY(-3px); }
.opt.right { background: #d3f9d8; border-color: #40c057; } .opt.wrong { background: #ffe3e3; border-color: #fa5252; }
.good { color: #2b8a3e; font-weight: 700; margin: 0 0 8px; } .bad { color: #c92a2a; font-weight: 700; margin: 0 0 8px; }
.mask { font-size: 1.8rem; letter-spacing: 3px; margin: 0; font-weight: 700; }
#wi { width: 100%; font: inherit; font-size: 1.4rem; text-align: center; padding: 12px; border-radius: 16px; border: 3px solid var(--line); }
#wi:focus { border-color: #ffa94d; outline: none; }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.result { text-align: center; padding: 24px 10px; display: grid; gap: 10px; justify-items: center; }
.result h2 { margin: 0; } .big-stars { font-size: 3.4rem; color: #fab005; letter-spacing: 6px; }

.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.res { display: grid; gap: 4px; padding: 16px; border-radius: 18px; border: 3px solid var(--line); background: #fffdf5; transition: transform .2s; }
.res:hover { transform: translateY(-5px); border-color: #ffa94d; }
.r-i { font-size: 2.2rem; } .res small { color: var(--muted); overflow-wrap: anywhere; }
.tips { padding-left: 22px; } .tips li { margin: 6px 0; }

.foot { text-align: center; color: var(--muted); padding: 20px 16px 40px; }
.small { font-size: .85rem; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; background: #2b2d42; color: #fff; padding: 10px 20px; border-radius: 999px; transition: .3s; z-index: 60; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.confetti span { position: absolute; top: -40px; animation: fall 2.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

@media (max-width: 600px) {
  .opts { grid-template-columns: 1fr; } .opts.emo { grid-template-columns: 1fr 1fr; }
  .weeks { grid-template-columns: 1fr; } .head-actions { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }
