/* Phones and tablets — measured on the original (inspin.me, v3892): one switch at 950px wide. Narrower, the
   game stacks: a 60px header (☰ first, then the coins and the header's buttons), the table under it at the width
   of the screen, then the messenger filling the rest — its tabs (38px), the messages, the input row (50px). The
   side rail, the leaders' strip and the footer are not there: the rail's buttons are in the ☰ drawer, the photo
   feed is a tab of the chat, the music player sits inside the music tab (main.js moves them). Windows open full
   screen. The original also makes everything a little smaller on small screens (its root font 11 → 8px). */

/* only on phones and tablets: the ☰ of the header, the photo-feed tab */
.m-menu, .mtab.m-only { display: none !important; }
.chat-body > .chat-feed, .chat-body > .chat-music-video { display: none; }

@media (max-width: 950px) {
  /* the pause page in the table's (small) area: "back to the table" and "another table" stay in sight at its bottom
     while the rest scrolls under them */
  .ps-buttons { position: sticky; bottom: 0; z-index: 3; margin: 0 -8px; padding: 14px 8px 10px; background: linear-gradient(180deg, rgba(26, 10, 52, 0) 0%, rgba(26, 10, 52, .88) 34%); }
  .ps-buttons .ps-faq { display: none; }
  html, body, #app { height: 100%; height: 100dvh; }
  /* a private conversation on a phone: the messages get the room — 🗑, 🚫, "ask for a subscription" and the day's
     limit are in the bar's ⋯ menu, and the quick gift row is left out (gifts: the profile, the 🎁 by the message box) */
  .dm-bar .dm-del, .dm-bar .dm-block, .dm-askbar, .dm-gifts.small, .dm-msgs + .dm-quota { display: none; }
  .dm-bar .dm-dots { display: grid; margin-inline-start: auto; }
  .chat.in-conv .chat-header { display: none; }

  /* the frame: header + table on top, the messenger below */
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: min(calc(83vw + 104px), 54vh, 54dvh) minmax(0, 1fr); }
  .rail, .footer { display: none !important; }
  .room { grid-column: 1; grid-row: 1; }
  .messenger { grid-column: 1; grid-row: 2; min-height: 0; }
  /* paused: the pause screen gets the whole phone (the chat is off in pause mode anyway) */
  body.paused .shell { grid-template-rows: minmax(0, 1fr) 0; }
  /* …but the lists and windows opened from ☰ (leaders, leagues, the shop …) are drawn in the messenger, full screen:
     only the chat itself is gone, they still open (2026-11-01: on a phone nothing opened in pause mode) */
  body.paused .messenger { min-height: 0; height: 0; overflow: visible; }
  body.paused .messenger > :not(.room-screen) { display: none; }
  .room .table { padding: 60px 0 12px; }

  /* the header: ☰, the coins and the buttons the panel shows on phones, spread over the width */
  /* (a tablet keeps them together in the middle, like the original's 500px group; a phone spreads them) */
  .topbar { height: 60px; gap: 10px; padding: 0 6px; justify-content: center; overflow-x: auto; scrollbar-width: none; }
  .topbar::-webkit-scrollbar { display: none; }
  .m-menu { display: grid !important; }
  .m-hide, .top-spacer { display: none !important; }
  /* the table switch and the pause sit on the table's top corner (layout.js phonePair): no room for them in the header */
  .topbar .m-pair { display: none !important; }
  .m-tablebtns { display: flex; position: absolute; top: 61px; left: 4px; z-index: 7; gap: 4px; direction: ltr; }
  .m-tablebtns .top-btn { width: 32px; height: 32px; font-size: 16px; border-radius: 9px; }
  .top-btn { flex: none; width: 40px; height: 40px; font-size: 20px; border-radius: 11px; }
  .coins-btn { flex: none; height: 40px; padding-block: 0; padding-inline: 10px 4px; font-size: .95rem; }
  .league-badge { flex: none; min-width: 0; height: 40px; padding-block: 0; padding-inline: 3px 8px; gap: 4px; }
  /* the league points stay on a phone too (2026-11-09, the owner: everyone sees every point, live); the day's timer is in
     the league window */
  .league-badge .lb-time { display: none; }
  .league-badge .lb-pts { font-size: 12px; white-space: nowrap; }
  .lb-num { width: 32px; height: 32px; }

  /* the messenger: tabs, messages, input */
  /* the tabs: one soft lilac capsule, the open tab a white pill in it (the owner's choice, 2026-10-30) */
  .mtabs { height: 42px; align-items: stretch; margin: 6px 8px 2px; padding: 4px; gap: 2px; background: #efe8fb; border-radius: 12px; }
  .mtabs .mtab { height: auto; background: transparent; color: #9a86c4; border-radius: 9px; box-shadow: none; }
  .mtabs .mtab.on { background: #fff; color: #7957b2; box-shadow: 0 0 0 1px #d9cbf3; }
  /* (the feed's tab, phones only: a grid like the others, its icon in the middle) */
  .mtab.m-only { display: grid !important; }
  .mtab svg { width: 22px; height: 20px; }
  .chat-input-row { height: 50px; }
  /* the side buttons beside the table's messages (about the table, your design, songs on/off, game sounds on/off),
     a little smaller than on a computer */
  .side-btns { top: 6px; inset-inline-end: 8px; gap: 6px; }
  .side-btn { width: 30px; height: 30px; font-size: 14px; }
  .side-btn.music, .side-btn.sound { font-size: 13px; }
  .chat-body.with-side > div:not(.side-btns) { padding-inline-end: 12px; }
  .chat-body.with-side:has(.cs-fab-slot:not([hidden])) > div:not(.side-btns) { padding-inline-end: 46px; }

  /* the photo feed as a tab, like the original's on a phone (v3894, 375px): four photos a row (84×131, 8px apart,
     the name and the age on the photo), no title and no message box, and "to the leaders" as a green bar kept at
     the bottom with its price in an orange pill */
  .on-feed .chat-header, .on-feed .chat-input-row { display: none; }
  .chat-body > .chat-feed:not([hidden]) { display: block; flex: 1; min-height: 0; overflow-y: auto; background: #fff; }
  .chat-feed .feed { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 100%; height: auto; padding: 8px 8px 0; overflow: visible; background: #fff; }
  .chat-feed .feed-list { flex: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-content: start; }
  .chat-feed .feed-item { width: 100%; height: auto; aspect-ratio: 84 / 131; margin: 0; border-radius: 10px; border-width: 2px; border-color: var(--nc, #e3dcef); background: #e7e7e7; box-shadow: 0 0 0 1px rgba(43, 26, 85, .12); }
  .chat-feed .feed-name { display: flex; font-size: 12px; padding: 4px 4px; }
  .chat-feed .feed-bar { order: 3; position: sticky; bottom: 0; z-index: 2; flex: none; display: flex; align-items: center; gap: 6px; height: 48px; margin: 2px 4px 10px;
    padding-inline: 16px 7px; border-radius: 10px; background: #01c138; box-shadow: 0 -6px 10px #fff; }
  .chat-feed .feed-buy { flex: 1; min-width: 0; width: auto; max-width: none; height: 100%; padding: 0; overflow: visible; flex-direction: row; align-items: center; justify-content: space-between; border-radius: 0; background: none; box-shadow: none; }
  /* pause / resume beside the price: a clear white button with its words and a drawn icon (two bars / a triangle,
     centred by construction — a ⏸ character sits off-centre in many fonts); orange while the feed is paused */
  .chat-feed .feed-pause { order: 2; flex: none; align-self: center; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px;
    border-radius: 10px; background: #fff; color: #018a28; font-size: 13px; font-weight: 700; white-space: nowrap; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
  .chat-feed .feed-pause::before { content: ''; flex: none; width: 11px; height: 13px; background: linear-gradient(90deg, currentColor 0 36%, transparent 36% 64%, currentColor 64%); border-radius: 1px; }
  .chat-feed .feed-pause .fp-long { display: none; }
  .chat-feed .feed-pause .fp-short { display: inline; }
  .chat-feed .feed-pause.on { background: #fdaa26; color: #fff; }
  .chat-feed .feed-pause.on::before { width: 11px; height: 13px; background: currentColor; clip-path: polygon(0 0, 100% 50%, 0 100%); }
  .chat-feed .feed-buy img { display: none; }
  .chat-feed .feed-buy-text { font-size: 15px; font-weight: 600; text-align: start; text-shadow: none; }
  .chat-feed .feed-buy-price { margin: 0; height: 34px; display: inline-flex; align-items: center; gap: 4px; padding: 0 12px; border-radius: 10px; background: #fdaa26; font-size: 14px; font-weight: 700; }

  /* the music player inside the music tab, above its lists */
  .chat-body:has(> .chat-music-video:not([hidden])) { flex-direction: column; }
  .chat-body > .chat-music-video:not([hidden]) { display: block; flex: none; }
  .chat-music-video .video-player { height: auto; max-height: 34vh; overflow: hidden; }
  /* the music tab on a phone: no title row and no message box (the lists get the room) */
  .on-music .chat-header { display: none; }
  /* playing: a small player on Now playing … */
  .chat-music-video .video-player:has(> .vp-stage:not([hidden])) { height: 132px; max-height: none; }
  /* … and a mini strip while searching or browsing: the picture small at the start, the song's name beside it */
  .chat-body:not([data-mu="now"]) > .chat-music-video .video-player:has(> .vp-stage:not([hidden])) { height: 64px; }
  .chat-body:not([data-mu="now"]) > .chat-music-video .vp-stage { display: flex; align-items: stretch; background: #17121f; }
  .chat-body:not([data-mu="now"]) > .chat-music-video .vp-stage > div:first-child { position: relative; inset: auto; flex: 0 0 114px; width: 114px; height: 64px; }
  .chat-body:not([data-mu="now"]) > .chat-music-video .vp-stage iframe { width: 114px; height: 64px; }
  .chat-body:not([data-mu="now"]) > .chat-music-video .vp-stage .vp-info { position: static; flex: 1; min-width: 0; padding: 6px 10px; background: none; flex-wrap: nowrap; }
  .chat-body:not([data-mu="now"]) > .chat-music-video .vp-info .vp-buttons { display: none; }
  /* the music lists on a phone: a slimmer sub-tab bar and search controls, so more songs show at once */
  .mu-tabs { padding: 4px 4px 3px; }
  .mu-tab { gap: 1px; font-size: 10px; }
  .mu-tab i { width: 24px; height: 24px; }
  .mu-tab i svg { width: 18px; height: 18px; }
  .mu-src { padding: 1px; }
  .mu-src > * { min-height: 26px; padding-block: 0; font-size: 12px; }
  .mu-search { height: 34px; }
  /* nothing playing: the "turn the video on" bar is slim, and out of the way while searching or browsing */
  .chat-body:not([data-mu="now"]) > .chat-music-video .video-player:has(> .vp-stage[hidden]) { display: none !important; }
  /* outside the music tab the table's song plays on: its player stays in the page — invisible, never in the way of a
     tap, at YouTube's smallest player size (200 × 200). Hidden (display: none, 0 × 0) a phone's Chrome, the Android
     app and Safari paused the muted song and it never sounded: "no songs, no sound" (the owner, 2026-11-12) */
  .chat-body > .chat-music-video[hidden]:has(.vp-stage:not([hidden])) { display: block !important; position: fixed; left: 0; bottom: 0; width: 200px; height: 200px; opacity: .01; pointer-events: none; overflow: hidden; }
  .chat-body > .chat-music-video[hidden] .video-player { display: block !important; width: 200px !important; height: 200px !important; max-height: none !important; }
  .chat-body > .chat-music-video[hidden] .vp-stage { display: block !important; width: 200px; height: 200px; }
  .chat-body > .chat-music-video[hidden] .vp-stage > div:first-child, .chat-body > .chat-music-video[hidden] .vp-stage iframe { position: absolute !important; inset: 0 !important; width: 200px !important; height: 200px !important; flex: none !important; }
  .chat-body > .chat-music-video[hidden] .vp-info, .chat-body > .chat-music-video[hidden] .vp-tap, .chat-body > .chat-music-video[hidden] .vp-idle { display: none !important; }
  /* idle: a short bar ("play your music" · turn the video on); playing: the 16:9 picture */
  .chat-music-video .vp-idle { position: static; flex-direction: row; justify-content: space-between; gap: 10px; padding: 6px 12px; }
  .chat-music-video .vp-idle-text { font-size: 13px; max-width: none; text-align: start; }
  .chat-music-video .btn.vp-on { padding: .45em 1em; font-size: 12px; flex: none; }

  /* windows (profiles, gift screen, leagues …) take the whole screen, like the original's */
  .room-screen { position: fixed; inset: 0; z-index: 50; }
  .md { width: min(322px, 88vw); }
}

/* small screens: a little smaller, as the original does (by width or by height) */
@media (max-width: 950px) and (max-width: 450px), (max-width: 950px) and (max-height: 700px) {
  .topbar { gap: 3px; padding: 0 4px; justify-content: space-between; }
  .top-btn { width: 38px; height: 38px; font-size: 19px; }
  .coins-btn { height: 38px; font-size: .9rem; }
}
@media (max-width: 950px) and (max-width: 359px), (max-width: 950px) and (max-height: 600px) {
  .topbar { gap: 2px; padding: 0 3px; }
  .top-btn { width: 34px; height: 34px; font-size: 17px; }
  .coins-btn { height: 34px; font-size: .82rem; padding-block: 0; padding-inline: 5px 3px; }
  .lb-num { width: 28px; height: 28px; }
  .league-badge { height: 34px; padding-inline: 1px 4px; gap: 2px; }
  .league-badge .lb-pts { font-size: 11px; }
}

/* a short screen: the table takes a little more of the height, with less room above and below the ring */
@media (max-width: 950px) and (max-height: 700px) {
  .shell { grid-template-rows: min(calc(83vw + 96px), 58vh, 58dvh) minmax(0, 1fr); }
  .room .table { padding: 52px 0 10px; }
}


/* a tablet held upright (iPad and the like): the table may take more of the tall screen (the chat keeps over a
   third), so the seats are not small on a big screen */
@media (min-width: 600px) and (max-width: 950px) and (orientation: portrait) {
  .shell { grid-template-rows: min(calc(83vw + 104px), 64vh, 64dvh) minmax(0, 1fr); }
}

/* a phone turned sideways (short and wide): the chat beside the table, on the side a line starts from (the grid
   follows the page's direction), the table in the rest — the original pushes its chat off the screen there */
@media (max-width: 950px) and (orientation: landscape) and (max-height: 500px) {
  .shell { grid-template-columns: min(340px, 44vw) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .messenger { grid-column: 1; grid-row: 1; }
  .room { grid-column: 2; grid-row: 1; }
  .room .table { padding: 52px 0 10px; }
  .mtabs { height: 34px; }
  .chat-input-row { height: 46px; }
}

/* a phone held upright, typing in the chat (the keyboard open): the chat takes the whole screen, like a messenger —
   the table and its top bar step aside until the keyboard closes (my turn to kiss still shows: table.js floatKiss).
   A player who chose "inside the chat" (mlayout.js) keeps the table in sight while typing. */
@media (max-width: 950px) and (orientation: portrait) {
  html:not([data-mob-layout="inline"]) .shell:has(.chat.typing) { grid-template-rows: 0 minmax(0, 1fr); }
  html:not([data-mob-layout="inline"]) .shell:has(.chat.typing) > .room { display: none; }
}

/* "inside the chat" (mlayout.js, the owner 2026-11-12): the windows (gift screen, profiles, the shop …) open in the
   chat's own area, as on a computer — the table stays in sight above them (in pause mode they keep the whole screen) */
@media (max-width: 950px) {
  html[data-mob-layout="inline"] body:not(.paused) .messenger { position: relative; }
  html[data-mob-layout="inline"] body:not(.paused) .messenger > .room-screen { position: absolute; inset: 0; z-index: 30; }
}
/* a foldable phone opened (Galaxy Z Fold 2–7: about 880 × 1100, nearly square) or a tablet held upright: the
   tablet layout (the owner, 2026-11-12) — the table on top in its own proportions (the ring as on a computer,
   table.js PHONE leaves it out: big cards, no seats stretched over the width), the chat under it. The table stays
   in sight while typing (the keyboard only makes the page shorter). */
@media (min-width: 700px) and (max-width: 950px) and (min-aspect-ratio: 3/4) {
  .shell, .shell:has(.chat.typing) { grid-template-columns: minmax(0, 1fr); grid-template-rows: min(calc(86vw + 76px), 70vh, 70dvh) minmax(0, 1fr); }
  .shell:has(.chat.typing) > .room { display: flex; }
}

/* "inside the chat" while typing (the keyboard takes half the phone — the owner, 2026-11-12: one line of chat was
   left): the play area moves up and gets smaller — its top bar steps aside, the table keeps about a third of what
   is left (the seats and the bottle still in sight) — and the chat's tab bar and title go until the keyboard closes,
   so the messages get the room. (Not in pause mode; in any orientation: the keyboard can make the page wider than tall.) */
@media (max-width: 950px) {
  html[data-mob-layout="inline"] body:not(.paused) .shell:has(.chat.typing) { grid-template-columns: minmax(0, 1fr); grid-template-rows: min(36vh, 36dvh, calc(60vw + 40px)) minmax(0, 1fr); }
  html[data-mob-layout="inline"] body:not(.paused) .shell:has(.chat.typing) > .room { grid-column: 1; grid-row: 1; display: flex; }
  html[data-mob-layout="inline"] body:not(.paused) .shell:has(.chat.typing) > .messenger { grid-column: 1; grid-row: 2; }
  html[data-mob-layout="inline"] body:not(.paused) .shell:has(.chat.typing) :is(.topbar, .m-tablebtns) { display: none; }
  html[data-mob-layout="inline"] body:not(.paused) .shell:has(.chat.typing) .room .table { padding: 6px 0 4px; }
  html[data-mob-layout="inline"] .chat.typing > .mtabs, html[data-mob-layout="inline"] .chat.typing > .chat-header { display: none; }
}

/* its button under the chat's floating arrow: phones and tablets only */
@media (min-width: 951px) { .side-btn.side-layout { display: none !important; } }

/* Inside Telegram (a Mini App, html.tg — telegram.js): full screen, Telegram's ✕ / back and ⋯ buttons and the phone's
   bars lie over the page. The room they take (--tg-top …, from Telegram) is kept free: the game, its windows, the ☰
   drawer, the dialogs and the messages that float on top all stay inside it. Outside Telegram the values are 0. */
html.tg { --tgt: var(--tg-top, 0px); --tgb: var(--tg-bottom, 0px); --tgl: var(--tg-left, 0px); --tgr: var(--tg-right, 0px); }
html.tg body { background: #1a0a34; }
html.tg #app { box-sizing: border-box; padding: var(--tgt) var(--tgr) var(--tgb) var(--tgl); }
html.tg #layer, html.tg .md-wrap, html.tg .room-screen, html.tg .ls-wrap, html.tg .ban-page, html.tg .ag-page {
  top: var(--tgt); bottom: var(--tgb); left: var(--tgl); right: var(--tgr); }
html.tg #toasts { top: calc(64px + var(--tgt)); }
html.tg .kiss-float { top: calc(10px + var(--tgt)); }
/* Number puzzle (numguess.js) on phones: the card at the top of the chat kept short — the range beside the box, the
   last guesses in a small scrolling list */
@media (max-width: 950px) {
  .hc-win { margin: 4px 6px; padding: 6px 8px; }
  .hc-chain i { font-size: 12px; }
  .cups-win { margin: 4px 6px; padding: 6px 8px; }
  .cups-stage { height: 80px; }
  .cups-cup { width: 46px; height: 52px; margin-left: -23px; }
  .cups-stage.open .cups-cup { transform: translateY(-28px); }
  .lvd-win { margin: 4px 6px; padding: 6px 8px; }
  .ll-strip { margin: 4px 6px; padding: 3px 8px; width: calc(100% - 12px); }
  .ll-strip > b { font-size: 12px; }
  .cq-win { margin: 4px 6px; padding: 6px 8px; }
  .cq-q { font-size: 14px; margin: 3px 0 5px; }
  .cq-btn { min-height: 38px; font-size: 13px; }
  .bgs-win { margin: 4px 6px; padding: 5px 8px; }
  .bgs-head b { font-size: 13px; }
  .bgs-pick { width: 46px; }
  .bgs-pick img { width: 32px; height: 32px; }
  .ng-win { margin: 4px 6px; padding: 6px 8px; }
  .ng-range { margin: 3px 0; font-size: 15px; }
  .ng-in { height: 32px; font-size: 16px; }
  .ng-go { padding-top: 4px; padding-bottom: 4px; }
  .ng-note { margin-top: 2px; font-size: 11px; }
  .ng-list { max-height: 64px; overflow-y: auto; margin-top: 4px; }
}
/* Table rainbow (rainbow.js) on phones: the card kept short */
@media (max-width: 950px) {
  .rb-win { margin: 4px 6px; padding: 6px 8px; }
  .rb-want { margin: 3px 0; }
  .rb-mine { margin-bottom: 4px; }
  .rb-go { height: 40px; font-size: 18px; }
}
