@font-face { font-family: "Nunito"; font-weight: 600; src: url(fonts/nunito-cyrillic-600-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Nunito"; font-weight: 800; src: url(fonts/nunito-cyrillic-800-normal.woff2) format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Nunito"; font-weight: 600; src: url(fonts/nunito-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-21FF, U+2212, U+25B6; }
@font-face { font-family: "Nunito"; font-weight: 800; src: url(fonts/nunito-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2190-21FF, U+2212, U+25B6; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #021022; overflow: hidden; font-family: "Nunito", "Segoe UI", Arial, sans-serif; font-weight: 600; }
body { user-select: none; -webkit-user-select: none; touch-action: manipulation; }
b, strong, h1, h2, h3 { font-weight: 800; }

#stage {
  position: absolute; left: 50%; top: 50%; width: 1600px; height: 900px;
  transform-origin: 0 0; overflow: hidden; background: #0b3a5c; color: #fff;
}
.bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0; transition: opacity .7s ease; }
.bg.on { opacity: 1; }

/* ---------- бульбашки ---------- */
#bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.bub { position: absolute; bottom: -40px; border-radius: 50%; border: 2px solid rgba(255,255,255,.55); background: radial-gradient(circle at 32% 30%, rgba(255,255,255,.7) 0 18%, rgba(255,255,255,.08) 40%, rgba(255,255,255,0) 70%);
  animation: rise linear infinite; }
@keyframes rise { 0% { transform: translate(0, 0); opacity: 0; } 8% { opacity: .9; } 50% { transform: translate(var(--sway), -480px); } 92% { opacity: .7; } 100% { transform: translate(0, -980px); opacity: 0; } }

/* ---------- персонажі ---------- */
#chars { position: absolute; inset: 0; pointer-events: none; transition: opacity .4s; z-index: 3; }
.char { position: absolute; transform: translateX(-50%); transition: opacity .35s ease, filter .3s ease; opacity: 0; }
.char.on { opacity: 1; }
.char.dim { filter: brightness(.72) saturate(.85); }
.char > img { display: block; height: 100%; width: auto; position: relative; }
.char.flip { transform: translateX(-50%) scaleX(-1); }
.char.glow > img { animation: glow 1.6s ease-in-out infinite; }
/* сторінка атласу на сцені — ще бліда, поки не ожила */
.char.faded > img { filter: grayscale(1) sepia(.35) brightness(1.08) contrast(.85); }
.char.glow.faded > img { animation: glowf 1.6s ease-in-out infinite; }
@keyframes glowf { 0%,100% { filter: grayscale(1) sepia(.35) brightness(1.08) contrast(.85) drop-shadow(0 0 6px rgba(255,220,120,.7)); } 50% { filter: grayscale(1) sepia(.35) brightness(1.08) contrast(.85) drop-shadow(0 0 22px rgba(255,230,140,1)); } }
@keyframes glow { 0%,100% { filter: drop-shadow(0 0 6px rgba(255,220,120,.7)); } 50% { filter: drop-shadow(0 0 22px rgba(255,230,140,1)); } }
.char.float { animation: floaty 3.2s ease-in-out infinite; }
@keyframes floaty { 0%,100% { translate: 0 0; } 50% { translate: 0 -14px; } }
.char.jump > img { animation: jump .9s ease-in-out 2; }
@keyframes jump { 0%,100% { transform: translateY(0); } 45% { transform: translateY(-150px); } }
#stage.tasking #chars { opacity: .18; }

/* батискаф із пілотом у віконці */
.subchar .porthole { position: absolute; border-radius: 50%; overflow: hidden; background: radial-gradient(circle at 50% 60%, #2f6f8f, #123a52); }
.subchar .pilot { position: absolute; left: 50%; top: 2%; height: 180%; width: auto; transform: translateX(-50%); }
.subchar.flip .pilot { transform: translateX(-50%) scaleX(-1); }
.subchar .glass { position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(ellipse at 30% 24%, rgba(255,255,255,.75) 0 7%, rgba(255,255,255,.18) 16%, rgba(255,255,255,0) 32%), linear-gradient(160deg, rgba(160,220,255,.22), rgba(40,120,170,.18));
  box-shadow: inset 0 0 18px rgba(0,40,70,.45); }
.subchar .hull { position: relative; z-index: 1; }

/* ---------- діалог ---------- */
#dialog {
  position: absolute; z-index: 10; left: 40px; right: 40px; bottom: 24px; min-height: 172px;
  background: rgba(5, 36, 62, .9); border: 3px solid rgba(140, 220, 255, .6); border-radius: 26px;
  padding: 30px 150px 26px 40px; font-size: 32px; line-height: 1.38; cursor: pointer;
  box-shadow: 0 10px 40px rgba(0,0,0,.45); display: none;
}
#dialog.on { display: block; animation: pop .25s ease; }
#dialog .name {
  position: absolute; top: -26px; left: 34px; padding: 6px 26px; border-radius: 16px; font-weight: 800; font-size: 28px;
  background: #ff9f43; color: #10202e; box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
#dialog .name:empty { display: none; }
#dialog.narr .text { font-style: italic; color: #d4f0ff; }
#dialog .next {
  position: absolute; right: 26px; bottom: 22px; width: 92px; height: 92px; border-radius: 50%; border: none;
  background: #ffcf4a; color: #10202e; font-size: 44px; font-weight: 900; cursor: pointer; box-shadow: 0 4px 0 #c08a10;
  animation: nudge 1.4s ease-in-out infinite;
}
@keyframes nudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(6px); } }
@keyframes pop { from { transform: scale(.97); opacity: .3; } to { transform: scale(1); opacity: 1; } }

/* ---------- верхні кнопки ---------- */
#topbar { position: absolute; top: 18px; right: 18px; display: flex; gap: 12px; z-index: 50; }
#topbar button {
  height: 60px; min-width: 60px; padding: 0 18px; border-radius: 18px; border: 2px solid rgba(255,255,255,.4);
  background: rgba(5, 36, 62, .75); color: #fff; font-size: 24px; font-weight: 800; cursor: pointer; font-family: inherit;
}
#topbar button:hover { background: rgba(20, 80, 120, .9); }

/* ---------- смужка атласу ---------- */
#atlasbar { position: absolute; top: 16px; left: 18px; z-index: 50; display: none; align-items: center; gap: 10px;
  background: rgba(5, 36, 62, .72); border: 2px solid rgba(255,255,255,.35); border-radius: 20px; padding: 6px 14px 6px 8px; }
#atlasbar.on { display: flex; }
#stage:has(.overlay.on:not(#atlasview):not(#pagegain)) #atlasbar { visibility: hidden; }
#atlasbar .book { width: 66px; height: 58px; border: none; background: none; padding: 0; cursor: pointer; }
#atlasbar .book img { width: 66px; height: 58px; object-fit: contain; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
#atlasbar .book:hover img { transform: scale(1.08); }
#atlasbar .slots { display: flex; gap: 7px; }
.slot { width: 40px; height: 48px; border-radius: 7px; border: 2px dashed rgba(255,255,255,.45); color: rgba(255,255,255,.55);
  font-size: 18px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.slot.got { border: 2px solid #c79a55; overflow: hidden; box-shadow: 0 0 10px rgba(255,220,140,.45); }
.slot.got img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot.stolen { border-color: #ff8f8f; color: #ff8f8f; }
.slot.fresh { animation: slotpop 1s ease; }
@keyframes slotpop { 0% { transform: scale(1); } 40% { transform: scale(1.5); box-shadow: 0 0 24px #ffe9a8; } 100% { transform: scale(1); } }

/* ---------- загальні панелі ---------- */
.overlay { position: absolute; inset: 0; z-index: 40; display: none; align-items: center; justify-content: center; background: rgba(2, 14, 30, .6); }
.overlay.on { display: flex; }
.panel {
  background: linear-gradient(180deg, rgba(10, 58, 92, .97), rgba(5, 34, 58, .97)); border: 3px solid rgba(140, 220, 255, .55);
  border-radius: 30px; box-shadow: 0 20px 60px rgba(0,0,0,.6); color: #fff; position: relative;
}
.btn {
  font-family: inherit; font-size: 30px; font-weight: 800; padding: 14px 34px; border-radius: 20px; border: none; cursor: pointer;
  background: #ffcf4a; color: #10202e; box-shadow: 0 5px 0 #c08a10;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #c08a10; }
.btn.blue { background: #5fd0ff; box-shadow: 0 5px 0 #2a8fb8; }
.btn.ghost { background: transparent; color: #d4f0ff; box-shadow: none; border: 2px solid rgba(212,240,255,.5); font-size: 24px; padding: 10px 22px; }
.btn[disabled] { opacity: .4; cursor: default; }

/* ---------- старт і титри ---------- */
#start { z-index: 60; background: radial-gradient(ellipse at center, rgba(5,36,62,.25), rgba(2,14,30,.8)); flex-direction: column; }
#start h1 { font-size: 92px; margin: 0; text-align: center; line-height: 1.05; text-shadow: 0 6px 30px rgba(0,0,0,.7); color: #ffe9a8; }
#start h3 { font-size: 56px; margin: 6px 0 0; color: #fff; text-shadow: 0 4px 20px rgba(0,0,0,.8); }
#start h2 { font-size: 32px; margin: 16px 0 36px; font-weight: 600; color: #d4f0ff; text-shadow: 0 2px 10px rgba(0,0,0,.8); }
#start .row { display: flex; gap: 26px; }
#start .heroes { position: absolute; bottom: 0; left: 0; right: 0; height: 420px; pointer-events: none; }
#start .heroes img { position: absolute; bottom: 30px; height: 360px; }
#start .sbook { width: 150px; margin-bottom: 8px; filter: drop-shadow(0 8px 14px rgba(0,0,0,.6)); }
#start .load { margin-top: 30px; font-size: 24px; color: #a9d8f0; height: 30px; }

#titlecard { z-index: 55; flex-direction: column; background: rgba(2,14,30,.72); cursor: pointer; }
#titlecard .t1 { font-size: 78px; font-weight: 900; color: #ffe9a8; text-align: center; text-shadow: 0 6px 30px rgba(0,0,0,.7); animation: pop .5s ease; }
#titlecard .t2 { font-size: 40px; margin-top: 18px; color: #d4f0ff; }
#titlecard .hint { position: absolute; bottom: 40px; font-size: 24px; color: #a9d8f0; }

/* ---------- лист у пляшці ---------- */
#letter { z-index: 45; }
#letter .paper { width: 1060px; padding: 56px 80px 40px; position: relative; color: #4a2c10; animation: unroll .6s ease;
  background: radial-gradient(ellipse at 50% 40%, #fbf1d8, #f0dcae 70%, #dcbf85); border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6), inset 0 0 60px rgba(150,100,40,.35); }
#letter .paper::before, #letter .paper::after { content: ""; position: absolute; left: -14px; right: -14px; height: 34px; border-radius: 17px;
  background: linear-gradient(180deg, #e6c98f, #c99e5a 60%, #a97c3c); box-shadow: 0 4px 10px rgba(0,0,0,.35); }
#letter .paper::before { top: -16px; } #letter .paper::after { bottom: -16px; }
@keyframes unroll { from { transform: scaleY(.1); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
#letter .ltext { font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 33px; line-height: 1.45; }
#letter .ltext p { margin: 0 0 14px; }
#letter .lsign { font-family: Georgia, serif; font-style: italic; font-size: 33px; text-align: right; margin-top: 4px; }
#letter .lnext { display: block; margin: 22px auto 0; }

/* ---------- цікавий факт ---------- */
#fact { z-index: 45; }
#fact .fcard { width: 1080px; padding: 34px 50px 30px; border-radius: 30px; position: relative; animation: pop .35s ease;
  background: linear-gradient(180deg, rgba(10, 70, 100, .97), rgba(5, 40, 66, .97)); border: 4px solid #7fe0ff; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
#fact .flabel { position: absolute; top: -24px; left: 40px; background: #7fe0ff; color: #06283d; font-weight: 800; font-size: 26px; padding: 6px 22px; border-radius: 14px; }
#fact .ftitle { font-size: 44px; font-weight: 800; color: #ffe9a8; margin-bottom: 10px; }
#fact .ftext { font-size: 33px; line-height: 1.42; }
#fact .ftext b { color: #ffe9a8; }
#fact .fnext { display: block; margin: 22px 0 0 auto; }

/* ---------- сторінка оживає ---------- */
#pagegain { z-index: 46; flex-direction: column; background: rgba(2,14,30,.75); }
#pagegain .pg { position: relative; width: 560px; transition: filter 1.6s ease, transform .8s cubic-bezier(.5,0,.3,1);
  filter: grayscale(1) sepia(.35) brightness(1.08) contrast(.85); animation: pop .5s ease; }
#pagegain .pg.alive { filter: none; }
#pagegain .pg.fly { transition: transform .8s cubic-bezier(.5,0,.3,1), opacity .8s; }
#pagegain .pg { aspect-ratio: 1; }
#pagegain .pg img { width: 100%; height: 100%; display: block; }
.ribbon { position: absolute; display: flex; align-items: center; justify-content: center; text-align: center; overflow: hidden;
  font-family: Georgia, "Times New Roman", serif; font-weight: 700; color: #6b3d14; line-height: 1.02; padding: 0 2%; text-shadow: 0 1px 0 rgba(255,245,220,.7); }
.idx { position: absolute; left: 17%; right: 17%; top: 23%; bottom: 20%; display: flex; flex-direction: column; justify-content: space-between;
  font-family: Georgia, "Times New Roman", serif; font-style: italic; color: #5a3410; }
.idx div { display: flex; align-items: baseline; gap: .3em; }
.idx i { flex: 1; border-bottom: .09em dotted rgba(90,52,16,.6); }
.idx b { font-style: normal; }
#pagegain .sparkles { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .4s; }
#pagegain .pg.alive .sparkles { opacity: 1; }
.spark { position: absolute; width: 18px; height: 18px; background: radial-gradient(circle, #fff 0 20%, #ffe9a8 35%, rgba(255,233,168,0) 70%); animation: twinkle 1.4s ease-in-out infinite; }
@keyframes twinkle { 0%,100% { transform: scale(.2); opacity: 0; } 50% { transform: scale(1.4); opacity: 1; } }
#pagegain .pgcap { font-size: 40px; font-weight: 800; color: #ffe9a8; margin-top: 20px; text-shadow: 0 3px 14px rgba(0,0,0,.8); }
#pagegain .pgcap span { font-size: 30px; color: #d4f0ff; margin-left: 14px; }
#pagegain .pgnext { margin-top: 16px; }

/* ---------- перегляд атласу ---------- */
#atlasview { z-index: 58; }
#atlasview .panel { width: 1420px; padding: 26px 40px 34px; }
#atlasview h2 { margin: 0 0 18px; font-size: 42px; color: #ffe9a8; text-align: center; }
#atlasview .close { position: absolute; top: 18px; right: 22px; }
#atlasview .pages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.apage { position: relative; aspect-ratio: 1; border-radius: 12px; }
.apage img { width: 100%; height: 100%; display: block; }
.apage:not(.got) { border: 3px dashed rgba(255,255,255,.35); display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(255,255,255,.04); }
.apage .ph { font-size: 64px; font-weight: 800; color: rgba(255,255,255,.35); }
.apage .pn { font-size: 20px; color: rgba(255,255,255,.5); }
.apage.stolen { border-color: #ff8f8f; } .apage.stolen .ph, .apage.stolen .pn { color: #ff9f9f; }

/* ---------- завдання ---------- */
#task .panel { width: 1340px; height: 820px; padding: 28px 40px 24px; display: flex; flex-direction: column; }
#task .head { display: flex; align-items: center; gap: 18px; margin-bottom: 6px; }
#task .subject { padding: 6px 18px; border-radius: 14px; font-size: 22px; font-weight: 800; background: #5fd0ff; color: #06283d; white-space: nowrap; }
#task .subject.math { background: #ffcf4a; } #task .subject.mova { background: #ff8fb1; } #task .subject.yds { background: #7be0a2; }
#task .title { font-size: 34px; font-weight: 900; flex: 1; }
#task .partno { font-size: 22px; color: #a9d8f0; }
#task .prompt { font-size: 29px; line-height: 1.35; margin: 8px 0 12px; color: #eaf8ff; }
#task .body { flex: 1; position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
#task .foot { display: flex; align-items: center; gap: 18px; min-height: 76px; }
#task .fb { flex: 1; font-size: 30px; font-weight: 800; }
#task .fb.good { color: #7be0a2; } #task .fb.bad { color: #ff8f8f; }
#task .reveal { margin-right: auto; }

.opts { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; }
.opts.col { flex-direction: column; align-items: stretch; max-width: 1000px; margin: 0 auto; width: 100%; }
.opt {
  font-family: inherit; font-size: 30px; padding: 18px 28px; border-radius: 20px; border: 3px solid rgba(140,220,255,.5);
  background: rgba(255,255,255,.08); color: #fff; cursor: pointer; text-align: left; transition: background .15s, transform .15s;
}
.opt:hover { background: rgba(255,255,255,.16); }
.opt.sel { border-color: #ffcf4a; background: rgba(255,207,74,.18); }
.opt.ok { border-color: #7be0a2; background: rgba(123,224,162,.28); }
.opt.no { border-color: #ff8f8f; background: rgba(255,120,120,.25); }
.opt.pill { text-align: center; min-width: 170px; font-weight: 800; }
.shake { animation: shake .4s; }
@keyframes shake { 20%,60% { transform: translateX(-10px); } 40%,80% { transform: translateX(10px); } }

.nums { display: flex; flex-direction: column; gap: 22px; max-width: 1150px; margin: 0 auto; width: 100%; }
.nrow { display: flex; align-items: center; gap: 18px; font-size: 30px; background: rgba(255,255,255,.06); padding: 14px 22px; border-radius: 18px; }
.nrow .q { flex: 1; line-height: 1.3; }
.nrow input {
  width: 150px; font-size: 34px; font-family: inherit; font-weight: 800; text-align: center; padding: 8px; border-radius: 14px;
  border: 3px solid rgba(140,220,255,.6); background: #fff; color: #06283d;
}
.nrow input.ok { border-color: #2fbf71; background: #dff7e9; }
.nrow input.no { border-color: #e65656; background: #ffe3e3; }
.nrow .unit { min-width: 70px; color: #d4f0ff; }

.order { display: flex; gap: 14px; justify-content: center; flex-wrap: nowrap; align-items: stretch; }
.order.col { flex-direction: column; align-items: center; }
.card {
  background: rgba(255,255,255,.1); border: 3px solid rgba(140,220,255,.5); border-radius: 18px; padding: 14px 16px;
  font-size: 26px; font-weight: 800; cursor: grab; text-align: center; touch-action: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
}
.order.col .card { width: 640px; font-size: 30px; }
.card.drag { opacity: .55; border-style: dashed; }
.card.ok { border-color: #7be0a2; background: rgba(123,224,162,.25); }
.card.no { border-color: #ff8f8f; background: rgba(255,120,120,.22); }
.order.arrows { gap: 58px; }
.order.arrows .card { position: relative; }
.order.arrows .card:not(:last-child)::after { content: '→'; position: absolute; right: -48px; top: 50%; transform: translateY(-50%); font-size: 42px; color: #ffe9a8; pointer-events: none; }
.arrowhint { text-align: center; font-size: 24px; color: #a9d8f0; margin-top: 14px; }

.sort { display: flex; flex-direction: column; gap: 18px; height: 100%; }
.pool { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; min-height: 70px; padding: 10px; border-radius: 18px; background: rgba(255,255,255,.05); }
.zones { display: flex; gap: 18px; flex: 1; min-height: 0; }
.zone { flex: 1; border: 3px dashed rgba(140,220,255,.6); border-radius: 22px; padding: 12px; display: flex; flex-direction: column; gap: 10px; align-items: center; background: rgba(255,255,255,.04); cursor: pointer; }
.zone .zt { font-size: 28px; font-weight: 900; color: #ffe9a8; }
.zone .zc { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.zone.hover { background: rgba(255,207,74,.15); border-color: #ffcf4a; }
.chip {
  font-size: 26px; font-weight: 800; padding: 10px 18px; border-radius: 16px; background: #eaf8ff; color: #06283d; cursor: grab;
  border: 3px solid transparent; touch-action: none;
}
.chip.sel { border-color: #ffcf4a; box-shadow: 0 0 0 4px rgba(255,207,74,.4); }
.chip.ok { background: #c8f2d8; } .chip.no { background: #ffd0d0; }
.dragghost { position: fixed; pointer-events: none; z-index: 1000; transform-origin: 0 0; opacity: .9; }

.answer { min-height: 92px; border-bottom: 4px solid rgba(140,220,255,.6); display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: center; padding: 10px; margin-bottom: 26px; font-size: 30px; }
.answer.ok { border-color: #7be0a2; }

.fills { display: flex; flex-direction: column; gap: 16px; max-width: 1200px; margin: 0 auto; width: 100%; }
.frow { display: flex; align-items: center; gap: 16px; background: rgba(255,255,255,.06); border-radius: 18px; padding: 12px 20px; }
.frow .ft { flex: 1; font-size: 28px; line-height: 1.3; }
.frow .blank { display: inline-block; min-width: 120px; border-bottom: 3px solid #ffcf4a; text-align: center; color: #ffe9a8; font-weight: 800; }
.frow.done .blank { border-color: #7be0a2; color: #7be0a2; }
.frow .fo { display: flex; gap: 10px; }
.frow .opt { padding: 8px 18px; font-size: 26px; text-align: center; min-width: 64px; }
.frow.done .fo { visibility: hidden; }
.bars svg text { font-family: inherit; fill: #eaf8ff; }

/* ---------- меню ---------- */
#menu { z-index: 70; }
#menu .panel { width: 760px; padding: 30px 40px; display: flex; flex-direction: column; gap: 12px; }
#menu h2 { margin: 0 0 6px; font-size: 38px; color: #ffe9a8; }
#menu .lesson { font-size: 22px; color: #a9d8f0; margin-top: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
#menu .item { font-family: inherit; text-align: left; font-size: 27px; padding: 10px 20px; border-radius: 14px; border: 2px solid rgba(140,220,255,.35); background: rgba(255,255,255,.06); color: #fff; cursor: pointer; }
#menu .item:hover { background: rgba(255,255,255,.16); }
#menu .item.cur { border-color: #ffcf4a; }
#menu .row { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
#menu .close { position: absolute; top: 16px; right: 20px; }

/* ---------- ефекти ---------- */
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
#fx img { position: absolute; }
.drop { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff, #8fdcff 60%, rgba(143,220,255,.2)); animation: drop .85s ease-out forwards; }
@keyframes drop { from { transform: translate(0,0); opacity: 1; } to { transform: translate(var(--dx), calc(var(--dy) + 120px)); opacity: 0; } }
.shakeStage { animation: stageShake .6s; }
@keyframes stageShake { 10%,50%,90% { translate: -12px 6px; } 30%,70% { translate: 12px -6px; } 0%,100% { translate: 0 0; } }
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 25; }
.flash.go { animation: flash .7s; }
@keyframes flash { 15% { opacity: .85; } 100% { opacity: 0; } }
.dark { position: absolute; inset: 0; background: #000; opacity: 0; transition: opacity 1.2s; pointer-events: none; z-index: 24; }
.dark.on { opacity: 1; }

#endcard { z-index: 55; flex-direction: column; justify-content: flex-start; padding-top: 110px; background: linear-gradient(180deg, rgba(2,14,30,.78), rgba(2,14,30,.2) 60%); }
#endcard .t1 { font-size: 64px; font-weight: 900; color: #ffe9a8; text-align: center; max-width: 1300px; text-shadow: 0 6px 30px rgba(0,0,0,.7); }
#endcard .t1:empty, #endcard .t2:empty { display: none; }
#endcard .t2 { font-size: 34px; margin: 18px 0 36px; color: #d4f0ff; text-align: center; max-width: 1200px; text-shadow: 0 3px 14px rgba(0,0,0,.9); }

/* ---------- карта світу ---------- */
#map { z-index: 45; background: linear-gradient(180deg, #3b2412, #2a180a); cursor: pointer; }
#map .mapimg { position: absolute; left: 0; top: 100px; width: 1600px; height: 800px; }
#map svg { position: absolute; inset: 0; }
#map .mtitle { position: absolute; top: 14px; left: 0; right: 0; text-align: center; font-size: 46px; font-weight: 800; color: #ffe9a8; text-shadow: 0 4px 20px rgba(0,0,0,.7); }
#map .msub { position: absolute; bottom: 36px; left: 330px; right: 330px; text-align: center; font-size: 26px; color: #fff6dc; line-height: 1.3;
  background: rgba(60,30,10,.72); border-radius: 16px; padding: 8px 18px; }
#map .msub:empty { display: none; }
#map .msub.top { bottom: auto; top: 112px; }
#map .mnext { position: absolute; left: 40px; bottom: 34px; }
.mring { animation: mring 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes mring { 50% { transform: scale(1.3); opacity: .4; } }
#map .mtxt { paint-order: stroke; stroke: rgba(255,246,220,.95); stroke-width: 6px; stroke-linejoin: round; }

/* ---------- глибиномір ---------- */
#depth { position: absolute; top: 92px; right: 18px; z-index: 50; width: 196px; white-space: nowrap; padding: 10px 14px 12px; border-radius: 18px; display: none;
  background: rgba(5, 36, 62, .82); border: 2px solid rgba(140,220,255,.55); text-align: center; }
#depth.on { display: block; }
#depth .dl { font-size: 18px; color: #a9d8f0; }
#depth .dv { font-size: 34px; font-weight: 800; color: #ffe9a8; font-variant-numeric: tabular-nums; }
#depth .dbar { height: 10px; border-radius: 5px; background: rgba(255,255,255,.15); margin-top: 6px; overflow: hidden; }
#depth .dbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7fe0ff, #2a6fd8, #0b1e4a); }
#stage:has(.overlay.on:not(#atlasview):not(#pagegain)) #depth { visibility: hidden; }
#stage.deep .bg { filter: brightness(.5) saturate(.8); transition: filter 2s; }
.bg { transition: opacity .7s ease, filter 2s; }

/* ---------- площа крижини ---------- */
.areaw { display: flex; gap: 40px; align-items: center; justify-content: center; height: 100%; }
.aleft { width: 480px; flex: none; }
.areasvg { width: 100%; height: auto; display: block; }
.areasvg .alab { font: 800 34px Nunito, sans-serif; fill: #06283d; text-anchor: middle; }
.areasvg .alab.light { fill: #ffe9a8; }
.areasvg .ah { font: 800 44px Nunito, sans-serif; fill: #c0392b; text-anchor: middle; }
.areasvg .dash { stroke: #c0392b; stroke-width: 4; stroke-dasharray: 12 9; }
.areasvg .ghost { fill: rgba(127,200,255,.28); stroke: #c0392b; stroke-width: 2; stroke-dasharray: 8 7; }
.areasvg .hintg { opacity: 0; transition: opacity .5s; }
.aleft.showhint .hintg { opacity: 1; }
.aright { flex: 1; max-width: 640px; display: flex; flex-direction: column; gap: 22px; align-items: flex-start; }
.aright .aq { font-size: 31px; line-height: 1.38; }
.aright .aq b { color: #ffe9a8; }
.aright .nrow { width: 100%; }
.ahint { font-size: 26px; line-height: 1.35; color: #ffe9a8; background: rgba(255,207,74,.12); border-radius: 16px; padding: 12px 18px; display: none; }
.ahint.on { display: block; }

/* ---------- вибір відмінка ---------- */
.picks { display: flex; flex-direction: column; gap: 12px; max-width: 1180px; margin: 0 auto; width: 100%; }
.prow { display: flex; align-items: center; gap: 18px; background: rgba(255,255,255,.06); border-radius: 16px; padding: 9px 18px; }
.prow .pt { flex: 1; font-size: 28px; }
.prow .pt b { color: #ffe9a8; text-decoration: underline; text-underline-offset: 5px; }
.prow select { font-family: inherit; font-size: 26px; font-weight: 800; padding: 6px 12px; border-radius: 12px; width: 450px;
  border: 3px solid rgba(140,220,255,.6); background: #fff; color: #06283d; cursor: pointer; }
.prow select.ok { border-color: #2fbf71; background: #dff7e9; opacity: 1; }
.prow select.no { border-color: #e65656; background: #ffe3e3; }

/* ---------- карта: підписати океани ---------- */
.mapdrop { display: flex; flex-direction: column; gap: 12px; align-items: center; height: 100%; justify-content: center; }
.mapdrop .pool { min-height: 64px; }
.mapdrop .chip { cursor: pointer; }
.mdmap { position: relative; width: 1060px; aspect-ratio: 2 / 1; border-radius: 12px; overflow: hidden; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.mdmap img { width: 100%; height: 100%; display: block; }
.mdzone { position: absolute; min-width: 190px; padding: 0 12px; white-space: nowrap; height: 44px; transform: translate(-50%, -50%); border: 3px dashed #c0392b; border-radius: 12px;
  background: rgba(255,246,220,.75); cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #5a2d0c; }
.mdzone:hover { background: rgba(255,233,168,.95); }
.mdzone.ok { border-style: solid; border-color: #2fbf71; background: rgba(223,247,233,.95); }
.mdzone.no { border-color: #e65656; background: rgba(255,210,210,.95); }

/* ---------- грамота ---------- */
#endcard .cert { width: 900px; padding: 34px 60px 30px; border-radius: 24px; text-align: center; color: #4a2c10; margin-bottom: 26px;
  background: radial-gradient(ellipse at 50% 40%, #fbf1d8, #f0dcae 70%, #dcbf85); border: 6px double #b8894a; box-shadow: 0 20px 60px rgba(0,0,0,.6); animation: pop .5s ease; }
#endcard .cert .c1 { font-family: Georgia, serif; font-size: 30px; letter-spacing: 6px; color: #8a5a22; }
#endcard .cert .c2 { font-size: 56px; font-weight: 900; color: #7a3d0c; margin: 6px 0 10px; }
#endcard .cert .c3 { font-size: 27px; line-height: 1.4; }
#endcard .cert .c4 { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 16px; font-family: Georgia, serif; font-style: italic; font-size: 24px; }
#endcard .cert img { height: 90px; }

/* ---------- узгодження зі спільним рушієм (engine/engine.css) ---------- */
/* в Атласі плавання й віддзеркалення застосовуються до всього героя, а не до картинки */
.char.float:not(.glow):not(.jump) img { animation: none; }
.char.flip img { transform: none; }
.char.flip.float:not(.glow) img { animation: none; }
#start h1 small { display: block; font-size: 56px; margin-top: 6px; color: #fff; }
#task .subject.inf { background: #c3a6ff; }
.lockbox, .ldiv { color: #fff; }
/* покажчик атласу в завданні «Покажчик атласу» */
.idxq { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(5, auto); grid-auto-flow: column; column-gap: 70px; row-gap: 2px; width: 760px; margin: 0 auto 14px; padding: 14px 34px; background: #f6e7c4; color: #3a2510; border-radius: 16px; font-size: 26px; font-weight: 700; }
.idxq div { display: flex; align-items: baseline; gap: .3em; }
.idxq i { flex: 1; border-bottom: .09em dotted rgba(90,52,16,.6); }
.idxq b { font-style: normal; color: #9a4a12; }
