/* nav — 2026-12-01 (owner, research «Іконки та навігація кубиком»): Phosphor stickers, Back in the working area,
   paging by blocks (side dots + Up / Down), the cube hint with face pictograms, focus as a flat world-colour plate. */

/* ------------------------------------------------------------------ icons: a silhouette on a flat sticker */
.pico { display: inline-grid; place-items: center; width: 1.25em; height: 1.25em; border-radius: 28%; flex: 0 0 auto; line-height: 0; vertical-align: -.28em;
  background: color-mix(in srgb, currentColor 14%, transparent); }
.pico svg { width: 66%; height: 66%; display: block; fill: currentColor; }
.pico.tint { background: var(--pc); color: var(--pi); }
.rail .rworld .wart { top: 0; bottom: 0; height: auto; display: grid; place-items: center; }
.rail .rworld .wart .pico { font-size: min(36px, 2.6em); }
.rail .rworld .wart .pico svg { width: 66%; height: 66%; }
.rail .rworld.on .wart .pico { background: var(--world-ink); color: var(--world); }
.chip .pico { font-size: 20px; }
.dock-cal .pico { font-size: 18px; margin-right: 6px; }

/* ------------------------------------------------------------------ Back (owner 2026-12-01): fixed top-left of the working
   area, the same place on every page, a milk plate with graphite ink so it never melts into a photo */
.pageback { position: fixed; z-index: 25; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px 0 8px;
  border-radius: 12px; background: #F8F6F0; color: #23262E; box-shadow: 0 0 0 2px #23262E, 0 0 0 4px #F8F6F0;   /* a double ring: seen on dark, light and photos */ font: 700 14px/1 Rubik, system-ui, sans-serif;
  letter-spacing: 0; text-transform: none; white-space: nowrap; transition: background .15s; }
.pageback:hover, .pageback:focus-visible { background: #fff; }
.pageback:focus-visible { outline: 3px solid var(--world, #EFC54B); outline-offset: 2px; }
.pageback .pico { font-size: 22px; background: none; color: inherit; }
.pageback[hidden] { display: none; }
/* nothing reserves a row: Back floats over the page (a banner is fine); text and buttons under it move right (main.js) */
.back-gap { padding-left: var(--back-gap) !important; }
.back-gap.top { padding-left: 0 !important; padding-top: var(--back-h) !important; }

/* ------------------------------------------------------------------ focus: lifted on a flat plate in the world colour (no glow, no frame) */
:root { --plate: var(--milk); }
[data-world="arcade"], [data-world="edu"], [data-world="music"] { --plate: var(--world); }
body:is([data-world="arcade"], [data-world="edu"], [data-world="music"]) main { --plate: var(--world-ink); }
body.navmode [data-nav].focus, body.navmode [data-nav]:focus-visible { box-shadow: 0 6px 0 0 var(--plate); transform: translateY(-3px) scale(1.03);
  outline: none; z-index: 2; transition: transform .18s var(--spring, ease), box-shadow .18s; }
@media (prefers-reduced-motion: reduce) {
  body.navmode [data-nav].focus, body.navmode [data-nav]:focus-visible { transform: none; transition: none; }
  .pg-dot i { transition: none; }
}

/* ------------------------------------------------------------------ paging: gentle snap to blocks that fit the screen
   only while the cube / keys drive the page: Chrome re-snaps after a layout change (images, 3D), which made a mouse
   player's page jump on entry; the first block snaps by its top, so the top of the page is a resting point too */
html { scroll-padding: var(--nav-top, 0px) 0 var(--nav-bottom, 0px); }
html:has(body.navmode) { scroll-snap-type: y proximity; }
main [data-nb] { scroll-snap-align: center; } main [data-nb="start"] { scroll-snap-align: start; }

/* ------------------------------------------------------------------ side position: dots per block, Up / Down */
.pager { position: fixed; z-index: 25; width: 24px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 3px 0; border-radius: 10px;
  background: rgba(21,23,27,.55); color: var(--milk); --dot: var(--milk); }
.pager[hidden] { display: none; }
body:is([data-world="arcade"], [data-world="edu"], [data-world="music"]) .pager { --dot: var(--world); }
.pg-btn { width: 24px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: inherit; opacity: .6;
  transition: opacity .15s; }
.pg-btn:hover { opacity: 1; } .pg-btn:disabled { opacity: .18; cursor: default; }
.pg-btn .pico { font-size: 18px; background: none; }
.pg-dots { display: flex; flex-direction: column; }
.pg-dot { width: 24px; height: 14px; display: grid; place-items: center; padding: 0; color: inherit; }
.pg-dot i { width: 6px; height: 6px; border-radius: 2px; background: currentColor; opacity: .35; transition: height .2s, opacity .2s; }
.pg-dot:hover i { opacity: .7; }
.pg-dot.on i { height: 12px; opacity: 1; background: var(--dot); }
body.welcoming .pager { display: none; }
@media (max-width: 600px) { .pager { width: 12px; } .pg-btn { display: none; } .pg-dot { width: 12px; height: 12px; } .pg-dot i { width: 4px; height: 4px; } .pg-dot.on i { height: 9px; } }

/* ------------------------------------------------------------------ the cube hint: face pictograms, folds into «?» */
.navhint { position: fixed; left: 50%; right: auto; bottom: 14px; transform: translateX(-50%); z-index: 31; display: flex; flex-wrap: wrap; justify-content: center;
  align-items: center; gap: 6px 16px; max-width: calc(100vw - 32px); width: max-content; padding: 6px 6px 6px 14px; border-radius: 14px;
  background: rgba(21,23,27,.94); color: var(--milk); font: 500 13px/1.2 Rubik, system-ui, sans-serif; --nh-ink: #23262E; }
.navhint[hidden] { display: none; }
.navhint .nh-g { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.navhint .mv { display: inline-flex; align-items: center; gap: 3px; }
.navhint .mv b { font: 800 12px Unbounded, sans-serif; color: var(--milk); background: none; padding: 0; border-radius: 0; }
.navhint .fpic { width: 26px; height: 26px; display: block; }
.navhint .nh-t { color: var(--muted); }
.navhint .nh-x { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; opacity: .6; }
.navhint .nh-x:hover { opacity: 1; background: rgba(255,255,255,.08); }
.navhint .nh-x .pico { font-size: 18px; background: none; }
.navhint.mini { padding: 0; gap: 0; background: none; }
.navhint .nh-q { width: 34px; height: 34px; border-radius: 11px; background: rgba(21,23,27,.94); color: var(--milk); font: 800 15px Unbounded, sans-serif; opacity: .75; }
.navhint .nh-q:hover { opacity: 1; }
.navhint.busy { gap: 10px; padding: 8px 14px; }
.navhint.busy .pico { font-size: 18px; }
.navhint kbd { font: 700 11px Rubik, sans-serif; padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,.12); }
body:has(#frame:not([hidden])) :is(.navhint, .pager) { display: none; }
@media (max-width: 900px) { .navhint { bottom: calc(74px + env(safe-area-inset-bottom)); gap: 4px 12px; } }
@media (max-width: 600px) { .navhint { font-size: 12px; } .navhint .nh-g { gap: 3px; } .navhint .fpic { width: 22px; height: 22px; } }

/* long pages: one progress track instead of a column of dots */
.pg-track { display: block; width: 4px; height: 84px; border-radius: 2px; background: var(--faint); margin: 4px auto; overflow: hidden; }
.pg-track i { display: block; width: 100%; min-height: 6px; border-radius: 2px; background: var(--world, var(--milk)); transition: height .2s; }

/* the jewel icons (owner 2026-12-01): the picture fills its place, no sticker, no tint */
.pico.img { background: none !important; border-radius: 0; width: 1.5em; height: 1.5em; object-fit: contain; padding: 0; flex: none; }
.pico.img.on { filter: none; }
.aimg { display: block; object-fit: contain; } .aimg.off { opacity: .35; }

/* ------------------------------------------------------------------ phones (owner 2026-12-01) */
/* Back: a small square arrow in the same top-left spot, the same milk plate and graphite ring */
@media (max-width: 700px), (max-height: 500px) {
  .pageback { width: 40px; height: 40px; padding: 0; justify-content: center; border-radius: 12px; }
  .pageback span:not(.pico) { display: none; }
  .pageback .pico { font-size: 24px; }
}

/* the tab bar: five places + «Ще» (the rest of the rail in a sheet) */
.tabbar .tmore { display: none; }
@media (max-width: 900px) {
  .tabbar { grid-template-columns: repeat(6, minmax(0, 1fr)); padding-left: 2px; padding-right: 2px; }
  .tabbar a, .tabbar .tmore { min-width: 0; min-height: 52px; align-content: center; }
  .tabbar a span:not(.ico), .tabbar .tmore > span:not(.ico) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar .tmore { display: grid; justify-items: center; gap: 4px; padding: 0; font: inherit; font-size: 11px; color: var(--muted); }
  .tabbar .tmore .ico { font-size: 22px; } .tabbar .tmore svg { fill: currentColor; }
  .tabbar .tmore.on, .tabbar .tmore[aria-expanded="true"] { color: var(--milk); }
}
.more { position: fixed; inset: 0; z-index: 29; }   /* under the tab bar (30): «Ще» stays tappable to close */
.more[hidden] { display: none; }
.more-bg { position: absolute; inset: 0; background: rgba(15, 16, 20, .66); }
.more-sheet { position: absolute; left: 0; right: 0; bottom: calc(68px + env(safe-area-inset-bottom)); max-height: calc(100% - 140px); overflow-y: auto;
  padding: 16px 16px 18px; border-radius: 24px 24px 0 0; background: #2c3039; animation: sheet .26s var(--spring, ease-out); }
.more-h { display: block; margin: 0 4px 12px; font: 800 14px Unbounded, sans-serif; color: var(--milk); }
.more-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.more-grid a { display: grid; justify-items: center; align-content: center; gap: 6px; min-height: 84px; padding: 10px 6px; border-radius: 16px;
  background: #353a45; color: var(--milk); text-decoration: none; font: 500 13px/1.2 Rubik, system-ui, sans-serif; text-align: center; }
.more-grid a .ico { font-size: 30px; }
.more-grid a.on { background: #F8F6F0; color: #23262E; }
@media (max-width: 900px) and (max-height: 500px) {   /* landscape phone: a thinner bar leaves room for the page */
  .tabbar { padding-top: 4px; padding-bottom: calc(4px + env(safe-area-inset-bottom)); }
  .tabbar a, .tabbar .tmore { min-height: 44px; gap: 2px; }
  .more-sheet { bottom: calc(52px + env(safe-area-inset-bottom)); max-height: calc(100% - 64px); }
}
@media (min-width: 901px) { .more { display: none; } }

/* the game frame on a phone: «Поверни телефон» in portrait; in landscape the game gets the whole screen */
.frame .rotate { display: none; }
@media (orientation: portrait) and (max-width: 700px) {
  .frame .rotate { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 24px;
    background: #23262E; color: #F8F6F0; text-align: center; }
  .rotate .rot-pic { width: 132px; height: 132px; overflow: visible; }
  .rotate .rot-phone { transform-box: fill-box; transform-origin: center; animation: rot-hint 2.4s ease-in-out infinite; }
  .rotate b { font: 800 20px/1.25 Unbounded, sans-serif; max-width: 300px; }
  .rotate span { color: #c9ccd2; font-size: 14px; max-width: 280px; }
  .rotate .btn { margin-top: 10px; background: #F8F6F0; color: #23262E; font-weight: 700; padding: 12px 22px; min-height: 48px; }
}
@keyframes rot-hint { 0%, 30% { transform: rotate(0); } 55%, 100% { transform: rotate(90deg); } }
@media (prefers-reduced-motion: reduce) { .rotate .rot-phone { animation: none; } }
@media (orientation: landscape) and (max-height: 500px) { .framebar { display: none; } }
