:root {
  --bg: rgba(18, 22, 18, 0.82);
  --bd: rgba(255, 255, 255, 0.12);
  --tx: #f1ead8;
  --mut: #b9b19c;
  --acc: #ffcf4a;
  --good: #8fe08a;
  --bad: #ff8a7a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none; background: #0d140f; color: var(--tx);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; cursor: crosshair; touch-action: none; }
.hidden { display: none !important; }
kbd { display: inline-block; padding: 0 5px; border: 1px solid rgba(255,255,255,.3); border-bottom-width: 2px; border-radius: 4px;
  font: 600 11px/16px ui-monospace, monospace; background: rgba(255,255,255,.08); color: var(--tx); }

.btn { background: #3b4a2e; color: var(--tx); border: 1px solid rgba(255,255,255,.18); border-radius: 8px; padding: 8px 14px;
  font: 600 14px system-ui, sans-serif; cursor: pointer; transition: background .15s, transform .05s; }
.btn:hover:not(:disabled) { background: #4f6340; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.btn.big { padding: 13px 28px; font-size: 18px; background: #b8551f; border-color: #e07a3a; }
.btn.big:hover { background: #d0652a; }
.btn.danger { background: #6a2a22; }

/* HUD */
#hud { position: fixed; left: 14px; top: 14px; width: 250px; background: var(--bg); border: 1px solid var(--bd);
  border-radius: 12px; padding: 10px 12px; backdrop-filter: blur(4px); }
.bar { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: 12px; }
.bl { width: 52px; color: var(--mut); }
.bt { flex: 1; height: 10px; background: rgba(255,255,255,.1); border-radius: 6px; overflow: hidden; }
.bf { height: 100%; border-radius: 6px; transition: width .2s; }
.bt.crit { animation: pulse 0.8s infinite; outline: 1px solid #ff5a4a; }
@keyframes pulse { 50% { background: rgba(255, 60, 40, .35); } }
.bv { width: 24px; text-align: right; font-variant-numeric: tabular-nums; }
#feels { font-size: 11px; color: var(--mut); margin-top: 6px; }
#status { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: rgba(255,255,255,.08); }
.tag.good { color: var(--good); } .tag.bad { color: var(--bad); }

#topright { position: fixed; right: 14px; top: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#clock { background: var(--bg); border: 1px solid var(--bd); border-radius: 12px; padding: 8px 14px; text-align: right; min-width: 170px; }
#clock .day { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
#clock .day small { font-size: 12px; color: var(--mut); font-weight: 500; }
#clock .time { font-size: 16px; font-variant-numeric: tabular-nums; }
#clock .wx { font-size: 12px; color: var(--mut); }
#clock .bio { font-size: 11px; color: var(--acc); }
#minimap { width: 150px; height: 150px; image-rendering: pixelated; border-radius: 10px; border: 1px solid var(--bd); background: #111; transition: width .2s, height .2s; }
#minimap.big { width: 380px; height: 380px; }
.tbtns { display: flex; gap: 5px; }

#log { position: fixed; left: 14px; bottom: 96px; width: min(440px, 40vw); display: flex; flex-direction: column; gap: 3px; pointer-events: none; }
.msg { font-size: 12px; background: rgba(10,14,10,.62); padding: 4px 9px; border-radius: 7px; width: fit-content; max-width: 100%;
  text-shadow: 0 1px 1px #000; transition: opacity .5s; }
.msg.good { color: var(--good); } .msg.bad { color: var(--bad); } .msg.warn { color: #ffd27a; } .msg.hint { color: #a8d8ff; }

#prompt { position: fixed; left: 50%; bottom: 122px; transform: translateX(-50%); background: rgba(0,0,0,.6); padding: 5px 12px;
  border-radius: 8px; font-size: 13px; pointer-events: none; white-space: nowrap; }
#itemname { position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%); font-size: 12px; color: var(--mut); white-space: nowrap; text-shadow: 0 1px 2px #000; }
#itemname b { color: var(--tx); }
#hotbar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 5px; background: var(--bg);
  padding: 6px; border-radius: 12px; border: 1px solid var(--bd); }
.slot { width: 50px; height: 50px; border-radius: 8px; background: rgba(255,255,255,.06); border: 2px solid transparent; position: relative;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.slot:hover { background: rgba(255,255,255,.12); }
.slot.sel { border-color: var(--acc); background: rgba(255,207,74,.12); }
.slot .key { position: absolute; left: 4px; top: 1px; font-size: 10px; color: var(--mut); }
.slot .cnt { position: absolute; right: 4px; bottom: 1px; font-size: 12px; font-weight: 700; text-shadow: 0 1px 2px #000; }
.slot .ic { display: flex; }

#pile { position: fixed; right: 14px; bottom: 14px; width: 230px; background: var(--bg); border: 1px solid var(--bd); border-radius: 12px; padding: 8px 10px; }
.ph { font-weight: 700; font-size: 13px; margin-bottom: 5px; }
.ph span { display: block; font-weight: 400; font-size: 10px; color: var(--mut); }
.plist { max-height: 240px; overflow-y: auto; margin-bottom: 6px; }
.pitem { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.pitem:hover { background: rgba(255,255,255,.1); }
.pn { flex: 1; } .pc { color: var(--acc); font-weight: 700; }

#menu { position: fixed; background: rgba(16,20,14,.94); border: 1px solid rgba(255,255,255,.2); border-radius: 10px; padding: 6px; min-width: 210px;
  box-shadow: 0 6px 20px rgba(0,0,0,.5); z-index: 5; }
.mh { font-weight: 700; font-size: 13px; padding: 2px 6px 5px; color: var(--acc); border-bottom: 1px solid var(--bd); margin-bottom: 3px; }
.mi { padding: 4px 6px; font-size: 13px; border-radius: 6px; cursor: pointer; display: flex; gap: 7px; align-items: center; }
.mi:hover { background: rgba(255,255,255,.12); }
.mi.dis { color: var(--mut); cursor: default; font-size: 12px; font-style: italic; }
.mi.dis:hover { background: none; }
.mk { display: inline-block; width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 4px; background: rgba(255,255,255,.12); font-size: 11px; font-weight: 700; font-style: normal; }
.mf { font-size: 10px; color: var(--mut); padding: 4px 6px 0; border-top: 1px solid var(--bd); margin-top: 3px; }

.panel { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(18,22,16,.96); border: 1px solid var(--bd);
  border-radius: 14px; padding: 16px 18px; width: min(860px, 94vw); max-height: 86vh; overflow-y: auto; z-index: 10; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.panel.small { width: 340px; display: flex; flex-direction: column; gap: 8px; text-align: center; }
.panel h2 { margin: 0 0 4px; }
.phead { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.phead span { color: var(--mut); font-size: 12px; flex: 1; }
.phead .btn { margin-left: auto; }
#craftlist { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rc { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; background: rgba(255,255,255,.04); border: 1px solid transparent; }
.rc { position: relative; overflow: hidden; }
.rc.busy { border-color: var(--acc); background: rgba(255,207,74,.12); }
.rc.done { border-color: var(--good); background: rgba(143,224,138,.18); transition: background .4s; }
.rc.done .btn:disabled, .rc.busy .btn:disabled { opacity: 1; }
.rprog { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(0,0,0,.35); }
.rprogf { height: 100%; width: 0; background: var(--acc); }
.rc.ok { border-color: rgba(143,224,138,.35); background: rgba(143,224,138,.07); }
.ric { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.25); border-radius: 8px; flex-shrink: 0; }
.rb { flex: 1; min-width: 0; }
.rn { font-weight: 700; font-size: 14px; }
.rd { font-size: 11px; color: var(--mut); margin: 1px 0 4px; }
.rneed { display: flex; flex-wrap: wrap; gap: 4px; }
.ing { display: inline-flex; align-items: center; font-size: 11px; padding: 1px 6px 1px 2px; border-radius: 8px; background: rgba(0,0,0,.25); }
.ing.have { color: var(--good); } .ing.miss { color: var(--bad); }
.helpgrid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 20px; font-size: 13px; }
.helpgrid h3 { margin: 6px 0; color: var(--acc); }
.helpgrid td { padding: 3px 6px 3px 0; vertical-align: top; }
.helpgrid li { margin: 3px 0; }

#sleep { position: fixed; inset: 0; background: rgba(0,0,10,.0); pointer-events: none; display: flex; align-items: flex-start; justify-content: center;
  transition: background 1s; }
#sleep div { margin-top: 18vh; font-size: 28px; opacity: 0; transition: opacity 1s; letter-spacing: 3px; }
#sleep.show { background: rgba(0,0,10,.55); }
#sleep.show div { opacity: .85; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(0,0,0,.35), rgba(0,0,0,.75)); z-index: 20; overflow-y: auto; padding: 20px; }
.screen .card { background: rgba(16,20,14,.93); border: 1px solid var(--bd); border-radius: 18px; padding: 24px 28px; width: min(980px, 96vw); max-height: 94vh; overflow-y: auto; box-shadow: 0 10px 50px rgba(0,0,0,.6); }
.card h1 { margin: 0; font-size: 44px; letter-spacing: 3px; color: var(--acc); text-shadow: 0 3px 0 #6a3a10; }
.card h3 { margin: 14px 0 6px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; color: var(--mut); }
.card h3 small { text-transform: none; letter-spacing: 0; }
.sub { color: var(--mut); margin: 6px 0 4px; }
.opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.opts.biomes { grid-template-columns: repeat(3, 1fr); }
.opts.inline { display: flex; gap: 6px; }
.opt { padding: 9px 11px; border-radius: 10px; background: rgba(255,255,255,.05); border: 2px solid transparent; cursor: pointer; position: relative; }
.opt:hover { background: rgba(255,255,255,.1); }
.opt.on { border-color: var(--acc); background: rgba(255,207,74,.1); }
.opt b { display: block; font-size: 14px; }
.opt small { display: block; color: var(--mut); font-size: 11px; margin-top: 2px; }
.opt i { position: absolute; right: 8px; top: 8px; font-size: 10px; font-style: normal; color: var(--acc); }
.row { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 18px; }
input#seedIn { background: rgba(255,255,255,.07); border: 1px solid var(--bd); color: var(--tx); border-radius: 8px; padding: 8px 10px; font-size: 14px; width: 150px; }
.savebox { margin: 12px 0; padding: 10px 12px; background: rgba(143,224,138,.08); border: 1px solid rgba(143,224,138,.3); border-radius: 10px; display: flex; gap: 12px; align-items: center; }
.savebox .btn { margin-left: auto; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 16px 0; }
.stats div { background: rgba(255,255,255,.05); border-radius: 10px; padding: 10px; font-size: 12px; color: var(--mut); text-align: center; }
.stats b { display: block; font-size: 22px; color: var(--tx); }
#end .card { text-align: center; }

@media (max-width: 900px) {
  .opts, .opts.biomes { grid-template-columns: 1fr 1fr; }
  #craftlist, .helpgrid, .stats { grid-template-columns: 1fr 1fr; }
  #log { bottom: 150px; }
}

#wear { display: flex; gap: 5px; margin-top: 7px; }
.wslot { width: 34px; height: 34px; border-radius: 7px; background: rgba(255,255,255,.06); display: flex; align-items: center; justify-content: center; border: 1px dashed rgba(255,255,255,.18); }
.wslot.on { border: 1px solid rgba(143,224,138,.5); cursor: pointer; background: rgba(143,224,138,.1); }
.wslot .wl { font-size: 8px; color: var(--mut); text-align: center; }
.pempty { font-size: 11px; color: var(--mut); padding: 4px 2px 8px; }
.pbtns { display: flex; gap: 5px; flex-wrap: wrap; }
.prow { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; color: var(--mut); text-align: left; }
.prow select { background: #2a3322; color: var(--tx); border: 1px solid var(--bd); border-radius: 6px; padding: 4px; max-width: 210px; }
.prow input[type=range] { width: 150px; }
.slot { width: 46px; height: 46px; }

.rc.upg { grid-column: 1 / -1; background: rgba(255,207,74,.06); border-color: rgba(255,207,74,.25); }
.rc.upg.ok { border-color: rgba(143,224,138,.5); }
.rc.upg .ric { font-size: 26px; }
.rn small { font-weight: 400; color: var(--mut); font-size: 11px; }
.ph b { font-weight: 600; color: var(--good); font-size: 11px; }
.ph b.full { color: var(--bad); }

.worlds { display: flex; flex-direction: column; gap: 6px; }
.world { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: rgba(143,224,138,.07); border: 1px solid rgba(143,224,138,.25); }
.world .wi { flex: 1; min-width: 0; }
.world .wi b { display: block; font-size: 15px; }
.world .wi small { color: var(--mut); font-size: 12px; }
input#nameIn { background: rgba(255,255,255,.07); border: 1px solid var(--bd); color: var(--tx); border-radius: 8px; padding: 8px 10px; font-size: 14px; width: 190px; }
#saved { font-size: 11px; color: var(--good); opacity: 0; transition: opacity .4s; margin-top: -4px; }
#saved.show { opacity: .9; }

.mprog { padding: 5px 6px 2px; border-top: 1px solid var(--bd); margin-top: 3px; font-size: 11px; color: var(--acc); }
.mpb { height: 5px; background: rgba(255,255,255,.12); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.mpb div { height: 100%; width: 0; background: var(--acc); }

#attrs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; cursor: pointer; }
.at { font-size: 11px; padding: 2px 6px; border-radius: 6px; background: rgba(255,255,255,.07); color: var(--mut); }
.at b { color: var(--tx); }
.at.neg b, .at.neg { color: var(--bad); }
.at.more { background: none; padding: 2px 0; }
.attrgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.attr { background: rgba(255,255,255,.04); border-radius: 10px; padding: 8px 10px; }
.an b { font-size: 14px; } .av { font-size: 18px; font-weight: 800; margin-left: 4px; } .av.neg { color: var(--bad); }
.an small { color: var(--mut); }
.ad { font-size: 11px; color: var(--mut); margin: 2px 0 5px; }
.am { font-size: 11px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.am .neg { color: var(--bad); } .am .pos { color: var(--good); } .mut { color: var(--mut); }
.xpbar { height: 6px; background: rgba(255,255,255,.1); border-radius: 4px; overflow: hidden; }
.xpbar div { height: 100%; background: #6fb6ff; }
.xpbar.loss div { background: var(--bad); }
.skillgrid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.skill { display: flex; gap: 8px; background: rgba(255,255,255,.04); border-radius: 10px; padding: 7px 9px; align-items: center; }
.si { font-size: 22px; width: 28px; text-align: center; }
.sb { flex: 1; min-width: 0; }
.sn b { font-size: 13px; } .lv { color: var(--acc); font-size: 12px; font-weight: 700; }
.sd { font-size: 10px; color: var(--mut); margin: 1px 0 4px; }
#char h3 { margin: 8px 0 6px; color: var(--acc); font-size: 13px; text-transform: uppercase; letter-spacing: 1px; }
#char .hint { font-size: 11px; color: var(--mut); margin: 6px 0 2px; }
@media (max-width: 900px) { .skillgrid { grid-template-columns: 1fr 1fr; } }

.slot .mb { position: absolute; left: 4px; bottom: 2px; height: 3px; border-radius: 2px; max-width: calc(100% - 8px); }
.pf { font-size: 10px; color: var(--mut); margin-right: 4px; }
#itemname i { color: #ffd34a; font-style: normal; }

#clock .season { font-size: 12px; color: #ffd34a; }

.rc.locked { opacity: .75; border: 1px dashed rgba(255,255,255,.2); grid-column: 1 / -1; }
.slot.extra { border-style: dashed; border-color: rgba(201,168,106,.4); }

.npc { background: rgba(255,255,255,.04); border-radius: 10px; padding: 9px 11px; margin-bottom: 8px; }
.nh b { font-size: 15px; } .nh small { color: var(--mut); margin-left: 4px; }
.ns { float: right; font-size: 12px; color: var(--acc); }
.nbars { display: flex; gap: 12px; margin: 6px 0; font-size: 11px; color: var(--mut); }
.nbars span { display: flex; align-items: center; gap: 5px; }
.nbars i { display: inline-block; width: 70px; height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
.nbars b { display: block; height: 100%; }
.ntasks { display: flex; flex-wrap: wrap; gap: 4px; }
.ntasks .btn.on { background: #7a6a20; border-color: var(--acc); }

.achs { margin: 6px 0 2px; font-size: 13px; color: var(--mut); }
.achs span { opacity: .25; margin-left: 3px; filter: grayscale(1); }
.achs span.got { opacity: 1; filter: none; }
.opt.locked { opacity: .45; cursor: default; }
.opts.profiles { grid-template-columns: repeat(4, 1fr); }

/* ================= Celular / toque ================= */
body { position: fixed; inset: 0; }
.panel, .screen, .plist, #craftlist, #charbody, #tribebody { overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.touchonly, .touchonly-block { display: none !important; }
body.touch .touchonly { display: inline-block !important; }
body.touch .touchonly-block { display: block !important; }
#touchui { display: none; }
body.touch #touchui { display: block; }
#joyBase { display: none; position: fixed; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.25); z-index: 6; pointer-events: none; }
#joyBase.run { border-color: var(--acc); background: rgba(255,207,74,.12); }
#joyKnob { position: absolute; left: 30px; top: 30px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.35); border: 2px solid rgba(255,255,255,.6); }
#joyHint { position: fixed; left: 8%; bottom: 22%; padding: 14px 18px; border: 2px dashed rgba(255,255,255,.25); border-radius: 50%; color: rgba(255,255,255,.5); font-size: 12px; pointer-events: none; z-index: 1; }
#tbtns { position: fixed; right: max(10px, env(safe-area-inset-right)); bottom: calc(66px + env(safe-area-inset-bottom)); display: grid; gap: 7px; z-index: 6; align-items: center; justify-items: center;
  grid-template-areas: 'rep take .' 'use drop act' 'sleep run act'; }
.tb { width: 56px; height: 58px; border-radius: 50%; border: 2px solid rgba(255,255,255,.25); background: rgba(20,26,18,.72); color: var(--tx); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.tb b { font-size: 20px; line-height: 1; font-weight: 400; }
.tb span { font-size: 9px; margin-top: 2px; max-width: 54px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tb:active { transform: scale(.94); background: rgba(80,100,60,.8); }
.tb.big { width: 84px; height: 84px; }
.tb.big b { font-size: 30px; }
.tb.big span { font-size: 10px; max-width: 76px; }
.tb.ready { border-color: var(--acc); box-shadow: 0 0 12px rgba(255,207,74,.35); }
.tb.on { border-color: var(--good); background: rgba(80,140,70,.6); }
body.touch kbd { display: none; }
body.touch .slot { touch-action: manipulation; }
body.touch #menu { min-width: 230px; max-width: 86vw; max-height: 60vh; overflow-y: auto; }
body.touch .mi { padding: 9px 8px; font-size: 14px; }
body.touch .mf { display: none; }
body.touch .pitem { padding: 7px 4px; }
body.touch .btn.small { padding: 7px 11px; font-size: 14px; }
body.touch #log { pointer-events: none; }

/* layout compacto (telas pequenas) */
@media (max-width: 900px), (max-height: 560px) {
  #hud { width: 158px; padding: 6px 8px; left: max(6px, env(safe-area-inset-left)); top: max(6px, env(safe-area-inset-top)); border-radius: 10px; }
  .bar { margin: 2px 0; font-size: 10px; gap: 5px; }
  .bl { width: 42px; } .bt { height: 7px; } .bv { width: 20px; }
  #feels, #wear, #attrs { display: none; }
  #status { margin-top: 3px; } .tag { font-size: 9px; padding: 1px 5px; }
  #topright { right: max(6px, env(safe-area-inset-right)); top: max(6px, env(safe-area-inset-top)); gap: 5px; }
  #clock { min-width: 0; padding: 5px 9px; }
  #clock .day { font-size: 15px; } #clock .time { font-size: 13px; } #clock .wx, #clock .bio, #clock .season { font-size: 10px; }
  #minimap { width: 86px; height: 86px; }
  #minimap.big { width: min(300px, 70vw); height: min(300px, 70vw); }
  .tbtns { flex-wrap: wrap; justify-content: flex-end; max-width: 210px; }
  #saved { display: none; }
  #log { left: 50%; transform: translateX(-50%); top: max(6px, env(safe-area-inset-top)); bottom: auto; width: min(44vw, 380px); }
  .msg { font-size: 10.5px; padding: 3px 7px; }
  #log .msg:nth-last-child(n+4) { display: none; }
  #hotbar { bottom: max(6px, env(safe-area-inset-bottom)); gap: 3px; padding: 4px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 12px); }
  .slot { width: min(42px, calc((100vw - 60px) / 10)); height: min(42px, calc((100vw - 60px) / 10)); }
  .slot .ic canvas { width: 80% !important; height: 80% !important; }
  .slot .key { display: none; }
  #itemname { bottom: 58px; font-size: 10.5px; max-width: 70vw; overflow: hidden; text-overflow: ellipsis; }
  #prompt { bottom: 76px; font-size: 11px; }
  #pile { right: auto; left: max(6px, env(safe-area-inset-left)); bottom: auto; top: 150px; width: 190px; padding: 6px 8px; max-height: 40vh; overflow-y: auto; }
  .plist { max-height: 22vh; }
  .panel { left: 0; top: 0; transform: none; width: 100vw; max-width: 100vw; height: 100vh; height: 100dvh; max-height: none; border-radius: 0; padding: 12px max(12px, env(safe-area-inset-left)) 20px; }
  .panel.small { left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(340px, 94vw); height: auto; border-radius: 14px; }
  .phead { flex-wrap: wrap; position: sticky; top: -12px; background: rgba(18,22,16,.98); padding: 6px 0; z-index: 2; }
  .phead span { order: 3; flex-basis: 100%; }
  #craftlist, .helpgrid, .attrgrid, .skillgrid { grid-template-columns: 1fr; }
  .rc .btn { padding: 10px 12px; }
  .screen { padding: 0; align-items: flex-start; }
  .screen .card { width: 100vw; max-height: none; min-height: 100%; border-radius: 0; padding: 16px max(14px, env(safe-area-inset-left)); }
  .card h1 { font-size: 30px; }
  .opts, .opts.biomes, .opts.profiles { grid-template-columns: 1fr 1fr; }
  .opts.inline { flex-wrap: wrap; }
  .row { gap: 12px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .world { flex-wrap: wrap; }
}
@media (max-width: 900px) and (orientation: portrait) {
  #pile { top: auto; bottom: 230px; }
  #tbtns { bottom: calc(70px + env(safe-area-inset-bottom)); }
}
@media (max-height: 430px) {
  #tbtns { grid-template-columns: repeat(4, auto); bottom: calc(60px + env(safe-area-inset-bottom)); gap: 5px; }
  .tb { width: 48px; height: 48px; } .tb.big { width: 64px; height: 64px; grid-row: auto; }
  #hud .bar { margin: 1px 0; }
  #minimap { width: 70px; height: 70px; }
  #pile { top: 120px; }
}

/* ajustes finos do celular */
body.touch [data-desk] { display: none !important; }
#hotbar { width: max-content; }
@media (max-width: 900px), (max-height: 560px) {
  #hotbar { flex-wrap: wrap; max-width: calc(100vw - 12px); }
  .tbtns { max-width: none; flex-wrap: nowrap; }
}
@media (max-width: 900px) and (orientation: portrait) {
  #log { left: max(6px, env(safe-area-inset-left)); transform: none; top: 112px; width: min(62vw, 320px); }
  #tbtns { bottom: calc(62px + env(safe-area-inset-bottom)); }
  #pile { top: auto; bottom: 64px; left: max(6px, env(safe-area-inset-left)); width: min(150px, 38vw); max-height: 34vh; }
  #pile .pbtns .btn { font-size: 11px; padding: 5px 7px; }
}
@media (max-height: 430px) {
  #tbtns { grid-template-areas: 'rep take use act' 'sleep run drop act'; bottom: calc(56px + env(safe-area-inset-bottom)); gap: 5px; }
  .tb { width: 48px; height: 48px; } .tb.big { width: 70px; height: 70px; }
}

@media (max-width: 900px), (max-height: 560px) {
  .panel { background: #121610; }
  .opt i ~ small, .opt b { padding-right: 34px; }
}
