:root {
  --ink: #e8dfc5;
  --muted: #a3ad9b;
  --gold: #dfbc7e;
  --panel: rgba(23, 36, 31, 0.94);
  --border: rgba(204, 192, 145, 0.22);
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #243d33;
  color: var(--ink);
  font:
    13px/1.65 "Microsoft YaHei",
    "PingFang SC",
    sans-serif;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--border);
  transition:
    background 0.18s,
    border 0.18s;
}
button:hover {
  background: #c5b18422;
  border-color: #d8bc81;
}
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
[hidden] {
  display: none !important;
}
#world {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
}
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 160px #0b201936;
}
header {
  position: absolute;
  left: 32px;
  right: 32px;
  top: 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  color: var(--gold);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 29px;
}
.brand span {
  font-family: serif;
  font-size: 20px;
  letter-spacing: 4px;
  line-height: 1.1;
}
.brand small {
  display: block;
  font: 8px/2 sans-serif;
  letter-spacing: 4px;
}
.top-right {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #d6d7bb;
  font-size: 11px;
  background: #1b302b99;
  padding: 5px 10px;
  border: 1px solid #aab59422;
}
.top-right button {
  border: 0;
  font-size: 18px;
}
.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #b4cd96;
  box-shadow: 0 0 8px #c7dd91;
}
.divider {
  height: 12px;
  width: 1px;
  background: #c1c7a633;
  margin: 0 5px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 6px 25px #0b191e33;
  background-image: repeating-linear-gradient(
    0deg,
    #b2a27a03 0,
    #b2a27a03 1px,
    transparent 1px,
    transparent 4px
  );
}
#vitals {
  position: absolute;
  left: 32px;
  top: 100px;
  width: 250px;
  padding: 12px;
  display: flex;
  gap: 12px;
}
.portrait {
  width: 44px;
  height: 48px;
  border: 1px solid #d7b97977;
  background: linear-gradient(145deg, #586954, #2a4740);
  font-size: 29px;
  text-align: center;
  color: #e6cc8c;
}
.vital-content {
  flex: 1;
}
.vital-name {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}
.vital-name span {
  color: var(--gold);
  font-size: 10px;
}
.bar {
  position: relative;
  height: 11px;
  background: #112724;
  border: 1px solid #9ba18533;
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #89564b, #be8770);
  transition: width 0.15s;
}
.bar span {
  position: absolute;
  inset: 0;
  font: 8px/9px monospace;
  text-align: center;
  color: #f1e2c4;
}
.bar.xp {
  height: 3px;
  margin-top: 5px;
  border: 0;
}
.xp i {
  background: #d3b578;
  width: 0;
}
.location {
  position: absolute;
  top: 31px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  text-shadow: 0 2px 10px #1e342c;
}
.eyebrow {
  font-size: 8px;
  letter-spacing: 3px;
  color: var(--gold);
}
.location h2 {
  font:
    26px/1.4 Georgia,
    "Songti SC",
    serif;
  letter-spacing: 7px;
  margin: 3px 0 5px;
}
.location > div {
  font-size: 10px;
  color: #e5e3c5;
}
.weather {
  border-left: 1px solid #ced2b64d;
  margin-left: 12px;
  padding-left: 12px;
}
#minimap-panel {
  position: absolute;
  right: 32px;
  top: 100px;
  width: 202px;
  padding: 11px 12px 6px;
}
.mini-heading,
.mini-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
}
.mini-heading {
  margin-bottom: 8px;
  color: #d6ccac;
  letter-spacing: 1px;
}
#coords {
  font: 9px monospace;
  color: #8a9e8c;
}
#minimap {
  width: 176px;
  height: 150px;
  image-rendering: pixelated;
  border: 1px solid #b4bb8c22;
}
.mini-bottom {
  font-size: 8px;
  margin-top: 3px;
}
#quest-panel {
  position: absolute;
  left: 32px;
  top: 186px;
  width: 250px;
  padding: 15px 17px;
}
.section-label {
  color: var(--gold);
  letter-spacing: 2px;
  font-size: 10px;
}
h3 {
  font-size: 15px;
  font-weight: 400;
  margin: 12px 0 8px;
}
#quest-desc {
  font-size: 11px;
  color: #b8c0ac;
  line-height: 1.9;
}
#quest-progress {
  font-size: 10px;
  color: #d7c48f;
  display: flex;
  justify-content: space-between;
}
.quest-hint {
  font-size: 9px;
  color: #879c88;
  border-top: 1px solid #afba8f22;
  padding-top: 9px;
  margin-top: 12px;
}
footer {
  position: absolute;
  bottom: 25px;
  left: 32px;
  right: 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  pointer-events: none;
}
footer > * {
  pointer-events: auto;
}
.bottom-left {
  display: flex;
  gap: 12px;
  align-items: center;
}
.bottom-left > span {
  font: 16px Georgia;
  color: var(--gold);
  margin-right: 8px;
}
.bottom-left button {
  padding: 6px 9px;
  font-size: 10px;
  background: #20352dcc;
}
kbd {
  font: 9px monospace;
  color: #afa98b;
  border: 1px solid #a5ae8233;
  padding: 1px 4px;
  margin-left: 5px;
  border-radius: 2px;
}
.hotbar {
  display: flex;
  gap: 6px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
}
.hotbar button {
  height: 66px;
  width: 62px;
  position: relative;
  background: #20372fe8;
  box-shadow: 0 3px 12px #10221d77;
}
.hotbar b {
  font-size: 24px;
  line-height: 27px;
  font-weight: 400;
  color: var(--gold);
  display: block;
}
.hotbar span {
  display: block;
  font-size: 9px;
  color: #c4c5a9;
}
.hotbar kbd {
  position: absolute;
  right: 3px;
  top: 3px;
  padding: 0 2px;
  font-size: 8px;
}
.hotbar button:active,
.hotbar button.active {
  background: #8b88634d;
  transform: translateY(2px);
}
.hotbar .red {
  color: #c88e79;
}
.bottom-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  color: #b1bca2;
  font-size: 9px;
  gap: 5px;
}
#save-status {
  color: #e0c890;
}
#toasts {
  position: absolute;
  right: 32px;
  top: 342px;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  perspective: 600px;
}
.toast {
  background: #20362ee8;
  border: 1px solid #a5b08233;
  border-left: 2px solid var(--gold);
  padding: 11px 14px;
  font-size: 11px;
  transform-origin: 100% 0;
  animation: toast-in 320ms cubic-bezier(.2, .85, .25, 1.15) both;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(.2, .7, .2, 1);
}
.toast.out {
  opacity: 0;
  transform: translateY(-5px) scale(.97);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.overlay:not([hidden]) {
  animation: overlay-in 180ms ease-out both;
}
.modal-card {
  transform-origin: 50% 45%;
  animation: modal-in 260ms cubic-bezier(.2, .85, .25, 1.08) both;
}
@keyframes overlay-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.975); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
#interact-prompt {
  position: absolute;
  bottom: 135px;
  left: 50%;
  transform: translateX(-50%);
  background: #20372fe8;
  border: 1px solid #bdc29955;
  padding: 8px 18px;
  color: #e7d7ac;
  white-space: nowrap;
  font-size: 11px;
}
#zone-toast {
  position: absolute;
  left: 50%;
  top: 29%;
  transform: translateX(-50%);
  font: 24px serif;
  letter-spacing: 8px;
  pointer-events: none;
  text-shadow: 0 2px 6px #132b20;
  transition: opacity 1s;
}
#event-banner {
  position: absolute;
  top: 145px;
  left: 50%;
  transform: translateX(-50%);
  background: #3e3b47dd;
  border: 1px solid #bfa8c755;
  padding: 8px 23px;
  font-size: 11px;
  color: #ddc5dd;
  white-space: nowrap;
}
#bossbar {
  position: absolute;
  top: 186px;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  text-align: center;
  color: #dcb7b4;
}
#chat-wrap {
  position: absolute;
  bottom: 111px;
  left: 32px;
  width: 270px;
  font-size: 10px;
}
#chat-log {
  color: #c1cbb4;
  text-shadow: 0 1px 3px #112b21;
  max-height: 80px;
  overflow: hidden;
}
#chat {
  width: 100%;
  background: #1e352c88;
  border: 1px solid #b8bd9222;
  color: #e8dbb6;
  padding: 5px 8px;
  font-size: 10px;
  margin-top: 5px;
}
#chat:not(:focus) {
  background: transparent;
  border-color: transparent;
}
input {
  color: var(--ink);
  background: #182c27;
  border: 1px solid #a2af8666;
  padding: 10px 13px;
}
.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #112a2266;
  backdrop-filter: blur(3px);
}
#welcome {
  justify-content: flex-start;
  background: linear-gradient(
    90deg,
    #142b28f5 0%,
    #142b28e0 27%,
    #142b2866 56%,
    #142b2811
  );
  backdrop-filter: none;
}
.intro {
  margin-left: 11vw;
  width: 330px;
  padding: 35px 0;
}
.intro > .eyebrow {
  font: 8px sans-serif;
  letter-spacing: 3px;
}
.intro h1 {
  font:
    60px/1.25 Georgia,
    "Songti SC",
    serif;
  letter-spacing: 8px;
  font-weight: 400;
  margin: 23px 0 6px;
  color: #f1e4c8;
}
.intro h1 span {
  display: block;
  color: #dabb84;
  letter-spacing: 17px;
}
.eng {
  font: 10px sans-serif;
  letter-spacing: 5px;
  color: #acb89c;
  margin-top: 18px;
}
.intro-line {
  width: 45px;
  height: 1px;
  background: #c6ae78;
  margin-top: 28px;
}
.intro p {
  color: #b8c1ad;
  font-size: 12px;
  line-height: 2.1;
  margin: 21px 0 27px;
  letter-spacing: 2px;
}
.name-label {
  display: block;
  font-size: 10px;
  color: #a5b59b;
  margin-bottom: 7px;
  letter-spacing: 2px;
}
#name {
  width: 100%;
  background: #1c332c99;
  height: 43px;
}
.gold {
  width: 100%;
  background: #d9b77b;
  color: #253d32;
  border: 1px solid #f4d297;
  padding: 12px 20px;
  text-align: left;
  font-size: 14px;
  letter-spacing: 5px;
  margin-top: 12px;
}
.gold:hover {
  background: #e6c68e;
  color: #1e3429;
}
.gold span {
  float: right;
}
#connect-status {
  font-size: 9px;
  color: #a9b99a;
  text-align: center;
  margin-top: 15px;
}
.intro-controls {
  font-size: 9px;
  color: #829b86;
  margin-top: 33px;
  white-space: nowrap;
}
.intro-note {
  position: absolute;
  right: 5vw;
  bottom: 6vh;
  font-size: 11px;
  line-height: 2;
  color: #e4d4ac;
  text-align: right;
  letter-spacing: 3px;
}
.intro-note span {
  font-size: 9px;
  color: #b8c8ab;
}
.modal-card {
  width: min(630px, 92vw);
  max-height: 85vh;
  padding: 30px;
  overflow: auto;
  position: relative;
}
.close {
  position: absolute;
  right: 15px;
  top: 10px;
  font-size: 25px;
  border: 0;
}
.modal-card h2 {
  font: 26px serif;
  color: #e3c58e;
  letter-spacing: 4px;
  margin: 4px 0 18px;
}
.modal-card p {
  color: #b9c7b0;
  font-size: 12px;
}
.modal-card .eyebrow {
  margin-bottom: 10px;
}
.modal-card button.action {
  padding: 10px 16px;
  margin: 5px 7px 5px 0;
  font-size: 12px;
}
.inventory {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin: 20px 0;
}
.item {
  background: #49634a22;
  border: 1px solid #9eae7c33;
  padding: 12px 6px;
  text-align: center;
}
.item img {
  width: 42px;
  height: 42px;
  image-rendering: pixelated;
}
.item b {
  display: block;
  font-weight: 400;
  font-size: 11px;
}
.item span {
  font-size: 11px;
  color: #e0bc7f;
}
.guide-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.guide-grid > div {
  padding: 13px;
  background: #ffffff04;
  border: 1px solid #a5b58422;
}
.guide-grid b {
  color: #d9bf8e;
}
.guide-grid p {
  margin: 7px 0 0;
  font-size: 11px;
}
.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 19px 0;
  gap: 20px;
}
.settings-row input[type="range"] {
  width: 200px;
  accent-color: #cfb278;
}
.world-map {
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  border: 1px solid #b9bf9c44;
}
.map-legend {
  display: flex;
  gap: 13px;
  font-size: 10px;
  color: #c3c9ac;
  flex-wrap: wrap;
  margin-top: 10px;
}
.network-warning {
  color: #e7b997;
}
@media (max-width: 1000px) {
  header {
    left: 18px;
    right: 18px;
  }
  .location {
    top: 29px;
  }
  .location .eyebrow {
    display: none;
  }
  .location h2 {
    font-size: 21px;
  }
  #vitals {
    left: 18px;
    width: 205px;
  }
  #quest-panel {
    left: 18px;
    width: 205px;
    padding: 12px;
  }
  #minimap-panel {
    right: 18px;
    width: 170px;
  }
  #minimap {
    width: 144px;
    height: 123px;
  }
  #toasts {
    right: 18px;
    width: 225px;
    top: 300px;
  }
  .bottom-right {
    display: none;
  }
  footer {
    left: 18px;
    right: 18px;
  }
  .bottom-left {
    gap: 6px;
  }
  .hotbar {
    left: auto;
    right: 0;
    transform: none;
  }
  .hotbar button {
    width: 51px;
  }
  #chat-wrap {
    left: 18px;
    width: 205px;
  }
  .intro {
    margin-left: 8vw;
  }
}
@media (max-height: 650px) {
  #quest-panel {
    top: 177px;
  }
  #quest-desc {
    font-size: 10px;
  }
  #quest-panel .quest-hint {
    display: none;
  }
  .intro {
    transform: scale(0.82);
    transform-origin: left center;
  }
  #vitals {
    top: 86px;
  }
  #minimap-panel {
    top: 86px;
  }
  .hotbar button {
    height: 55px;
  }
  .intro-controls {
    margin-top: 17px;
  }
}
@media (max-width: 650px) {
  .brand span {
    font-size: 14px;
  }
  .brand small {
    font-size: 6px;
  }
  .location {
    display: none;
  }
  #quest-panel {
    display: none;
  }
  #vitals {
    top: 80px;
    width: 185px;
  }
  #minimap-panel {
    top: 80px;
    width: 125px;
    padding: 7px;
  }
  #minimap {
    width: 109px;
    height: 94px;
  }
  .mini-heading {
    font-size: 8px;
  }
  .mini-bottom {
    display: none;
  }
  .top-right {
    font-size: 9px;
  }
  footer {
    bottom: 17px;
  }
  .bottom-left {
    position: absolute;
    bottom: 73px;
  }
  .hotbar {
    right: 50%;
    transform: translateX(50%);
  }
  .hotbar button {
    width: 51px;
  }
  #chat-wrap {
    bottom: 152px;
    width: 185px;
  }
  #toasts {
    top: 210px;
    width: 180px;
    font-size: 10px;
  }
  .intro {
    margin-left: 9vw;
    width: 290px;
  }
  .intro h1 {
    font-size: 52px;
  }
  .intro-note {
    display: none;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .inventory {
    grid-template-columns: repeat(3, 1fr);
  }
}
/* In-game controls use compact labels and drawn assets. */
#weapon-switch {
  position: absolute;
  bottom: 106px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  padding: 3px;
  gap: 2px;
  background: #1c302bd9;
}
#weapon-switch button {
  font-size: 10px;
  padding: 5px 12px;
  border-color: transparent;
  color: #9ead98;
}
#weapon-switch button.selected {
  color: #e9d4a5;
  border-color: #aa96654d;
  background: #b39b6822;
}
.bar.energy {
  height: 3px;
  border: 0;
  margin-top: 3px;
}
.energy i {
  background: #7d9eaa;
}
.journal-entry {
  border-top: 1px solid var(--border);
  padding: 8px 0 13px;
}
.journal-entry h3 {
  color: #ddc492;
}
blockquote {
  border-left: 2px solid #9c9567;
  margin: 24px 0;
  padding: 12px 20px;
  color: #c9c6a9;
  background: #8c936211;
  font:
    14px/2 Georgia,
    "Songti SC",
    serif;
}
.gear-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 9px;
}
.gear-card {
  padding: 11px 13px;
  border: 1px solid #a5b59433;
  background: #788d6b0b;
}
.gear-card h4 {
  margin: 0 0 5px;
  font-size: 12px;
  font-weight: 400;
}
.gear-card p {
  margin: 3px 0;
  font-size: 10px;
}
.gear-card button {
  font-size: 10px;
  padding: 4px 8px;
  margin: 5px 5px 0 0;
}
.gear-card.rare {
  border-color: #79a4c777;
}
.gear-card.epic {
  border-color: #b393c677;
}
.gear-card.uncommon {
  border-color: #8bac7b77;
}
.equipment-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: #cab789;
  font-size: 11px;
  border-block: 1px solid var(--border);
  padding: 12px 0;
  margin-bottom: 15px;
}
.bag-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.bag-tabs button {
  padding: 5px 13px;
}
.muted {
  color: #8e9e89;
  font-size: 10px;
}
@media (max-width: 650px) {
  #weapon-switch {
    bottom: 87px;
  }
  .gear-grid {
    grid-template-columns: 1fr;
  }
  #weapon-switch button {
    padding: 4px 10px;
  }
}
.hotbar b.skill-art {
  height: 30px;
  width: 32px;
  margin: 0 auto;
  background-size: 32px 34px;
  background-position: center;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}
.portrait {
  font-size: 0;
  background-size: auto 48px;
  background-repeat: no-repeat;
  background-position: center bottom;
  image-rendering: pixelated;
  background-color: #354c3a;
}
.bottom-left {
  gap: 5px;
}
.bottom-left button {
  padding: 6px 7px;
}
@media (max-width: 1050px) {
  .bottom-left {
    position: absolute;
    bottom: 78px;
  }
  #chat-wrap {
    bottom: 154px;
  }
}

html, body {
  min-height: 100%;
  height: 100%;
}
@supports (height: 100dvh) {
  html, body { height: 100dvh; }
}
#modal {
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.modal-card {
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
#modal-close {
  position: sticky;
  float: right;
  z-index: 2;
  top: -20px;
  margin: -15px -15px 0 8px;
  width: 44px;
  height: 44px;
  background: #17241f;
}
#touch-controls { display: none; }

@media (max-width: 700px), (pointer: coarse) {
  header {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    top: max(8px, env(safe-area-inset-top));
  }
  .brand { gap: 5px; }
  .brand span { font-size: 13px; }
  .brand small { letter-spacing: 2px; }
  .top-right { gap: 5px; padding: 3px 5px; }
  .top-right button { min-width: 40px; min-height: 40px; }
  #vitals {
    left: max(8px, env(safe-area-inset-left));
    top: calc(max(8px, env(safe-area-inset-top)) + 50px);
    width: min(46vw, 188px);
    padding: 7px;
    gap: 7px;
  }
  .portrait { width: 34px; height: 38px; background-size: auto 38px; }
  .vital-name { margin-bottom: 3px; }
  #minimap-panel {
    right: max(8px, env(safe-area-inset-right));
    top: calc(max(8px, env(safe-area-inset-top)) + 50px);
    width: min(31vw, 128px);
    padding: 6px;
  }
  #minimap { width: 100%; height: auto; aspect-ratio: 176 / 150; }
  #quest-panel { display: none; }
  .location { display: none; }
  footer {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    height: 0;
  }
  .bottom-left {
    position: absolute;
    left: 50%;
    bottom: calc(112px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    max-width: calc(100vw - 16px);
    white-space: nowrap;
  }
  .bottom-left > span { display: none; }
  .bottom-left button {
    min-height: 42px;
    padding: 5px 8px;
    font-size: 10px;
    background: #20352de8;
  }
  .bottom-left kbd, .hotbar kbd { display: none; }
  .hotbar {
    position: absolute;
    right: max(8px, env(safe-area-inset-right));
    bottom: 0;
    left: auto;
    transform: none;
    display: grid;
    grid-template-columns: repeat(2, 58px);
    gap: 5px;
  }
  .hotbar button {
    width: 58px;
    height: 54px;
    padding: 2px;
    touch-action: manipulation;
  }
  .hotbar b { font-size: 20px; line-height: 23px; }
  .hotbar b.skill-art { width: 25px; height: 25px; background-size: 25px 27px; }
  .hotbar span { font-size: 9px; }
  #weapon-switch {
    top: calc(max(8px, env(safe-area-inset-top)) + 146px);
    bottom: auto;
    left: 50%;
    transform: translateX(-50%);
    max-width: 48vw;
  }
  #weapon-switch button { min-height: 40px; padding: 4px 8px; white-space: nowrap; }
  #touch-controls {
    display: block;
    position: fixed;
    z-index: 2;
    left: max(14px, env(safe-area-inset-left));
    bottom: max(24px, env(safe-area-inset-bottom));
    width: 116px;
    height: 116px;
    border: 1px solid #d1c28a66;
    border-radius: 50%;
    background: #17282088;
    box-shadow: inset 0 0 0 8px #a8ae7820, 0 3px 14px #0b191e66;
    touch-action: none;
  }
  #move-stick { position: absolute; inset: 0; touch-action: none; }
  .stick-thumb {
    position: absolute;
    width: 44px;
    height: 44px;
    left: 50%;
    top: 50%;
    margin: -22px;
    border: 1px solid #e1ca8c99;
    border-radius: 50%;
    background: #d0bb7966;
    box-shadow: 0 2px 8px #101d17aa;
    pointer-events: none;
  }
  #chat-wrap { display: none; }
  #toasts {
    top: calc(max(8px, env(safe-area-inset-top)) + 200px);
    right: max(8px, env(safe-area-inset-right));
    width: min(45vw, 190px);
  }
  #event-banner, #bossbar { top: 205px; max-width: 90vw; }
  #event-banner { white-space: normal; text-align: center; }
  #interact-prompt { bottom: 180px; max-width: 90vw; white-space: normal; text-align: center; }
  #zone-toast { max-width: 90vw; text-align: center; font-size: 18px; letter-spacing: 4px; }
  .overlay { padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
  .modal-card {
    width: min(630px, 100%);
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 20px);
    padding: 18px 14px;
  }
  .modal-card h2 { font-size: 22px; }
  .modal-card button.action { min-height: 44px; }
  .inventory { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .item { padding: 8px 4px; }
  .item img { width: 36px; height: 36px; }
  .gear-grid { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  #touch-controls { width: 104px; height: 104px; }
  .hotbar { grid-template-columns: repeat(2, 52px); }
  .hotbar button { width: 52px; height: 50px; }
  .bottom-left button { padding-inline: 6px; }
  #weapon-switch button { padding-inline: 5px; font-size: 9px; }
}
@media (max-width: 700px) and (orientation: landscape) {
  #vitals, #minimap-panel { top: calc(max(6px, env(safe-area-inset-top)) + 46px); }
  #minimap-panel { width: 112px; }
  #minimap { max-height: 78px; }
  #weapon-switch { top: calc(max(6px, env(safe-area-inset-top)) + 132px); }
  #touch-controls { width: 92px; height: 92px; bottom: max(10px, env(safe-area-inset-bottom)); }
  .stick-thumb { width: 38px; height: 38px; margin: -19px; }
  .bottom-left { bottom: calc(0px + env(safe-area-inset-bottom)); }
  .hotbar { grid-template-columns: repeat(5, 50px); }
  .hotbar button { width: 50px; height: 48px; }
  #toasts { top: calc(160px + env(safe-area-inset-top)); }
}
