  @font-face { font-family:'Marck Script'; src:url('../fonts/MarckScript-Regular.ttf') format('truetype'); font-display:block; }   /* надпись от руки на полароиде */
  :root { --ink:#4a2a18; --paper:#f7e8c8; --edge:#3b2213; --gold:#ffd23a; }
  html, body { margin:0; height:100%; background:#140f24; overflow:hidden; overscroll-behavior:none;
    touch-action:none; -webkit-user-select:none; user-select:none; -webkit-touch-callout:none;
    -webkit-tap-highlight-color:transparent; }
  body { position:fixed; inset:0; font-family:'Nunito', system-ui, -apple-system, sans-serif; font-weight:700; }
  #stage { position:absolute; top:0; bottom:0; left:50%; transform:translateX(-50%); overflow:hidden; }
  #c { position:absolute; left:0; top:0; display:block; touch-action:none; }
  #safe { position:fixed; top:0; left:0; visibility:hidden; pointer-events:none;
    padding-top:env(safe-area-inset-top); padding-bottom:env(safe-area-inset-bottom); }

  .box { background:var(--paper); color:var(--ink); border:3px solid var(--edge);
    box-shadow: inset 0 0 0 3px #f0d6a6, inset 0 0 0 5px #c9965c, 0 5px 0 rgba(0,0,0,.35); border-radius:6px; }


  .px { font-family:'Press Start 2P', 'Nunito', monospace; font-weight:400; }
  .btn { font-family:inherit; font-size:17px; font-weight:800; color:#fff8e6; background:#4f9a3f;
    border:3px solid #23461c; border-radius:6px; padding:8px 18px; box-shadow: inset 0 -4px 0 #367a2b, inset 0 3px 0 #78c25e, 0 4px 0 rgba(0,0,0,.35);
    text-shadow: 0 2px 0 #23461c; touch-action:manipulation; cursor:pointer; }
  .btn:active { transform: translateY(3px); box-shadow: inset 0 -2px 0 #367a2b, inset 0 3px 0 #78c25e, 0 1px 0 rgba(0,0,0,.35); }
  .btn.red { background:#c8473d; border-color:#5a1a16; box-shadow: inset 0 -4px 0 #9c3029, inset 0 3px 0 #ee7b6c, 0 4px 0 rgba(0,0,0,.35); text-shadow:0 2px 0 #5a1a16; }
  .btn.ghost { background:#b8946a; border-color:#5a3a20; box-shadow: inset 0 -4px 0 #94704a, inset 0 3px 0 #d8b88c, 0 4px 0 rgba(0,0,0,.35); text-shadow:0 2px 0 #5a3a20; }

  .modal { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; z-index:10;
    background:rgba(12,8,26,.55); opacity:0; pointer-events:none; transition:opacity .3s; }
  .modal.show { opacity:1; pointer-events:auto; }
  .modal .box { width:84%; max-width:360px; max-height:80%; overflow:auto; padding:20px 20px 18px; text-align:center;
    transform: scale(.6) translateY(30px); transition: transform .45s cubic-bezier(.25,1.7,.45,1); -webkit-overflow-scrolling:touch; touch-action:pan-y; }
  .modal.show .box { transform: scale(1) translateY(0); }
  .modal h2 { margin:2px 0 14px; font-size:16px; line-height:1.6; font-family:'Press Start 2P', 'Nunito', monospace; font-weight:400; color:#a8322c; text-shadow:0 2px 0 #f0c9a0; }
  .modal p { margin:0 0 10px; font-size:17px; line-height:1.35; }
  .modal .sign { margin-top:14px; font-weight:600; font-size:18px; color:#7a3a24; }
  .modal .row { display:flex; gap:12px; justify-content:center; margin-top:16px; }
  .modal .deco { font-size:28px; margin-bottom:4px; letter-spacing:6px; }

  #title { position:absolute; inset:0; z-index:20; display:flex; flex-direction:column; align-items:center; justify-content:center;
    text-align:center; color:#fff1c4; background: radial-gradient(ellipse at 50% 45%, rgba(20,12,40,.15), rgba(10,6,24,.75));
    transition: opacity .7s; padding:0 18px; }
  #title.hide { opacity:0; pointer-events:none; }
  #title h1 { font-size:min(25px, 6.2vw); line-height:1.5; margin:0 0 14px; font-weight:400; font-family:'Press Start 2P', 'Nunito', monospace;
    text-shadow: 0 3px 0 #7a2a20, 0 6px 0 #2a1020, 0 0 24px rgba(255,190,90,.45); animation: bob 2.6s ease-in-out infinite; }
  #title .sub { font-size:20px; margin-bottom:26px; color:#ffe6a8; text-shadow:0 2px 0 #2a1020; }
  #title .btn { font-size:22px; padding:12px 26px; animation: pulse 1.6s ease-in-out infinite; }
  #title #newBtn { font-size:16px; padding:9px 20px; margin-top:16px; animation:none; }
  #title #newBtn[hidden] { display:none; }
  #title .tip { margin-top:22px; font-size:14px; opacity:.85; text-shadow:0 2px 0 #2a1020; }
  @keyframes bob { 0%,100%{ transform:translateY(0) } 50%{ transform:translateY(-6px) } }
  @keyframes pulse { 0%,100%{ transform:scale(1) } 50%{ transform:scale(1.06) } }

  /* полароид после финала */
  #photo { flex-direction:column; background:rgba(12,8,26,.7); }
  /* портрет из фоторамки на полке: деревянная рамка, тап — закрыть */
  #pic { background:rgba(12,8,26,.75); cursor:pointer; }
  .picframe { width:88%; max-width:460px; padding:12px; background:#7a4a24; border:4px solid #4a2810; border-radius:2px;
    box-shadow: inset 0 0 0 3px #d8a860, inset 0 0 0 6px #5a3218, 0 14px 40px rgba(0,0,0,.55); transform: scale(.5) rotate(-1.5deg); transition: transform .35s cubic-bezier(.2,1.4,.4,1); }
  #pic.show .picframe { transform: scale(1) rotate(-1.5deg); }
  .picframe img { display:block; width:100%; image-rendering:pixelated; }
  .polaroid { width:76%; max-width:330px; background:#fbf8ef; padding:12px 12px 0; border-radius:2px;
    box-shadow: 0 10px 30px rgba(0,0,0,.5), 0 2px 0 #d8d2c0; transform: rotate(-2.5deg) scale(.7); transition: transform .5s cubic-bezier(.25,1.6,.45,1); }
  #photo.show .polaroid { transform: rotate(-2.5deg) scale(1); }
  .polaroid img { display:block; width:100%; image-rendering:pixelated; background:#1b1430; }
  #photo.show .polaroid img { animation: develop 2.2s ease-out both; }
  .polaroid .cap { height:58px; display:flex; align-items:center; justify-content:center;
    font-family:'Marck Script', cursive; font-weight:400; font-size:30px; color:#3a3550; transform:rotate(-1.5deg); }
  #photo .row { margin-top:22px; }
  @keyframes develop { 0% { filter: brightness(2.6) saturate(0) contrast(.6); } 100% { filter: none; } }


/* кнопка «в меню» (Играть.html): в игре — всегда слева сверху, над заставкой тоже */
#stage > #homeBtn { position:absolute; z-index:25; top:max(10px, env(safe-area-inset-top)); left:10px; font-size:20px; padding:4px 10px; text-decoration:none; animation:none; }

/* гардероб: свои костюмы Макса, мамы и папы (js/mods.js) */
#stage > #wardBtn { position:absolute; z-index:25; top:max(10px, env(safe-area-inset-top)); left:66px; font-size:20px; padding:4px 10px; animation:none; }
#wardrobe { z-index:30; }
#wardrobe .box { width:92%; max-width:560px; max-height:88%; padding:16px; }
.wsec { border:3px dashed transparent; border-radius:12px; padding:6px; margin-bottom:6px; text-align:left; }
.wsec.over { border-color:#e8a820; background:#fff3a0; }
.whead { display:flex; align-items:center; justify-content:space-between; margin:0 4px 6px; color:#7a3a24; font-size:18px; }
.wtpl { font-size:14px; color:#4a6a9a; text-decoration:none; border-bottom:1px dashed; }
.wrow { display:flex; flex-wrap:wrap; gap:8px; padding-bottom:4px; }
.wcard { position:relative; flex:none; width:84px; min-height:104px; display:flex; flex-direction:column; align-items:center; justify-content:flex-end; gap:3px;
  background:#fffaf0; border:2px solid #c9965c; border-radius:10px; padding:4px; font-size:13px; font-weight:800; color:#7a3a24; overflow:hidden; }
.wcard span { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.wpic { width:70px; height:auto; image-rendering:pixelated; }
.wdel { position:absolute; top:2px; right:2px; width:22px; height:22px; padding:0; border:0; border-radius:6px; background:#c8473d; color:#fff; font-size:12px; cursor:pointer; }
.wadd { justify-content:center; cursor:pointer; font-family:inherit; background:#f0e4c8; border-style:dashed; }
.wadd span { font-size:34px; line-height:1; }
.wwait { justify-content:center; font-size:28px; }
.wbad { color:#c8473d; font-size:14px; margin:4px; }
.wcard.off { background:#e8dcc4; border-style:dotted; }
.wcard.off .wpic, .wcard.off span { opacity:.45; }
.wcard.off .wpic { filter:grayscale(1); }
.wback, .wbin { position:absolute; top:2px; width:24px; height:24px; padding:0; border:0; border-radius:6px; color:#fff; font-size:13px; cursor:pointer; }
.wback { right:2px; background:#4f9a3f; }
.wbin { left:2px; background:#8a6a50; }

/* магнитофон: кнопка 📼 и окно «Кассеты» (js/music.js) */
#stage > #tapesBtn { position:absolute; z-index:25; top:max(10px, env(safe-area-inset-top)); left:122px; font-size:20px; padding:4px 10px; animation:none; }
#tapes { z-index:30; }
#tapes .box { width:92%; max-width:480px; max-height:88%; padding:16px; }
#tapes.over .box { box-shadow:0 0 0 5px #ffd23a; }
.trow { display:flex; align-items:center; gap:10px; width:100%; margin-bottom:6px; padding:6px 8px; background:#fffaf0; border:2px solid #c9965c; border-radius:10px;
  font-family:inherit; font-weight:800; font-size:16px; color:#7a3a24; text-align:left; box-sizing:border-box; }
.trow.on { background:#fff3a0; border-color:#e8a820; }
.tplay, .tdel { flex:none; width:34px; height:34px; border:0; border-radius:8px; font-size:16px; cursor:pointer; color:#fff; }
.tplay { background:#4f9a3f; }
.tdel { background:#8a6a50; }
.tname { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.tadd { justify-content:center; cursor:pointer; background:#f0e4c8; border-style:dashed; }

/* гардероб: шаги, крупный «⬇ образец», надетый костюм, «неправильный костюм» */
.wsteps { display:flex; flex-wrap:wrap; justify-content:center; align-items:center; gap:6px; margin:-4px 0 10px; color:#9a6a40; font-weight:800; font-size:14px; }
.wsteps span { background:#fffaf0; border:2px solid #c9965c; border-radius:8px; padding:2px 8px; color:#7a3a24; }
.wtplbig { background:#dcecff; border:2px solid #4a7ac8; color:#2a4a8a; text-decoration:none; cursor:pointer; }
.wtplbig:hover { background:#c8e0ff; }
.wcard:not(.off):not(.wadd):not(.wtplbig):not(.wwait) { cursor:pointer; }
.wcard.worn { border-color:#e8a820; background:#fff3a0; box-shadow:0 0 0 3px #ffd23a; }
.wcard.bad .wpic { outline:2px dashed #c8473d; }
.wbadtag { position:absolute; left:2px; right:2px; top:38%; transform:rotate(-8deg); background:#c8473d; color:#fff; font-style:normal; font-size:10px; line-height:1.15; padding:2px; border-radius:4px; text-align:center; }

/* громкость магнитофона */
.tvol { display:flex; align-items:center; gap:10px; margin:-4px 4px 12px; font-size:22px; }
.tvol input { flex:1; accent-color:#4f9a3f; height:28px; cursor:pointer; }

/* редактор игрушек (js/toyedit.js) */
#stage > #toyBtn { position:absolute; z-index:25; top:max(10px, env(safe-area-inset-top)); left:178px; font-size:20px; padding:4px 10px; animation:none; }
#toyEd { z-index:30; }
#toyEd .box { width:94%; max-width:520px; max-height:92%; padding:14px; }
#toyList { justify-content:center; }
.tpic { width:60px; height:auto; image-rendering:pixelated; }
.tedrow { display:flex; gap:12px; justify-content:center; align-items:flex-start; }
#toyCv { width:min(264px, 58vw); height:auto; aspect-ratio:1; border:3px solid #c9965c; border-radius:8px; touch-action:none; cursor:crosshair; image-rendering:pixelated; }
.tside { display:flex; flex-direction:column; gap:8px; align-items:center; }
#toyPrev { width:60px; height:52px; background:#2f6a44; border-radius:8px; }
#toyTools { display:grid; grid-template-columns:repeat(2, 40px); gap:6px; }
#toyTools button, #toyPick button { height:40px; border:2px solid #c9965c; border-radius:8px; background:#fffaf0; font-size:20px; cursor:pointer; padding:0; }
#toyTools button.sel { background:#fff3a0; border-color:#e8a820; box-shadow:0 0 0 2px #ffd23a; }
#toyPal { display:grid; grid-template-columns:repeat(8, 1fr); gap:5px; margin:10px 0 6px; }
#toyPal button { height:30px; border:2px solid #7a4a2c; border-radius:6px; cursor:pointer; }
#toyPal button.sel { box-shadow:0 0 0 3px #ffd23a; transform:scale(1.08); }
#toyPick { display:flex; gap:4px; overflow-x:auto; align-items:center; padding:4px 0; font-size:13px; color:#7a3a24; font-weight:800; }
#toyPick button { flex:none; width:36px; height:36px; display:flex; align-items:center; justify-content:center; }
#toyPick canvas { image-rendering:pixelated; max-width:30px; max-height:30px; }
#toyName { width:100%; box-sizing:border-box; margin:6px 0 0; padding:8px 10px; font:800 16px Nunito, sans-serif; border:2px solid #c9965c; border-radius:8px; color:#7a3a24; }

/* «✨ Попросить Gemini» */
.wgem { display:block; width:100%; margin:0 0 12px; padding:10px; border:2px solid #7a5ad0; border-radius:10px; background:linear-gradient(90deg, #e8e0ff, #dcecff);
  font:800 17px Nunito, sans-serif; color:#3a2a7a; cursor:pointer; }
.wgem:hover { background:linear-gradient(90deg, #ddd2ff, #cfe4ff); }
#gemModal { z-index:31; }
#gemModal .box { width:94%; max-width:520px; max-height:92%; padding:14px; text-align:left; }
#gemModal h2 { text-align:center; }
.gsteps { display:flex; flex-wrap:wrap; gap:6px; justify-content:center; margin-bottom:10px; font-size:13px; font-weight:800; }
.gsteps span { background:#fffaf0; border:2px solid #c9965c; border-radius:8px; padding:2px 8px; color:#7a3a24; }
#gemBase, #gemAsk { width:100%; box-sizing:border-box; border:2px solid #c9965c; border-radius:8px; padding:8px 10px; font:600 14px/1.35 Nunito, sans-serif; color:#3a2418; background:#fffaf0; resize:vertical; }
#gemBase { color:#7a5a40; }
#gemAsk { font-size:16px; font-weight:800; background:#fff; border-color:#7a5ad0; }
.gaskl { display:block; margin:10px 2px 4px; font-weight:800; color:#3a2a7a; }
