/* ============ Grundlæggende ============ */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1030; color: #fff;
  font-family: 'Nunito', system-ui, sans-serif; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
#game canvas { touch-action: none; }
button, .slot { touch-action: manipulation; }
.overlay { touch-action: pan-y; -webkit-overflow-scrolling: touch; }
input { -webkit-user-select: text; user-select: text; }
#game canvas { display: block; }
.hidden { display: none !important; }
button { font-family: inherit; font-weight: 900; font-size: 15px; color: #1a0f2e; background: #ffd23f;
  border: none; border-radius: 10px; padding: 8px 14px; cursor: pointer; box-shadow: 0 3px 0 #b8901a; }
button:hover { filter: brightness(1.1); }
button:active { transform: translateY(2px); box-shadow: 0 1px 0 #b8901a; }
button:disabled { background: #555a66; color: #aaa; box-shadow: none; cursor: default; }

/* ============ HUD ============ */
#hud { position: fixed; inset: 0; pointer-events: none; }
.panel { position: absolute; background: rgba(12, 16, 40, 0.72); border: 2px solid rgba(255,255,255,0.12);
  border-radius: 14px; padding: 10px 12px; backdrop-filter: blur(4px); }
#hud-left { top: 12px; left: 12px; width: 240px; }
#hud-right { top: 12px; right: 12px; width: 250px; }
#hud-top { top: 12px; left: 50%; transform: translateX(-50%); text-align: center; min-width: 300px; }
#goal { top: 150px; left: 12px; width: 240px; font-size: 14px; line-height: 1.35; border-color: rgba(255, 210, 63, 0.5); }
.stat { margin-bottom: 6px; }
.lbl { font-size: 13px; font-weight: 700; opacity: 0.9; }
.bar { position: relative; height: 16px; background: rgba(0,0,0,0.5); border-radius: 8px; overflow: hidden; margin-top: 2px; }
.fill { height: 100%; border-radius: 8px; transition: width 0.15s; }
.fill.hp { background: linear-gradient(90deg, #ff3355, #ff7a5a); }
.fill.o2 { background: linear-gradient(90deg, #38c8ff, #8ff0ff); }
.fill.power { background: linear-gradient(90deg, #ffb020, #ffe14d); }
.fill.shield { background: linear-gradient(90deg, #7a7aff, #b8b0ff); }
.fill.danger { animation: blink 0.5s infinite alternate; background: #ff3355; }
@keyframes blink { from { opacity: 1; } to { opacity: 0.35; } }
.bartxt { position: absolute; inset: 0; font-size: 11px; font-weight: 900; text-align: center; line-height: 16px;
  text-shadow: 0 1px 2px #000; }
.up { color: #7dff7a; } .down { color: #ff6b7a; }
.sub { font-size: 12px; opacity: 0.7; margin-top: 8px; }
.resrow { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; align-items: center; }
.res { background: rgba(255,255,255,0.1); border-radius: 8px; padding: 2px 7px; font-weight: 900; font-size: 15px; }
.res.small { font-size: 13px; }
.res.zero { opacity: 0.4; }
#backpack .lbl { margin-right: 4px; }
#day-label { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 20px; letter-spacing: 1px; }
#clock { position: relative; height: 8px; background: #ffd27a; border-radius: 4px; margin: 6px 0; overflow: hidden; }
#clock-night { position: absolute; right: 0; top: 0; bottom: 0; background: #283070; }
#clock-fill { position: absolute; left: 0; top: 0; bottom: 0; border-right: 3px solid #fff; background: rgba(0,0,0,0.25); }
#top-info { font-size: 13px; opacity: 0.9; }

#minimap { position: absolute; right: 12px; bottom: 12px; width: 200px; height: 200px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25); background: rgba(0,0,0,0.3); }

#hotbar { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; pointer-events: auto; }
.slot { position: relative; width: 92px; padding: 6px 4px; background: rgba(12,16,40,0.82); border: 2px solid rgba(255,255,255,0.15);
  border-radius: 12px; text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.slot:hover { border-color: rgba(255,255,255,0.5); }
.slot.sel { border-color: #ffd23f; background: rgba(80,60,10,0.85); box-shadow: 0 0 14px rgba(255,210,63,0.6); }
.slot.poor .ico { opacity: 0.5; }
.slot .key { position: absolute; top: 2px; left: 6px; font-size: 11px; font-weight: 900; opacity: 0.7; }
.slot .ico { font-size: 24px; line-height: 1.1; }
.slot .nm { font-size: 11px; font-weight: 900; white-space: nowrap; }
.slot .cost { font-size: 11px; font-weight: 700; }
.slot .cost .miss { color: #ff6b7a; }

#build-info { position: absolute; bottom: 100px; left: 50%; transform: translateX(-50%); background: rgba(12,16,40,0.85);
  padding: 8px 14px; border-radius: 10px; font-size: 14px; display: none; text-align: center; max-width: 520px; }
#build-info.show { display: block; }
#build-info .why { color: #ff8a8a; font-weight: 900; margin-top: 2px; }
#build-info .okay { color: #8aff9a; font-size: 12px; margin-top: 2px; }

#toasts { position: absolute; top: 110px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { background: rgba(12,16,40,0.9); padding: 7px 14px; border-radius: 10px; font-weight: 700; font-size: 14px;
  border-left: 4px solid #38c8ff; transition: opacity 0.5s; }
.toast.bad { border-color: #ff3355; } .toast.good { border-color: #7dff7a; } .toast.warn { border-color: #ffd23f; }
.toast.fade { opacity: 0; }

#banner { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%) scale(0.8); opacity: 0;
  font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: 38px; text-align: center; letter-spacing: 2px;
  text-shadow: 0 0 20px rgba(0,0,0,0.8), 0 3px 0 #000; transition: all 0.3s; white-space: nowrap; }
#banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#banner.bad { color: #ff4d6a; } #banner.good { color: #ffe14d; } #banner.warn { color: #ffb020; } #banner.info { color: #cfe8ff; }

#floats, #bars { position: absolute; inset: 0; overflow: hidden; }
.float { position: absolute; left: 0; top: 0; font-weight: 900; font-size: 18px; text-shadow: 0 2px 3px #000; white-space: nowrap; }
.float.small { font-size: 14px; }
.hpbar { position: absolute; left: 0; top: 0; width: 44px; height: 6px; background: rgba(0,0,0,0.6); border-radius: 3px; overflow: hidden; }
.hpbar i { display: block; height: 100%; background: #ff3355; }
.hpbar.boss { width: 120px; height: 10px; } .hpbar.boss i { background: #ff2bb5; }
.hpbar.dome { width: 90px; height: 8px; } .hpbar.dome i { background: #b8b0ff; }
#minebar { position: absolute; left: 0; top: 0; width: 60px; height: 8px; background: rgba(0,0,0,0.6); border-radius: 4px; overflow: hidden; display: none; }
#minebar-fill { height: 100%; background: #ffd23f; }

#help { top: 50%; left: 50%; transform: translate(-50%, -50%); width: 440px; font-size: 14px; }
#help h3 { margin: 4px 0 6px; font-family: 'Orbitron', sans-serif; color: #ffd23f; }
#help p { margin: 3px 0; }

#vignette { position: fixed; inset: 0; pointer-events: none; box-shadow: inset 0 0 160px rgba(255, 30, 60, 0); transition: box-shadow 0.2s; }
#vignette.danger { animation: danger 0.8s infinite alternate; }
#vignette.hit { animation: hit 0.35s; }
@keyframes danger { from { box-shadow: inset 0 0 120px rgba(255, 30, 60, 0.15); } to { box-shadow: inset 0 0 180px rgba(255, 30, 60, 0.55); } }
@keyframes hit { from { box-shadow: inset 0 0 200px rgba(255, 30, 60, 0.7); } to { box-shadow: inset 0 0 160px rgba(255, 30, 60, 0); } }

/* ============ Menu og skærme ============ */
.overlay { position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto;
  background: radial-gradient(ellipse at center, rgba(11,16,48,0.35), rgba(11,16,48,0.85)); }
#pause, #gameover { align-items: center; }
.box { background: rgba(12,16,40,0.92); border: 2px solid rgba(255,255,255,0.15); border-radius: 18px; padding: 24px 32px; text-align: center; }
.box h2 { font-family: 'Orbitron', sans-serif; margin-top: 0; }
.btns { display: flex; gap: 10px; justify-content: center; margin-top: 16px; }
.big-num { font-size: 22px; }
.earn { font-size: 26px; font-weight: 900; color: #ffd23f; }
.record { font-size: 22px; font-weight: 900; color: #7dff7a; animation: blink 0.4s infinite alternate; }

.menu-wrap { width: min(1000px, 94vw); padding: 30px 0 40px; text-align: center; }
.title { font-family: 'Orbitron', sans-serif; font-weight: 900; font-size: clamp(36px, 7vw, 76px); margin: 10px 0 0; letter-spacing: 4px;
  color: #aee3ff; text-shadow: 0 0 30px rgba(56, 200, 255, 0.7), 0 5px 0 #0b1030; }
.title span { color: #ff7a3a; text-shadow: 0 0 30px rgba(255, 122, 58, 0.7), 0 5px 0 #0b1030; }
.story { max-width: 680px; margin: 12px auto; font-size: 16px; line-height: 1.5; background: rgba(12,16,40,0.7); padding: 12px 18px; border-radius: 12px; }
.stats-row { display: flex; gap: 12px; justify-content: center; margin: 12px 0; flex-wrap: wrap; }
.stats-row div { background: rgba(12,16,40,0.8); padding: 8px 16px; border-radius: 10px; font-size: 16px; }
button.big { font-size: 24px; padding: 14px 40px; margin: 8px 0 18px; background: #ff7a3a; color: #fff; box-shadow: 0 5px 0 #a8461a; }
button.tiny { font-size: 12px; background: transparent; color: #aaa; box-shadow: none; text-decoration: underline; }
.menu-cols { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; text-align: left; }
@media (max-width: 800px) { .menu-cols { grid-template-columns: 1fr; } }
.menu-cols section { background: rgba(12,16,40,0.8); border-radius: 14px; padding: 12px 16px; }
.menu-cols h2 { font-family: 'Orbitron', sans-serif; font-size: 16px; color: #ffd23f; margin: 6px 0 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.card { background: rgba(255,255,255,0.06); border: 2px solid transparent; border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.card.chosen { border-color: #ffd23f; }
.card.locked { opacity: 0.8; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: inset 0 -8px 0 rgba(0,0,0,0.25); }
.cname { font-weight: 900; font-size: 16px; } .cname small { font-weight: 700; opacity: 0.7; font-size: 12px; }
.ctext { font-size: 13px; opacity: 0.85; flex: 1; }
.tag { font-weight: 900; color: #7dff7a; font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.row small { display: block; opacity: 0.7; font-size: 12px; }
.pips { display: flex; gap: 3px; }
.pips i { width: 10px; height: 10px; border-radius: 3px; background: rgba(255,255,255,0.15); }
.pips i.on { background: #ffd23f; }
.controls { opacity: 0.85; margin-top: 16px; font-size: 14px; }

/* ============ Ting, E-hjælp, værksted og kort ============ */
kbd { font-family: inherit; font-size: 10px; background: rgba(255,255,255,0.2); border-radius: 4px; padding: 0 4px; margin-left: 2px; }
#items { margin-top: 6px; }
#prompt { position: absolute; left: 0; top: 0; display: none; background: rgba(12,16,40,0.85); border: 2px solid #ffd23f;
  padding: 4px 10px; border-radius: 10px; font-weight: 900; font-size: 13px; white-space: nowrap; }
#top-info { line-height: 1.4; }
#craft, #bigmap { align-items: center; }
.craft-box { width: min(980px, 96vw); max-height: 94vh; overflow-y: auto; text-align: left; }
.craft-box h2 { text-align: center; }
.craft-box .center { justify-content: center; }
.craft-box .hint { text-align: center; opacity: 0.8; font-size: 13px; }
.craft-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 800px) { .craft-cols { grid-template-columns: 1fr; } }
.craft-cols h3 { font-family: 'Orbitron', sans-serif; color: #ffd23f; font-size: 15px; margin: 8px 0; }
.crow { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.cico { font-size: 26px; width: 34px; text-align: center; }
.cinfo { flex: 1; }
.cinfo small { display: block; opacity: 0.75; font-size: 12px; }
.cinfo .pips { margin-top: 4px; }
.ccost { font-weight: 900; font-size: 13px; white-space: nowrap; }
.ccost .miss { color: #ff6b7a; }
.map-box { padding: 16px 20px; }
#bigmap-canvas { width: min(640px, 80vh, 90vw); height: min(640px, 80vh, 90vw); border-radius: 12px; display: block; margin: 0 auto; }
.legend { font-size: 13px; opacity: 0.85; margin: 6px 0 0; }
#bigmap-info { margin: 8px 0 0; }

/* ============ Lydstyrke-knapper ============ */
.sound-panel { display: inline-flex; flex-direction: column; gap: 6px; background: rgba(12,16,40,0.8); padding: 10px 14px;
  border-radius: 12px; margin: 0 auto 16px; }
.vol-row { display: flex; align-items: center; gap: 6px; }
.vol-row span { width: 120px; text-align: left; font-weight: 900; }
button.vol { font-size: 13px; padding: 5px 12px; background: #3a4060; color: #cfd6ee; box-shadow: 0 2px 0 #20253a; }
button.vol.on { background: #ffd23f; color: #1a0f2e; box-shadow: 0 2px 0 #b8901a; }
#pause-sound { margin-top: 12px; }

#lives { font-size: 20px; letter-spacing: 2px; margin-bottom: 6px; }
#lives .lost { opacity: 0.35; }

#btn-sound { position: absolute; right: 18px; bottom: 222px; pointer-events: auto; font-size: 20px; padding: 6px 10px;
  background: rgba(12,16,40,0.8); color: #fff; box-shadow: none; border: 2px solid rgba(255,255,255,0.2); }
#sound-pop { position: absolute; right: 70px; bottom: 210px; pointer-events: auto; }
#sound-pop .sound-panel { margin: 0; }

/* Navne over de andre spillere */
.pname { position: absolute; left: 0; top: 0; font-weight: 900; font-size: 13px; color: #7dff7a; text-shadow: 0 1px 3px #000;
  white-space: nowrap; padding-bottom: 5px; background: linear-gradient(90deg, #7dff7a var(--hp), rgba(0,0,0,0.5) var(--hp)) bottom / 100% 4px no-repeat; }

/* ============ Multiplayer ============ */
.mp { background: rgba(12,16,40,0.8); border-radius: 14px; padding: 10px 16px; margin: 0 auto 16px; max-width: 620px; }
.mp h2 { font-family: 'Orbitron', sans-serif; font-size: 16px; color: #7dff7a; margin: 4px 0 10px; }
.mp-row { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 6px 0; flex-wrap: wrap; }
.mp-row label { font-weight: 900; }
.mp input { font-family: inherit; font-size: 16px; font-weight: 900; padding: 7px 10px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.4); color: #fff; width: 180px; }
#mp-code { width: 90px; text-transform: uppercase; letter-spacing: 3px; text-align: center; }
.mp-or { opacity: 0.7; }
.mp-status { min-height: 20px; margin: 6px 0 0; font-weight: 700; }
.mp-status.bad { color: #ff8a8a; }
.mp-info { margin-top: 10px; opacity: 0.9; }
#net-info { font-size: 13px; color: #7dff7a; margin-top: 2px; }

/* ============ Gemte spil ============ */
.saved-run { display: flex; gap: 14px; align-items: center; justify-content: center; flex-wrap: wrap; background: rgba(12,16,40,0.85);
  border: 2px solid #7dff7a; border-radius: 14px; padding: 10px 16px; margin: 6px auto 4px; max-width: 680px; text-align: left; }
.saved-run .big { margin: 0; }
.code { font-family: 'Orbitron', sans-serif; letter-spacing: 2px; color: #ffd23f; }
button.big.secondary { font-size: 16px; padding: 9px 22px; background: #3a4060; color: #fff; box-shadow: 0 3px 0 #20253a; }
.load-row { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 4px 0 14px; flex-wrap: wrap; }
.load-row input { font-family: inherit; font-size: 15px; font-weight: 900; padding: 6px 10px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.25);
  background: rgba(0,0,0,0.4); color: #fff; width: 130px; text-transform: uppercase; letter-spacing: 2px; text-align: center; }

/* ============ Touch (iPad/mobil) ============ */
#touch-ui { display: none; }
body.touch #touch-ui { display: block; }
.stick { position: absolute; width: 130px; height: 130px; margin: -65px 0 0 -65px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.45); background: rgba(255,255,255,0.08); display: none; pointer-events: none; }
.stick.on { display: block; }
.stick i { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; border-radius: 50%;
  background: rgba(255,255,255,0.7); box-shadow: 0 0 14px rgba(255,255,255,0.5); }
.stick.aim { border-color: rgba(255,90,110,0.6); }
.stick.aim i { background: rgba(255,90,110,0.8); }
.hint-zone { position: absolute; bottom: 120px; font-weight: 900; font-size: 14px; opacity: 0.45; pointer-events: none; }
.hint-zone.left { left: 40px; } .hint-zone.right { right: 230px; }
#tbtns { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: 110px; display: grid;
  grid-template-columns: repeat(2, auto); gap: 10px; pointer-events: auto; }
#tbtns-top { position: absolute; right: max(12px, env(safe-area-inset-right)); top: 236px; display: flex; flex-direction: column; gap: 8px; pointer-events: auto; }
.tbtn { width: 64px; height: 64px; border-radius: 50%; font-size: 28px; padding: 0; background: rgba(12,16,40,0.75);
  border: 3px solid rgba(255,255,255,0.35); box-shadow: 0 4px 0 rgba(0,0,0,0.4); color: #fff; }
.tbtn.big { grid-column: span 2; width: 88px; height: 88px; font-size: 40px; justify-self: center; border-color: #ffd23f; }
.tbtn.small { width: 48px; height: 48px; font-size: 20px; }
.tbtn.down { transform: scale(0.92); background: rgba(255,210,63,0.5); }
#tbtn-cancel { display: none; position: absolute; left: 50%; transform: translateX(-50%); bottom: 112px; width: auto; height: 48px;
  border-radius: 24px; padding: 0 18px; font-size: 16px; pointer-events: auto; }
body.touch.building #tbtn-cancel { display: block; }
body.touch.building .hint-zone.right::after { content: ' (eller: træk spøgelset og slip for at bygge)'; }
/* Kortet og knapperne til højre må ikke ligge under tommelfingeren */
body.touch #minimap { top: 236px; bottom: auto; right: 76px; width: 150px; height: 150px; }
body.touch #btn-sound { bottom: auto; top: 396px; right: 76px; }
body.touch #sound-pop { bottom: auto; top: 396px; right: 130px; }
body.touch #build-info { bottom: 165px; }
body.touch #hud-left { left: max(12px, env(safe-area-inset-left)); }
body.touch #hud-right { right: max(12px, env(safe-area-inset-right)); }
.slot.demolish .ico { filter: none; }
body.touch .slot { width: 80px; }
body.touch.building .hint-zone.left { width: 26vw; }
body.touch.building .hint-zone.left::after { content: ' (her i hjørnet)'; }

/* ============ Telefon (lille skærm) ============ */
/* Alle paneler skaleres ned med "zoom", så det hele passer på en lille skærm */
body.phone #hud-left, body.phone #hud-right, body.phone #hud-top, body.phone #goal, body.phone #hotbar,
body.phone #build-info, body.phone #help { zoom: 0.62; }
body.phone #hud-left { top: 6px; left: max(6px, env(safe-area-inset-left)); }
body.phone #hud-right { top: 6px; right: max(6px, env(safe-area-inset-right)); }
body.phone #hud-top { top: 6px; }
body.phone #goal { top: 210px; left: max(10px, env(safe-area-inset-left)); max-width: 260px; }
body.phone #hud-right .sub { display: none; }
body.phone #hotbar { bottom: 6px; max-width: 150vw; overflow-x: auto; scrollbar-width: none; }
body.phone #hotbar::-webkit-scrollbar { display: none; }
body.phone #build-info { bottom: 120px; }
body.phone #minimap { top: 156px; right: 56px; width: 104px; height: 104px; border-width: 2px; }
body.phone #tbtns-top { top: 156px; right: max(6px, env(safe-area-inset-right)); gap: 5px; }
body.phone .tbtn { width: 48px; height: 48px; font-size: 22px; }
body.phone .tbtn.big { width: 66px; height: 66px; font-size: 30px; }
body.phone .tbtn.small { width: 38px; height: 38px; font-size: 16px; }
body.phone #tbtns { bottom: 60px; gap: 6px; right: max(8px, env(safe-area-inset-right)); }
body.phone #btn-sound { top: 266px; right: 56px; font-size: 16px; padding: 4px 8px; }
body.phone #sound-pop { top: 266px; right: 104px; zoom: 0.8; }
body.phone #tbtn-cancel { bottom: 70px; height: 38px; font-size: 13px; }
body.phone .hint-zone { display: none; }
body.phone .stick { width: 100px; height: 100px; margin: -50px 0 0 -50px; }
body.phone .stick i { width: 44px; height: 44px; }
body.phone #banner { font-size: 20px; letter-spacing: 1px; white-space: normal; width: 80vw; }
body.phone #toasts { top: 56px; zoom: 0.8; }
body.phone #prompt { font-size: 11px; padding: 2px 8px; }
body.phone .float { font-size: 14px; }
body.phone .menu-wrap { padding-top: 10px; }
body.phone .story { font-size: 13px; }
body.phone .box { padding: 14px 16px; }
/* Telefonen på højkant under spillet: bed om at vende den */
#rotate-hint { display: none; }
@media (orientation: portrait) {
  body.phone #hud:not(.hidden) ~ #rotate-hint { display: flex; position: fixed; inset: 0; z-index: 50; align-items: center; justify-content: center;
    background: rgba(11,16,48,0.94); font-family: 'Orbitron', sans-serif; font-size: 22px; text-align: center; line-height: 1.6; }
}
/* Telefon – placering af kort og knapper (tommelfingrene skal have plads) */
body.phone #goal { top: 118px; left: 50%; transform: translateX(-50%); max-width: 430px; text-align: center; padding: 6px 10px; }
body.phone #minimap { top: 152px; left: max(6px, env(safe-area-inset-left)); right: auto; width: 96px; height: 96px; }
body.phone #tbtns-top { top: 252px; left: max(6px, env(safe-area-inset-left)); right: auto; flex-direction: row; gap: 5px; }
body.phone #btn-sound { top: 252px; left: 180px; right: auto; }
body.phone #sound-pop { top: 294px; left: 6px; right: auto; }
body.phone #tbtns { left: 0; top: 0; right: 0; bottom: 0; display: block; pointer-events: none; }
body.phone #tbtns .tbtn { position: absolute; pointer-events: auto; }
body.phone #tbtns [data-tkey="e"] { right: max(62px, calc(env(safe-area-inset-right) + 56px)); bottom: 10px; }
body.phone #tbtns [data-tkey="q"] { right: max(8px, env(safe-area-inset-right)); bottom: 10px; }
body.phone #tbtns [data-tkey="f"] { right: max(8px, env(safe-area-inset-right)); bottom: 64px; }
body.phone #tbtns [data-tkey="r"] { right: max(8px, env(safe-area-inset-right)); bottom: 118px; }
body.phone #hotbar { left: max(110px, 22vw); transform: none; max-width: calc(100vw - 260px); zoom: 0.62; }
