@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@500;600;700&family=Fredoka:wght@600;700&display=swap');

:root { --ink:#17233d; --cream:#f7f3e8; --coral:#ee755b; --yellow:#f7c94a; --mint:#78bda4; --blue:#78aede; }
* { box-sizing:border-box; }
body { margin:0; overflow:hidden; background:#222d3f; color:var(--ink); font-family:"DM Sans",sans-serif; }
body, #game { touch-action:none; -webkit-user-select:none; user-select:none; }
button { font:inherit; }
#game { display:block; width:100vw; height:100vh; }
.loading { position:fixed; inset:0; z-index:30; display:grid; place-content:center; justify-items:center; gap:14px; background:#91bd7c; color:var(--ink); font-family:"Fredoka",sans-serif; transition:.5s ease; }
.loading.done { opacity:0; visibility:hidden; pointer-events:none; }
.loading-mark { width:72px; height:72px; display:grid; place-items:center; border:3px solid var(--ink); border-radius:22px; background:var(--yellow); box-shadow:7px 7px 0 rgba(23,35,61,.18); font-size:25px; }
.hud { position:fixed; inset:0; pointer-events:none; z-index:10; }
.topbar { display:flex; justify-content:space-between; align-items:flex-start; padding:18px 22px; }
.panel { background:rgba(255,253,246,.94); border:2px solid var(--ink); border-radius:18px; box-shadow:5px 5px 0 rgba(23,35,61,.16); pointer-events:auto; }
.player-card { display:flex; align-items:center; gap:12px; padding:9px 13px 9px 9px; min-width:245px; }
.avatar { width:44px; height:44px; display:grid; place-items:center; border-radius:12px; background:var(--yellow); border:2px solid var(--ink); font-size:25px; }
.player-meta { flex:1; }
.player-name { display:flex; justify-content:space-between; gap:16px; font-family:"Fredoka",sans-serif; font-size:14px; }
.bars { display:grid; gap:5px; margin-top:7px; }
.bar-row { display:flex; align-items:center; gap:6px; font-size:10px; }
.bar { width:128px; height:7px; background:#ddd7c8; border-radius:99px; overflow:hidden; border:1px solid var(--ink); }
.bar i { display:block; height:100%; background:var(--coral); transition:width .25s; }
.bar.energy i { background:var(--yellow); } .bar.happy i { background:var(--mint); }
.clock { min-width:115px; text-align:center; padding:10px 14px; }
.clock strong { display:block; font-family:"Fredoka",sans-serif; font-size:21px; } .clock small { color:#718096; }
.wallet { position:absolute; right:22px; top:88px; padding:9px 14px; font-family:"Fredoka",sans-serif; }
.wallet b { color:#3d966f; }
.quest { position:absolute; left:22px; bottom:22px; width:268px; padding:12px 14px; }
.quest small { text-transform:uppercase; letter-spacing:1.5px; color:#87909d; } .quest p { margin:5px 0 0; font-size:14px; }
.prompt { position:absolute; left:50%; bottom:26px; transform:translateX(-50%); display:none; padding:10px 15px; font-size:13px; }
.prompt.show { display:block; }
.prompt kbd { display:inline-grid; place-items:center; width:24px; height:24px; margin-right:8px; border:1px solid var(--ink); border-radius:6px; background:var(--yellow); box-shadow:2px 2px 0 var(--ink); }
.toast { position:absolute; left:50%; top:110px; transform:translate(-50%, -10px); opacity:0; padding:9px 14px; transition:.25s; }
.toast.show { opacity:1; transform:translate(-50%, 0); }
.mobile { display:none; position:absolute; left:18px; bottom:18px; width:132px; height:132px; pointer-events:auto; }
.mobile button { position:absolute; width:44px; height:44px; border:2px solid var(--ink); border-radius:12px; background:rgba(255,253,246,.9); font-weight:bold; }
#up { left:44px; top:0 } #down { left:44px; bottom:0 } #left { left:0; top:44px } #right { right:0; top:44px }
.interact-mobile { display:none; position:absolute; right:24px; bottom:34px; width:68px; height:68px; border-radius:50%; border:2px solid var(--ink); background:var(--yellow); font-family:"Fredoka"; pointer-events:auto; }
.menu-mobile { display:none; position:absolute; right:18px; top:128px; width:44px; height:44px; border:2px solid var(--ink); border-radius:12px; background:rgba(255,253,246,.94); pointer-events:auto; }
.mobile-menu { display:none; position:absolute; right:10px; top:180px; width:210px; padding:12px; flex-direction:column; gap:8px; pointer-events:auto; }
.mobile-menu.show { display:flex; }
.mobile-menu strong { font-family:"Fredoka"; }
.mobile-menu button { border:2px solid var(--ink); border-radius:10px; background:white; padding:9px; }
.dialogue { position:absolute; left:50%; bottom:85px; transform:translateX(-50%) translateY(20px); width:min(520px, calc(100vw - 32px)); padding:16px 18px; opacity:0; pointer-events:none; transition:.25s; }
.dialogue.show { opacity:1; transform:translateX(-50%) translateY(0); pointer-events:auto; }
.dialogue strong { font-family:"Fredoka"; } .dialogue p { margin:6px 0 12px; }
.dialogue-actions { display:flex; gap:8px; flex-wrap:wrap; }
.dialogue-actions button { border:2px solid var(--ink); border-radius:10px; background:white; padding:7px 10px; cursor:pointer; }
.joystick { display:none; position:absolute; left:20px; bottom:calc(20px + env(safe-area-inset-bottom)); width:132px; height:132px; border:3px solid rgba(23,35,61,.78); border-radius:50%; background:rgba(255,253,246,.42); backdrop-filter:blur(8px); pointer-events:auto; touch-action:none; }
.joystick::after { content:""; position:absolute; width:8px; height:8px; left:calc(50% - 4px); top:calc(50% - 4px); border-radius:50%; background:rgba(23,35,61,.35); }
.joystick-knob { position:absolute; width:58px; height:58px; left:34px; top:34px; border:3px solid var(--ink); border-radius:50%; background:rgba(247,201,74,.94); box-shadow:3px 4px 0 rgba(23,35,61,.22); transform:translate(0,0); touch-action:none; }
.weather { position:absolute; right:22px; top:145px; font-size:11px; }
.minimap { position:absolute; right:22px; bottom:22px; width:150px; height:150px; border:3px solid var(--ink); border-radius:50%; background:rgba(139,185,112,.92); box-shadow:5px 5px 0 rgba(23,35,61,.18); pointer-events:none; }
.camera-mobile { display:none; position:absolute; right:22px; top:128px; width:52px; height:52px; border:3px solid var(--ink); border-radius:50%; background:rgba(255,253,246,.94); pointer-events:auto; font-size:19px; }
.sprint-mobile { display:none; position:absolute; right:108px; bottom:96px; width:58px; height:58px; border:3px solid var(--ink); border-radius:50%; background:rgba(247,201,74,.94); pointer-events:auto; font-size:10px; font-weight:800; }
.vehicle-mobile { display:none; position:absolute; right:174px; bottom:58px; width:48px; height:48px; border:3px solid var(--ink); border-radius:50%; background:rgba(255,253,246,.94); pointer-events:auto; font-weight:800; }
.rotate-hint { display:none; }
@media (max-width:700px), (pointer:coarse), (orientation:landscape) and (max-height:500px) {
  .topbar { padding:8px; }
  .player-card { min-width:152px; min-height:58px; gap:7px; padding:7px 8px 7px 7px; border-radius:14px; }
  .avatar { width:38px; height:38px; border-radius:10px; }
  .player-name { font-size:12px; }
  .bars { gap:3px; margin-top:4px; }
  .bar-row { font-size:9px; }
  .bar { width:62px; height:6px; }
  .clock { min-width:78px; padding:7px 8px; border-radius:14px; }
  .clock strong { font-size:16px; }
  .clock small { font-size:10px; }
  .wallet { right:8px; top:73px; padding:7px 9px; font-size:13px; border-radius:14px; }
  .quest { left:8px; bottom:170px; width:200px; padding:8px 10px; border-radius:14px; }
  .quest p { font-size:11px; }
  .joystick { display:block; }
  .camera-mobile, .sprint-mobile, .vehicle-mobile { display:grid; place-items:center; touch-action:none; }
  .camera-mobile { right:12px; top:122px; }
  .sprint-mobile { right:92px; bottom:58px; }
  .vehicle-mobile { right:164px; bottom:66px; }
  .minimap { right:8px; bottom:8px; width:112px; height:112px; }
  .mobile { display:none; }
  .mobile button { width:52px; height:52px; font-size:17px; border-radius:14px; touch-action:none; }
  #up { left:52px; top:0 } #down { left:52px; bottom:0 } #left { left:0; top:52px } #right { right:0; top:52px }
  .interact-mobile { display:grid; place-items:center; right:18px; bottom:50px; width:72px; height:72px; font-size:20px; touch-action:none; }
  .menu-mobile { display:block; top:184px; }
  .mobile-menu { top:236px; }
  .dialogue { bottom:82px; max-height:38vh; overflow:auto; }
}
@media (max-width:700px) and (orientation:portrait), (pointer:coarse) and (orientation:portrait) {
  .rotate-hint { position:fixed; z-index:20; top:50%; left:50%; display:flex; transform:translate(-50%,-50%); flex-direction:column; align-items:center; gap:9px; padding:13px 18px; border:2px solid var(--ink); border-radius:16px; background:rgba(255,253,246,.92); box-shadow:4px 4px 0 rgba(23,35,61,.2); font-size:12px; text-align:center; pointer-events:none; }
  .rotate-hint span { font-size:27px; }
  .minimap { bottom:140px; }
}
@media (max-width:700px) and (orientation:landscape), (pointer:coarse) and (orientation:landscape), (orientation:landscape) and (max-height:500px) {
  .topbar { padding:6px 10px; }
  .player-card { min-width:190px; padding:5px 8px; }
  .clock { min-width:105px; }
  .wallet { right:10px; top:62px; }
  .menu-mobile { right:8px; top:174px; }
  .mobile-menu { top:224px; }
  .camera-mobile { right:10px; top:112px; }
  .quest { left:155px; bottom:8px; width:210px; }
  .joystick { left:12px; bottom:12px; width:118px; height:118px; }
  .joystick-knob { width:52px; height:52px; left:30px; top:30px; }
  .sprint-mobile { right:112px; bottom:56px; }
  .vehicle-mobile { right:174px; bottom:66px; }
  .interact-mobile { right:18px; bottom:34px; }
  .minimap { width:96px; height:96px; left:calc(50% - 48px); right:auto; top:8px; bottom:auto; }
  .dialogue { bottom:24px; max-height:55vh; }
}
