/* Every phone app fitting the phone: no scrolling, short screens, the phone held
   sideways; and Messages (with its tabs), the chat dock, the Tutorial app, the
   first Downtown order and an order's details. Loads after apps.css. */

/* Grub Dash: every screen fits the phone, no scrolling. The screen is a column;
   the part that can give (the route map, the list of offers) takes what's left. */
#screen[data-app=grubdash] { display: flex; flex-direction: column; overflow: hidden; }
#screen[data-app=grubdash] > * { flex: none; }
#screen[data-app=grubdash] .gdHero img { max-height: 14vh; width: auto; }
#screen[data-app=grubdash] .offers { flex: 0 1 auto; min-height: 0; overflow: hidden; }
#screen[data-app=grubdash] .offerBtns { margin-bottom: 8px; }
#screen[data-app=grubdash] .offer { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px; }
.offer .payRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.offer .payRow .tipLine { margin: 2px 0 0; font-size: 11px; }
.offer .payRow .within { flex: none; margin: 0; padding: 6px 10px; }
.offer .payRow .within b { font-size: 22px; }
.offer .stops { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-top: 2px dashed rgba(27, 29, 36, .18); padding-top: 6px; }
.offer .stops .rest, .offer .stops .cust { border-top: 0; padding: 0; gap: 6px; align-items: flex-start; }
.offer .stops .rest img { width: 34px; height: 34px; flex: none; }
.offer .stops .avatar { flex: none; }
.offer .stops div { font-size: 12px; min-width: 0; }
.offer .stops span { font-size: 11px; }
.offer .items.inline { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 0; font-size: 12px; }
.offer .items.inline img { width: 22px; height: 22px; }
.offer .mapWrap { position: relative; flex: 1 1 0; min-height: 70px; }
.offer .mapWrap #offerMap { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; }
.offer .mapWrap .legend { position: absolute; left: 6px; right: 6px; bottom: 6px; margin: 0; padding: 3px 6px; border-radius: 8px; background: #fff; border: 2px solid var(--gd-ink); font-size: 10px; }
#screen[data-app=grubdash] .active { flex: 0 1 auto; min-height: 0; overflow: hidden; }
/* (short screens: the Grub Dash hero gives up some room so everything still fits) */
@media (max-height: 720px) {
  #screen[data-app=grubdash] .gdHero { padding: 2px 8px 6px; }
  #screen[data-app=grubdash] .gdHero img { max-height: 44px; }
  #screen[data-app=grubdash] .gdHero h3 { margin: 2px 0; font-size: 17px; }
  #screen[data-app=grubdash] .gdHero p { margin: 0; font-size: 12px; }
  #screen[data-app=grubdash] .gdHero .radar { transform: scale(.7); margin: -12px auto; }
}
/* (offline: the burger gives up its room first, closing the gap under the
   top bar, before anything below it gets pushed down) */
#screen[data-app=grubdash] .gdHero { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; padding-top: 0; }
#screen[data-app=grubdash] .gdHero > * { flex: none; }
#screen[data-app=grubdash] .gdHero > img { flex: 0 1 110px; min-height: 36px; height: auto; max-height: none; width: auto; aspect-ratio: 1; object-fit: contain; margin: -6px 0 -4px; }

/* Messages (js/phone/apps/messages.js) */
.msgList .msgRow { width: 100%; border: 0; background: none; font: inherit; color: inherit; text-align: left; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.msgList .msgRow .ai { width: 42px; height: 42px; border-radius: 12px; box-shadow: 2px 2px 0 var(--gd-ink); flex: none; display: grid; place-items: center; }
.msgList .msgRow .ai img { width: 80%; height: 80%; object-fit: contain; }
.msgWho { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msgWho b { font: 700 13.5px/1.2 var(--gd-font); }
.msgWho small { color: var(--gd-mute); font-size: 11px; }
.msgWho span { color: var(--gd-mute); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msgList .badge { position: static; }
.msgThread { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 10px; }
.msgIn { align-self: flex-start; max-width: 88%; background: #fff; border: var(--gd-line) solid var(--gd-ink); border-radius: var(--gd-r-md); border-bottom-left-radius: 4px; box-shadow: var(--gd-sh-sm) var(--gd-sh-sm) 0 var(--gd-ink); padding: 8px 12px; display: flex; flex-direction: column; gap: 8px; }
.msgIn p { margin: 0; font: 500 13.5px/1.35 var(--gd-font); }
.msgIn .btn { margin: 0; align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; }
.msgIn small { color: var(--gd-mute); font-size: 10.5px; }

/* Multiplayer: the home screen's dock is chat */
.chatDock { flex-direction: column; justify-content: flex-start; gap: 8px; padding: 10px; background: rgba(27, 29, 36, .72); border-radius: var(--gd-r-lg); box-shadow: var(--gd-sh) var(--gd-sh) 0 var(--gd-ink); }
.chatDock .cdLog { max-height: 78px; overflow-y: auto; font: 500 12.5px/1.35 var(--gd-font); color: #fff; padding: 0 4px; }
.chatDock .cdLog p { margin: 2px 0; word-wrap: break-word; }
.chatDock .cdLog p b { color: #8cc4ff; margin-right: 4px; }
.chatDock .cdLog p.me b { color: #ffb08a; }
.chatDock .cdLog p.sys { color: #ffe08a; }
.chatDock .cdLog .muted { color: rgba(255,255,255,.7); }
.chatDock .cdRow { display: flex; gap: 6px; align-items: center; }
.chatDock .cdRow input { flex: 1; min-width: 0; height: 40px; border: var(--gd-line) solid var(--gd-ink); border-radius: 22px; padding: 0 14px; background: #fff; color: var(--gd-ink); font: 500 14px var(--gd-font); box-shadow: inset 2px 2px 0 rgba(27, 29, 36, .08); }
.chatDock .cdRow input:focus { outline: none; border-color: var(--gd-blue); box-shadow: 3px 3px 0 var(--gd-blue); }
.chatDock .cdRow button { flex: none; width: 40px; height: 40px; border: var(--gd-line) solid var(--gd-ink); border-radius: 50%; display: grid; place-items: center; cursor: pointer; font-size: 18px; padding: 0; }
.chatDock .cdSend { background: var(--gd-red); color: #fff; box-shadow: 2px 2px 0 var(--gd-ink); }
.chatDock .cdCog { background: rgba(255,255,255,.18); color: #fff; }
.chatDock .cdCog.on { background: var(--gd-mustard); color: var(--gd-ink); }
.chatDock .cdOpts { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(255,255,255,.12); color: #fff; border-radius: var(--gd-r-sm); padding: 8px 10px; font: 600 12.5px/1.2 var(--gd-font); }
.vehApp .vehNeed { margin: -4px 0 0; }

/* The Tutorial app (js/phone/apps/tutorial.js) */
.tutList { list-style: none; margin: 0 0 12px; padding: 0 12px; display: flex; flex-direction: column; background: #fff; border: var(--gd-line) solid var(--gd-ink); border-radius: var(--gd-r-md); box-shadow: var(--gd-sh-sm) var(--gd-sh-sm) 0 var(--gd-ink); }
.tutList li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font: 600 12.5px/1.2 var(--gd-font); color: var(--gd-mute); }
.tutList li + li { border-top: 2px dashed rgba(27, 29, 36, .14); }
.tutList li i { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font: 700 10.5px/1 var(--gd-font); font-style: normal; background: #eceef3; color: var(--gd-ink); border: 2px solid var(--gd-ink); }
.tutList li.done { color: var(--gd-ink); }
.tutList li.done i { background: var(--gd-green); }
.tutList li.now { margin: 0 -12px; padding: 7px 12px; background: #fff3c4; color: var(--gd-ink); font-weight: 700; }
.tutList li.now i { background: var(--gd-dash); box-shadow: 0 0 0 3px rgba(255, 138, 42, .3); }
.tutDone { min-height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 18px 6px; gap: 10px; }
.tutDone .big { width: 96px; height: 96px; margin: 0 auto 6px; border-radius: 50%; display: grid; place-items: center; background: var(--gd-green); color: var(--gd-ink); font-size: 56px; border: 3px solid var(--gd-ink); box-shadow: 4px 4px 0 var(--gd-ink); animation: gd-popin .4s cubic-bezier(.2, 1.6, .4, 1); }
.tutDone h2 { margin: 6px 0 0; font: 700 26px/1.05 var(--gd-font); text-transform: uppercase; letter-spacing: .03em; }
.tutDone p { margin: 0 0 10px; color: var(--gd-mute); font: 500 13.5px/1.4 var(--gd-font); }
.tutDone .btn { align-self: stretch; }
#screen[data-app=tutorial] { overflow-y: auto; }

/* The wide (sideways) phone on a short screen: more icons a row, and Joe's
   vehicles side by side (the 3D view left, the rest right), so they fit. */
@media (orientation: landscape) and (max-height: 520px) {
  body.touch .apps { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px 6px; }
  body.touch .wall { margin: 2px 4px 8px; font-size: 18px; }
  body.touch .dock { padding: 6px; }
  body.touch .vehApp { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: min-content; grid-auto-flow: row dense; column-gap: 12px; row-gap: 6px; align-content: start; }
  body.touch .vehApp > * { grid-column: 2; }
  body.touch .vehApp > .vehStage { grid-column: 1; grid-row: 1 / span 7; min-height: 200px; height: 100%; }
  body.touch .vehApp .statTri { height: 78px; }
}

/* A phone held sideways (touch, a short screen): the in-game phone is wide and
   short (phone.css), so the apps use the width instead of scrolling: a slimmer
   app bar, and the apps with a big picture put it beside their controls.
   Same look as upright, just laid out for the space. */
@media (orientation: landscape) and (max-height: 520px) {
  html body.touch .appbar, html body.touch #phone.music .appbar { padding-top: 26px; padding-bottom: 5px; margin-bottom: 8px; }
  html body.touch .appbar b { font-size: 16px; }
  html body.touch .appbar button { width: 28px; height: 28px; }
  html body.touch #screen { padding-bottom: 10px; }
  /* Radio: the record on the left, what's playing and the controls on the right */
  html body.touch .radio { display: grid; grid-template-columns: minmax(150px, 36%) 1fr; column-gap: 16px; row-gap: 6px; align-items: center; }
  html body.touch .radio .art { grid-column: 1; grid-row: 1 / span 5; height: 100%; min-height: 150px; }
  html body.touch .radio .disc { width: 104px; height: 104px; }
  html body.touch .radio > :not(.art) { grid-column: 2; }
  html body.touch .radio .times { margin-top: -4px; }
  html body.touch .radio .replay, html body.touch .radio .tracks { grid-column: 1 / -1; }
  /* Maps: the whole map on the left, the places and directions on the right */
  html body.touch #screen[data-app="maps"] { display: grid; grid-template-columns: auto 1fr; grid-auto-rows: min-content; column-gap: 12px; align-content: start; }
  html body.touch #screen[data-app="maps"] > * { grid-column: 2; }
  html body.touch #screen[data-app="maps"] > .appbar { grid-column: 1 / -1; }
  html body.touch #screen[data-app="maps"] > .mapWrap { grid-column: 1; grid-row: 2 / span 30; width: min(calc(100vh - 124px - env(safe-area-inset-bottom, 0px)), 46vw); align-self: start; } /* (the whole map in view, clear of an iPhone's home bar) */
  /* Grub Dash: tighter, so going online and picking an area fit without scrolling */
  html body.touch .gdHero { padding: 0 6px; }
  html body.touch .gdHero h3 { margin: 2px 0; font-size: 18px; }
  html body.touch .gdHero p { font-size: 13px; }
  html body.touch .gdStats { margin-top: 8px; }
  html body.touch .gdStats div { padding: 6px; }
  html body.touch .areaSwitch { margin-top: 8px; padding: 8px 10px; gap: 4px; }
  /* Profile: the picture beside your name, and the stats in one row */
  html body.touch .profile .avatarBtn img { width: 64px; height: 64px; }
  html body.touch .profile { margin-bottom: 8px; }
  html body.touch .grid2 { grid-template-columns: repeat(4, 1fr); }
  /* Multiplayer and the other heroes: a little less air */
  html body.touch .mechHero { padding: 0 12px 2px; }
  html body.touch .mechHero .big { font-size: 32px; }
  html body.touch .mechHero h3 { margin: 4px 0; }
}
/* (Grub Dash: the first Downtown order after its card's "Let's go!" has more time) */
.offer .firstCity { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 6px 10px; border: 2px solid var(--gd-ink); border-radius: var(--gd-r-sm); background: #dcebff; color: var(--gd-ink); font: 700 12.5px/1.25 var(--gd-font); }
/* Messages: Texts, Chat and Logs (js/phone/apps/messages.js); Chat and Logs
   are a line each, with the time on the game's clock under it on the right.
   The bar and the tabs stay put while what's under them scrolls (in Chat the
   box to type in stays at the bottom). */
#screen[data-app="messages"] { display: flex; flex-direction: column; }
#screen[data-app="messages"] > * { flex: none; }
#screen[data-app="messages"] > .logList, #screen[data-app="messages"] > .msgList, #screen[data-app="messages"] > .msgThread { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
#screen[data-app="messages"] > :is(.logList, .msgList, .msgThread)::-webkit-scrollbar { display: none; }
#screen[data-app="messages"] > .chatRow { margin: 8px 0 0; }
.msgTabs { margin: 0 0 10px; }
.msgTabs .badge { position: static; display: inline-flex; width: 18px; height: 18px; font-size: 10px; margin-left: 6px; vertical-align: 1px; border: 0; animation: none; }
.logList { display: flex; flex-direction: column; gap: 6px; padding: 0 0 10px; }
.logLine { background: #fff; border: 2px solid var(--gd-ink); border-radius: var(--gd-r-sm); padding: 6px 10px 5px; }
.logLine p { margin: 0; font: 500 13px/1.35 var(--gd-font); overflow-wrap: anywhere; }
.logLine small { display: block; text-align: right; color: var(--gd-mute); font-size: 10px; font-weight: 700; margin-top: 2px; }
.chatList .logLine p b { color: var(--gd-blue); margin-right: 4px; }
.chatList .logLine.me { background: var(--gd-mustard); }
.chatList .logLine.me p b { color: var(--gd-ketchup); }
.chatList .logLine.sys { background: #fff6e5; }
.chatList .logLine.sys p { color: #7a4a00; }
.chatList .logLine.sys p b { color: #c77700; }
/* an order's details: the tip in green, a clock by the time limit, the customer's face */
.tipLine .tipUp { color: var(--gd-green-dk); }
.within b .gl { width: .8em; height: .8em; vertical-align: -0.06em; margin-right: 4px; }
.avatar.face { background: var(--gd-purple); overflow: hidden; }
.avatar.face img { width: 100%; height: 100%; object-fit: cover; }
