/* ============================================================================
   ГЛАВНАЯ — «Мой живой мир»: тетрадка в клеточку.

   Вместо фото-стола с карандашами — настоящий лист тетради в клеточку:
   тёплая бумага, голубая сетка клеток и красная линия поля слева.
   Всё лежит прямо на этой бумаге — миры, кнопка «Создать мир», инструкция
   и подсказка про приложения. Заголовок — «написанный ребёнком».

   Подключается ПОСЛЕ assets/theme.css. Только вид, никакой логики.
   ========================================================================== */

:root {
  --sheet: #fbf9ef;                 /* тёплая тетрадная бумага */
  --grid: rgba(96, 150, 208, 0.20); /* голубая клетка */
  --grid-alt: rgba(96, 150, 208, 0.16);
  --margin-line: rgba(228, 82, 92, 0.30); /* красная линия поля */
  --crayon: #2a4d7a;               /* «чернила» для детского заголовка */
}

* { box-sizing: border-box; }

html, body { margin: 0; }

/* ── Фон: страница тетради ───────────────────────────────────────────────── */
body:has(.wrap .sheet) {
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font, "Segoe UI", system-ui, sans-serif);
  background: #eef0e8;   /* чуть темнее бумаги, чтобы лист «читался» */
}

/* ── Контейнер: лист почти во весь экран ─────────────────────────────────── */
.wrap {
  position: relative;
  max-width: none;
  margin: 0 auto;
  padding: clamp(16px, 3vw, 36px) clamp(14px, 3vw, 32px);
}

/* ── Тетрадный лист — «рабочее меню» ─────────────────────────────────────── */
.sheet {
  position: relative;
  background:
    /* красная линия поля слева — как в настоящей тетради */
    linear-gradient(to right, transparent 0, transparent 40px, var(--margin-line) 40px 41px, transparent 41px),
    /* горизонтальные клетки */
    repeating-linear-gradient(0deg, transparent 0 26px, var(--grid-alt) 26px 27px),
    /* вертикальные клетки */
    repeating-linear-gradient(90deg, transparent 0 26px, var(--grid) 26px 27px),
    var(--sheet);
  border: 1px solid rgba(120, 90, 50, 0.12);
  border-radius: 10px;
  padding: clamp(22px, 4vw, 46px) clamp(22px, 4vw, 48px) clamp(26px, 4vw, 48px);
  box-shadow:
    0 22px 50px rgba(60, 50, 30, 0.18),
    0 4px 12px rgba(60, 50, 30, 0.10),
    inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

/* ── Шапка листа: детский заголовок ──────────────────────────────────────── */
.sheet-head {
  position: relative;
  margin: 0 0 24px;
}

/* «Мой мир» — будто ребёнок написал фломастером */
.title {
  margin: 0 0 10px;
  font-family: "Comic Sans MS", "Segoe Print", "Bradley Hand", "Marker Felt",
    "Comic Neue", cursive, var(--font);
  font-size: clamp(46px, 8vw, 84px);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -2px;
  color: var(--crayon);
  transform: rotate(-2.5deg);
  transform-origin: left bottom;
  text-shadow:
    2px 2px 0 rgba(255, 122, 89, 0.35),
    4px 4px 0 rgba(255, 194, 75, 0.25);
}
/* лёгкая «разноцветность» букв — как нарисовано разными фломастерами */
.title::first-letter {
  color: #ff7a59;
}

.lead {
  margin: 0 0 8px;
  max-width: 720px;
  font-size: clamp(16px, 2.3vw, 19px);
  line-height: 1.55;
  color: var(--lead, #3c5a72);
}
.lead b { color: #ff7a59; }

/* ── Образовательный блок в шапке: что даёт мир ──────────────────────────── */
.hero-facts {
  margin: 14px 0 6px;
  max-width: 720px;
}
.hero-facts-note {
  display: block;
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
}
.fact-chips {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.fact-chips li {
  font-size: 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(18, 110, 130, 0.16);
  border-radius: 999px;
  padding: 6px 13px;
  box-shadow: 0 3px 8px rgba(60, 40, 20, 0.05);
}

/* ── Живой рыбак в шапке: плавает и пускает пузырьки ─────────────────────── */
.hero-fish {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 88px;
  height: 88px;
  pointer-events: none;
  z-index: 2;
}
.fishswim { position: absolute; inset: 0; width: 100%; height: 100%; }
.fishball { transform-origin: 50% 50%; animation: fishSwim 5.5s ease-in-out infinite; }
.fishball ellipse { transform-origin: 30px 32px; animation: fishTail 0.9s ease-in-out infinite; }
@keyframes fishSwim {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(-6px, -7px) rotate(-7deg); }
  50%  { transform: translate(-2px, -3px) rotate(3deg); }
  75%  { transform: translate(4px, -6px) rotate(6deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
@keyframes fishTail { 0%,100% { transform: scaleX(1); } 50% { transform: scaleX(1.12); } }
.bubbles i {
  position: absolute;
  bottom: 0;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, rgba(18, 181, 165, 0.35));
  animation: bubbleUp 3.2s ease-in infinite;
  opacity: 0;
}
.bubbles i:nth-child(1) { left: 26px; animation-delay: 0s; }
.bubbles i:nth-child(2) { left: 40px; width: 6px; height: 6px; animation-delay: 1.1s; }
.bubbles i:nth-child(3) { left: 52px; width: 5px; height: 5px; animation-delay: 2.2s; }
@keyframes bubbleUp {
  0%   { transform: translateY(0) scale(0.5); opacity: 0; }
  20%  { opacity: .8; }
  100% { transform: translateY(-70px) scale(1.1); opacity: 0; }
}

/* переключатель языка в шапке листа */
.sheet-head .langrow { display: flex; justify-content: flex-end; margin: 6px 0 0; }
.langpick { display: inline-flex; gap: 4px; }
.langpick button {
  appearance: none; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700;
  padding: 4px 11px; border-radius: 10px; border: 1px solid transparent;
  background: transparent; color: var(--dim); transition: color .15s, background .15s;
}
.langpick button:hover { color: var(--ink); }
.langpick button[aria-pressed="true"] {
  color: #fff; border-color: var(--accent); background: var(--accent);
}

/* ── Блок «Какие миры есть» (в шапке, после выбора языка) ──────────────── */
.worlds {
  margin-top: 22px;
  padding: 16px 18px 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(18, 110, 130, 0.16);
  border-radius: 16px;
  box-shadow: 0 4px 14px rgba(60, 40, 20, 0.05);
}
.worlds-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
  color: var(--ink);
}
.worlds-sub {
  margin: 0 0 14px;
  font-size: 13.5px;
  color: var(--muted);
}
.worlds-list {
  list-style: none;
  margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.worlds-list .wr {
  position: relative;
  display: flex; flex-direction: column; gap: 2px;
  padding: 11px 13px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(18, 110, 130, 0.14);
}
.worlds-list .wr-ico {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 2px;
}
.worlds-list .wr-name {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--ink);
}
.worlds-list .wr-sub {
  font-size: 12px;
  color: var(--muted);
}
.worlds-list .wr-tag {
  margin-top: 7px;
  align-self: flex-start;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
}
.worlds-list .wr.ready { border-color: rgba(18, 110, 130, 0.18); }
.worlds-list .wr.ready .wr-tag { color: #0a6a5c; background: rgba(20, 160, 120, 0.12); }
.worlds-list .wr.soon { border-style: dashed; border-color: rgba(18, 110, 130, 0.24); }
.worlds-list .wr.soon .wr-tag { color: var(--accent); background: rgba(88, 214, 255, 0.12); }
.worlds-list .wr.soon .wr-ico { filter: grayscale(0.35); opacity: 0.9; }

/* ── Секция «Твои миры» ──────────────────────────────────────────────────── */
.section-label {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 14px;
  font-size: 16px; font-weight: 800; color: var(--ink);
  letter-spacing: 0.2px;
}
.section-label .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.15);
}

/* ── Карточки миров — «аквариумные окошки» на тетрадном листе ────────────── */
.tanks {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 26px;
}
.tank {
  position: relative;
  display: flex; flex-direction: column;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(18, 110, 130, 0.16);
  border-radius: 20px;
  padding: 14px;
  box-shadow:
    0 10px 24px rgba(60, 40, 20, 0.10),
    0 2px 6px rgba(60, 40, 20, 0.06);
  transition: transform .2s cubic-bezier(.2,.7,.2,1), box-shadow .2s, border-color .2s;
}
.tank:hover {
  transform: translateY(-5px) rotate(-0.8deg);
  box-shadow:
    0 20px 40px rgba(60, 40, 20, 0.16),
    0 4px 10px rgba(60, 40, 20, 0.08);
  border-color: rgba(255, 122, 89, 0.6);
}
.tank[hidden] { display: none; }
/* «стекло аквариума»: картинка в белом паспарту и рамке */
.tank .shot {
  position: relative;
  aspect-ratio: 16 / 10;
  background: #dff0ee;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: inset 0 0 0 1px rgba(18, 110, 130, 0.12);
}
.tank .shot img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.tank .shot img.drawing, .tank .shot img.photo, .tank .shot img.model { object-fit: contain; background: #fff; padding: 8px; }
/* Живая 3D-модель: канвас занимает всё окно карточки, фигура в профиль */
.tank .shot canvas.model3d { display: block; width: 100%; height: 100%; }
.tank:hover .shot img { transform: scale(1.08); }
.tank .shot .veil {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(20, 60, 90, 0.20) 100%);
}
.tank .shot .none {
  position: absolute; inset: 0; display: grid; place-content: center; gap: 6px;
  color: #7396ab; font-size: 13px; text-align: center;
}
.tank .shot .none .big { font-size: 34px; line-height: 1; }
.tank .shot .fade { opacity: 0; transition: opacity .35s; }
.tank .shot .fade.on { opacity: 1; }
.tank .body { padding: 13px 4px 4px; display: flex; flex-direction: column; gap: 5px; }
.tank h2 {
  margin: 0;
  font-size: 18px; font-weight: 800;
  color: var(--crayon);
  font-family: "Comic Sans MS", "Segoe Print", "Bradley Hand", cursive, var(--font);
}
.tank .meta {
  color: var(--muted); font-size: 12.5px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}
.tank .meta code {
  color: var(--dim);
  font-family: ui-monospace, Consolas, monospace; font-size: 11px; letter-spacing: .5px;
  background: rgba(18, 110, 130, 0.06);
  border-radius: 6px; padding: 1px 6px;
}
.tank .kill {
  position: absolute; top: 20px; right: 20px; z-index: 1;
  width: 30px; height: 30px; border-radius: 50%; padding: 0;
  border: 1px solid rgba(18, 110, 130, 0.22);
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer;
  display: grid; place-content: center; opacity: .55;
  transition: opacity .15s, background .15s, color .15s;
}
.tank:hover .kill, .tank .kill:focus-visible { opacity: 1; }
.tank .kill:hover { background: #ffe4e8; color: var(--danger); border-color: rgba(255, 90, 110, .5); }

/* ── Кнопка «Создать мир» ────────────────────────────────────────────────── */
.newtank {
  border: 2.5px dashed rgba(255, 122, 89, 0.55);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.45);
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--accent-deep); cursor: pointer;
  font: inherit; font-size: 15.5px; font-weight: 800;
  padding: 26px 20px; min-height: 140px;
  box-shadow: 0 8px 22px rgba(60, 40, 20, 0.07);
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
}
.newtank:hover {
  border-color: var(--accent);
  background: rgba(255, 122, 89, 0.06);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(255, 122, 89, 0.20);
}
.newtank .plus { font-size: 28px; line-height: 1; }
.empty { color: var(--muted); padding: 6px 0 18px; }

/* ── Инструкция-разворот ─────────────────────────────────────────────────── */
.how {
  position: relative;
  margin: 24px 0 0;
  border: 1.5px dashed rgba(18, 110, 130, 0.3);
  border-radius: 16px;
  background: rgba(18, 181, 165, 0.04);
}
.how summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; font-size: 15px; font-weight: 800; color: var(--ink);
}
.how summary::-webkit-details-marker { display: none; }
.how .chev { font-size: 12px; color: var(--accent); transition: transform .15s; }
.how[open] .chev { transform: rotate(90deg); }
.how .howbody { padding: 4px 18px 20px; }
.hsteps {
  list-style: none; counter-reset: step; margin: 0 0 16px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.hsteps li {
  counter-increment: step; position: relative;
  display: flex; flex-direction: column; gap: 8px;
  background: rgba(255, 255, 255, 0.55); border: 1px solid rgba(18, 110, 130, 0.14); border-radius: 14px;
  padding: 13px 14px 14px; font-size: 13.5px; color: var(--ink);
  box-shadow: 0 5px 14px rgba(60, 40, 20, 0.05);
}
.hsteps li::before {
  content: counter(step);
  position: absolute; top: 10px; right: 12px;
  font-size: 12px; font-weight: 800; color: var(--accent);
  font-family: "Comic Sans MS", "Segoe Print", cursive, var(--font);
}
.hsteps .ico { font-size: 22px; line-height: 1; }
.how .demo { max-width: 320px; }

/* ── Секция про приложения — «где запускать мир» ─────────────────────────── */
.apps {
  position: relative;
  margin: 24px 0 0;
  padding: 22px 24px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(18, 110, 130, 0.16);
  border-radius: 20px;
  box-shadow: 0 8px 22px rgba(60, 40, 20, 0.07);
}
.apps h3 {
  margin: 0 0 8px;
  font-size: 20px; font-weight: 800;
  color: var(--crayon);
  font-family: "Comic Sans MS", "Segoe Print", "Bradley Hand", cursive, var(--font);
}
.apps p { margin: 0 0 18px; color: var(--muted); font-size: 14.5px; }
.approw {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.appcard {
  display: flex; align-items: center; gap: 13px;
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  padding: 14px 15px; text-decoration: none; color: var(--ink);
  box-shadow: 0 6px 16px rgba(60, 40, 20, 0.08);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.appcard:hover { transform: translateY(-3px); border-color: rgba(255, 122, 89, 0.55); box-shadow: 0 12px 26px rgba(60, 40, 20, 0.12); }
.appcard .ico {
  flex: none; width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center; font-size: 24px;
  background: rgba(18, 181, 165, 0.14);
  border: 1px solid rgba(18, 181, 165, 0.16);
}
.appcard b { display: block; font-size: 14.5px; font-weight: 800; color: var(--crayon); }
.appcard i { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); }

/* ── Ввод кода — «открыть мир по коду» ───────────────────────────────────── */
.bycode {
  position: relative;
  margin-top: 24px;
  padding: 22px 24px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(18, 110, 130, 0.16);
  border-radius: 20px;
  box-shadow: 0 8px 22px rgba(60, 40, 20, 0.07);
}
.bycode .blk { min-width: 0; }
.bycode h3 {
  margin: 0 0 6px;
  font-size: 20px; font-weight: 800;
  color: var(--crayon);
  font-family: "Comic Sans MS", "Segoe Print", "Bradley Hand", cursive, var(--font);
}
.bycode p { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.bycode form { display: flex; gap: 10px; flex-wrap: wrap; }
.bycode input {
  flex: 1; min-width: 170px; font: inherit; font-size: 14px;
  letter-spacing: 2px; font-family: ui-monospace, Consolas, monospace;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  border: 1px solid rgba(18, 110, 130, 0.24);
  border-radius: 12px; padding: 12px 14px;
}
.bycode input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.18); }
.bycode .btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 14px; font-weight: 800;
  border: 0; border-radius: 12px; padding: 12px 22px;
  background: var(--accent); color: #fff; transition: background .15s, transform .1s;
  box-shadow: 0 4px 12px rgba(255, 122, 89, 0.3);
}
.bycode .btn:hover { background: var(--accent-deep); transform: translateY(-1px); }

/* ── Футер (внутри листа) ────────────────────────────────────────────────── */
footer {
  position: relative;
  margin-top: 26px; padding-top: 16px;
  border-top: 1px solid rgba(18, 110, 130, 0.16);
  color: var(--muted);
  font-size: 13px;
}
footer a { color: var(--muted); text-decoration: underline; }
footer a:hover { color: var(--accent-deep); }
.foot-note b { color: var(--ink); }

/* ── Адаптив ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .wrap { padding: 18px 14px 40px; }
  .sheet { padding: 20px 16px 26px; }
  .title { letter-spacing: -1px; }
  .bycode { flex-direction: column; align-items: stretch; }
  .appcard { padding: 12px 13px; }
  /* Рыбку на узком экране — маленькой в угол, а заголовку даём отступ,
     чтобы буквы не заходили под неё. На совсем узком прячем её совсем. */
  .hero-fish { width: 48px; height: 48px; top: -4px; right: 0; }
  .title { padding-right: 44px; }
  .sheet-head { padding-left: 0; }
}
@media (max-width: 420px) {
  .hero-fish { display: none; }
}