/* The phone itself: frame, status bar, peek, mini player, and the shared building blocks
   used by apps (app bars, buttons, lists, toggles, segmented controls).
   The look is the Sticker Street kit's (css/kit/, tokens --gd-*): a 2.5px ink outline,
   a hard offset shadow, flat brand colors, Fredoka; pressed slides into its shadow,
   locked is hatched and dashed. */

#screen { touch-action: pan-y; }
#topLeft .row1 { display: flex; gap: 8px; }
.money.neg { color: var(--gd-ketchup); }
/* ---------- phone ---------- */
#phoneWrap { position: fixed; right: 24px; bottom: 0; z-index: 20; transform: translateY(calc(100% - 64px)); transition: transform .45s cubic-bezier(.2,1.2,.4,1); }
#phoneWrap:not(.open) #phone { cursor: pointer; }
#phoneWrap:not(.open):hover { transform: translateY(calc(100% - 72px)); }
#phoneWrap.open { transform: translateY(-20px); }
#phoneWrap:not(.open) #screen { pointer-events: none; }
#peek { position: absolute; top: 40px; left: 24px; right: 24px; display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; transition: opacity .2s; z-index: 2; pointer-events: none; }
#phoneWrap.open #peek { opacity: 0; }
#peek .pk { display: flex; align-items: center; gap: 6px; background: #fff; color: var(--gd-ink); border: 2px solid var(--gd-ink); box-shadow: 2px 2px 0 var(--gd-ink); padding: 2px 10px 2px 3px; border-radius: 10px; font: 700 13px/1.2 var(--gd-font); }
#peek .pbadge { background: var(--gd-red); color: #fff; border: 2px solid var(--gd-ink); box-shadow: 2px 2px 0 var(--gd-ink); font: 700 12px/1.2 var(--gd-font); padding: 2px 9px; border-radius: 10px; animation: pop 1s infinite; }
#peek .pmusic { background: var(--gd-pink); color: #fff; border: 2px solid var(--gd-ink); box-shadow: 2px 2px 0 var(--gd-ink); font: 700 12px/1.2 var(--gd-font); padding: 2px 9px; border-radius: 10px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.touch.driving #phoneWrap:not(.open) { transform: translateY(110%); }
#phone { position: relative; width: 330px; height: min(660px, calc(100vh - 40px)); background: #15171d; border: 3px solid var(--gd-ink); border-radius: 46px; padding: 11px; box-shadow: 6px 6px 0 var(--gd-ink); display: flex; flex-direction: column; }
.notch { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); width: 88px; height: 22px; background: #000; border-radius: 12px; z-index: 3; }
#screen { flex: 1; border-radius: 35px; overflow-y: auto; overflow-x: hidden; background: var(--gd-dots), var(--gd-cream); color: var(--gd-ink); padding: 48px 14px 14px; scrollbar-width: none; }
#screen::-webkit-scrollbar { display: none; }
#phoneClose { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--gd-ink); background: #fff; color: var(--gd-ink); font-size: 12px; }
/* app bars: one flat brand color, an ink edge underneath, the title in capitals */
.appbar { --c: var(--gd-app-red); display: flex; align-items: center; justify-content: space-between; margin: -48px -14px 12px; padding: 46px 12px 11px; color: #fff; background: var(--c); border-bottom: var(--gd-line) solid var(--gd-ink); }
.appbar b { flex: 1; text-align: center; font: 700 18px/1 var(--gd-font); text-transform: uppercase; letter-spacing: .03em; text-shadow: 2px 2px 0 rgba(0, 0, 0, .2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar button { background: #fff; border: var(--gd-line) solid var(--gd-ink); box-shadow: 2px 2px 0 var(--gd-ink); color: var(--gd-ink); width: 34px; height: 34px; border-radius: 9px; font-size: 20px; line-height: 1; }
.appbar span { min-width: 34px; }
.appbar.red { --c: var(--gd-app-red); }
.appbar.blue { --c: var(--gd-app-blue); }
.appbar.green { --c: var(--gd-app-green); }
.appbar.purple { --c: var(--gd-app-purple); }
.appbar.gray { --c: var(--gd-app-gray); }
.appbar.dark { --c: var(--gd-app-dark); }
.appbar.orange { --c: var(--gd-app-orange); }
.appbar.pink { --c: var(--gd-app-pink); }
.appbar.steel { --c: var(--gd-app-steel); }
.appbar.angel { --c: var(--gd-app-angel); }
.appbar.angel b { color: var(--gd-ink); text-shadow: none; }
/* buttons: a sticker that slides into its shadow when pressed */
.btn { --c: var(--gd-paper); --t: var(--gd-ink); --sc: var(--gd-ink); position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px; margin-top: 10px; padding: 6px 18px;
  border: var(--gd-line) solid var(--sc); border-radius: var(--gd-r); box-shadow: var(--gd-sh) var(--gd-sh) 0 var(--sc); background: var(--c); color: var(--t);
  font: 700 14px/1.1 var(--gd-font); text-transform: uppercase; letter-spacing: .04em; text-align: center; text-wrap: balance; cursor: pointer; transition: transform .06s, box-shadow .06s, filter .1s; -webkit-tap-highlight-color: transparent; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: calc(var(--gd-sh) + 1px) calc(var(--gd-sh) + 1px) 0 var(--sc); filter: brightness(1.05); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--sc); }
.btn.primary { --c: var(--gd-red); --t: #fff; text-shadow: 1px 1px 0 rgba(0, 0, 0, .25); }
.btn.ghost { --c: var(--gd-paper); }
.btn.danger { --c: var(--gd-paper); --t: var(--gd-ketchup); --sc: var(--gd-ketchup); box-shadow: var(--gd-sh-sm) var(--gd-sh-sm) 0 var(--sc); }
.btn.small { min-height: 34px; padding: 5px 12px; font-size: 12px; border-radius: var(--gd-r-sm); box-shadow: var(--gd-sh-sm) var(--gd-sh-sm) 0 var(--sc); width: auto; margin: 0; }
.btn.big { min-height: 56px; padding: 6px 26px; font-size: 19px; border-radius: var(--gd-r-md); }
.two { display: flex; gap: 10px; }
.kbi { display: inline-flex; }
.muted { color: var(--gd-mute); }
.center { text-align: center; }
.small { font-size: 12px; }
.neg { color: var(--gd-ketchup); }
.pos { color: var(--gd-green-dk); }
/* lists: a white card with dashed lines between its rows */
.list { 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); overflow: hidden; }
.row { display: flex; justify-content: space-between; align-items: center; padding: 10px 13px; min-height: 48px; border-bottom: 2px dashed rgba(27, 29, 36, .18); font: 500 14px/1.25 var(--gd-font); gap: 10px; }
.row:last-child { border: 0; }
.toggle { width: 52px; height: 30px; flex: none; border-radius: 15px; background: #e8dcbf; border: var(--gd-line) solid var(--gd-ink); position: relative; padding: 0; cursor: pointer; }
.toggle i { position: absolute; left: 2px; top: 50%; width: 21px; height: 21px; margin-top: -10.5px; border-radius: 50%; background: #fff; border: 2px solid var(--gd-ink); transition: left .15s; }
.toggle.on { background: var(--gd-green); }
.toggle.on i { left: calc(100% - 23px); }
/* sliders: an ink-outlined track filling with color up to a white thumb (--v: phone/kit.js fillRanges) */
:is(#screen, #miniPlayer, #menu) input[type=range] { --v: 50; --c: var(--gd-pink); --th: 24px; --fill: calc(var(--th) / 2 + (100% - var(--th)) * var(--v) / 100);
  -webkit-appearance: none; appearance: none; height: 14px; border: 2px solid var(--gd-ink); border-radius: 8px; background: linear-gradient(90deg, var(--c) 0 var(--fill), #fff var(--fill)); outline: none; margin: 6px 0; }
:is(#screen, #miniPlayer, #menu) input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: var(--th); height: var(--th); border-radius: 50%; background: #fff; border: var(--gd-line) solid var(--gd-ink); box-shadow: 2px 2px 0 var(--gd-ink); cursor: pointer; }
:is(#screen, #miniPlayer, #menu) input[type=range]::-moz-range-thumb { box-sizing: border-box; width: var(--th); height: var(--th); border-radius: 50%; background: #fff; border: var(--gd-line) solid var(--gd-ink); box-shadow: 2px 2px 0 var(--gd-ink); }
#miniPlayer input[type=range] { --th: 18px; height: 10px; margin: 0; }
@media (max-width: 700px), (max-height: 520px) {
  #phoneWrap { left: 0; right: 0; display: flex; justify-content: center; }
  #phoneWrap.open { transform: translateY(-8px); }
  #phone { width: min(360px, 94vw); height: min(680px, calc(100vh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))); }
}
.listHead { margin: 4px 2px 8px; font: 700 11px/1.2 var(--gd-font); letter-spacing: .1em; text-transform: uppercase; color: var(--gd-mute); }
.row.col { flex-direction: column; align-items: stretch; gap: 8px; }
/* segmented tabs: the one that's on is a mustard sticker */
.seg { display: flex; gap: 3px; background: #fff; border: var(--gd-line) solid var(--gd-ink); border-radius: var(--gd-r); box-shadow: var(--gd-sh-sm) var(--gd-sh-sm) 0 var(--gd-ink); padding: 3px; }
.seg button { flex: 1 1 auto; min-width: min-content; border: 2px solid transparent; background: none; padding: 7px 5px; border-radius: 8px; font: 700 11.5px/1.1 var(--gd-font); text-transform: uppercase; letter-spacing: .02em; color: var(--gd-mute); text-wrap: balance; cursor: pointer; }
.seg button.on { background: var(--gd-mustard); color: var(--gd-ink); border-color: var(--gd-ink); }
/* ---------- round 5: phone top, mini player, area switch ---------- */
#phoneTop { position: absolute; top: 12px; left: 12px; right: 12px; height: 38px; z-index: 5; border: 0; background: transparent; border-radius: 30px 30px 8px 8px; cursor: pointer; }
#phoneWrap.open #phoneTop:hover { background: rgba(255,255,255,.12); }
/* the music player: a white sticker with round buttons (the play button pink) */
#miniPlayer { position: absolute; top: 46px; left: 20px; right: 20px; z-index: 6; display: flex; flex-direction: column; gap: 2px; padding: 5px 7px 3px; border-radius: var(--gd-r-md); background: #fff; color: var(--gd-ink); border: var(--gd-line) solid var(--gd-ink); box-shadow: var(--gd-sh-sm) var(--gd-sh-sm) 0 var(--gd-ink); cursor: pointer; }
#miniPlayer button { width: 32px; height: 32px; border-radius: 50%; border: var(--gd-line) solid var(--gd-ink); background: #fff; color: var(--gd-ink); font-size: 13px; flex: none; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; }
#miniPlayer button:hover { background: var(--gd-cream); }
#miniPlayer .mpPlay { width: 36px; height: 36px; background: var(--gd-pink); color: #fff; box-shadow: 2px 2px 0 var(--gd-ink); font-size: 13px; }
#miniPlayer .mpPlay:hover { background: var(--gd-pink); filter: brightness(1.08); }
.mpArt { width: 38px; height: 38px; border-radius: 9px; border: 2px solid var(--gd-ink); flex: none; background: radial-gradient(circle at 30% 25%, hsl(var(--h) 90% 70%), hsl(calc(var(--h) + 40) 70% 35%)); display: flex; align-items: center; justify-content: center; }
.mpArt i { width: 22px; height: 22px; border-radius: 50%; background: repeating-radial-gradient(circle, #1b1d24 0 2px, #2b2e38 2px 3px); }
.mpArt i.spin { animation: spin 3s linear infinite; }
.mpInfo { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.mpInfo b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mpInfo small { font-size: 10.5px; color: var(--gd-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#miniPlayer .mpRow { display: flex; align-items: center; gap: 6px; height: 40px; }
#miniPlayer .mpVol { display: flex; align-items: center; gap: 6px; height: 22px; }
#miniPlayer .mpVol button { width: 22px; height: 22px; font-size: 11px; border-width: 2px; }
#miniPlayer .mpVol button:hover { background: var(--gd-cream); }
#mpVol { flex: 1; min-width: 0; cursor: pointer; }
body.touch #mpVol { --th: 22px; height: 12px; }
#phone.music #screen { padding-top: 128px; }
#phone.music .appbar { margin-top: -128px; padding-top: 126px; }
/* collapsed: show the status bar and the music controls */
#phoneWrap:not(.open):has(#phone.music) { transform: translateY(calc(100% - 136px)); }
#phoneWrap:not(.open):has(#phone.music):hover { transform: translateY(calc(100% - 142px)); }
#phone.music #peek { top: 126px; }
body.touch.driving #phoneWrap:not(.open):has(#phone.music) { transform: translateY(110%); }
body:not(.touch):has(#phone.music) #prompts { bottom: 152px; }
#miniPlayer .mpClose { width: 26px; height: 26px; font-size: 11px; border-width: 2px; margin-left: -2px; }
#phoneWrap { transition: transform .3s ease-out; }
body.touch.driving #phoneWrap:not(.open), body.touch.driving #phoneWrap:not(.open):has(#phone.music) { transform: translateY(calc(100% - 64px)); }
body.touch.driving #phoneWrap:not(.open):has(#phone.music) { transform: translateY(calc(100% - 136px)); }
#homeTip { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--gd-ink); color: #fff; font: 600 12px/1.3 var(--gd-font); padding: 5px 10px; border-radius: var(--gd-r-sm); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; }
/* "Tab or click to open your phone": above the closed phone, pointing down at it */
#phoneTip { position: absolute; right: 60px; bottom: 76px; display: flex; align-items: center; gap: 6px; background: #fff; color: var(--gd-ink); border: var(--gd-line) solid var(--gd-ink); box-shadow: var(--gd-sh-sm) var(--gd-sh-sm) 0 var(--gd-ink); font: 700 13px/1.2 var(--gd-font); padding: 4px 12px 4px 5px; border-radius: var(--gd-r); pointer-events: none; transition: opacity .2s, bottom .3s ease-out; }
#phoneTip::after { content: ""; position: absolute; right: 60px; top: 100%; margin-top: 1px; width: 12px; height: 12px; background: #fff; border-right: var(--gd-line) solid var(--gd-ink); border-bottom: var(--gd-line) solid var(--gd-ink); transform: translateY(-7px) rotate(45deg); }
body:has(#phone.music) #phoneTip { bottom: 148px; }
body.touch #phoneTip, body.phone-open #phoneTip { display: none; }
.seg.small button { font-size: 10.5px; letter-spacing: 0; padding: 5px 4px; }
.btn[disabled] { --c: var(--gd-hatch); background: var(--gd-hatch); border-style: dashed; box-shadow: none; color: #8f8570; text-shadow: none; transform: none; filter: none; pointer-events: none; }
.btn small { font-size: .8em; opacity: .75; text-transform: none; letter-spacing: 0; font-weight: 600; margin-left: 4px; }
/* showroom on a phone: the phone becomes a shorter sheet so the car stays in view */
@media (max-width: 700px) {
  body.showroom #phone { height: min(58vh, 520px); }
}
.appbar.angel button { color: var(--gd-ink); }
/* Settings: tooltips off */
body.no-tips #worldTip, body.no-tips #hint, body.no-tips #phoneTip, body.no-tips #homeTip { display: none !important; }
/* app bar back button: a drawn chevron in a little white sticker */
.appbar button.back { display: flex; align-items: center; justify-content: center; padding: 0; flex: none; cursor: pointer; }
.appbar button.back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.appbar button.back:hover { background: var(--gd-cream); }
.appbar button.back:active { transform: translate(2px, 2px); box-shadow: none; }

/* First visit: the Grub Dash icon glows until you open it... */
.appIcon.glow { position: relative; z-index: 3; } /* (its tag lies over the next app, not under it) */
.appIcon .tapHere { position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); z-index: 2; padding: 3px 8px; border: 2px solid var(--gd-ink); border-radius: var(--gd-r); background: var(--gd-gold); color: var(--gd-ink); font: 700 11px/1.1 var(--gd-font); font-style: normal; white-space: nowrap; box-shadow: 2px 2px 0 var(--gd-ink); pointer-events: none; animation: gd-breathe 1.4s infinite; }
.appIcon .tapHere::before { content: ''; position: absolute; left: -7px; top: 50%; width: 9px; height: 9px; margin-top: -5px; background: var(--gd-gold); border-left: 2px solid var(--gd-ink); border-bottom: 2px solid var(--gd-ink); transform: rotate(45deg); } /* (pointing at the app) */
.appIcon.glow .ai { box-shadow: 0 0 0 4px var(--gd-gold), var(--gd-sh) var(--gd-sh) 0 4px var(--gd-ink); animation: gd-breathe 1.4s infinite; }
/* ...then the E key on "Go online" keeps pressing itself until you do */
.btn.pressMe .kbi { display: inline-block; animation: keyPress 1s ease-in-out infinite; }
@keyframes keyPress { 0%, 55%, 100% { transform: translateY(0); filter: none; } 20%, 35% { transform: translateY(3px) scale(.92); filter: brightness(.85); } }

/* once the phone has been opened, its "how to open" label goes for the rest of the session */
body.phone-known #phoneTip { display: none !important; }

/* On a phone (touch), the tucked-away phone shows just the music controls:
   the status bar hides and the player moves up to the top edge. */
#miniPlayer { transition: top .3s ease-out; }
body.touch #phoneWrap:not(.open) #phone.music .statusbar, body.touch #phoneWrap:not(.open) #phone.music .notch { opacity: 0; }
body.touch #phoneWrap:not(.open) #phone.music #miniPlayer { top: 18px; }
body.touch #phoneWrap:not(.open):has(#phone.music), body.touch.driving #phoneWrap:not(.open):has(#phone.music) { transform: translateY(calc(100% - 100px)); }

/* A phone or tablet held sideways (a short screen): the in-game phone turns
   wide (more like a small tablet), so apps are properly sized rather than
   squeezed into a sliver: no notch, a slim status bar, and the music player
   folded away while it's open (the Radio app has it). */
@media (orientation: landscape) and (max-height: 520px) {
  html body.touch #phone { width: min(640px, 80vw); height: calc(100vh - 10px - env(safe-area-inset-bottom, 0px)); padding: 6px; border-radius: 26px; }
  html body.touch #phoneWrap.open { transform: translateY(-5px); }
  html body.touch #phone .notch { display: none; }
  html body.touch #phone .statusbar { top: 10px; left: 26px; right: 26px; }
  html body.touch #phoneWrap.open #miniPlayer { display: none; }
  html body.touch #screen, html body.touch #phone.music #screen { padding-top: 34px; border-radius: 22px; }
  html body.touch .appbar, html body.touch #phone.music .appbar { margin-top: -34px; padding-top: 30px; padding-bottom: 8px; }
}

/* Joe's showroom on a phone or tablet: the shop's phone is a bit taller, the
   music player folds away while you shop (so Apply / Fit it / Install are in
   view), and the timer moves out of the shop's title. */
html body.touch.showroom #phoneWrap.open #miniPlayer { display: none; }
html body.touch.showroom #phone.music #screen { padding-top: 48px; }
html body.touch.showroom #phone.music .appbar { margin-top: -48px; padding-top: 46px; }
@media (orientation: portrait) { html body.touch.showroom #phone { height: min(66vh, 580px); } }
body.touch.showroom #hud #timer { top: 52px; left: auto; right: 10px; transform: none; }

/* Career: Amazing Co. has taken over the phone: a glitchy blue and red edge */
body.phone-hacked #phone { box-shadow: 0 0 0 4px var(--gd-cop-blue), 6px 6px 0 4px var(--gd-cop-red); animation: hkPhone 2.4s steps(1) infinite; }
@keyframes hkPhone { 0%, 92% { filter: none; } 93% { filter: hue-rotate(40deg) saturate(1.6); } 96% { filter: none; } 97% { filter: hue-rotate(-30deg); } }
@media (prefers-reduced-motion: reduce) { body.phone-hacked #phone { animation: none; } }
