@font-face {
  font-family: Nunito;
  font-weight: 400 900;
  font-display: swap;
  src: url('../assets/nunito-cyrillic.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: 400 900;
  font-display: swap;
  src: url('../assets/nunito-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+2000-206F, U+2212;
}

:root {
  font: 100%/1.5 Nunito, system-ui, sans-serif;
  color: #20313a;
  background: #faf8f1;
  --teal: #176b67;
  --line: #dce5dc;
  --muted: #526964;
  --white: #fffefa;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, select, input { font: inherit; color: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button:disabled { cursor: default; opacity: .58; }
a { color: var(--teal); }
:focus-visible { outline: 3px solid #17548b; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1.12; }
h1 { font-size: clamp(1.85rem, 5.2vw, 3.15rem); font-weight: 900; letter-spacing: -.035em; }
h2 { font-size: clamp(1.25rem, 3vw, 1.65rem); font-weight: 850; }
svg { width: 1.2rem; height: 1.2rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wrap { width: min(calc(100% - 2rem), 67rem); margin-inline: auto; }
.site-header { background: var(--white); border-bottom: 1px solid #e9e6db; }
.header-inner, .row { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.header-inner { justify-content: space-between; min-height: 62px; }
.brand, .nav-link { display: inline-flex; min-height: 48px; align-items: center; text-decoration: none; }
.brand { gap: .5rem; color: #20313a; font-weight: 900; font-size: 1.2rem; }
.brand img { width: 31px; height: 35px; }
.nav-link { font-weight: 800; }
.button, select, input {
  min-width: 48px;
  min-height: 48px;
  border: 1px solid #b8d1c8;
  border-radius: 12px;
  background: var(--white);
  padding: .45rem .85rem;
}
.button { display: inline-flex; gap: .45rem; align-items: center; justify-content: center; color: var(--teal); text-decoration: none; font-weight: 850; text-align: center; line-height: 1.15; }
.button:hover:not(:disabled) { background: #e6f1e8; }
.button.primary { color: white; background: var(--teal); border-color: var(--teal); }
.button.primary:hover { background: #115653; }
.button.quiet { border-color: transparent; background: #eef3ea; }
.icon-button { padding: .4rem; }
.icon-button .cross, .icon-button[aria-pressed="true"] .wave { display: none; }
.icon-button[aria-pressed="true"] .cross { display: initial; }
select {
  appearance: none;
  padding-inline-end: 2.25rem;
  background: var(--white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%23176b67' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") right .65rem center / 1rem no-repeat;
  font-weight: 800;
}
label { font-weight: 800; }
.home, .catalog, .game-page { padding-block: clamp(1rem, 3vw, 2rem) 3rem; }
.home { display: grid; grid-template-columns: 1fr 1.15fr; gap: 2rem; align-items: center; }
.home-copy p { margin-block: 1rem; max-width: 31ch; font-size: 1.2rem; }
.home-room { min-height: 325px; }
.home-bear { width: 28%; position: absolute; bottom: 12%; left: 43%; }
.filters { margin-block: 1.4rem; gap: 1rem; align-items: end; }
.filters label, #share-field { display: grid; gap: .35rem; }
.card { border: 1px solid var(--line); border-radius: 18px; background: var(--white); }
.catalog .card { max-width: 44rem; }
.game-list { display: grid; gap: 1rem; }
.card-copy { padding: clamp(1rem, 3vw, 1.5rem); }
.card-copy > p, .card-copy > a, .card-copy > div { margin-top: .75rem; }
.game-card { overflow: hidden; display: grid; grid-template-columns: minmax(11rem, .85fr) 1fr; }
.card-room { display: flex; gap: 7%; align-items: end; justify-content: center; padding-bottom: 12%; min-height: 155px; }
.card-room img:first-child { width: 29%; }
.card-room img:last-child { width: 41%; }
.muted, .round { color: var(--muted); }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; column-gap: .55rem; color: var(--muted); font-weight: 800; }
.breadcrumbs a { display: inline-flex; min-height: 48px; align-items: center; }
.heading-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1.25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.notice { border-radius: 12px; background: #f9e7ca; padding: .7rem .9rem; margin-bottom: 1rem; }
.play-panel { border: 1px solid #d7e3d9; border-radius: 20px; padding: .7rem; background: var(--white); box-shadow: 0 5px 16px #3e5c4b0b; }
.toolbar, .taskbar, .play-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; }
.toolbar, .play-footer { padding: .15rem .25rem; }
.location-label { font-size: .95rem; color: var(--muted); padding-left: .65rem; }
.taskbar { margin-block: .6rem; padding: .55rem .85rem; border: 1px solid #e3ece2; border-radius: 14px; background: #f1f6ed; }
.round { font-size: .91rem; font-weight: 800; }
.prompt { font-size: clamp(1.08rem, 2.8vw, 1.38rem); font-weight: 900; line-height: 1.25; }
.room { position: relative; overflow: hidden; border-radius: 16px; background: linear-gradient(to bottom, #fae9d4 0 62%, #d6bda2 62% 63.3%, #c6ddd2 63.3% 100%); isolation: isolate; }
#board {
  height: clamp(252px, 39vw, 400px);
  --center: 61%;
  --floor: 86%;
  --on-y: 39%;
  --low-y: 72%;
  --near-x: 84%;
  --start-x: 23%;
  --inside-y: 55%;
  --toy-size: clamp(60px, 22cqh, 88px);
  container-type: size;
}
.room .window { position: absolute; width: min(28%, 234px); top: 7%; left: 9%; pointer-events: none; user-select: none; }
.room .plant { position: absolute; height: 42%; right: 6%; bottom: 29%; pointer-events: none; user-select: none; }
#board .plant { right: 3.5%; bottom: 34%; height: 36%; opacity: .9; }
.rug { position: absolute; border-radius: 50%; width: 39%; height: 15%; left: 5%; bottom: 8%; background: #b2cdc0; border: 2px solid #9cbfb0; }
.prop, .toy, .spot { position: absolute; user-select: none; -webkit-user-select: none; }
.prop { height: 69%; left: var(--center); bottom: calc(100% - var(--floor)); transform: translateX(-50%); pointer-events: none; }
[data-prop="box"].prop { height: 52%; }
[data-scene="bench"] { --on-y: 29%; }
[data-prop="bench"].prop { height: 53%; }
[data-prop="basket"].prop { height: 69%; }
.prop.front { z-index: 4; }
.spot, .toy { --x: var(--start-x); --y: var(--low-y); left: var(--x); top: var(--y); transform: translate(-50%, -50%); touch-action: none; }
.spot[data-place="on"], .toy[data-place="on"] { --x: var(--center); --y: var(--on-y); }
.toy[data-place="on"] { --y: calc(var(--on-y) - 12px); }
.spot[data-place="under"], .toy[data-place="under"] { --x: var(--center); }
.spot[data-place="near"], .toy[data-place="near"] { --x: var(--near-x); }
.spot[data-place="inside"], .toy[data-place="inside"] { --x: var(--center); --y: var(--inside-y); }
#second-toy[data-place="start"] { --y: 43%; }
#board.dual-station {
  --floor: 67%;
  --on-y: 33%;
  --low-y: 56%;
  --inside-y: 41%;
  --toy-size: clamp(56px, 19cqh, 82px);
}
.dual-station [data-station="0"] { --center: 28%; }
.dual-station [data-station="1"] { --center: 69%; --near-x: 91%; }
.dual-station [data-prop="bench"] { --on-y: 29%; }
.dual-station [data-prop="box"] { --inside-y: 40%; }
.dual-station [data-prop="basket"] { --inside-y: 41%; }
.dual-station .toy[data-place="start"] { --start-x: 25%; --y: 86%; }
.dual-station #second-toy[data-place="start"] { --start-x: 49%; --y: 86%; }
.dual-station .window, .dual-station .plant { opacity: .4; }
.dual-station .rug { left: 12%; bottom: 3%; width: 50%; }
[data-location="classroom"].room { background: linear-gradient(#f5ead5 0 65%, #d4ae8a 65% 67%, #eacda8 67% 100%); }
.spot { width: 48px; height: 48px; padding: 0; z-index: 5; border: 2px dashed #215f59; border-radius: 50%; background: #f8fff5e8; display: grid; place-items: center; }
.spot::after { content: ''; width: 11px; height: 11px; border-radius: 50%; background: #42776c; }
.spot:hover { border-style: solid; }
.toy { width: var(--toy-size); min-width: 48px; min-height: 48px; padding: 2px; border: 2px solid transparent; border-radius: 20%; background: transparent; cursor: grab; z-index: 3; }
.toy img { display: block; width: 100%; pointer-events: none; }
.toy[aria-pressed="true"] { border-color: #176b67; background: #f0f8edb5; }
.toy:disabled { opacity: 1; }
.toy.dragging { z-index: 6; cursor: grabbing; pointer-events: none; }
.finish { position: absolute; z-index: 7; inset: 0; display: grid; place-content: center; justify-items: center; gap: .55rem; background: #fbf6e8f7; font-weight: 900; font-size: clamp(1.2rem, 4vw, 1.9rem); }
.finish img { width: clamp(60px, 20cqh, 88px); }
.finish .button { font-size: 1rem; }
.play-footer { margin-top: .45rem; min-height: 54px; }
.feedback { color: #415e57; font-weight: 750; }
.feedback[data-tone="success"] { color: #125a46; font-weight: 900; }
.guide { display: grid; gap: .85rem; margin-top: 1rem; }
.guide ol { padding-inline-start: 1.3rem; margin-bottom: 0; }
.guide li + li { margin-top: .5rem; }
.guide section { scroll-margin-top: 1rem; }
.video-clip + .video-clip { margin-top: 1rem; }
.video-clip h3 { margin-bottom: .5rem; }
video { width: min(100%, 50rem); aspect-ratio: 16 / 9; display: block; border-radius: 14px; background: #20313a; }
video::cue { background: #20313af5; color: #fff; font-family: Nunito, sans-serif; }
.share { padding-block: .6rem; }
#share-status:not(:empty) { margin-top: .5rem; }
#share-link { width: 100%; }
dialog { max-width: min(calc(100vw - 2rem), 27rem); border: 1px solid var(--line); border-radius: 18px; padding: 1.25rem; color: inherit; background: var(--white); }
dialog p { margin-block: .65rem 1rem; }
dialog::backdrop { background: #172c3380; }
body.expanded { overflow: hidden; }
body.expanded #site-header,
body.expanded #game-heading,
body.expanded #guide { display: none; }
body.expanded #play-panel {
  position: fixed;
  z-index: 10;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: .6rem;
  padding: max(.6rem, env(safe-area-inset-top)) max(.6rem, env(safe-area-inset-right)) max(.6rem, env(safe-area-inset-bottom)) max(.6rem, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
}
body.expanded .toolbar {
  position: sticky;
  z-index: 8;
  top: 0;
  top: env(safe-area-inset-top, 0px);
  background: var(--white);
}
body.expanded #board { flex: 1 0 230px; height: auto; max-height: 650px; }

@media (max-width: 42rem) {
  .home, .game-card { grid-template-columns: 1fr; }
  .card-room { padding-bottom: 6%; max-height: 230px; }
  .card-room img { max-height: 145px; }
  .home-room { min-height: 245px; }
  .toolbar, .play-footer { padding-inline: 0; }
  .wrap { width: calc(100% - 1.15rem); }
  #board { --center: 60%; --near-x: 87%; --start-x: 19%; }
  #board .plant { height: 28%; right: 2%; }
  #board .prop { max-width: 48%; }
}
@media (max-width: 25rem) {
  .brand { font-size: 1.05rem; }
  .button { padding-inline: .58rem; }
  .play-panel { padding: .45rem; }
  .taskbar { padding-inline: .55rem; }
  .stage-settings .button { font-size: .86rem; padding-inline: .48rem; }
  .stage-settings svg { width: 1rem; height: 1rem; }
  #board { --near-x: 89%; }
}
@media (max-height: 33rem) and (orientation: landscape) {
  body.expanded #board { flex-basis: 184px; }
  body.expanded #board.has-two-toys { flex-basis: 252px; }
}
