/* LapKa 2 — главы пути, пейзажи, истории, Мугивара, видеотека */

#main { min-width: 0; }
#app { grid-template-columns: 248px minmax(0, 1fr); }
@media (max-width: 820px) { #app { grid-template-columns: minmax(0, 1fr); } }

/* ---------- летящие лепестки на фоне ---------- */
.petals { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.petals i { position: absolute; top: -30px; width: 13px; height: 13px; border-radius: 70% 0 70% 0; background: var(--pri); opacity: .5; animation: petal linear infinite; }
@keyframes petal { to { transform: translate(var(--px), 108vh) rotate(var(--pr)); } }

/* ---------- шапка раздела с пейзажем ---------- */
.sec-hero { position: relative; margin-top: 6px; border: 2.5px solid var(--edge); border-radius: 26px; box-shadow: 0 6px 0 var(--edge); overflow: hidden; background: var(--card); }
.sec-hero .scene { display: block; width: 100%; height: 150px; }
.sec-hero-in { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; padding: 14px 18px 16px; border-top: 2.5px solid var(--edge); background: var(--card); }
.sec-hero-in > div:first-child { flex: 1; min-width: 0; }
.sec-hero-in h2 .jp { color: var(--pri); font-size: .8em; margin-left: 4px; }
.sec-hero-in p { color: var(--muted); font-weight: 600; font-size: 14.5px; margin: 2px 0 10px; }
.sec-hero-in .bar { max-width: 380px; }
.sec-hero-in small { display: block; margin-top: 5px; color: var(--muted); font-weight: 700; font-size: 12.5px; }

/* ---------- главы на пути ---------- */
.unit-h { display: flex; align-items: center; gap: 10px; align-self: stretch; margin: 26px 0 14px; padding: 10px 16px; border-radius: 18px; border: 2.5px solid var(--edge); background: var(--card); box-shadow: 0 4px 0 var(--edge); font-size: 17px; }
.unit-h:first-child { margin-top: 0; }
.unit-h b { flex: 1; font-weight: 800; }
.unit-h small { font-weight: 800; color: var(--muted); }
.unit-n { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: var(--pri); color: var(--pri-ink); border: 2.5px solid var(--edge); font-weight: 900; flex: none; }
.unit-h.done { background: var(--ok-bg); }
.unit-h.done .unit-n { background: var(--ok); color: #123524; }
.path { padding-top: 26px; }
.node-decor { position: absolute; top: 6px; opacity: .9; pointer-events: none; }
.node-decor.l { left: -150px; } .node-decor.r { right: -150px; }
.hello-cat { border: 0; background: none; padding: 0; cursor: pointer; flex: none; }
.hello-cat.pet .mascot { animation: petpop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes petpop { 40% { transform: scale(1.14) rotate(-6deg); } }

/* ---------- Мугивара ---------- */
#mugi-fab { position: fixed; right: 20px; bottom: 20px; z-index: 28; display: flex; align-items: center; gap: 8px; padding: 6px 16px 6px 8px; border-radius: 999px; border: 2.5px solid var(--edge); background: var(--card); color: var(--ink); box-shadow: 0 5px 0 var(--edge); font-weight: 800; transition: transform .1s, box-shadow .1s; }
#mugi-fab:hover { transform: translateY(-2px); box-shadow: 0 7px 0 var(--edge); }
#mugi-fab:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--edge); }
#overlay.on ~ #mugi-fab { display: none; }
.mugi-top { padding: 0; overflow: hidden; }
.modal-box.mg-box { width: min(560px, 100%); padding: 0; overflow: hidden; display: flex; }
.mg { display: flex; flex-direction: column; width: 100%; height: min(680px, calc(100vh - 36px)); }
.mg-head { display: flex; align-items: center; gap: 12px; padding: 14px 58px 12px 16px; border-bottom: 2.5px solid var(--edge); background: linear-gradient(120deg, var(--card) 50%, var(--pri-2)); }
.mg-head b { display: block; font-size: 19px; font-weight: 900; } .mg-head small { color: var(--muted); font-weight: 700; }
.mg-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--soft); }
.mg-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.mg-msg.u { align-self: flex-end; }
.mg-bub { padding: 10px 14px; border-radius: 18px; border: 2.5px solid var(--edge); background: var(--card); font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.mg-msg.u .mg-bub { background: var(--pri); color: var(--pri-ink); border-bottom-right-radius: 6px; }
.mg-msg.a .mg-bub { border-bottom-left-radius: 6px; }
.mg-bub p { margin: 0 0 6px; } .mg-bub p:last-child { margin: 0; } .mg-bub ul { margin: 4px 0; padding-left: 18px; } .mg-bub hr { border: 0; border-top: 2px dashed var(--line); margin: 8px 0; }
.mg-bub .jp { font-size: 1.15em; }
.mg-ava { flex: none; }
.mg-dots { display: inline-flex; gap: 5px; padding: 4px 2px; } .mg-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: dot 1s infinite; } .mg-dots i:nth-child(2) { animation-delay: .15s; } .mg-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 40% { transform: translateY(-6px); opacity: .5; } }
.mg-chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px; border-top: 2px dashed var(--line); scrollbar-width: none; flex: none; } .mg-chips::-webkit-scrollbar { display: none; }
.mg-chips .chip { flex: none; padding: 6px 12px; font-size: 13.5px; }
.mg-form { display: flex; gap: 8px; padding: 10px 14px 14px; flex: none; }
.mg-form input { flex: 1; min-width: 0; padding: 12px 14px; border: 2.5px solid var(--edge); border-radius: 16px; background: var(--card); font-weight: 600; font-size: 16px; outline: 0; }
.mg-form input:focus { box-shadow: 0 0 0 4px var(--pri-2); }
.fb-ask { padding: 4px 0 0; font-size: 13.5px; color: inherit; opacity: .8; }

/* ---------- истории ---------- */
.lesson.story .l-body { justify-content: flex-start; gap: 14px; }
.st-glyph { font-size: 28px; }
.st-intro b { font-size: 20px; font-weight: 900; } .st-intro p { color: var(--muted); font-weight: 600; margin-top: 4px; }
.st-lines { display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; }
.st-line { display: flex; gap: 10px; align-items: flex-end; max-width: 94%; animation: popin .3s; }
.st-line.me { align-self: flex-end; flex-direction: row-reverse; }
.st-ava { display: grid; place-items: center; border-radius: 50%; border: 2.5px solid var(--edge); font-weight: 900; color: #3b2a3f; flex: none; }
.st-bub { background: var(--card); border: 2.5px solid var(--edge); border-radius: 20px 20px 20px 6px; padding: 10px 14px; box-shadow: 0 4px 0 var(--edge); min-width: 0; }
.st-line.me .st-bub { background: var(--pri-2); border-radius: 20px 20px 6px 20px; }
.st-name { font-size: 12px; font-weight: 800; color: var(--muted); }
.st-jp { font-size: 23px; line-height: 1.55; cursor: pointer; }
.st-ru { display: block; margin-top: 6px; padding: 5px 10px; border: 2px dashed var(--line); border-radius: 12px; background: var(--soft); font-weight: 700; font-size: 14.5px; color: var(--ink); text-align: left; transition: filter .15s; }
.st-ru.hid { filter: blur(5px); user-select: none; }
.st-ru.hid::after { content: ""; }
.st-words { display: flex; flex-direction: column; gap: 8px; }
.st-word { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--soft); font-weight: 700; color: var(--ink); text-align: left; }
.st-word .jp { font-size: 20px; min-width: 96px; } .st-word span:nth-child(2) { flex: 1; } .st-word .ic { color: var(--muted); }

/* ---------- аниме-зал: поиск, жанры, видеотека ---------- */
.an-tools { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.an-search { flex: 1; min-width: 220px; padding: 12px 16px; border: 2.5px solid var(--edge); border-radius: 16px; background: var(--card); box-shadow: 0 4px 0 var(--edge); font-weight: 700; font-size: 16px; outline: 0; }
.an-search:focus { box-shadow: 0 4px 0 var(--edge), 0 0 0 4px var(--pri-2); }
.an-genres { flex-wrap: nowrap; overflow-x: auto; padding: 2px 2px 8px; margin: 0 -2px 10px; scrollbar-width: none; } .an-genres::-webkit-scrollbar { display: none; } .an-genres .tab { flex: none; }
.an-card .an-glyph { font-size: 62px; }
.an-parts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.an-parts span { display: flex; flex-direction: column; padding: 6px 12px; border-radius: 14px; background: rgba(255, 255, 255, .92); color: #3b2a3f; border: 2px solid #3b2a3f; }
.an-parts b { font-size: 20px; line-height: 1.2; } .an-parts small { font-size: 11.5px; font-weight: 700; opacity: .75; max-width: 170px; line-height: 1.25; }
.an-parts i { font-style: normal; font-weight: 900; opacity: .8; }
.sub-h { margin: 22px 0 12px; }
.vid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 18px; }
.vid { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 0 0 10px; border-radius: 20px; border: 2.5px solid var(--edge); background: var(--card); box-shadow: 0 5px 0 var(--edge); overflow: hidden; color: var(--ink); transition: transform .12s; }
.vid:hover { transform: translateY(-3px); }
.vid-th { position: relative; display: block; aspect-ratio: 16 / 9; background-color: var(--pri-2); background-size: cover; background-position: center; border-bottom: 2.5px solid var(--edge); }
.vid-th i { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: #3b2a3f; display: grid; place-items: center; font-style: normal; font-size: 20px; border: 2.5px solid #3b2a3f; padding-left: 3px; }
.vid b { padding: 6px 12px 0; font-size: 15px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vid small { padding: 0 12px; color: var(--muted); font-weight: 700; font-size: 12.5px; }
.install { margin: 4px 0 14px; font-size: 14.5px; }
.lock-msg { min-height: 20px; }

/* ---------- телефон ---------- */
@media (max-width: 1100px) { .node-decor { display: none; } }
@media (max-width: 1100px) { .home > .hello { order: 1; } .home > .track { order: 2; } .home > .home-side { order: 3; } }
@media (max-width: 820px) {
  #mugi-fab { right: 12px; bottom: calc(78px + env(safe-area-inset-bottom)); padding: 5px; }
  #mugi-fab span { display: none; }
  .sec-hero .scene { height: 120px; }
  .sec-hero-in { flex-direction: column; align-items: stretch; }
  .unit-h { font-size: 15.5px; }
  .modal-box.mg-box { width: 100%; }
  #modal:has(.mg-box) { padding: 0; place-items: stretch; }
  #modal .mg-box { max-height: none; height: 100dvh; border-radius: 0; border: 0; box-shadow: none; }
  .mg { height: 100%; }
  .st-jp { font-size: 20px; }
  .vid-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .an-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .an-card { min-height: 170px; padding: 12px; } .an-card .an-glyph { font-size: 50px; } .an-card b { font-size: 15.5px; }
  .g-grid { grid-template-columns: 1fr; }
  #tabbar a { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) { .petals { display: none; } }

.ob .chips.pickable { max-height: 46vh; overflow-y: auto; padding: 6px 4px 10px; align-content: flex-start; }

/* ---------- отрывки из трейлеров ---------- */
.iconbtn.clip { background: var(--acc); color: #3b2a3f; }
.clip-btn { align-self: center; }
.tw { margin-bottom: 6px; }
.tw-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tw-w { display: inline-flex; align-items: baseline; gap: 8px; padding: 7px 12px; border-radius: 14px; border: 2.5px solid var(--edge); background: var(--soft); box-shadow: 0 3px 0 var(--edge); color: var(--ink); font-weight: 700; }
.tw-w:active { transform: translateY(3px); box-shadow: none; }
.tw-w .jp { font-size: 19px; } .tw-w small { font-size: 13px; color: var(--muted); } .tw-w i { font-style: normal; font-size: 11px; font-weight: 800; color: var(--pri-ink); background: var(--pri-2); border-radius: 8px; padding: 1px 6px; }
.kino .player { max-width: 520px; }
.kino .opt { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; }
.kino .opt .jp { font-size: 24px; } .kino .opt small { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.kino .opt.ok small, .kino .opt.no small { color: inherit; }
.scene-play.clip .row { margin-top: 4px; }
.l-fb .row { gap: 6px 12px; margin-top: 4px; }

.mg-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mg-acts .btn { white-space: normal; text-align: left; }
.mg-msg.a { max-width: 96%; }
