:root{--ink:#f6e7c1;--panel:#3b2a1a;--edge:#c9a05a;color-scheme:dark}
html,body{margin:0;height:100%;background:#1d2b1f;overflow:hidden;font-family:Georgia,'Palatino Linotype',serif;color:var(--ink)}
canvas{display:block;width:100%;height:100%;image-rendering:pixelated;touch-action:none;-webkit-user-select:none;user-select:none}
html,body{touch-action:none;-webkit-tap-highlight-color:transparent}
/* ===== Cartão de objetivo acompanhado ===== */
#objective{position:fixed;left:8px;top:8px;z-index:5;width:min(280px,30vw);min-width:190px;background:#24190fe8;border:2px solid #c9a05a;border-left:5px solid #7ed957;border-radius:8px;padding:7px 10px;box-shadow:0 3px 10px #0008;display:none;pointer-events:auto;font-size:12px;line-height:1.35}
#objective b{display:block;color:#ffdc83;font-size:12px;margin-bottom:2px}
#objective span{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#objective button{width:100%;padding:2px 4px;margin:4px 0 0;text-align:left;font-size:11px;background:transparent;border:0;color:#f6e7c1;cursor:pointer}
#objective button:hover,#objective button:focus-visible{background:#ffffff18;outline:1px solid #ffd96b}
@media(pointer:coarse){#objective{top:calc(92px + env(safe-area-inset-top,0px));left:calc(5px + env(safe-area-inset-left,0px));width:min(220px,47vw);min-width:0;padding:5px 7px;font-size:11px}#objective b{font-size:11px}}
.achgroup{margin:12px 0;padding:8px 10px;background:#24190f88;border:1px solid #8f6b3e;border-radius:7px}
.achhead{display:flex;justify-content:space-between;gap:8px;margin-bottom:6px;color:#ffdc83}
.achrow{padding:5px 2px;border-top:1px solid #ffffff18}
.achrow.locked{opacity:.58}
.achprogress{height:6px;background:#1a110a;border:1px solid #6b4a2a;border-radius:5px;overflow:hidden;margin-top:4px}
.achprogress i{display:block;height:100%;background:#7ed957}

#titleScreen{position:fixed;inset:0;z-index:100;pointer-events:auto;touch-action:manipulation;display:flex;align-items:center;justify-content:center;padding:18px;box-sizing:border-box;overflow:auto;background:linear-gradient(180deg,rgba(10,22,14,.68),rgba(11,17,12,.88)),radial-gradient(ellipse at 50% 30%,#557d45 0%,#203b28 48%,#101b14 100%)}
#titleScreen[hidden]{display:none}#titleScreen .title-card{width:min(94vw,560px);max-height:calc(100dvh - 36px);overflow:auto;box-sizing:border-box;text-align:center;padding:clamp(18px,4vw,34px);border:4px solid #c9a05a;border-radius:12px;background:linear-gradient(145deg,#49341fef,#241d15f5);box-shadow:0 12px 0 #120d09,0 22px 55px #0009}
#titleScreen .brand-mark{font-size:clamp(34px,7vw,62px);line-height:1.05;color:#ffe29a;text-shadow:3px 3px 0 #583a1d,5px 5px 0 #140e08;margin:0 0 10px}#titleScreen .subtitle{font-size:clamp(13px,2.5vw,17px);color:#cfe7b5;margin:0 0 22px}
#titleScreen .title-actions{display:grid;gap:9px;max-width:340px;margin:0 auto}#titleScreen .title-actions button{position:relative;z-index:101;pointer-events:auto;touch-action:manipulation;-webkit-tap-highlight-color:transparent;width:100%;min-height:46px;margin:0;font-size:16px;font-weight:bold;border-width:3px;background:#527c3c;border-color:#d5b66d;color:#fff2cb;box-shadow:0 3px 0 #182313}#titleScreen .title-actions button:first-child{background:#8b6330}
#titleScreen .title-actions button:hover,#titleScreen .title-actions button:focus-visible{filter:brightness(1.18);transform:translateY(-1px)}#titleScreen .title-foot{margin-top:18px;font-size:12px;line-height:1.6;color:#d8c9a8}#titleScreen .title-info{display:none;text-align:left;max-width:420px;margin:16px auto 0;padding:12px;border:1px solid #8c7048;border-radius:8px;background:#17170fd9;line-height:1.55;font-size:14px}#titleScreen .title-info.visible{display:block}#titleScreen .title-info h2{margin:0 0 8px;color:#ffe29a;font-size:18px}#titleScreen .title-info p{margin:6px 0}
@media(max-height:520px){#titleScreen{padding:6px}#titleScreen .title-card{padding:12px;max-height:calc(100dvh - 12px)}#titleScreen .brand-mark{font-size:32px;margin-bottom:5px}#titleScreen .subtitle{margin-bottom:10px}#titleScreen .title-actions{gap:5px}#titleScreen .title-actions button{min-height:38px;padding:5px}#titleScreen .title-foot{margin-top:8px}}

/* ===== Direção visual: fantasia aconchegante em tons pastel ===== */
:root{--ink:#584a57;--panel:#fff8ed;--edge:#d7a4a6;color-scheme:light}
html,body{background:#dce9d5;color:var(--ink);font-family:'Trebuchet MS','Arial Rounded MT Bold',system-ui,sans-serif}
#c{filter:saturate(.9) brightness(1.035) contrast(.97) sepia(.035)}
#titleScreen{
 background:
   radial-gradient(circle at 14% 24%,rgba(255,239,180,.72) 0 2px,transparent 3px),
   radial-gradient(circle at 83% 19%,rgba(255,239,180,.65) 0 2px,transparent 3px),
   radial-gradient(circle at 78% 76%,rgba(238,211,241,.5) 0 3px,transparent 4px),
   linear-gradient(180deg,rgba(70,101,76,.25),rgba(37,63,51,.58)),
   radial-gradient(ellipse at 50% 30%,#b9d4a7 0%,#789b78 48%,#405e52 100%);
}
#titleScreen .title-card{
 border:3px solid #e5bd85;border-radius:22px;
 background:linear-gradient(145deg,rgba(255,250,240,.98),rgba(248,232,239,.98));
 box-shadow:0 8px 0 #66775b88,0 18px 48px #233e2c70;
}
#titleScreen .brand-mark{color:#72566f;text-shadow:0 2px 0 #fff0c6,2px 4px 0 #d9b7c9}
#titleScreen .subtitle{color:#6b896b}
#titleScreen .title-actions button{
 border:2px solid #fff2d4!important;border-radius:16px!important;
 background:#a9ca91!important;color:#3f5945!important;
 box-shadow:0 4px 0 #7d9e70!important;
}
#titleScreen .title-actions button:first-child{background:#eab58f!important;color:#694c49!important;box-shadow:0 4px 0 #c88e72!important}
#titleScreen .title-actions button:nth-child(3){background:#c7b4df!important;color:#594d6c!important;box-shadow:0 4px 0 #a390bf!important}
#titleScreen .title-actions button:nth-child(4){background:#f1d285!important;color:#67583c!important;box-shadow:0 4px 0 #cfad62!important}
#titleScreen .title-actions button:hover,#titleScreen .title-actions button:focus-visible{filter:brightness(1.06);transform:translateY(-2px)}
#titleScreen .title-foot{color:#78697a}
#titleScreen .title-info{border:1px solid #dfc3cf;border-radius:16px;background:#fffaf0eF;color:#584a57}
#titleScreen .title-info h2{color:#805c77}
#tb button,#mobbar button,#b_act,#b_chest,.p,#menu .p,#objective,.achgroup,.achprogress,.cal div,.sl,.hb,.vb,#eb{
 border-radius:12px;
}
#tb button,#mobbar button{
 border-color:#e7c3a6;background:#fff7e9;color:#5e5260;
 box-shadow:0 2px 0 #c9a895;
}
#tb button:active,#mobbar button:active{background:#f1d9e7}
#b_act{border-color:#f4d7a2;background:#fff4dc;color:#876274;box-shadow:0 4px 12px #46354a44}
#b_chest{border-color:#e7c3a6;background:#fff7e9}
#b_chest:active,#b_chest:hover{background:#f7e3cb}
#clk{border-top-color:#9cc78b;background:rgba(0,0,0,.62)!important;color:#fff7e9;text-shadow:0 1px 3px #000a}
#c1,#c2,#c3,#c4{color:#fff8e9}
.coin{background:#f4cd71;border-color:#d6a54e}
#bars{filter:drop-shadow(0 2px 2px #53454a66)}
.vb{background:#fff3e8;border-color:#e5bd85}
.vb i{background:#9fca91}
.vb:nth-child(2) i{background:#e995a8}
.sl{background:#fff7e9dd;border-color:#d9bba7}
.sl.on{border-color:#e6a6bb;box-shadow:0 0 0 2px #fff3f7,0 0 10px #e6a6bb88}
.sl b,.sl i{color:#5d5060;text-shadow:0 1px 2px #fff6}
.p,#menu .p{background:#fff8eef5;border-color:#e3baa8;color:#584a57;box-shadow:0 5px 18px #4c3d4d33}
#menu{background:#38433f88}
button{background:#e7c3a6;color:#5a4b56;border-color:#d7a4a6;border-radius:12px}
button:hover,button:focus-visible{background:#f1d4dc;outline-color:#bd91bb}
button[disabled]{filter:saturate(.5)}
.g .sl{border-radius:11px}
.hb{background:#eadfd0;border-color:#d4b39d}
.achgroup{background:#f2e7df;border-color:#dfc1ae}
.achhead,#objective b{color:#8a617c}
.achrow{border-color:#dfc8c7}
.achprogress{background:#eadfd0;border-color:#d4b39d}
.achprogress i{background:#98c58b}
#objective{background:#fff8eef2;border-color:#e4bfa7;border-left-color:#a4c88e;color:#584a57;box-shadow:0 4px 12px #493c4933}
#objective button{color:#766078}
#objective button:hover,#objective button:focus-visible{background:#f2e3e9;outline-color:#cf9bb5}
.cal div{border-color:#dfc1ae;background:#fff8ef}
.cal .on{border-color:#d7a4a6;background:#f3dce5}
.cal .pa{opacity:.48}
@media(max-width:520px){
 #bw:not(.side){background:#fff8eef0;border-color:#e4bfa7}
}
@media(pointer:coarse) and (orientation:portrait){
 #tb,#mobbar{max-width:calc(100vw - 152px);flex-wrap:wrap;gap:3px}
 #tb{top:calc(4px + env(safe-area-inset-top,0px))}
 #mobbar{top:calc(46px + env(safe-area-inset-top,0px))}
 #tb button,#mobbar button{padding:5px 7px;font-size:10px;min-height:32px}
 #msg{top:calc(90px + env(safe-area-inset-top,0px))!important;max-width:calc(100vw - 24px);font-size:12px}
 #objective{top:calc(132px + env(safe-area-inset-top,0px))!important}
}

/* ===== HUD mobile ULTRA compacto + PWA ===== */
@media (pointer:coarse), (max-width:900px){
  /* Baú some */
  #b_chest{display:none!important;visibility:hidden!important;width:0!important;height:0!important;overflow:hidden!important;pointer-events:none!important}
  #objective{display:none!important}
  #mobbar{display:none!important}

  /* Menu ☰ pequeno */
  #tb{display:flex!important;position:fixed;left:calc(4px + env(safe-area-inset-left,0px));top:calc(4px + env(safe-area-inset-top,0px));z-index:10;gap:0}
  #tb button{padding:0;width:36px;height:36px;min-height:36px;min-width:36px;font-size:16px;line-height:36px;text-align:center;
    border-radius:10px;background:#000a;border:1.5px solid #c9a05a88;color:#ffd96b;margin:0}

  /* Relógio: só hora + ouro */
  #hudR{top:calc(4px + env(safe-area-inset-top,0px));right:calc(4px + env(safe-area-inset-right,0px));gap:0;align-items:flex-start}
  #clk{min-width:0!important;padding:3px 7px!important;font-size:10px!important;line-height:1.15!important;
    background:rgba(0,0,0,.55)!important;border:1px solid rgba(255,255,255,.12)!important;border-top:3px solid #7ed957!important;
    border-radius:8px!important;box-shadow:0 1px 4px #0005;opacity:1}
  #c1{display:none!important} /* dia/estação */
  #c4{display:none!important} /* local/clima */
  #c2{font-size:14px!important;font-weight:bold;letter-spacing:0.5px}
  #c3{font-size:10px!important;gap:3px}
  #wic{width:12px!important;height:12px!important}
  .coin{width:8px;height:8px}

  /* Botão E menor */
  #b_act{display:flex!important;align-items:center;justify-content:center;
    position:fixed;right:calc(6px + env(safe-area-inset-right,0px));
    bottom:calc(58px + env(safe-area-inset-bottom,0px));
    width:44px!important;height:44px!important;font-size:16px!important;
    border-radius:12px;border:2px solid #c9a05a;background:#1a110acc;color:#ffd96b;
    box-shadow:0 2px 6px #0005;z-index:9;padding:0;margin:0}

  /* Barras finíssimas ao lado do E */
  #bars{position:fixed!important;
    right:calc(6px + env(safe-area-inset-right,0px));
    bottom:calc(106px + env(safe-area-inset-bottom,0px));
    left:auto!important;top:auto!important;
    flex-direction:row;gap:2px;opacity:.85;z-index:8}
  #bars .vb{width:8px!important;height:28px!important;border-width:1px;border-radius:2px}
  #bars .vb span{font-size:7px;bottom:0}

  /* Hotbar mais baixa e slots menores */
  #bw{position:fixed;left:50%;transform:translateX(-50%);
    bottom:calc(4px + env(safe-area-inset-bottom,0px))!important;
    background:#0009;padding:3px 6px 4px;border-radius:10px;border:1.5px solid #c9a05a88;
    z-index:8;text-align:center}
  #bw #sn{display:none}
  #bar{display:flex;gap:2px;justify-content:center}
  #bar .sl{width:34px!important;height:34px!important;min-width:34px;min-height:34px;border-width:2px;border-radius:6px}
  #bar .sl img{width:22px;height:22px;left:50%;top:50%;transform:translate(-50%,-50%)}
  #bar .sl b{font-size:7px}
  #bar .sl i{font-size:8px}

  /* Hotbar lateral (saída sul) */
  #bw.side{
    left:calc(4px + env(safe-area-inset-left,0px))!important;right:auto!important;
    transform:none!important;bottom:calc(8px + env(safe-area-inset-bottom,0px))!important;
    flex-direction:column;padding:4px;max-height:65vh;overflow:auto}
  #bw.side #bar{flex-direction:column;gap:2px}
  #bw.side #bar .sl{width:34px!important;height:34px!important}

  #msg{top:calc(44px + env(safe-area-inset-top,0px));max-width:50vw;font-size:11px;padding:2px 8px;z-index:9}
}
@media (pointer:coarse) and (orientation:landscape){
  #bar .sl{width:30px!important;height:30px!important;min-width:30px;min-height:30px}
  #bar .sl img{width:18px;height:18px}
  #b_act{width:40px!important;height:40px!important;bottom:calc(48px + env(safe-area-inset-bottom,0px))}
  #bars{bottom:calc(92px + env(safe-area-inset-bottom,0px))}
  #bars .vb{height:24px!important;width:7px!important}
  #c2{font-size:12px!important}
  #tb button{width:32px;height:32px;min-width:32px;min-height:32px;font-size:14px;line-height:32px}
}
@media (display-mode: standalone), (display-mode: fullscreen){
  /* App instalado: ainda mais colado nas bordas */
  #tb{top:calc(2px + env(safe-area-inset-top,0px))}
  #hudR{top:calc(2px + env(safe-area-inset-top,0px))}
}

body.mobile-hud #b_chest{display:none!important}
body.mobile-hud #c1,body.mobile-hud #c4{display:none!important}
