/* City Drive: the apartment's HUD, prompt bubble, action button and popups (dark glass, pixel font, gold). */
.apt { position: absolute; z-index: 12; pointer-events: none; overflow: hidden; font: 20px/1.15 'Jersey 10', monospace; color: var(--text, #ece8de); -webkit-user-select: none; user-select: none; }
.apt * { box-sizing: border-box; }
.apt [hidden] { display: none !important; }
.apt kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 4px; background: #f2c25a; color: #2a1a06; font: inherit; font-size: 17px; line-height: 1; box-shadow: 0 2px 0 #8a5a1a; }
.apt.touch kbd { display: none; }

/* HUD */
.apt-top { position: absolute; left: calc(env(safe-area-inset-left) + 10px); top: calc(env(safe-area-inset-top) + 10px); display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; max-width: calc(100% - 20px); }
.apt-chip { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 4px 12px; background: rgba(16, 19, 28, .86); border: 1px solid rgba(255, 255, 255, .12); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); backdrop-filter: blur(8px); }
.apt-chip > span { color: var(--sub, #aaa59b); font-size: 16px; line-height: 1; }
.apt-cash b { font: 400 28px/1 'Jersey 10', monospace; color: #f2c25a; letter-spacing: .5px; min-width: 64px; }
.apt-cash.up b { color: #7ee67e; }
.apt-cash.down b { color: #ff8a7a; }
.apt-slots { display: flex; gap: 4px; }
.apt-slots i { width: 32px; height: 32px; border-radius: 5px; background: rgba(0, 0, 0, .35) center / 26px no-repeat; border: 1px dashed rgba(255, 255, 255, .2); image-rendering: pixelated; }
.apt-slots i.full { border: 1px solid rgba(242, 194, 90, .7); background-color: rgba(242, 194, 90, .14); }
.apt-basket-ic { width: 30px; height: 23px; image-rendering: pixelated; }
.apt-crop { display: flex; gap: 8px; font-size: 22px; }
.apt-crop span { display: flex; align-items: center; gap: 4px; }
.apt-crop span i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.apt-crop em { font-style: normal; color: var(--sub, #aaa59b); font-size: 17px; }
.apt-bump { animation: apt-bump .45s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes apt-bump { 30% { transform: scale(1.12); } }
.apt-hint { position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + 66px); transform: translateX(-50%); max-width: calc(100% - 24px); padding: 6px 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 21px; color: #ffe2a0; background: rgba(16, 19, 28, .86); border: 1px solid rgba(242, 194, 90, .35); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.apt:not(.narrow) .apt-hint { top: calc(env(safe-area-inset-top) + 10px); }
.apt:not(.narrow) .apt-top + .apt-hint { left: auto; right: calc(env(safe-area-inset-right) + 10px); transform: none; }

/* In-world labels */
.apt-bubble, .apt-radio { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 6px; padding: 4px 10px 5px; border-radius: 8px; white-space: nowrap; background: rgba(16, 19, 28, .9); border: 1px solid rgba(255, 255, 255, .16); box-shadow: 0 6px 16px rgba(0, 0, 0, .45); font-size: 21px; will-change: transform; }
.apt-bubble::after { content: ''; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: rgba(16, 19, 28, .9); }
.apt-bubble { animation: apt-bob 1.6s ease-in-out infinite; }
.apt-bubble.wait { color: var(--sub, #aaa59b); flex-direction: column; gap: 3px; padding-bottom: 6px; }
.apt-bar { display: block; width: 74px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.apt-bar i { display: block; height: 100%; background: var(--c, #f2c25a); }
.apt-bubble.wait kbd { display: none; }
@keyframes apt-bob { 50% { margin-top: -3px; } }
.apt-radio { font-size: 16px; padding: 2px 8px 3px; color: #ffd98a; background: rgba(16, 19, 28, .75); max-width: 220px; overflow: hidden; }
.apt-radio span { overflow: hidden; text-overflow: ellipsis; }
.apt-radio svg { flex: none; }

/* The big action button (touch) */
.apt-act { position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 18px); transform: translateX(-50%); pointer-events: auto; display: none; align-items: center; justify-content: center; gap: 10px; min-width: 180px; height: 64px; padding: 0 28px; border-radius: 32px; border: 1px solid #ffe7a8; background: linear-gradient(180deg, #ffd978, #e0a43a); color: #2a1a06; font: 400 32px/1 'Jersey 10', monospace; box-shadow: 0 5px 0 #8a5a1a, 0 12px 26px rgba(0, 0, 0, .5); touch-action: manipulation; cursor: pointer; animation: apt-glow 1.4s ease-in-out infinite; }
.apt-act:active { transform: translate(-50%, 4px); box-shadow: 0 1px 0 #8a5a1a, 0 6px 16px rgba(0, 0, 0, .5); }
.apt-act kbd { background: #2a1a06; color: #ffd978; box-shadow: none; }
.apt-act.leave { background: linear-gradient(180deg, #e8e4dc, #b8b2a6); border-color: #fff; box-shadow: 0 5px 0 #5a564e, 0 12px 26px rgba(0, 0, 0, .5); }
.apt.touch .apt-act, .apt.upright .apt-act { display: inline-flex; }
@keyframes apt-glow { 50% { filter: brightness(1.08); } }

/* Things flying to the HUD, floating text */
.apt-fly { position: absolute; width: 12px; height: 12px; border-radius: 3px; background: var(--c); box-shadow: 0 0 0 2px rgba(0, 0, 0, .55), 0 0 12px var(--c); pointer-events: none; z-index: 3; }
.apt-fly.box { width: 30px; height: 26px; border-radius: 0; background: transparent center / contain no-repeat; box-shadow: none; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0, 0, 0, .6)); }
.apt-float { position: absolute; transform: translate(-50%, -100%); font-size: 24px; white-space: nowrap; text-shadow: 0 2px 0 #000, 0 0 10px rgba(0, 0, 0, .7); animation: apt-float 1.5s ease-out forwards; pointer-events: none; }
@keyframes apt-float { from { opacity: 0; margin-top: 10px; } 15% { opacity: 1; margin-top: 0; } 70% { opacity: 1; } to { opacity: 0; margin-top: -40px; } }

/* Popups */
.apt-layer { position: absolute; inset: 0; pointer-events: auto; z-index: 5; display: grid; place-items: center; padding: 12px; }
.apt-shade { position: absolute; inset: 0; background: rgba(6, 5, 10, .55); animation: apt-fade .2s; }
@keyframes apt-fade { from { opacity: 0; } }
.apt-pop { position: relative; width: min(480px, 100%); max-height: 100%; overflow: auto; padding: 16px 18px 18px; background: rgba(16, 19, 28, .94); border: 1px solid rgba(255, 255, 255, .14); border-radius: 10px; box-shadow: 0 14px 40px rgba(0, 0, 0, .6); backdrop-filter: blur(10px); animation: apt-pop .3s cubic-bezier(.3, 1.5, .5, 1); overscroll-behavior: contain; touch-action: pan-y; }
@keyframes apt-pop { from { transform: translateY(14px) scale(.95); opacity: 0; } }
.apt-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 2px; }
.apt-head h3 { margin: 0; font: 400 34px/1 'Jersey 10', monospace; color: #f2c25a; }
.apt-x { width: 44px; height: 44px; flex: none; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .14); background: rgba(255, 255, 255, .06); color: var(--text, #ece8de); font: inherit; font-size: 22px; cursor: pointer; }
.apt-x:hover { background: rgba(255, 255, 255, .14); }
.apt-sub { margin: 2px 0 10px; color: var(--sub, #aaa59b); font-size: 18px; }
.apt-pop h4 { margin: 12px 0 6px; font: 400 20px/1 'Jersey 10', monospace; color: #d8d3c8; display: flex; align-items: center; gap: 8px; }
.apt-pop h4 span { color: var(--sub, #aaa59b); font-size: 16px; }
.apt-grid { display: grid; gap: 8px; }
.apt-grid.three { grid-template-columns: repeat(3, 1fr); }
.apt-grid.five { grid-template-columns: repeat(5, 1fr); }
.apt-opt { position: relative; display: grid; justify-items: center; align-content: start; gap: 2px; min-height: 64px; padding: 10px 4px 8px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .12); background: rgba(255, 255, 255, .05); color: var(--text, #ece8de); font: inherit; cursor: pointer; transition: transform .1s, background .15s, border-color .15s; touch-action: manipulation; }
.apt-opt:hover:not([disabled]) { background: rgba(255, 255, 255, .1); border-color: var(--c, #f2c25a); }
.apt-opt:active:not([disabled]) { transform: scale(.96); }
.apt-opt.on { border-color: #f2c25a; background: rgba(242, 194, 90, .16); box-shadow: inset 0 0 0 1px #f2c25a; }
.apt-opt[disabled] { opacity: .38; cursor: default; }
.apt-opt img { width: 48px; height: 66px; object-fit: contain; image-rendering: pixelated; margin-bottom: 2px; }
.apt-opt.sm img { width: 30px; height: 36px; }
.apt-opt b { font-weight: 400; font-size: 22px; line-height: 1; color: var(--c, #ece8de); }
.apt-opt small { font-size: 16px; color: var(--sub, #aaa59b); line-height: 1.05; }
.apt-opt .apt-to { color: #d8d3c8; }
.apt-grid.five .apt-opt b { font-size: 19px; }
.apt-grid.five .apt-opt small { font-size: 14px; }
.apt-result { display: flex; align-items: center; gap: 12px; margin: 12px 0 8px; padding: 10px 12px; border-radius: 8px; background: rgba(0, 0, 0, .3); border: 1px solid var(--c, rgba(255, 255, 255, .12)); }
.apt-result img { width: 27px; height: 33px; image-rendering: pixelated; }
.apt-result b { display: block; font-weight: 400; font-size: 26px; line-height: 1; color: var(--c, #ece8de); }
.apt-result small { font-size: 17px; color: var(--sub, #aaa59b); }
.apt-result.none b { color: #ff8a7a; font-size: 22px; }
.apt-gold { display: flex; align-items: center; justify-content: center; width: 100%; height: 56px; margin: 8px 0 4px; border-radius: 8px; border: 1px solid #ffe7a8; background: linear-gradient(180deg, #ffd978, #e0a43a); color: #2a1a06; font: 400 28px/1 'Jersey 10', monospace; box-shadow: 0 3px 0 #8a5a1a; cursor: pointer; touch-action: manipulation; }
.apt-gold:active:not([disabled]) { transform: translateY(2px); box-shadow: 0 1px 0 #8a5a1a; }
.apt-gold[disabled] { filter: grayscale(1); opacity: .45; cursor: default; }
.apt-empty { margin: 6px 0; padding: 12px; border-radius: 8px; background: rgba(0, 0, 0, .25); color: var(--sub, #aaa59b); font-size: 18px; text-align: center; }
.apt-list { display: grid; gap: 6px; }
.apt-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .1); border-left: 4px solid var(--c); }
.apt-row img { width: 33px; height: 27px; image-rendering: pixelated; }
.apt-row span { flex: 1; min-width: 0; }
.apt-row b { display: block; font-weight: 400; font-size: 22px; line-height: 1; color: var(--c); }
.apt-row small { font-size: 16px; color: var(--sub, #aaa59b); }
.apt-btn { flex: none; height: 44px; min-width: 96px; padding: 0 14px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .1); color: var(--text, #ece8de); font: inherit; font-size: 20px; cursor: pointer; touch-action: manipulation; }
.apt-btn:hover:not([disabled]) { background: rgba(255, 255, 255, .18); }
.apt-btn[disabled] { opacity: .4; cursor: default; }
.apt-pslots { display: inline-flex; gap: 3px; }
.apt-pslots i { width: 22px; height: 20px; border-radius: 3px; border: 1px dashed rgba(255, 255, 255, .25); background: center / 18px no-repeat; image-rendering: pixelated; }
.apt-pslots i.full { border: 1px solid rgba(242, 194, 90, .7); }
.apt-book { margin-top: 10px; border-top: 1px solid rgba(255, 255, 255, .1); padding-top: 8px; }
.apt-book summary { cursor: pointer; color: var(--sub, #aaa59b); font-size: 19px; list-style: none; padding: 6px 0; }
.apt-book summary::before { content: '→ '; }
.apt-book[open] summary::before { content: '↓ '; }
.apt-book ul { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 3px; }
.apt-book li { display: flex; align-items: center; gap: 8px; padding: 3px 8px; border-radius: 5px; font-size: 17px; color: var(--sub, #aaa59b); background: rgba(0, 0, 0, .2); }
.apt-book li i { width: 10px; height: 10px; border-radius: 2px; background: rgba(255, 255, 255, .15); flex: none; }
.apt-book li b { margin-left: auto; font-weight: 400; color: #8a857c; }
.apt-book li em { font-style: normal; width: 44px; text-align: right; color: #8a857c; }
.apt-book li.known { color: #d8d3c8; }
.apt-book li.known i { background: var(--c); }
.apt-book li.known b { color: var(--c); }
.apt-book li.known em { color: #f2c25a; }

.apt.narrow { font-size: 18px; }
.apt.narrow .apt-chip { min-height: 40px; padding: 3px 9px; gap: 6px; }
.apt.narrow .apt-cash b { font-size: 24px; min-width: 0; }
.apt.narrow .apt-slots i { width: 28px; height: 28px; background-size: 22px; }
.apt.narrow .apt-chip > span { display: none; }
.apt.narrow .apt-hint { font-size: 19px; top: calc(env(safe-area-inset-top) + 60px); }
.apt.narrow .apt-grid.five { grid-template-columns: repeat(3, 1fr); }
.apt.narrow .apt-pop { padding: 12px 12px 14px; }
@media (max-width: 380px) { .apt-grid.three { gap: 6px; } .apt-opt b { font-size: 19px; } }
/* Keep the use button above the phone, which always peeks up from the bottom edge. */
.apt-act { bottom: calc(env(safe-area-inset-bottom) + 84px); }

/* Smaller everything on phones (owner: "the ui in the house is massive and covers up the screen"). */
@media (max-width: 560px), (max-height: 500px) {
  .apt-top { top: calc(env(safe-area-inset-top) + 6px); left: calc(env(safe-area-inset-left) + 6px); gap: 5px; }
  .apt-chip, .apt.narrow .apt-chip { min-height: 30px; padding: 2px 8px; gap: 5px; border-radius: 6px; }
  .apt-chip > span { display: none; }
  .apt-cash b, .apt.narrow .apt-cash b { font-size: 19px; min-width: 0; }
  .apt-slots i, .apt.narrow .apt-slots i { width: 20px; height: 20px; background-size: 16px; }
  .apt-basket-ic { width: 20px; height: 15px; }
  .apt-crop { font-size: 16px; gap: 6px; }
  .apt-crop em { font-size: 13px; }
  .apt-hint, .apt.narrow .apt-hint { font-size: 15px; padding: 3px 10px; top: calc(env(safe-area-inset-top) + 42px); }
  .apt:not(.narrow) .apt-hint { top: calc(env(safe-area-inset-top) + 6px); }
  .apt-radio { font-size: 13px; }
  .apt-bubble { font-size: 15px; padding: 2px 7px 3px; }
  .apt-act { height: 44px; min-width: 120px; padding: 0 18px; font-size: 22px; border-radius: 22px; }
  .apt-layer { padding: 6px; }
  .apt-pop { padding: 10px 12px 12px; border-radius: 10px; }
  .apt-head h3 { font-size: 24px; }
  .apt-x { width: 34px; height: 34px; }
  .apt-sub { font-size: 14px; margin: 0 0 6px; }
  .apt-pop h4 { margin: 6px 0 4px; font-size: 16px; }
  .apt-pop h4 span { font-size: 13px; }
  .apt-grid { gap: 5px; }
  .apt-opt { min-height: 40px; padding: 4px 3px 5px; gap: 0; }
  .apt-opt img { width: 26px; height: 36px; margin-bottom: 0; }
  .apt-opt.sm img { width: 18px; height: 22px; }
  .apt-opt b, .apt-grid.five .apt-opt b { font-size: 16px; }
  .apt-opt small, .apt-grid.five .apt-opt small { font-size: 12px; }
  .apt-result { margin: 6px 0 4px; padding: 5px 8px; gap: 8px; }
  .apt-result b { font-size: 19px; }
  .apt-result small { font-size: 13px; }
  .apt-gold { height: 40px; font-size: 21px; margin: 6px 0 2px; }
  .apt-row { padding: 4px 6px; }
  .apt-row b { font-size: 17px; }
  .apt-row small { font-size: 13px; }
  .apt-btn { height: 34px; min-width: 72px; font-size: 16px; }
  .apt-empty { font-size: 14px; padding: 8px; }
  .apt-book summary { font-size: 15px; }
  .apt-book li { font-size: 14px; }
}
/* Landscape phones: wider popups (less scrolling), the use button low down (the phone sits at the left). */
@media (max-height: 500px) and (orientation: landscape) {
  .apt-pop { width: min(640px, 100%); }
  .apt-grid.five, .apt.narrow .apt-grid.five { grid-template-columns: repeat(5, 1fr); }
  .apt-act { bottom: calc(env(safe-area-inset-bottom) + 10px); }
}
