/* Goblin Rivals v1.0 chrome. Storybook warmth: parchment panels, wood borders,
   chunky friendly buttons. No glow spam. Game world renders on canvas. */

:root {
  --paper: #fff6e0;
  --paper2: #f6e8c8;
  --wood: #7e5228;
  --wood-dark: #5c3a1a;
  --ink: #3a2410;
  --ink-dim: #8a6f52;
  --gold: #e8a921;
  --gold-hot: #ffd977;
  --green: #4d9b43;
  --green-dark: #2d6b28;
  --red: #d9534f;
  --sky: #69b7d4;
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%; overflow: hidden;
  background: #14240f;
  color: var(--ink);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  overscroll-behavior: none;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; background: #1c2b16; }

.hidden { display: none !important; }

button {
  font-family: inherit; border: none; cursor: pointer; color: var(--ink);
  background: var(--paper2); border: 2px solid var(--wood); border-radius: 12px;
  transition: transform .06s;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
}
button:active { transform: scale(.96); }
input {
  font-family: inherit; color: var(--ink); background: var(--paper);
  border: 2px solid var(--wood); border-radius: 12px; outline: none;
  padding: 12px 14px; font-size: 16px; font-weight: 700;
}
input::placeholder { color: var(--ink-dim); font-weight: 600; }
input:focus { border-color: var(--gold); }

/* ---------- Menu ---------- */
#menu {
  position: fixed; inset: 0; z-index: 30; overflow-y: auto;
  background:
    radial-gradient(900px 420px at 50% -8%, rgba(124, 201, 79, .28), transparent),
    radial-gradient(1000px 520px at 50% 112%, rgba(126, 82, 40, .5), transparent),
    linear-gradient(180deg, #1d3317, #16280f 55%, #241a0e);
  display: flex; justify-content: center;
  touch-action: pan-y;
}
.menu-inner {
  width: min(440px, 94vw); padding: 18px 0 36px;
  display: flex; flex-direction: column; align-items: center; gap: 11px;
}
#logo { text-align: center; line-height: .9; margin-top: 6px; }
#logo .l1, #logo .l2 {
  display: inline-block; font-weight: 900; letter-spacing: 2px;
  font-size: clamp(40px, 10vw, 58px);
  text-shadow: 0 3px 0 rgba(0, 0, 0, .35);
}
#logo .l1 { color: var(--gold-hot); margin-right: 10px; }
#logo .l2 { color: #8fd45e; }
.tagline { margin-top: 8px; color: #cfe3b8; font-size: 14px; }
.tagline b { color: var(--gold-hot); }

#menuGoblin { margin: -4px 0 -8px; }

.name-row { display: flex; gap: 8px; width: 100%; }
#tagInput { width: 72px; text-align: center; text-transform: uppercase; }
#nameInput { flex: 1; }

.big-btn {
  width: 100%; padding: 15px; font-size: 22px; font-weight: 900; letter-spacing: 1px;
  color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .3);
  background: linear-gradient(180deg, #79cf62, #4d9b43);
  border: 3px solid var(--green-dark);
  box-shadow: 0 5px 0 var(--green-dark);
  border-radius: var(--radius);
}
.big-btn:active { box-shadow: 0 2px 0 var(--green-dark); transform: translateY(3px); }
.big-btn.dd {
  background: linear-gradient(180deg, #ffd977, #e8a921);
  border-color: #8a6510; box-shadow: 0 5px 0 #8a6510; color: var(--ink);
  text-shadow: none;
}

.menu-row { display: flex; gap: 8px; width: 100%; justify-content: center; }
.mini-btn { padding: 10px 16px; font-size: 14.5px; font-weight: 800; }

#friendsRow { display: flex; gap: 8px; width: 100%; }
#roomInput { width: 108px; text-align: center; text-transform: uppercase; }

#accountRow { color: #cfe3b8; font-size: 13.5px; display: flex; gap: 10px; align-items: center; }
#accountRow #acctTitle { color: #b4e88a; }
#bankedGold { color: var(--gold-hot); font-weight: 900; display: inline-flex; align-items: center; gap: 4px; }
#connStatus { font-size: 12px; color: #93a982; min-height: 15px; }

/* class picker */
#classRow { display: flex; gap: 7px; width: 100%; }
.class-tile {
  flex: 1; padding: 7px 2px 6px; border-radius: 13px; cursor: pointer;
  background: var(--paper); border: 3px solid var(--wood); text-align: center;
}
.class-tile.sel { border-color: var(--tile-color, var(--gold)); background: #fffdf4; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
.class-tile canvas { width: 50px; height: 46px; }
.class-tile .cn { display: block; font-size: 11px; font-weight: 900; letter-spacing: .5px; }
.class-tile .ca { display: block; font-size: 9.5px; color: var(--ink-dim); font-weight: 700; }
#classBlurb { min-height: 16px; font-size: 13px; color: #e8dcc0; text-align: center; }
#classBlurb b { color: #fff; }
.mini-class-row { display: flex; gap: 6px; justify-content: center; }
.mini-class-row .class-tile { flex: 0 0 70px; padding: 4px 2px 3px; }
.mini-class-row .class-tile canvas { width: 38px; height: 34px; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud button { pointer-events: auto; }

#topbar { position: absolute; top: 10px; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 12px; align-items: flex-start; }
#sackbox {
  background: rgba(30, 20, 8, .78); border: 2px solid var(--wood); border-radius: 14px;
  padding: 7px 14px 7px 9px;
  font-size: 23px; font-weight: 900; color: var(--gold-hot);
  display: flex; align-items: center; gap: 8px;
}
#sackbox.heavy { color: #fff; }
#weightPips { font-size: 11px; color: #cbb591; letter-spacing: 1px; font-weight: 700; }
#rightHud { position: absolute; inset: 0; pointer-events: none; }
#lb {
  position: absolute; top: 10px; right: 12px;
  background: rgba(30, 20, 8, .68); border-radius: 12px; padding: 8px 12px; min-width: 150px;
  font-size: 12px; color: #f1e6cd;
}
.lb-title { font-size: 10px; letter-spacing: 2px; color: #cbb591; margin-bottom: 5px; font-weight: 800; }
#lbList { list-style: none; }
#lbList li { display: flex; justify-content: space-between; gap: 10px; line-height: 1.5; min-width: 0; }
#lbList li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#lbList li.me { color: var(--gold-hot); font-weight: 800; }
#lbList li .g { color: var(--gold-hot); flex: none; }
#inviteBtn {
  width: 100%; min-height: 27px; margin-top: 6px; padding: 4px 7px;
  display: flex; align-items: center; justify-content: center; gap: 5px;
  border: 2px solid #b07514; border-radius: 8px;
  background: linear-gradient(#ffd977, #e8a921); color: #3a2410;
  font: 900 10px/1 "Trebuchet MS", system-ui, sans-serif; letter-spacing: .8px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .3); pointer-events: auto;
}
#inviteBtn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0, 0, 0, .3); }
#inviteBtn:disabled { display: none; }
#inviteRoomCode { opacity: .72; letter-spacing: 1px; }

#hpwrap { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); width: min(280px, 52vw); }
#hpbar { height: 13px; background: rgba(20, 12, 5, .7); border-radius: 8px; overflow: hidden; border: 2px solid rgba(60, 36, 16, .8); }
#hpfill { height: 100%; width: 100%; background: linear-gradient(90deg, #79cf62, #4d9b43); }
#hpfill.low { background: linear-gradient(90deg, #e35d5d, #a83232); }
#xpbar { margin-top: 5px; height: 7px; background: rgba(20, 12, 5, .7); border-radius: 6px; position: relative; }
#xpfill { height: 100%; width: 0%; background: linear-gradient(90deg, #b48ae8, #8458c9); border-radius: 6px; }
#lvlTag { position: absolute; right: -4px; top: -21px; font-size: 12px; font-weight: 900; color: #d8c2f5; text-shadow: 0 1px 3px #000; }

#minimap {
  position: absolute; right: 10px; bottom: max(10px, env(safe-area-inset-bottom));
  border-radius: 50%; background: rgba(20, 12, 5, .6); border: 2px solid rgba(60, 36, 16, .8);
}
/* touch: the bottom band belongs to thumbs. minimap rides top-right instead */
body.touch #minimap {
  top: calc(env(safe-area-inset-top, 0px) + 58px);
  bottom: auto;
  right: calc(env(safe-area-inset-right, 0px) + 10px);
}
body.touch #buffs {
  top: calc(env(safe-area-inset-top, 0px) + 58px);
  right: calc(env(safe-area-inset-right, 0px) + 160px);
  align-items: flex-end;
}

/* kill feed: bottom-left, OUT of the way of the gold counter */
#feed {
  position: absolute; left: 12px; bottom: max(76px, calc(env(safe-area-inset-bottom) + 70px));
  font-size: 11.5px; color: #e8dcc0;
  display: flex; flex-direction: column-reverse; gap: 3px; max-width: 44vw;
}
#feed .f { background: rgba(20, 12, 5, .55); padding: 3px 8px; border-radius: 8px; animation: feedin .25s; }
#feed .f b { color: var(--gold-hot); }
#feed .f.hot { color: #ffe9b0; }
@keyframes feedin { from { opacity: 0; transform: translateX(-8px); } }

#offer {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: max(86px, calc(env(safe-area-inset-bottom) + 76px));
  width: 100%; max-width: 420px; text-align: center; pointer-events: auto;
}
.offer-title { font-weight: 900; font-size: 14px; color: #ffe9b0; text-shadow: 0 2px 4px #000; margin-bottom: 7px; }
#offerCards { display: flex; gap: 8px; justify-content: center; padding: 0 8px; }
.card {
  position: relative;
  flex: 0 1 122px; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 11px 6px 9px; border-radius: 14px;
  background: var(--paper); border: 3px solid var(--wood);
  box-shadow: 0 4px 0 rgba(0, 0, 0, .3);
  font-size: 12px; line-height: 1.3; color: var(--ink); text-align: center;
}
.card:hover, .card:active { border-color: var(--gold); background: #fffdf4; }
.card .ico {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--paper2); border: 2px solid var(--wood);
  display: flex; align-items: center; justify-content: center;
}
.card .nm { font-weight: 900; display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .lvl { color: #b07514; font-weight: 800; font-size: 10.5px; }
.card .ds { color: var(--ink-dim); display: block; font-size: 10.5px; font-weight: 600; }
.card .key {
  position: absolute; top: -8px; left: -8px;
  background: var(--wood); color: #fff; border: 2px solid var(--paper);
  border-radius: 7px; font-size: 11px; font-weight: 900; padding: 1px 6px;
}

#toasts { position: absolute; left: 50%; transform: translateX(-50%); top: 17%; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast {
  background: rgba(25, 16, 6, .88); border: 2px solid var(--wood); color: #f5ecd8;
  padding: 8px 16px; border-radius: 20px;
  font-size: 14px; animation: feedin .3s; white-space: nowrap; max-width: 92vw;
}
.toast b { color: var(--gold-hot); }

#banner {
  position: absolute; left: 0; right: 0; top: 25%; text-align: center;
  font-size: clamp(28px, 7vw, 52px); font-weight: 900; letter-spacing: 2px;
  color: var(--gold-hot); text-shadow: 0 3px 0 #6b4d10, 0 7px 24px rgba(0, 0, 0, .8);
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
#banner.show { opacity: 1; }
#banner .sub { display: block; font-size: 16px; letter-spacing: 1px; color: #fff; text-shadow: 0 2px 8px #000; }

#ragebanner {
  position: absolute; left: 50%; transform: translateX(-50%);
  background: rgba(90, 18, 18, .85); color: #ffc9c9; border: 2px solid #a83232;
  padding: 6px 14px; border-radius: 10px; font-weight: 800; font-size: 13px;
}

#cartHint {
  position: absolute; left: 50%; transform: translateX(-50%); top: 56px;
  background: rgba(30, 20, 8, .8); border: 2px solid var(--wood);
  padding: 5px 14px; border-radius: 10px; font-size: 13px; font-weight: 700; color: var(--gold-hot);
}

body.ads-disabled .ad-only { display: none !important; }

body.touch #rightHud {
  inset: auto;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  right: calc(env(safe-area-inset-right, 0px) + 8px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
body.touch #rightHud #lb {
  display: block; position: static; box-sizing: border-box;
  width: 150px; min-width: 0; max-width: 42vw; padding: 6px 8px;
  font-size: 10.5px; border: 2px solid rgba(126, 82, 40, .72);
}
body.touch #rightHud .lb-title { font-size: 8.5px; letter-spacing: 1.15px; margin-bottom: 3px; }
body.touch #rightHud #lbList li { line-height: 1.27; gap: 5px; }
body.touch #rightHud #inviteBtn { min-height: 24px; margin-top: 4px; font-size: 9.5px; padding: 3px 4px; }
body.touch #rightHud #minimap { position: static; width: 84px; height: 84px; flex: none; }

#lootBanner {
  position: absolute; left: 50%; transform: translateX(-50%); top: 33%;
  background: rgba(30, 20, 8, .92); border: 3px solid var(--gold);
  border-radius: 14px; padding: 10px 22px; text-align: center;
  font-weight: 900; font-size: 18px; color: var(--gold-hot); pointer-events: none;
}
#lootBanner .sub { display: block; font-size: 12px; font-weight: 700; color: #e8dcc0; }
#lootBanner.depart { border-color: var(--red); }

.round-btn {
  position: absolute; left: 12px; bottom: max(12px, env(safe-area-inset-bottom));
  width: 50px; height: 50px; border-radius: 50%; background: rgba(30, 20, 8, .78);
  border: 2px solid var(--wood);
}
#emoteWheel {
  position: absolute; left: 16px; bottom: calc(env(safe-area-inset-bottom, 0px) + 74px);
  display: flex; flex-direction: column; gap: 6px; pointer-events: auto;
}
#emoteWheel button { width: 46px; height: 46px; border-radius: 50%; background: var(--paper); }

/* Touch action cluster: DASH owns the corner, the special stacks right above
   it. one clean thumb column that nothing else is allowed to enter. */
#dashBtn {
  position: absolute;
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  width: 84px; height: 84px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3f6f9e, #24405c);
  border: 3px solid var(--sky);
  display: none; pointer-events: auto; overflow: hidden;
}
body.touch #dashBtn { display: inline-flex; }
#dashBtn.cooling, #abilityBtn.cooling { filter: grayscale(.8) brightness(.75); }
#dashCdRing, #abilityCdRing {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(rgba(0, 0, 0, .55) var(--cd, 0%), transparent 0);
  pointer-events: none;
}
#abilityBtn {
  position: absolute;
  right: calc(env(safe-area-inset-right, 0px) + 25px);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 112px);
  width: 62px; height: 62px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #6a4a8a, #3a2854);
  border: 3px solid var(--class-color, #b48ae8);
  pointer-events: auto; overflow: hidden;
}
body:not(.touch) #abilityBtn {
  right: 12px; bottom: max(158px, calc(env(safe-area-inset-bottom) + 158px));
  width: 52px; height: 52px;
}

/* left-handed touch: mirror the whole bottom band */
body.touch.lefty #dashBtn { right: auto; left: calc(env(safe-area-inset-left, 0px) + 14px); }
body.touch.lefty #abilityBtn { right: auto; left: calc(env(safe-area-inset-left, 0px) + 25px); }
body.touch.lefty .round-btn { left: auto; right: calc(env(safe-area-inset-right, 0px) + 12px); }
body.touch.lefty #emoteWheel { left: auto; right: calc(env(safe-area-inset-right, 0px) + 16px); }
body.touch.lefty #feed { left: auto; right: 12px; align-items: flex-end; text-align: right; }

#combo { position: absolute; top: 62px; left: 50%; transform: translateX(-50%); text-align: center; pointer-events: none; }
#comboN { font-size: 30px; font-weight: 900; color: var(--gold-hot); text-shadow: 0 2px 0 #6b4d10, 0 4px 14px #000; display: inline-block; }
#comboN.pop { animation: comboPop .18s; }
@keyframes comboPop { 50% { transform: scale(1.45) rotate(-4deg); } }
#comboBar { width: 90px; height: 5px; background: rgba(0, 0, 0, .5); border-radius: 4px; margin: 2px auto 0; overflow: hidden; }
#comboFill { height: 100%; background: linear-gradient(90deg, #f2994e, #ffd977); }

#buffs { position: absolute; top: 62px; right: 12px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.buff {
  display: flex; align-items: center; gap: 6px;
  background: rgba(30, 20, 8, .78); border: 2px solid var(--wood); color: #f5ecd8;
  border-radius: 20px; padding: 4px 10px 4px 6px; font-size: 12px; font-weight: 800; animation: feedin .25s;
}
.buff .bt { color: var(--gold-hot); min-width: 24px; text-align: right; }

/* ---------- Overlays ---------- */
/* overlays scroll when the panel is taller than the screen; margin:auto keeps
   short panels centered WITHOUT clipping tall ones (the flex-center trap) */
.overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(15, 22, 10, .82);
  display: flex; align-items: flex-start; justify-content: center; overflow-y: auto;
  touch-action: pan-y; padding: 12px;
}
.panel {
  background: var(--paper); border: 4px solid var(--wood); border-radius: 20px;
  padding: 18px; width: min(430px, 100%);
  box-shadow: 0 10px 0 rgba(0, 0, 0, .25);
  text-align: center; display: flex; flex-direction: column; gap: 11px;
  margin: auto; color: var(--ink);
}
.panel.wide { width: min(560px, 96vw); }
.panel-title { font-weight: 900; font-size: 20px; letter-spacing: 1px; }
.subtle { color: var(--ink-dim); font-size: 12px; font-weight: 600; }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-row .big-btn { flex: 1; min-width: 150px; padding: 13px; font-size: 17px; }

#deathTitle { font-size: clamp(34px, 8vw, 46px); font-weight: 900; color: var(--red); letter-spacing: 2px; }
#deathDetail { font-size: 15px; color: var(--ink-dim); font-weight: 600; }
#deathDetail b { color: var(--ink); }
#deathLoot { font-size: 14.5px; font-weight: 700; }
#deathLoot .bad { color: var(--red); }
#deathLoot .good { color: var(--green-dark); }
.statrow { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-dim); font-weight: 700; }
.statrow b { color: var(--ink); font-size: 16px; display: block; }
.sharecard { width: 100%; max-width: 360px; border-radius: 10px; align-self: center; border: 3px solid var(--wood); }
.perk-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.perk-line {
  font-size: 13px; color: var(--ink); cursor: pointer; font-weight: 700;
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--paper2); border: 2px dashed var(--wood); border-radius: 10px; padding: 7px 10px;
}
.perk-line.as-btn { border-style: dashed; }
.perk-line.armed { border-style: solid; border-color: var(--gold); background: #fff3cf; }
.ad-chip { background: var(--gold); color: #3a2410; font-size: 10px; font-weight: 900; border-radius: 4px; padding: 1px 5px; }
.gold-line { border-color: #8a6510; background: #fff3cf; }
.gold-text { color: #b07514; font-weight: 900; }

/* ---------- Shop / Settings ---------- */
#shopTabs { display: flex; gap: 6px; justify-content: center; }
.tab { padding: 8px 16px; font-weight: 800; font-size: 14px; opacity: .55; }
.tab.active { opacity: 1; background: var(--gold-hot); border-color: #8a6510; }
#shopGrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 9px; max-height: 46vh; overflow-y: auto; padding: 4px; touch-action: pan-y; }
.shop-item { background: var(--paper2); border: 3px solid var(--wood); border-radius: 12px; padding: 8px 4px; cursor: pointer; }
.shop-item canvas { width: 60px; height: 60px; }
.shop-item .nm { font-size: 11px; font-weight: 800; display: block; }
.shop-item .pr { font-size: 11px; color: #b07514; font-weight: 800; }
.shop-item.owned .pr { color: var(--ink-dim); }
.shop-item.equipped { border-color: var(--gold); background: #fff3cf; }

.setting { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 700; padding: 4px 0; }
.setting input[type=range] { width: 55%; }

.ad-panel { border-style: dashed; }
#fakeAdBody { font-size: 15px; color: var(--ink-dim); padding: 26px 10px; font-weight: 600; }
#fakeAdTimer { font-size: 40px; font-weight: 900; color: #b07514; }

/* ---------- Tutorial: full overlay, dismiss on any tap ---------- */
#tut {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(14, 20, 9, .93);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; touch-action: pan-y; padding: 12px;
}
.tut-card {
  width: min(560px, 100%); padding: 16px;
  background: var(--paper); border: 4px solid var(--wood); border-radius: 22px;
  box-shadow: 0 12px 0 rgba(0, 0, 0, .3);
  display: flex; flex-direction: column; gap: 12px;
  animation: tutIn .4s ease-out; margin: auto;
}
@keyframes tutIn { from { opacity: 0; transform: translateY(-16px); } }
#tut.bye { animation: tutOut .25s forwards; }
@keyframes tutOut { to { opacity: 0; } }
.tut-head { font-size: 22px; font-weight: 900; letter-spacing: 1px; display: flex; align-items: baseline; justify-content: space-between; }
.tut-skip { font-size: 11px; color: var(--ink-dim); font-weight: 700; }
.tut-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tut-cell { display: flex; flex-direction: column; gap: 4px; }
.tut-pic { width: 100%; border-radius: 12px; border: 3px solid var(--wood); background: #7cc94f; }
.tut-verb { font-size: 15px; font-weight: 900; letter-spacing: 1px; color: var(--green-dark); }
.tut-txt { font-size: 12.5px; line-height: 1.45; color: #5c452a; font-weight: 600; }
.tut-txt b { font-weight: 900; color: var(--ink); }
#tutGo { font-size: 19px; }

#rotateHint {
  position: fixed; bottom: 8px; left: 50%; transform: translateX(-50%);
  z-index: 50; color: #cfe3b8; font-size: 12px; background: rgba(0, 0, 0, .6); padding: 4px 12px; border-radius: 10px;
}

/* ---------- Mobile ---------- */
@media (max-width: 620px) {
  #feed { font-size: 10.5px; max-width: 52vw; bottom: max(70px, calc(env(safe-area-inset-bottom) + 66px)); }
  #offer { max-width: 100vw; }
  .card { flex-basis: 108px; padding: 9px 4px 8px; }
  .card .ds { display: none; }
  .card .ico { width: 34px; height: 34px; }
  /* Boon cards stay out of the action-button thumb column. */
  body.touch #buffs { top: calc(env(safe-area-inset-top, 0px) + 92px); right: calc(env(safe-area-inset-right, 0px) + 154px); }
  body.touch #offer { padding-right: 100px; }
  body.touch.lefty #offer { padding-right: 0; padding-left: 100px; }
  #sackbox { font-size: 19px; padding: 6px 11px 6px 7px; }
  #combo { top: 56px; }
  #buffs { top: 56px; }
  #cartHint { left: 8px; transform: none; top: 58px; font-size: 11px; max-width: calc(100vw - 174px); text-align: left; }
  #ragebanner { left: 8px; transform: none; top: 82px; max-width: calc(100vw - 174px); font-size: 11px; }
  #lootBanner { top: 26%; font-size: 15px; padding: 8px 14px; width: max-content; max-width: 92vw; }
  .tut-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tut-pic { border-width: 2px; }
  .tut-head { font-size: 17px; }
  .tut-txt { font-size: 10.5px; }
  .tut-verb { font-size: 13px; }
  #tutGo { font-size: 16px; padding: 12px; }
  .menu-inner { gap: 9px; }
  #menuGoblin { width: 170px; height: 116px; }
  .class-tile canvas { width: 42px; height: 38px; }
  #hpwrap { width: 38vw; }
  .panel { padding: 14px; gap: 9px; }
  #deathTitle { font-size: 30px; }
  .sharecard { max-width: 250px; }
  .statrow { gap: 11px; font-size: 11px; }
  .btn-row .big-btn { min-width: 120px; padding: 11px; font-size: 15px; }
  .perk-line { font-size: 11.5px; padding: 6px 8px; }
  #shopGrid { max-height: 38vh; }
}
@media (max-width: 620px), (pointer: coarse), (orientation: landscape) and (max-height: 480px) {
  #rightHud {
    inset: auto;
    top: calc(env(safe-area-inset-top, 0px) + 8px);
    right: calc(env(safe-area-inset-right, 0px) + 8px);
    display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  }
  #rightHud #lb {
    display: block; position: static; box-sizing: border-box;
    width: 150px; min-width: 0; max-width: 42vw; padding: 6px 8px;
    font-size: 10.5px; border: 2px solid rgba(126, 82, 40, .72);
  }
  #rightHud .lb-title { font-size: 8.5px; letter-spacing: 1.15px; margin-bottom: 3px; }
  #rightHud #lbList li { line-height: 1.27; gap: 5px; }
  #rightHud #inviteBtn { min-height: 24px; margin-top: 4px; font-size: 9.5px; padding: 3px 4px; }
  #rightHud #minimap { position: static; width: 84px; height: 84px; flex: none; }
  body:not(.touch) #abilityBtn { bottom: 68px; }
}
@media (max-height: 480px) {
  #menuGoblin { display: none; }
  .menu-inner { gap: 7px; padding-top: 8px; }
  .tut-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .tut-txt { font-size: 9.5px; }
  .sharecard { display: none; }
}

@media (orientation: landscape) {
  body.touch #rightHud #minimap { width: 70px; height: 70px; }
  body.touch #abilityBtn {
    right: calc(env(safe-area-inset-right, 0px) + 112px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 25px);
  }
  body.touch.lefty #abilityBtn {
    right: auto;
    left: calc(env(safe-area-inset-left, 0px) + 112px);
  }
}
@media (orientation: landscape) and (pointer: coarse) {
  #rightHud #minimap { width: 70px; height: 70px; }
}
@media (max-height: 700px) and (max-width: 620px) {
  .sharecard { max-width: 210px; }
  #killcamNote { display: none; }
}
