/* ---------- 2.0 network: the "new version" card (close 4008) and the digging-full picture ---------- */
/* Above modals (30, editor 31) and toasts (35): nothing else works until the page reloads. */
.update-card { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(10, 14, 30, .72); }
.update-card-box { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 28px 40px 32px; border-radius: 24px; background: #1d2236; border: 4px solid #7be35a; box-shadow: 0 14px 40px rgba(0, 0, 0, .5); }
.update-card-pic { font-size: 76px; line-height: 1; animation: update-card-spin 2.4s linear infinite; }
/* Two classes, so style.css's later .btn (font-size 20px) can't shrink the ▶. */
.update-card .update-card-go { min-width: 132px; min-height: 76px; font-size: 42px; line-height: 1; }
@keyframes update-card-spin { to { transform: rotate(360deg); } }

/* Holding on terrain with a full digging record: a picture toast, never a sentence. */
.dig-full { display: inline-block; font-size: 34px; line-height: 1.1; letter-spacing: 6px; }

@media (max-width: 700px), (max-height: 600px) {
  .update-card-box { padding: 20px 26px 24px; gap: 14px; }
  .update-card-pic { font-size: 58px; }
  .update-card .update-card-go { min-width: 112px; min-height: 64px; font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .update-card-pic { animation: none; }
}

/* ---------- 2.1 Quick Join: the Friends Board, Class Key pad, Come-Play Horn and its card ---------- */
/* Round face tiles (8×8 face pictures scaled up pixelated), a 🟢 or 🔒 dot, a 🎉 for a horn, the name underneath. */
.face-board { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 12px; }
.face-tile { position: relative; display: inline-flex; flex-direction: column; align-items: center; gap: 4px; width: 76px; padding: 0; border: 0; background: none; color: #fff; cursor: pointer; touch-action: manipulation; }
.face-tile .face-pic { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--line); background: #2f3657; box-shadow: 0 0 0 3px rgba(255,255,255,.22), 0 6px 0 rgba(0,0,0,.35); image-rendering: pixelated; object-fit: cover; font-size: 34px; line-height: 1; transition: transform .1s; }
.face-tile:hover .face-pic { transform: scale(1.06); }
.face-tile:active .face-pic { transform: scale(.95); }
.face-dot { position: absolute; top: -2px; right: 2px; font-size: 18px; line-height: 1; filter: drop-shadow(0 2px 0 rgba(0,0,0,.6)); }
.face-horn { position: absolute; top: -10px; left: -2px; font-size: 24px; line-height: 1; animation: face-horn 0.9s ease-in-out infinite; }
.face-tile.horn .face-pic { box-shadow: 0 0 0 3px var(--yellow), 0 0 18px 4px rgba(255,201,40,.75), 0 6px 0 rgba(0,0,0,.35); }
.face-tile.locked { cursor: default; }
.face-tile.locked .face-pic { filter: grayscale(.7) brightness(.75); }
.face-name { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; font-size: 14px; text-shadow: 0 2px 2px rgba(0,0,0,.8); }
.face-me { cursor: default; }
.face-me .face-pic { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,210,63,.5), 0 6px 0 rgba(0,0,0,.35); }
.class-tile .face-pic { background: linear-gradient(180deg, #ffe27a, #c58a00); }
.board-empty { display: grid; place-items: center; min-width: 64px; height: 64px; font-size: 28px; opacity: .7; }
@keyframes face-horn { 50% { transform: rotate(-14deg) scale(1.15); } }

/* Start screen: your face beside ▶ PLAY, classmates beside it. Main menu: the same faces in a strip. */
.start-board { margin: 22px auto -8px; }
.start-board .face-board { gap: 8px 10px; }
.friends-strip { max-width: min(720px, 94vw); overflow-x: auto; overscroll-behavior: contain; touch-action: pan-x; pointer-events: auto; scrollbar-width: none; }
.friends-strip::-webkit-scrollbar { display: none; }
/* One row that centres when it fits and scrolls sideways when it doesn't. */
.friends-strip .face-board { width: max-content; margin: 0 auto; flex-wrap: nowrap; padding: 10px 4px 2px; }
.friends-strip .face-tile .face-pic { width: 52px; height: 52px; font-size: 28px; }
.friends-strip .face-tile { width: 64px; }
.friends-strip .face-name { max-width: 64px; font-size: 12px; }

/* In the Friends panel: tap a friend's face to whoosh beside them. */
.face-btn { position: relative; flex: none; width: 48px; height: 48px; padding: 0; border: 3px solid var(--line); border-radius: 50%; background: #2f3657; cursor: pointer; touch-action: manipulation; }
.face-btn .face-pic { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; image-rendering: pixelated; font-size: 24px; }
.face-btn .face-go { position: absolute; right: -8px; bottom: -6px; font-size: 16px; }
.face-btn:disabled { opacity: .5; cursor: default; }
/* Two classes, so style.css's later .btn rules (position, font-size, padding) can't undo these. */
.friends-panel .horn-btn { display: block; margin: 0 auto 10px; min-width: 96px; min-height: 60px; padding: 8px 22px 10px; font-size: 32px; line-height: 1; --c: var(--yellow); --l: var(--yellow-l); --d: var(--yellow-d); }
.friends-panel .horn-btn.wait { --c: var(--dark); --l: var(--dark-l); --d: var(--dark-d); font-size: 26px; }

/* The Class Key pad (grown-ups): three slots, nine big pictures, ⌫ and ✕. */
.class-pad { position: relative; width: min(420px, 94vw); max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; text-align: center; }
.class-pad .class-close { position: absolute; top: 10px; right: 10px; z-index: 1; }
.class-ico { font-size: 46px; line-height: 1; }
.class-slots { display: flex; justify-content: center; gap: 10px; margin: 10px 0 4px; }
.class-slot { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 16px; border: 3px dashed rgba(255,255,255,.35); font-size: 38px; line-height: 1; }
.class-slot.on { border-style: solid; border-color: var(--line); background: rgba(255,255,255,.12); }
.class-state { min-height: 38px; margin: 4px 0; font-size: 30px; line-height: 1.2; }
.class-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(300px, 100%); margin: 0 auto; }
.class-pic { aspect-ratio: 1; border: 3px solid var(--line); border-radius: 18px; background: linear-gradient(180deg, #5a6796, #2f3657); font-size: 44px; line-height: 1; cursor: pointer; box-shadow: inset 0 3px 0 rgba(255,255,255,.2), 0 5px 0 rgba(0,0,0,.35); touch-action: manipulation; }
.class-pic:active { transform: translateY(3px); }
.class-pic:disabled { opacity: .6; cursor: default; }
.class-pad .class-undo { margin-top: 12px; min-width: 72px; font-size: 24px; }
.class-note { margin: 12px 0 0; font-size: 13px; font-weight: 800; line-height: 1.4; opacity: .85; }
.class-wrong .class-slots { animation: class-shake .35s linear; }
.class-right .class-state { animation: class-pop .4s ease-out; }
@keyframes class-shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
@keyframes class-pop { from { transform: scale(.4); } to { transform: scale(1); } }

/* A classmate's horn: above menus, modals (30, editor 31) and toasts (35), below the reload card (40). Bottom centre,
   clear of the touch controls' corners. */
.invite-card { position: fixed; left: 0; right: 0; bottom: calc(150px + var(--safe-b)); z-index: 36; display: flex; justify-content: center; pointer-events: none; }
.invite-box { position: relative; display: flex; align-items: center; gap: 14px; padding: 12px 18px 12px 14px; border-radius: 22px; background: #1d2236f2; border: 4px solid var(--yellow); box-shadow: 0 12px 30px rgba(0,0,0,.5); pointer-events: auto; animation: invite-in .35s ease-out; }
.invite-who { position: relative; }
.invite-face { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--line); background: #2f3657; image-rendering: pixelated; font-size: 34px; }
.invite-horn { position: absolute; right: -14px; bottom: -6px; font-size: 30px; animation: face-horn .9s ease-in-out infinite; }
.invite-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--display); font-size: 22px; }
.invite-card .invite-go { min-width: 92px; min-height: 64px; font-size: 36px; line-height: 1; }
.invite-close { position: absolute; top: -14px; right: -14px; width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line); background: #414b6e; font-size: 16px; font-weight: 900; cursor: pointer; }
body.quiz-open .invite-card, .invite-card[hidden] { display: none; } /* it waits until the question is done, or (hidden) until you are back from Adventure or Blitz */
@keyframes invite-in { from { transform: translateY(40px) scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

@media (max-width: 700px), (max-height: 600px) {
  .face-board { gap: 8px; }
  .face-tile { width: 62px; }
  .face-tile .face-pic { width: 52px; height: 52px; font-size: 28px; }
  .face-name { max-width: 62px; font-size: 12px; }
  .start-board { margin: 14px auto -12px; }
  .friends-strip .face-tile .face-pic { width: 44px; height: 44px; font-size: 24px; }
  .friends-strip .face-tile { width: 54px; }
  .class-slot { width: 52px; height: 52px; font-size: 32px; }
  .class-pic { font-size: 36px; }
  .invite-card { bottom: calc(118px + var(--safe-b)); }
  .invite-box { gap: 10px; padding: 10px 14px 10px 10px; }
  .invite-face { width: 54px; height: 54px; }
  .invite-name { max-width: 90px; font-size: 18px; }
  .invite-card .invite-go { min-width: 78px; min-height: 56px; font-size: 30px; }
}
/* In a world the bottom belongs to the stick, ⚔, jump and the open slots, so for its short stay (invite-card.js IN_WORLD)
   the card sits in the band above the Learn prompt and below the guide, map and open slots; on portrait phones it keeps
   left of the camera buttons, and on landscape phones it takes the toasts' place at the top (over the guide and map). */
body.playing .invite-card { top: max(34%, calc(272px + var(--safe-t))); bottom: auto; }
@media (orientation: portrait) and (max-width: 700px) {
  body.playing .invite-card { right: calc(56px + var(--safe-r)); }
}
@media (orientation: landscape) and (max-width: 700px), (orientation: landscape) and (max-height: 600px) {
  body.playing .invite-card { top: calc(16px + var(--safe-t)); left: calc(182px + var(--safe-l)); right: calc(216px + var(--safe-r)); }
}
@media (max-height: 460px) {
  .start-board { margin: 6px auto -16px; }
  .start-board .face-name, .friends-strip .face-name { display: none; }
  /* Landscape phones: the strip sits between the player card and the coins, so it scrolls instead of growing. */
  .friends-strip { max-width: 44vw; }
  /* The pad side by side: key, slots and ⌫ on the left, the pictures on the right. */
  .class-pad { display: grid; grid-template-columns: auto auto; grid-template-areas: "ico grid" "slots grid" "state grid" "undo grid"; align-items: center; column-gap: 22px; width: auto; max-width: 94vw; padding: 12px 18px; }
  .class-pad .class-close { left: 10px; right: auto; }
  .class-ico { grid-area: ico; font-size: 34px; }
  .class-slots { grid-area: slots; margin: 0; gap: 6px; }
  .class-state { grid-area: state; min-height: 30px; margin: 0; font-size: 24px; }
  .class-pad .class-undo { grid-area: undo; margin: 0 auto; }
  .class-grid { grid-area: grid; width: 222px; gap: 6px; }
  .class-pic { font-size: 30px; border-radius: 14px; }
  .class-note { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .face-horn, .invite-horn, .invite-box, .class-wrong .class-slots, .class-right .class-state { animation: none; }
}
