* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #0d0b08;
  color: #ff981f;
  font: bold 12px Verdana, Tahoma, sans-serif;
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

.screen {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- login ---- */
#login {
  background: radial-gradient(ellipse at center, #3b2e1c 0%, #120d07 75%);
}

.login-box {
  width: 380px;
  padding: 26px 30px;
  background: linear-gradient(#4a3f30, #2e271d);
  border: 3px solid #1a140d;
  box-shadow: inset 0 0 0 2px #6b5c45, 0 10px 40px #000;
  text-align: center;
}

.login-box h1 {
  margin: 0;
  font: 900 38px Georgia, serif;
  color: #ffcc33;
  text-shadow: 3px 3px 0 #000, 0 0 18px #a8650a;
  letter-spacing: 2px;
}

.login-box h1 span {
  color: #d0261d;
}

.login-box .sub {
  color: #c8b48a;
  margin: 4px 0 18px;
}

.login-box label {
  display: block;
  text-align: left;
  color: #ffff00;
  margin-top: 10px;
  text-shadow: 1px 1px #000;
}

.login-box input {
  width: 100%;
  padding: 6px;
  margin-top: 3px;
  background: #1c1710;
  border: 1px solid #6b5c45;
  color: #fff;
  font: bold 13px Verdana;
}

.btn {
  margin-top: 16px;
  padding: 7px 24px;
  background: linear-gradient(#6b5c45, #3e3529);
  border: 2px solid #1a140d;
  color: #ffff00;
  font: bold 13px Verdana;
  cursor: pointer;
  text-shadow: 1px 1px #000;
  box-shadow: inset 0 0 0 1px #8a7a5f;
}

.btn:hover {
  color: #fff;
}

.btn.small {
  margin: 0;
  padding: 3px 9px;
  font-size: 11px;
}

.btn.red {
  color: #ff6b6b;
}

.btn.green {
  color: #6bff6b;
}

.err {
  color: #ff3b3b;
  margin-top: 10px;
  min-height: 16px;
  text-shadow: 1px 1px #000;
}

.note {
  margin-top: 12px;
  color: #9d8b6a;
  font-weight: normal;
}

/* ---- frame (Authentic OSRS Fixed-Mode Stone UI) ---- */
.frame {
  display: flex;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%23463d32'/%3E%3Crect x='1' y='1' width='1' height='1' fill='%2352473a'/%3E%3Crect x='5' y='2' width='1' height='1' fill='%23393127'/%3E%3Crect x='3' y='6' width='1' height='1' fill='%2354493c'/%3E%3Crect x='7' y='5' width='1' height='1' fill='%23342c23'/%3E%3C/svg%3E");
  border: 3px solid #120e09;
  box-shadow:
    inset 2px 2px 0 #665949,
    inset -2px -2px 0 #262018,
    0 0 50px #000;
  padding: 6px;
  gap: 6px;
}

.left {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#viewport {
  position: relative;
  width: 720px;
  height: 528px;
  border: 2px solid #14100a;
  box-shadow: 0 0 0 1px #5c5040;
  background: #000;
}

#cv {
  display: block;
  cursor: pointer;
  image-rendering: auto;
}

.chatbox {
  width: 720px;
  height: 150px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Crect width='6' height='6' fill='%23cab68e'/%3E%3Crect x='1' y='1' width='1' height='1' fill='%23c1ac82'/%3E%3Crect x='4' y='3' width='1' height='1' fill='%23d2bf98'/%3E%3Crect x='2' y='5' width='1' height='1' fill='%23bda77d'/%3E%3C/svg%3E");
  border: 2px solid #18130d;
  box-shadow: inset 2px 2px 0 #8f7e61, inset -2px -2px 0 #6c5e47;
  display: flex;
  flex-direction: column;
}

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px;
  color: #000;
  font: 12px Verdana;
  display: flex;
  flex-direction: column;
}

.chat div {
  line-height: 15px;
}

.chat .pub b {
  color: #000;
}

.chat .pub span {
  color: #0000ff;
}

.chat .game {
  color: #000;
}

.chat .sys {
  color: #7f0000;
}

.chat .win {
  color: #006000;
  font-weight: bold;
}

.chatin {
  border-top: 1px solid #8a7a5f;
  padding: 3px 8px;
  color: #000;
  font: bold 12px Verdana;
  display: flex;
  gap: 4px;
  align-items: center;
}

.chatin input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: #0000ff;
  font: 12px Verdana;
}

/* ---- right side ---- */
.right {
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.orbs {
  height: 86px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%233d352a'/%3E%3Crect x='2' y='1' width='1' height='1' fill='%234a4033'/%3E%3Crect x='6' y='5' width='1' height='1' fill='%23312a21'/%3E%3C/svg%3E");
  border: 2px solid #16110b;
  box-shadow: inset 1px 1px 0 #5f5343, inset -1px -1px 0 #241e17;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  padding: 6px 12px;
}

.orb {
  position: relative;
  height: 34px;
  border-radius: 17px;
  background: linear-gradient(#2c251d, #19140e);
  border: 2px solid #0e0a06;
  box-shadow: inset 0 0 0 1px #5c5040;
  display: flex;
  align-items: center;
  padding-left: 38px;
  font: bold 13px Verdana;
  color: #00ff00;
  text-shadow: 1px 1px #000;
  cursor: default;
  user-select: none;
}

.orb::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--fill, #333);
  box-shadow: inset -3px -4px 6px rgba(0, 0, 0, .6), inset 2px 2px 3px rgba(255, 255, 255, .3);
  border: 1px solid #000;
}

.orb::after {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  width: 18px;
  height: 18px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, .75));
}

.orb.hp {
  --fill: #b81508;
}

.orb.hp::after {
  background-image: url('/skills/hp.png');
}

.orb.pray {
  --fill: #1ea8c7;
}

.orb.pray::after {
  background-image: url('/skills/pray.png');
}

.orb.run {
  --fill: #c9a41a;
  cursor: pointer;
}

.orb.run::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23fff6cc' stroke='%232b1c08' stroke-width='1' d='M5 2h4v6l4 2v3H4V9l1-2z'/%3E%3C/svg%3E");
}

.orb.spec {
  --fill: #1f8a8a;
  cursor: pointer;
}

.orb.spec::after {
  background-image: url('/ui/combat.png');
}

.orb.on {
  box-shadow: 0 0 0 2px #ffff00 inset;
}

.orb.off::before {
  filter: grayscale(.85) brightness(.55);
}

.tabs {
  display: flex;
  gap: 2px;
}

.tabs button {
  flex: 1;
  height: 35px;
  background: linear-gradient(#564b3d, #3a3228);
  border: 2px solid #14100a;
  box-shadow: inset 1px 1px 0 #706250, inset -1px -1px 0 #262018;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tabs button img {
  image-rendering: pixelated;
}

.tabs button.on {
  background: linear-gradient(#822819, #4f160d);
  box-shadow: inset 1px 1px 0 #ab3f2c, inset -1px -1px 0 #2c0b06;
}

.panel {
  height: 470px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Crect width='8' height='8' fill='%233e3529'/%3E%3Crect x='1' y='2' width='1' height='1' fill='%23493f32'/%3E%3Crect x='5' y='1' width='1' height='1' fill='%23342c22'/%3E%3Crect x='3' y='6' width='1' height='1' fill='%23473d30'/%3E%3Crect x='7' y='5' width='1' height='1' fill='%23312920'/%3E%3C/svg%3E");
  border: 2px solid #14100a;
  box-shadow: inset 2px 2px 0 #262018, inset -2px -2px 0 #5b4f3f;
  padding: 8px;
  overflow-y: auto;
}

.bottombar {
  display: flex;
  justify-content: space-between;
  padding: 4px 6px;
  background: #2a241a;
  border: 2px solid #1a140d;
}

.bottombar a {
  color: #ffff00;
  text-decoration: none;
}

.bottombar a:hover {
  color: #fff;
}

#whoami {
  color: #fff;
}

/* inventory */
.inv {
  display: grid;
  grid-template-columns: repeat(4, 52px);
  grid-auto-rows: 52px;
  gap: 4px;
  justify-content: center;
  margin-top: 6px;
}

.slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  cursor: pointer;
}

.slot:hover {
  background: rgba(255, 255, 255, .07);
}

.slot canvas {
  pointer-events: none;
}

.slot .q {
  position: absolute;
  left: 2px;
  top: 0;
  color: #ffff00;
  font: bold 10px Verdana;
  text-shadow: 1px 1px #000;
}

.title {
  color: #ff981f;
  text-align: center;
  font-size: 13px;
  margin: 2px 0 8px;
  text-shadow: 1px 1px #000;
}

/* equipment */
.equip {
  position: relative;
  width: 200px;
  height: 250px;
  margin: 6px auto;
  background:
    linear-gradient(#262018, #262018) 99px 22px / 2px 200px no-repeat,
    linear-gradient(#262018, #262018) 50px 71px / 100px 2px no-repeat,
    linear-gradient(#262018, #262018) 30px 121px / 140px 2px no-repeat,
    linear-gradient(#262018, #262018) 30px 221px / 140px 2px no-repeat;
}

.eslot {
  position: absolute;
  width: 44px;
  height: 44px;
  background: #332b21;
  border: 1px solid #16110b;
  box-shadow: inset 1px 1px 0 #231d16, inset -1px -1px 0 #594d3d;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.eslot.empty {
  opacity: .45;
}

.eslot .lbl {
  position: absolute;
  bottom: 1px;
  font: 8px Verdana;
  color: #9d8b6a;
}

.bonus {
  font: 11px Verdana;
  color: #ff981f;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px 12px;
  padding: 0 6px;
}

.bonus b {
  color: #ffff00;
  font-weight: normal;
}

/* combat tab */
.styles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 10px 0;
}

.styles button {
  height: 46px;
  background: linear-gradient(#5a4f3f, #3a3125);
  border: 2px solid #1a140d;
  color: #ff981f;
  font: bold 11px Verdana;
  cursor: pointer;
}

.styles button.on {
  background: linear-gradient(#8a2a1c, #5e1a10);
  color: #fff;
}

.specbar {
  margin-top: 14px;
  height: 26px;
  border: 2px solid #000;
  background: #5a1212;
  position: relative;
  cursor: pointer;
}

.specbar div {
  height: 100%;
  background: linear-gradient(#28b4b4, #176f6f);
}

.specbar span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font: bold 11px Verdana;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}

.specbar.on {
  box-shadow: 0 0 0 2px #ffff00;
}

.specbar.on div {
  background: linear-gradient(#42d4d4, #1e8f8f);
}

.specbar.on span {
  color: #ffff00;
  text-shadow: 1px 1px #000;
}

/* stats */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.stat {
  background: rgba(0, 0, 0, .3);
  border: 1px solid #1a140d;
  padding: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat .n {
  color: #ff981f;
}

.stat .v {
  color: #ffff00;
  font-size: 13px;
}

.stat .v.up {
  color: #00ff00;
}

.stat .v.down {
  color: #ff3030;
}

/* prayer */
.prayers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.pr {
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  font: 8px Verdana;
  color: #c8b48a;
  text-align: center;
}

.pr canvas {
  pointer-events: none;
}

.pr.on {
  background: radial-gradient(circle, rgba(255, 240, 170, .45), rgba(255, 220, 100, .05) 70%);
  color: #fff;
}

.pr.locked {
  opacity: .3;
  cursor: not-allowed;
}

/* lobby */
.lobby {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 10, .82);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 100%;
  gap: 10px;
  padding: 12px;
  overflow: hidden;
}

.box {
  background: linear-gradient(#4a3f30, #2e271d);
  border: 2px solid #1a140d;
  box-shadow: inset 0 0 0 1px #6b5c45;
  padding: 10px;
  overflow-y: auto;
}

.box h3 {
  margin: 0 0 8px;
  color: #ffcc33;
  font-size: 14px;
  text-shadow: 1px 1px #000;
  border-bottom: 1px solid #6b5c45;
  padding-bottom: 4px;
}

.prow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 2px;
  border-bottom: 1px solid rgba(0, 0, 0, .3);
  color: #fff;
}

.prow small {
  color: #c8b48a;
  font-weight: normal;
}

.rules label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px 8px 2px 0;
  color: #ffff00;
  font-weight: normal;
  cursor: pointer;
}

.chal {
  background: #5e1a10;
  border: 1px solid #000;
  padding: 6px;
  margin-bottom: 6px;
  color: #fff;
}

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.presets .btn.on {
  color: #fff;
  box-shadow: inset 0 0 0 2px #ffcc00;
}

.palette {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.palette .slot {
  height: 36px;
  background: rgba(0, 0, 0, .25);
}

.lv {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin: 6px 0;
}

.lv label {
  color: #ff981f;
  font-weight: normal;
  font-size: 11px;
}

.lv input {
  width: 100%;
  background: #1c1710;
  border: 1px solid #6b5c45;
  color: #ffff00;
  font: bold 11px Verdana;
  padding: 2px;
}

.hint {
  color: #c8b48a;
  font-weight: normal;
  font-size: 11px;
  margin: 4px 0;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(0, 0, 0, .55);
  font: 900 46px Georgia, serif;
  color: #ffcc33;
  text-shadow: 3px 3px 0 #000;
  pointer-events: none;
}

.overlay small {
  font: bold 16px Verdana;
  color: #fff;
  margin-top: 8px;
}

.spectbar {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
}

#tooltip {
  position: fixed;
  pointer-events: none;
  background: #3e3529;
  border: 1px solid #000;
  color: #fff;
  padding: 3px 6px;
  font: 11px Verdana;
  z-index: 9;
}

/* ---- v2: item sprites, context menu, modal, popup ---- */
.ii {
  max-width: 36px;
  max-height: 32px;
  image-rendering: pixelated;
  pointer-events: none;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, .6));
}

.eslot .ii {
  max-width: 34px;
  max-height: 32px;
}

.palette {
  grid-template-columns: repeat(6, 1fr) !important;
}

.palette .slot {
  height: 34px;
}

.palette .ii {
  max-width: 30px;
  max-height: 28px;
}

#wpic .ii {
  max-width: 48px;
  max-height: 44px;
  margin: 4px 0;
}

.ctxmenu {
  position: absolute;
  display: none;
  z-index: 20;
  min-width: 140px;
  background: #5d5447;
  border: 2px solid #000;
  font: bold 12px Verdana;
  color: #fff;
  padding: 0 0 2px;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, .6);
}

.ctxmenu .mh {
  background: #000;
  color: #5d5447;
  padding: 2px 4px;
  font-weight: bold;
}

.ctxmenu .mi {
  padding: 2px 4px;
  cursor: pointer;
  white-space: nowrap;
}

.ctxmenu .mi:hover {
  color: #ffff00;
  background: rgba(0, 0, 0, .15);
}

.modal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 15;
  width: 340px;
  background: linear-gradient(#4a3f30, #2e271d);
  border: 3px solid #1a140d;
  box-shadow: inset 0 0 0 1px #6b5c45, 0 6px 30px #000;
  padding: 12px;
}

.modal .mtitle {
  color: #ff981f;
  font-size: 14px;
  text-align: center;
  margin-bottom: 8px;
  text-shadow: 1px 1px #000;
}

.chalpop {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 12;
  background: rgba(46, 39, 29, .95);
  border: 2px solid #1a140d;
  box-shadow: inset 0 0 0 1px #6b5c45;
  padding: 8px 10px;
  color: #fff;
  font: 12px Verdana;
  max-width: 260px;
}

.chalpop small {
  color: #c8b48a;
}

.chat .duelreq {
  color: #7e3878;
  font-weight: bold;
}

.chat .duelreq:hover {
  text-decoration: underline;
}

.tabs button {
  font-size: 15px;
}

#gl {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

#cv {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

#viewport {
  overflow: hidden;
  touch-action: none;
}

/* ---- authentic OSRS stone tabs & panel ---- */
.tabs {
  display: flex;
  gap: 2px;
  background: #1e1913;
  padding: 3px;
  border: 2px solid #0e0b08;
  box-shadow: inset 0 0 0 1px #4b4133;
}

.tabs button {
  flex: 1;
  height: 36px;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #5d5447 0%, #443c32 55%, #342d24 100%);
  border: 1px solid #14100b;
  border-radius: 3px;
  box-shadow: inset 1px 1px 0 #7a7060, inset -1px -1px 0 #231e18;
  cursor: pointer;
  filter: none;
}

.tabs button:hover {
  background: linear-gradient(180deg, #6d6354 0%, #4f463a 55%, #3d352b 100%);
}

.tabs button.on {
  background: linear-gradient(180deg, #8e3424 0%, #6d2317 55%, #4e170e 100%);
  box-shadow: inset 1px 1px 0 #b34f3c, inset -1px -1px 0 #2e0d08;
}

.tabs button img {
  max-width: 26px;
  max-height: 26px;
  image-rendering: pixelated;
  pointer-events: none;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, .75));
}

.panel {
  background: radial-gradient(ellipse at 50% 30%, #463c30 0%, #3a3126 70%, #2f281f 100%);
  border: 2px solid #14100b;
  box-shadow: inset 0 0 0 1px #5c5040, inset 0 0 12px rgba(0, 0, 0, .45);
}

/* ---- OSRS Duel Setup Screen ---- */
.modal.duelscreen {
  width: 676px;
  max-height: 504px;
  padding: 0;
  overflow: hidden;
  background: #3e3529;
  border: 3px solid #14100b;
  box-shadow: inset 0 0 0 2px #6b5c45, 0 12px 40px #000;
}

.ds-head {
  background: linear-gradient(180deg, #5a4b38, #3b3124);
  border-bottom: 2px solid #14100b;
  padding: 6px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ff981f;
  font: bold 14px Verdana;
  text-shadow: 1px 1px #000;
}

.ds-body {
  display: grid;
  grid-template-columns: 245px 1fr;
  gap: 8px;
  padding: 8px;
}

.ds-col {
  background: rgba(25, 20, 14, .62);
  border: 1px solid #14100b;
  box-shadow: inset 0 0 0 1px #574b3a;
  padding: 8px;
}

.ds-h {
  color: #ffcc33;
  font: bold 12px Verdana;
  margin: 0 0 6px;
  text-shadow: 1px 1px #000;
  border-bottom: 1px solid #574b3a;
  padding-bottom: 3px;
}

.ds-rules {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}

.ds-rules label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #ff981f;
  font: 12px Verdana;
  cursor: pointer;
}

.ds-rules label:hover {
  color: #ffff00;
}

.ds-invwrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ds-side {
  background: rgba(0, 0, 0, .28);
  border: 1px solid #1a140d;
  padding: 6px;
}

.ds-side-t {
  color: #ffff00;
  font: bold 11px Verdana;
  text-align: center;
  margin-bottom: 4px;
  text-shadow: 1px 1px #000;
}

.ds-eq {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  margin-bottom: 5px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.ds-inv {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.ds-cell {
  width: 25px;
  height: 25px;
  background: rgba(62, 53, 41, .65);
  border: 1px solid #1e1811;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ds-cell img {
  max-width: 22px;
  max-height: 22px;
  image-rendering: pixelated;
}

.ds-foot {
  background: #2c241b;
  border-top: 2px solid #14100b;
  padding: 7px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.ds-status {
  color: #ffff00;
  font: bold 11px Verdana;
  text-shadow: 1px 1px #000;
}

.ds-status.warn {
  color: #ff5555;
}

.ds-status.ok {
  color: #55ff55;
}

/* ---- OSRS Standard Spellbook ---- */
.spellbook {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 2px;
}

.sp-cell {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
}

.sp-cell:hover {
  background: rgba(255, 255, 255, .10);
}

.sp-cell img {
  max-width: 26px;
  max-height: 26px;
  image-rendering: pixelated;
  pointer-events: none;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, .7));
}

.sp-cell.locked img {
  filter: grayscale(1) brightness(.45);
  opacity: .55;
}

.sp-info {
  margin-top: 8px;
  padding: 5px;
  background: rgba(0, 0, 0, .35);
  border: 1px solid #1a140d;
  text-align: center;
  font: 11px Verdana;
  color: #ff981f;
  min-height: 34px;
}

/* ---- OSRS-style skill boxes with icons ---- */
.stat {
  background: linear-gradient(180deg, #4b4134 0%, #372f25 100%);
  border: 1px solid #14100b;
  box-shadow: inset 1px 1px 0 #665947, inset -1px -1px 0 #211c16;
  padding: 5px 8px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat img {
  width: 25px;
  height: 25px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(1px 1px 0 rgba(0, 0, 0, .75));
}

.stat .sv {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font: bold 13px Verdana;
  text-shadow: 1px 1px #000;
}

.stat .sl {
  color: #b8a47c;
  font-size: 11px;
}

.stat .vb {
  color: #ffff00;
  font-size: 12px;
}

.bottombar { flex-wrap: wrap; gap: 4px; align-items: center; font-size: 11px; }
.bb-links { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
#settingsLink { color: #6bff6b; }

/* ---- OSRS Mobile Full-Screen HUD (phones & tablets) ---- */
.mob-chat-btn {
  display: none;
}

.inv, .slot {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#game, #game button, #game a, .orb, .tabs, .panel, .modal, .bottombar, .chatbox, .ctxmenu {
  touch-action: manipulation;
}

@media (max-width: 1020px) {
  html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
  }
  #game.screen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    padding: 0;
    display: block;
    overflow: hidden;
  }
  .login-box {
    width: min(360px, 94vw);
    padding: 20px;
  }
  .frame {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    padding: 0;
    margin: 0;
    border: 0;
    box-shadow: none;
    background: #000;
    display: block;
  }
  .left {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    display: block;
  }
  #viewport {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    border: 0;
    box-shadow: none;
  }

  /* OSRS Mobile top-left collapsible chatbox */
  .mob-chat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    background: linear-gradient(180deg, #5d5447, #3a3228);
    border: 2px solid #120e09;
    box-shadow: inset 1px 1px 0 #7a7060;
    color: #ffff00;
    font: bold 11px Verdana;
    text-shadow: 1px 1px #000;
    border-radius: 4px;
    cursor: pointer;
  }
  .chatbox {
    position: fixed;
    top: max(6px, env(safe-area-inset-top));
    left: max(6px, env(safe-area-inset-left));
    z-index: 25;
    width: auto;
    height: auto;
    background: transparent;
    border: 0;
    box-shadow: none;
  }
  .chatbox .chat,
  .chatbox .chatin {
    display: none;
  }
  .chatbox.mob-open {
    width: min(340px, calc(100vw - 110px));
    height: 150px;
    background: rgba(202, 182, 142, 0.92);
    border: 2px solid #18130d;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.7);
  }
  .chatbox.mob-open .mob-chat-btn {
    position: absolute;
    top: -2px;
    right: -2px;
    padding: 2px 8px;
    font-size: 10px;
    z-index: 2;
  }
  .chatbox.mob-open .chat {
    display: flex;
  }
  .chatbox.mob-open .chatin {
    display: flex;
  }
  .chatbox.mob-open .chatin input {
    font-size: 16px;
  }

  /* OSRS Mobile right-side HUD container (passthrough pointer events) */
  .right {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    pointer-events: none;
    z-index: 20;
  }

  /* Top-right OSRS Mobile Orbs cluster */
  .orbs {
    position: fixed;
    top: max(6px, env(safe-area-inset-top));
    right: max(54px, calc(50px + env(safe-area-inset-right)));
    pointer-events: auto;
    height: auto;
    display: flex;
    flex-direction: row;
    gap: 5px;
    padding: 4px 6px;
    background: rgba(38, 32, 24, 0.82);
    border: 2px solid #120e09;
    border-radius: 20px;
    box-shadow: inset 0 0 0 1px #5c5040, 0 2px 8px rgba(0, 0, 0, 0.6);
  }
  .orb {
    height: 30px;
    padding: 0 8px 0 30px;
    font-size: 11px;
    border-radius: 15px;
  }
  .orb::before {
    width: 22px;
    height: 22px;
  }
  .orb::after {
    left: 5px;
    top: 5px;
    width: 16px;
    height: 16px;
  }

  /* Right-edge vertical OSRS Mobile stone tabs */
  .tabs {
    position: fixed;
    right: max(4px, env(safe-area-inset-right));
    top: 50%;
    transform: translateY(-50%);
    pointer-events: auto;
    flex-direction: column;
    width: 44px;
    gap: 3px;
    padding: 3px;
    background: rgba(24, 20, 14, 0.88);
    border-radius: 5px;
  }
  .tabs button {
    width: 36px;
    height: 40px;
    flex: none;
  }

  /* Floating OSRS Mobile side panel (Inventory / Prayer / Combat / etc.) */
  .panel {
    position: fixed;
    right: max(54px, calc(50px + env(safe-area-inset-right)));
    bottom: max(8px, env(safe-area-inset-bottom));
    pointer-events: auto;
    width: 220px;
    height: auto;
    max-height: calc(100dvh - 68px);
    background: rgba(54, 46, 36, 0.90);
    border: 2px solid #14100a;
    border-radius: 4px;
    box-shadow: inset 1px 1px 0 #665947, 0 6px 24px rgba(0, 0, 0, 0.75);
    padding: 6px;
  }
  .right.mob-collapsed .panel {
    display: none;
  }
  .inv {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 42px;
    gap: 3px;
  }
  .slot {
    border-radius: 3px;
  }

  /* Bottom-left compact OSRS Mobile utility pill */
  .bottombar {
    position: fixed;
    left: max(6px, env(safe-area-inset-left));
    bottom: max(6px, env(safe-area-inset-bottom));
    pointer-events: auto;
    background: rgba(34, 28, 20, 0.86);
    border: 2px solid #120e09;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    box-shadow: inset 0 0 0 1px #5c5040;
  }
  #whoami {
    display: none;
  }

  /* Modals & Duel Screen responsive on mobile */
  .modal {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(360px, 94vw);
    max-height: 90dvh;
    overflow-y: auto;
    z-index: 40;
  }
  .modal.duelscreen {
    width: min(680px, 95vw) !important;
    max-height: 92dvh;
    overflow-y: auto;
  }
  .ds-body {
    flex-direction: column !important;
    grid-template-columns: 1fr !important;
  }
  .ds-invwrap {
    flex-direction: column !important;
  }
  .ctxmenu .mi {
    padding: 7px 10px;
    font-size: 13px;
  }
}

@media (max-width: 560px) {
  .orbs {
    flex-wrap: wrap;
    max-width: 175px;
    border-radius: 10px;
  }
  .panel {
    width: 204px;
    max-height: calc(100dvh - 102px);
  }
  .inv {
    grid-auto-rows: 39px;
  }
}
