/* 传奇网页原型 — 暗红黑老客户端致敬风 HUD */
:root {
  --bg: #030101;
  --panel: #0c0404;
  --panel-2: #140606;
  --border: #7a1c1c;
  --border-soft: #3a1010;
  --border-gold: #b89040;
  --gold: #e8c858;
  --gold-dim: #a07830;
  --text: #e8d090;
  --muted: #6a4a30;
  --hp: #b02018;
  --mp: #185098;
  --ok: #3a8a3a;
  --chrome-hi: #5a2820;
  --chrome-lo: #080202;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", SimHei, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.rotate-tip {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 4, 4, 0.96);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.rotate-tip-inner { max-width: 320px; }
.rotate-tip-text { font-size: 1.2rem; color: var(--gold); margin: 12px 0 6px; }
.rotate-tip-sub { font-size: 0.85rem; color: var(--muted); margin-bottom: 16px; }
.rotate-phone { font-size: 2.5rem; }

@media (orientation: portrait) and (max-width: 900px) {
  .rotate-tip { display: flex; }
}

.app {
  display: grid;
  grid-template-rows: 0 1fr 0; /* pass4: canvas-first client chrome; HTML chrome collapsed */
  width: 100%;
  height: 100%;
  max-height: 100dvh;
}

.topbar {
  display: none; /* canvas HUD replaces webpage topbar */
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
  background:
    linear-gradient(180deg, #4a1810 0%, #1c0808 40%, #0a0303 100%);
  border-bottom: 2px solid #6a2018;
  box-shadow:
    inset 0 1px 0 rgba(200,140,60,0.28),
    inset 0 -1px 0 #2a0c0c,
    0 3px 10px rgba(0,0,0,0.65);
  flex-shrink: 0;
}
.brand { display: flex; flex-direction: column; gap: 1px; }
.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-shadow: 0 0 8px rgba(240, 180, 40, 0.35), 1px 1px 0 #401010;
}
.brand-sub { font-size: 0.65rem; color: var(--muted); }
.top-hint { font-size: 0.7rem; color: var(--muted); text-align: right; }

.stage {
  position: relative;
  min-height: 0;
  background: #040202;
  overflow: hidden;
}
#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
  cursor: crosshair;
}

/* 底部状态栏 — 老客户端黑底红框 + 粗血蓝条 */
.hud {
  display: none; /* pass4: HP/MP/EXP drawn on canvas like Mir-mobile */
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 0;
  background:
    linear-gradient(180deg, #3a1210 0%, #140505 42%, #060202 100%);
  border-top: 2px solid #6a1c18;
  box-shadow:
    inset 0 1px 0 rgba(200,140,60,0.22),
    inset 0 0 0 1px #2a0c0c,
    0 -4px 16px rgba(0,0,0,0.55);
  flex-shrink: 0;
}

.bars { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.bar-row {
  display: grid;
  grid-template-columns: 40px 1fr 78px;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
}
.bar-label {
  color: var(--gold);
  font-weight: 700;
  text-shadow: 1px 1px 0 #200808;
}
.bar-track {
  height: 13px;
  background: #030101;
  border: 2px solid #5a1410;
  border-radius: 1px;
  overflow: hidden;
  box-shadow: inset 0 0 8px #000, inset 0 1px 0 rgba(200,140,60,0.12);
}
.bar-fill { height: 100%; width: 0%; transition: width 0.1s linear; }
.bar-fill.hp {
  background: linear-gradient(180deg, #f06050 0%, var(--hp) 45%, #801010 100%);
  box-shadow: inset 0 1px 0 rgba(255,200,180,0.35);
}
.bar-fill.mp {
  background: linear-gradient(180deg, #58a0e8 0%, var(--mp) 45%, #103060 100%);
  box-shadow: inset 0 1px 0 rgba(180,220,255,0.3);
}
.bar-text {
  color: var(--text);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 3px;
  font-size: 0.76rem;
  color: var(--text);
}
.stats-row span {
  white-space: nowrap;
  padding: 1px 6px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border-soft);
}

.hud-right {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  min-width: 200px;
  max-width: 280px;
}

.chat-log {
  height: 72px;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid #3a1410;
  box-shadow: inset 0 0 0 1px #1a0808, inset 0 1px 0 rgba(180,120,40,0.12);
  padding: 4px 6px;
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--muted);
}
.log-line { margin-bottom: 2px; }
.log-level { color: #ffe080; font-weight: 700; }
.log-loot { color: #80d080; }
.log-combat { color: #e09090; }
.controls-hint { font-size: 0.62rem; color: var(--muted); }

.bag-panel {
  position: absolute;
  right: 12px;
  top: 12px;
  width: min(320px, 92vw);
  background: linear-gradient(165deg, #321210 0%, #140606 55%, #080202 100%);
  border: 2px solid #6a1c18;
  outline: 1px solid rgba(180,130,50,0.25);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(200,150,60,0.2), inset 0 0 0 1px #2a0c0c;
  z-index: 20;
  padding: 10px;
}
.bag-panel.hidden { display: none; }
.bag-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-shadow: 1px 1px 0 #301010;
}
.bag-close {
  background: #1a0808;
  border: 1px solid var(--border-soft);
  color: var(--text);
  width: 28px;
  height: 28px;
  cursor: pointer;
}
.bag-equip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.equip-slot {
  background: #0a0404;
  border: 1px solid var(--border-soft);
  padding: 8px;
  font-size: 0.78rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.equip-slot.empty { color: var(--muted); }
.bag-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.bag-slot {
  aspect-ratio: 1;
  background: #100606;
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 0.68rem;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  line-height: 1.2;
}
.bag-slot:hover { border-color: var(--gold-dim); }
.bag-slot.equipped { outline: 1px solid var(--ok); }
.bag-slot.empty { color: #503828; }
.slot-qty {
  position: absolute;
  right: 3px;
  bottom: 2px;
  font-size: 0.65rem;
  color: var(--gold);
}
.bag-hint { margin-top: 8px; font-size: 0.68rem; color: var(--muted); }

.vstick-base {
  display: none;
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 15;
  width: 118px;
  height: 118px;
  border-radius: 50%;
  border: 2px solid rgba(160, 48, 48, 0.85);
  background:
    radial-gradient(circle at 50% 50%, rgba(40, 12, 12, 0.55), rgba(10, 4, 4, 0.72));
  box-shadow:
    inset 0 0 0 1px rgba(240, 180, 60, 0.18),
    0 4px 14px rgba(0, 0, 0, 0.55);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  align-items: center;
  justify-content: center;
}
.vstick-base.active {
  border-color: rgba(220, 160, 60, 0.95);
  box-shadow:
    inset 0 0 0 1px rgba(240, 200, 80, 0.35),
    0 0 16px rgba(180, 60, 40, 0.35);
}
.vstick-base.run {
  border-color: rgba(255, 200, 80, 1);
  box-shadow:
    inset 0 0 0 1px rgba(255, 220, 120, 0.5),
    0 0 18px rgba(220, 120, 40, 0.55);
}
.vstick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin-left: -24px;
  margin-top: -24px;
  border-radius: 50%;
  border: 2px solid #a03030;
  background:
    radial-gradient(circle at 35% 30%, rgba(180, 50, 50, 0.95), rgba(50, 10, 10, 0.95));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(240, 180, 60, 0.25);
  pointer-events: none;
  transition: none;
}
.vstick-label {
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  color: var(--gold);
  text-shadow: 1px 1px 0 #200808;
  opacity: 0.85;
  pointer-events: none;
  white-space: nowrap;
}
.touch-actions {
  display: none;
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 15;
  flex-direction: column;
  gap: 8px;
}
.pad-btn, .action-btn {
  width: 46px;
  height: 46px;
  border-radius: 4px;
  border: 2px solid #7a2020;
  background:
    linear-gradient(180deg, rgba(70,18,18,0.88), rgba(20,6,6,0.88));
  box-shadow: inset 0 1px 0 rgba(240,180,60,0.2), 0 2px 6px rgba(0,0,0,0.5);
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 800;
  text-shadow: 1px 1px 0 #200808;
}
.action-btn.atk {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border-color: #a03030;
  background:
    radial-gradient(circle at 35% 30%, rgba(180,40,40,0.95), rgba(70,10,10,0.92));
}

@media (pointer: coarse), (max-width: 900px) {
  .vstick-base { display: flex; }
  .touch-actions { display: flex; }
  .top-hint { display: none; }
  .hud { grid-template-columns: 1fr; }
  .hud-right { max-width: none; min-width: 0; }
  .chat-log { height: 52px; }
}

.btn {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, #4a1818, #2a0c0c);
  color: var(--gold);
  padding: 8px 14px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, #6a2020, #3a1010); }

.homage-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 5;
  font-size: 0.62rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.5);
  padding: 3px 8px;
  border: 1px solid var(--border-soft);
  pointer-events: none;
}

/* —— 人物纸娃娃 / 对话 / 商店 / 仓库 —— */
.modal-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, 94vw);
  max-height: min(86vh, 560px);
  overflow-y: auto;
  background: linear-gradient(160deg, #2a1010, #100606);
  border: 2px solid var(--border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.75), inset 0 0 0 1px #3a1818;
  z-index: 30;
  padding: 10px;
  -webkit-overflow-scrolling: touch;
}
.modal-panel.hidden { display: none; }

.char-panel {
  position: absolute;
  left: 12px;
  top: 12px;
  width: min(360px, 94vw);
  max-height: min(88vh, 580px);
  overflow-y: auto;
  background: linear-gradient(160deg, #2a1010, #100606);
  border: 2px solid var(--border);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.7), inset 0 0 0 1px #3a1818;
  z-index: 22;
  padding: 10px;
}
.char-panel.hidden { display: none; }

.char-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}
.char-doll {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "helmet helmet"
    "necklace necklace"
    "weapon armor"
    "bracelet ring";
  gap: 6px;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border-soft);
  padding: 8px;
  min-height: 160px;
}
.doll-slot {
  background: #0a0404;
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-size: 0.72rem;
  padding: 10px 4px;
  cursor: pointer;
  min-height: 40px;
  touch-action: manipulation;
}
.doll-slot.empty { color: var(--muted); }
.doll-helmet { grid-area: helmet; }
.doll-necklace { grid-area: necklace; }
.doll-weapon { grid-area: weapon; }
.doll-armor { grid-area: armor; }
.doll-bracelet { grid-area: bracelet; }
.doll-ring { grid-area: ring; }

.char-stats {
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text);
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--border-soft);
  padding: 8px;
}
.char-stats div { margin-bottom: 2px; }

.panel-sub {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  margin: 8px 0 6px;
  letter-spacing: 0.04em;
}

.dialogue-body {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 10px;
}
.dialogue-body p { margin-bottom: 8px; }
.dialogue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shop-panel { width: min(460px, 96vw); }
.shop-gold {
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 6px;
  font-size: 0.85rem;
}
.shop-buy { margin-bottom: 8px; }
.shop-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  background: #0a0404;
  border: 1px solid var(--border-soft);
  color: var(--text);
  padding: 10px 12px;
  margin-bottom: 4px;
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  text-align: left;
  touch-action: manipulation;
}
.shop-row:hover, .shop-row:active { border-color: var(--gold-dim); background: #1a0a0a; }
.shop-row .price { color: var(--gold); font-weight: 700; white-space: nowrap; margin-left: 8px; }
.shop-sell {
  max-height: 160px;
  overflow-y: auto;
}

.warehouse-panel { width: min(400px, 96vw); }

.bag-slot, .equip-slot, .doll-slot, .shop-row, .action-btn, .btn, .bag-close, .vstick-base {
  touch-action: manipulation;
}

@media (pointer: coarse), (max-width: 900px) {
  .char-panel { left: 6px; top: 6px; right: 6px; width: auto; }
  .modal-panel { width: min(96vw, 460px); }
  .char-body { grid-template-columns: 1fr; }
  .touch-actions { gap: 6px; }
  .action-btn { width: 44px; height: 44px; font-size: 0.85rem; }
}

/* —— 选职业 / 技能栏 / 地图名 —— */
.class-select {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(4, 2, 2, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.class-select.hidden { display: none; }
.class-select-inner {
  width: min(520px, 96vw);
  background: linear-gradient(160deg, #2a1010, #100606);
  border: 2px solid var(--border);
  box-shadow: 0 12px 40px rgba(0,0,0,0.75);
  padding: 18px 16px 16px;
  text-align: center;
}
.class-select-inner h2 {
  color: var(--gold);
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}
.class-select-sub {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 14px;
}
.class-choices {
  display: grid;
  gap: 10px;
}
.class-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
}
.class-card strong {
  font-size: 1.05rem;
  color: var(--gold);
}
.class-card span {
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 500;
}

.map-label {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  z-index: 6;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--gold);
  background: linear-gradient(180deg, rgba(50,14,10,0.92), rgba(0,0,0,0.88));
  border: 1px solid #6a4020;
  outline: 1px solid rgba(180,130,50,0.2);
  box-shadow: inset 0 1px 0 rgba(220,170,70,0.25), inset 0 0 0 1px #1a0808;
  padding: 3px 14px;
  pointer-events: none;
  letter-spacing: 0.1em;
  text-shadow: 1px 1px 0 #200808;
}

.skill-bar {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  z-index: 16;
  display: flex;
  gap: 3px;
  padding: 4px 5px;
  background:
    linear-gradient(180deg, rgba(50,16,12,0.96) 0%, rgba(10,3,3,0.96) 55%, rgba(4,1,1,0.96) 100%);
  border: 2px solid #5a1810;
  outline: 1px solid rgba(180,130,50,0.35);
  box-shadow:
    inset 0 0 0 1px #2a0c08,
    inset 0 1px 0 rgba(220,170,70,0.3),
    inset 0 -1px 0 rgba(0,0,0,0.6),
    0 6px 18px rgba(0,0,0,0.75);
  max-width: 96vw;
  overflow-x: auto;
  border-radius: 1px;
}
.skill-hint {
  color: var(--muted);
  font-size: 0.72rem;
  padding: 6px 10px;
}
.skill-slot {
  position: relative;
  min-width: 54px;
  max-width: 64px;
  height: 46px;
  background:
    linear-gradient(180deg, #3a1610 0%, #120606 55%, #080202 100%);
  border: 1px solid #6a2018;
  box-shadow:
    inset 0 1px 0 rgba(220,170,70,0.22),
    inset 0 0 0 1px #1a0808,
    0 1px 0 rgba(0,0,0,0.5);
  color: var(--gold);
  cursor: pointer;
  padding: 3px 2px;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  border-radius: 1px;
}
.skill-slot.ready { border-color: var(--gold-dim); }
.skill-slot.passive { opacity: 0.85; border-style: dashed; }
.skill-slot.empty { opacity: 0.4; cursor: default; }
.skill-slot .sk-key {
  position: absolute;
  left: 3px;
  top: 2px;
  font-size: 0.62rem;
  color: var(--gold);
  font-weight: 700;
}
.skill-slot .sk-name {
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
}
.skill-slot .sk-meta {
  font-size: 0.58rem;
  color: var(--muted);
  margin-top: 2px;
}
.skill-slot .sk-cd {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
}

@media (pointer: coarse), (max-width: 900px) {
  .skill-bar {
    bottom: 64px;
    left: 8px;
    right: 72px;
    transform: none;
    width: auto;
  }
  .skill-slot { min-width: 52px; height: 48px; }
  .map-label { top: 28px; font-size: 0.7rem; }
}


/* ===== 质量关：横屏优先移动端布局 ===== */
@media (orientation: landscape) and (max-height: 520px),
       (pointer: coarse) and (orientation: landscape) {
  .topbar {
    padding: 2px 10px;
    min-height: 0;
  }
  .brand-title { font-size: 0.85rem; letter-spacing: 0.08em; }
  .brand-sub { display: none; }
  .top-hint { display: none; }
  .hud {
    padding: 3px 8px 4px;
    gap: 4px;
    grid-template-columns: 1fr minmax(140px, 32vw);
  }
  .bar-row { grid-template-columns: 28px 1fr 64px; font-size: 0.65rem; gap: 4px; }
  .bar-track { height: 10px; }
  .stats-row { font-size: 0.65rem; gap: 4px 8px; margin-top: 1px; }
  .stats-row span { padding: 0 4px; }
  .chat-log { height: 36px; font-size: 0.62rem; }
  .controls-hint { display: none; }
  .homage-badge { display: none; }
  .map-label { top: 4px; font-size: 0.65rem; padding: 2px 8px; }
  .skill-bar {
    left: auto;
    right: 78px;
    bottom: 8px;
    transform: none;
    max-width: 42vw;
    padding: 4px;
    gap: 4px;
  }
  .skill-slot { min-width: 46px; max-width: 56px; height: 42px; }
  .vstick-base {
    display: flex;
    left: 10px;
    bottom: 8px;
    width: 108px;
    height: 108px;
  }
  .vstick-knob { width: 44px; height: 44px; margin-left: -22px; margin-top: -22px; }
  .vstick-label { bottom: -16px; font-size: 0.58rem; }
  .touch-actions {
    display: flex;
    right: 8px;
    bottom: 8px;
    flex-direction: column;
    gap: 6px;
  }
  .action-btn { width: 44px; height: 44px; font-size: 0.8rem; }
  .action-btn.atk { width: 58px; height: 58px; }
}

/* 竖屏：提示旋转，但仍尽量给可玩横条布局 */
@media (orientation: portrait) and (max-width: 900px) {
  .rotate-tip { display: flex; }
  .app {
    /* 尽量压扁顶底 chrome，把舞台留给游戏 */
  }
  .brand-sub, .top-hint, .controls-hint, .homage-badge { display: none; }
  .topbar { padding: 2px 8px; }
  .brand-title { font-size: 0.8rem; }
  .hud {
    padding: 2px 6px 4px;
    grid-template-columns: 1fr;
  }
  .chat-log { height: 28px; }
  .stats-row { display: none; }
  .vstick-base { display: flex; left: 6px; bottom: 6px; width: 100px; height: 100px; }
  .touch-actions { display: flex; right: 6px; bottom: 6px; }
  .skill-bar {
    bottom: 58px;
    left: 6px;
    right: 70px;
    transform: none;
  }
}

/* 桌面也略收紧 HUD，舞台更大 */
@media (min-width: 901px) and (min-height: 600px) {
  .hud { padding: 6px 10px 8px; }
  .chat-log { height: 64px; }
}


/* ===== Mir-mobile denser chrome pass ===== */
.bag-panel, .modal-panel, .char-panel, .class-select-inner {
  background: linear-gradient(165deg, #321210 0%, #120505 55%, #060202 100%) !important;
  border-color: #6a1c18 !important;
  box-shadow:
    0 10px 32px rgba(0,0,0,0.82),
    inset 0 1px 0 rgba(200,150,60,0.22),
    inset 0 0 0 1px #2a0c0c !important;
}
.bag-slot, .equip-slot, .doll-slot {
  background: linear-gradient(180deg, #1a0a08, #080202);
  border-color: #4a1810;
  box-shadow: inset 0 1px 0 rgba(180,130,50,0.12);
}
.action-btn, .pad-btn {
  border-color: #6a2018;
  background: linear-gradient(180deg, rgba(70,20,14,0.92), rgba(16,5,4,0.92));
  box-shadow: inset 0 1px 0 rgba(220,170,70,0.28), 0 2px 8px rgba(0,0,0,0.55);
}
.vstick-base {
  border-color: rgba(140,40,30,0.9);
  background: radial-gradient(circle at 50% 45%, rgba(50,14,12,0.7), rgba(6,2,2,0.82));
  box-shadow: inset 0 0 0 1px rgba(200,150,60,0.22), 0 4px 16px rgba(0,0,0,0.6);
}
.skill-slot.ready {
  border-color: #c9a24a;
  box-shadow: inset 0 0 8px rgba(200,150,60,0.18), 0 0 6px rgba(180,120,40,0.25);
}


/* ===== Quiet pass #2: native-app Mir chrome（减网页感） ===== */
.app {
  background: #020000;
}
.topbar {
  padding: 3px 8px;
  background:
    linear-gradient(180deg, #5a2018 0%, #2a0c0a 38%, #0c0303 100%);
  border-bottom: 2px solid #8a5028;
  box-shadow:
    inset 0 1px 0 rgba(240,200,100,0.35),
    inset 0 -2px 0 #1a0606,
    0 4px 14px rgba(0,0,0,0.7);
}
.brand-title {
  font-size: 0.92rem;
  letter-spacing: 0.18em;
  color: #f0d060;
  text-shadow: 0 0 10px rgba(240,180,40,0.45), 1px 1px 0 #401008, -1px 0 0 #200808;
}
.brand-sub { font-size: 0.58rem; color: #6a4830; letter-spacing: 0.04em; }
.homage-badge {
  opacity: 0.55;
  font-size: 0.55rem;
  border-color: #3a1810;
  background: rgba(0,0,0,0.55);
}

.hud {
  padding: 4px 8px 5px;
  background:
    linear-gradient(180deg, #4a1812 0%, #180606 36%, #060101 100%);
  border-top: 2px solid #8a5028;
  box-shadow:
    inset 0 1px 0 rgba(240,200,100,0.28),
    inset 0 0 0 1px #2a0c0c,
    0 -6px 20px rgba(0,0,0,0.65);
  position: relative;
}
.hud::before {
  content: "";
  position: absolute;
  left: 6px; right: 6px; top: 2px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,150,60,0.45), transparent);
  pointer-events: none;
}
.bar-track {
  height: 14px;
  border: 2px solid #6a2018;
  background:
    linear-gradient(180deg, #050101, #120606);
  box-shadow:
    inset 0 0 10px #000,
    inset 0 1px 0 rgba(200,150,60,0.15),
    0 0 0 1px #1a0808;
}
.bar-fill.hp {
  background: linear-gradient(180deg, #ff8070 0%, #d02818 40%, #701010 100%);
}
.bar-fill.mp {
  background: linear-gradient(180deg, #70b8ff 0%, #2060b0 40%, #103060 100%);
}
.bar-label {
  color: #f0d060;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}
.stats-row span {
  background: linear-gradient(180deg, rgba(40,12,10,0.9), rgba(8,2,2,0.9));
  border: 1px solid #5a2018;
  box-shadow: inset 0 1px 0 rgba(200,150,60,0.15);
  color: #e8d090;
  border-radius: 1px;
}
.chat-log {
  background: rgba(0,0,0,0.82);
  border: 1px solid #5a2018;
  box-shadow:
    inset 0 0 0 1px #1a0808,
    inset 0 1px 0 rgba(200,150,60,0.18);
}

.skill-bar {
  padding: 5px 6px;
  background:
    linear-gradient(180deg, rgba(70,22,14,0.97) 0%, rgba(18,6,4,0.97) 50%, rgba(4,1,1,0.97) 100%);
  border: 2px solid #8a5028;
  outline: 1px solid rgba(140,40,30,0.55);
  box-shadow:
    inset 0 0 0 1px #2a0c08,
    inset 0 1px 0 rgba(240,200,100,0.35),
    inset 0 -2px 0 rgba(0,0,0,0.7),
    0 8px 22px rgba(0,0,0,0.8);
}
.skill-slot {
  min-width: 56px;
  height: 48px;
  background:
    linear-gradient(180deg, #4a1c14 0%, #1a0806 48%, #0a0202 100%);
  border: 2px solid #6a2818;
  box-shadow:
    inset 0 1px 0 rgba(240,200,100,0.28),
    inset 0 -1px 0 #000,
    inset 0 0 0 1px #1a0808,
    0 2px 4px rgba(0,0,0,0.55);
}
.skill-slot.ready {
  border-color: #d0a040;
  box-shadow:
    inset 0 0 10px rgba(220,170,60,0.28),
    0 0 8px rgba(200,140,40,0.4),
    inset 0 1px 0 rgba(255,220,120,0.35);
}
.skill-slot .sk-name {
  text-shadow: 1px 1px 0 #200808;
}

.map-label {
  background: linear-gradient(180deg, rgba(70,22,14,0.95), rgba(8,2,2,0.95));
  border: 2px solid #8a5028;
  outline: 1px solid rgba(140,40,30,0.4);
  box-shadow:
    inset 0 1px 0 rgba(240,200,100,0.35),
    inset 0 0 0 1px #1a0808,
    0 4px 12px rgba(0,0,0,0.55);
  letter-spacing: 0.16em;
}

.bag-panel, .modal-panel, .char-panel, .class-select-inner {
  border: 2px solid #8a5028 !important;
  outline: 1px solid rgba(140,40,30,0.45);
  background:
    linear-gradient(165deg, #3a1410 0%, #140505 50%, #060101 100%) !important;
  box-shadow:
    0 12px 36px rgba(0,0,0,0.85),
    inset 0 1px 0 rgba(240,200,100,0.28),
    inset 0 0 0 1px #2a0c0c,
    inset 0 -1px 0 rgba(0,0,0,0.6) !important;
}
.bag-header {
  border-bottom: 1px solid #5a2018;
  padding-bottom: 6px;
  margin-bottom: 10px;
  letter-spacing: 0.12em;
}
.bag-slot, .equip-slot, .doll-slot {
  border: 1px solid #6a2818;
  background: linear-gradient(180deg, #22100c, #0a0404);
  box-shadow: inset 0 1px 0 rgba(200,150,60,0.12), inset 0 0 8px rgba(0,0,0,0.5);
}

.vstick-base {
  border: 3px solid rgba(160,60,40,0.9);
  background:
    radial-gradient(circle at 50% 42%, rgba(70,22,16,0.72), rgba(6,2,2,0.88));
  box-shadow:
    inset 0 0 0 2px rgba(200,150,60,0.28),
    inset 0 0 24px rgba(0,0,0,0.55),
    0 6px 18px rgba(0,0,0,0.7);
}
.vstick-knob {
  border: 2px solid #c07040;
  background:
    radial-gradient(circle at 32% 28%, #c05040, #401010 70%, #1a0606);
  box-shadow:
    0 3px 10px rgba(0,0,0,0.65),
    inset 0 1px 0 rgba(255,220,120,0.35);
}
.action-btn {
  border: 2px solid #8a4028;
  background: linear-gradient(180deg, rgba(90,28,18,0.95), rgba(20,6,4,0.95));
  box-shadow:
    inset 0 1px 0 rgba(240,200,100,0.3),
    inset 0 -1px 0 #000,
    0 3px 8px rgba(0,0,0,0.6);
}
.action-btn.atk {
  border-color: #c05030;
  background: radial-gradient(circle at 35% 30%, #d04030, #501010 70%, #1a0606);
  box-shadow:
    inset 0 1px 0 rgba(255,200,120,0.35),
    0 0 14px rgba(180,40,20,0.4),
    0 4px 10px rgba(0,0,0,0.65);
}

.btn, .shop-row {
  border: 1px solid #8a5028;
  background: linear-gradient(180deg, #5a2018, #2a0c0c);
  box-shadow: inset 0 1px 0 rgba(240,200,100,0.22);
}

/* 舞台内阴影：配合 canvas vignette，更不像浏览器空白页 */
.stage {
  background: #010000;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.85);
}


/* pass2-chrome-hide：进一步去网页感 */
.top-hint { display: none !important; }
.brand-sub { display: none !important; }
.homage-badge { display: none !important; }
.controls-hint { display: none !important; }
.topbar {
  padding: 2px 10px !important;
  min-height: 28px;
}
.brand-title {
  font-size: 0.82rem !important;
  letter-spacing: 0.22em !important;
}
.hud .bar-track {
  height: 15px !important;
  border-width: 2px !important;
  border-color: #8a4028 !important;
  position: relative;
}
.hud .bars {
  padding: 2px 4px;
  background: linear-gradient(180deg, rgba(40,12,10,0.55), rgba(0,0,0,0.15));
  border: 1px solid #5a2018;
  box-shadow: inset 0 1px 0 rgba(220,170,70,0.2);
}
.skill-bar {
  border-width: 2px !important;
  border-color: #a06830 !important;
}


/* ===== Quiet pass #3: fully opaque Mir-mobile game skin（零网页文档感） ===== */
html, body {
  background: #000 !important;
}
.app {
  background: #000 !important;
  grid-template-rows: 26px 1fr auto;
}
.topbar {
  display: flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 8px !important;
  min-height: 26px !important;
  height: 26px;
  background:
    linear-gradient(180deg, #6a2818 0%, #2a0c08 55%, #0a0202 100%) !important;
  border-bottom: 2px solid #c9a24a !important;
  box-shadow:
    inset 0 1px 0 rgba(255,220,120,0.4),
    inset 0 -2px 0 #1a0604,
    0 4px 12px rgba(0,0,0,0.85) !important;
}
.brand { width: 100%; align-items: center; }
.brand-title {
  width: 100%;
  text-align: center;
  font-size: 0.78rem !important;
  letter-spacing: 0.28em !important;
  color: #f5d060 !important;
  text-shadow: 0 0 12px rgba(240,180,40,0.55), 1px 1px 0 #401008 !important;
}
.brand-sub, .top-hint, .homage-badge, .controls-hint { display: none !important; }

/* 底栏：不透明客户端状态条 */
.hud {
  background:
    linear-gradient(180deg, #5a2014 0%, #1a0806 38%, #050101 100%) !important;
  border-top: 3px solid #c9a24a !important;
  box-shadow:
    inset 0 1px 0 rgba(255,220,120,0.35),
    inset 0 0 0 1px #2a0c0c,
    0 -8px 24px rgba(0,0,0,0.75) !important;
  opacity: 1 !important;
  padding: 6px 10px 7px !important;
}
.hud::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: 3px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,150,60,0.35), transparent);
  pointer-events: none;
}
.hud .bars {
  background:
    linear-gradient(180deg, rgba(50,16,12,0.95), rgba(10,3,2,0.92)) !important;
  border: 2px solid #8a4028 !important;
  box-shadow:
    inset 0 1px 0 rgba(240,200,100,0.28),
    inset 0 0 12px rgba(0,0,0,0.55) !important;
  padding: 4px 6px !important;
}
.bar-track {
  background: #020000 !important;
  border-color: #a05028 !important;
  opacity: 1 !important;
}
.stats-row span {
  background: linear-gradient(180deg, #3a1410, #100404) !important;
  border: 1px solid #8a5028 !important;
  color: #f0d060 !important;
  font-weight: 700;
}
.chat-log {
  background: #050101 !important;
  border: 2px solid #6a2818 !important;
  color: #a07848 !important;
  opacity: 1 !important;
}

/* 技能栏：完全不透明游戏皮 */
.skill-bar {
  background:
    linear-gradient(180deg, #5a2014 0%, #1a0806 48%, #060101 100%) !important;
  border: 3px solid #c9a24a !important;
  outline: 1px solid #6a1810 !important;
  box-shadow:
    inset 0 1px 0 rgba(255,220,120,0.4),
    inset 0 -2px 0 #000,
    0 8px 22px rgba(0,0,0,0.85) !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
}
.skill-slot {
  background:
    linear-gradient(180deg, #4a1c14 0%, #140606 55%, #080202 100%) !important;
  border: 2px solid #8a4028 !important;
  opacity: 1 !important;
}
.skill-slot.ready {
  border-color: #f0d060 !important;
  box-shadow:
    inset 0 0 12px rgba(240,200,80,0.35),
    0 0 10px rgba(200,140,40,0.45) !important;
}

/* 地图标签：金属铭牌 */
.map-label {
  background: linear-gradient(180deg, #5a2014, #0a0202) !important;
  border: 2px solid #c9a24a !important;
  opacity: 1 !important;
  box-shadow:
    inset 0 1px 0 rgba(255,220,120,0.4),
    0 4px 14px rgba(0,0,0,0.7) !important;
}

.stage {
  background: #000 !important;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.95) !important;
}

/* 摇杆/动作：不透明 */
.vstick-base {
  background:
    radial-gradient(circle at 50% 42%, rgba(80,24,16,0.95), rgba(6,2,2,0.98)) !important;
  opacity: 1 !important;
}
.action-btn {
  opacity: 1 !important;
  background: linear-gradient(180deg, #6a2818, #1a0806) !important;
}

/* 面板全不透明 */
.bag-panel, .modal-panel, .char-panel, .class-select-inner {
  background:
    linear-gradient(165deg, #3a1410 0%, #120505 55%, #050101 100%) !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
}
.class-select {
  background: rgba(0,0,0,0.92) !important;
}


/* ===== pass4: landscape-first Mir-mobile client chrome ===== */
html, body {
  width: 100%;
  height: 100%;
  background: #030101;
}
.homage-badge { display: none !important; }
.map-label { display: none !important; } /* canvas draws map chip */

.skill-bar {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: auto;
  transform: none;
  display: flex;
  gap: 4px;
  padding: 8px 8px;
  background: transparent !important; /* canvas draws gold strip behind */
  border: none !important;
  box-shadow: none !important;
  z-index: 6;
  max-width: min(320px, 42vw);
}
.skill-bar .skill-slot {
  width: 48px;
  height: 48px;
  min-width: 44px;
  border: 2px solid #c9a24a;
  background:
    linear-gradient(180deg, rgba(70,24,14,0.92) 0%, rgba(18,6,4,0.94) 100%);
  box-shadow: inset 0 0 0 1px rgba(160,40,28,0.55), 0 2px 6px rgba(0,0,0,0.55);
  color: #f0d060;
  border-radius: 3px;
  font-size: 0.65rem;
}
.skill-bar .skill-slot.ready {
  box-shadow: inset 0 0 0 1px rgba(240,200,80,0.7), 0 0 10px rgba(240,180,40,0.35);
}
.skill-bar .skill-hint { color: #a07840; font-size: 0.7rem; }

.touch-actions {
  right: 12px;
  bottom: 78px;
  z-index: 7;
}
.touch-actions .action-btn {
  width: 48px;
  height: 48px;
  border: 2px solid #c9a24a;
  background: linear-gradient(180deg, #5a2010 0%, #1a0806 100%);
  color: #f0d060;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(160,40,28,0.6), 0 3px 8px rgba(0,0,0,0.5);
}
.touch-actions .action-btn.atk {
  width: 56px;
  height: 56px;
  border-color: #e0b040;
  background: radial-gradient(circle at 40% 35%, #8a3020, #2a0806 70%);
}

.vstick-base {
  left: 18px;
  bottom: 18px;
  z-index: 7;
  opacity: 0.92;
  border: 2px solid rgba(200,150,60,0.55);
  background: rgba(10,4,4,0.45);
}
.vstick-knob {
  background: radial-gradient(circle at 35% 30%, #e0c060, #8a6020 70%);
  border: 2px solid #f0d080;
}

/* Force landscape preference strongly */
@media (orientation: portrait) and (max-width: 1100px) {
  .rotate-tip { display: flex !important; }
}
@media (orientation: landscape) {
  .rotate-tip { display: none !important; }
  .stage { height: 100dvh; }
}

/* Keep chat accessible but tiny overlay if needed */
#chat-log {
  position: absolute;
  left: 12px;
  bottom: 110px;
  width: min(280px, 40vw);
  max-height: 72px;
  overflow: hidden;
  opacity: 0.75;
  pointer-events: none;
  font-size: 0.65rem;
  z-index: 5;
  background: rgba(8,2,2,0.55);
  border: 1px solid rgba(160,100,40,0.4);
  padding: 4px 6px;
}


/* ===== PASS4 FINAL: kill webpage chrome, canvas-first ===== */
.app {
  grid-template-rows: 0 1fr 0 !important;
  background: #000 !important;
}
.topbar {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden !important;
}
.hud {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: none !important;
  overflow: hidden !important;
}
.stage {
  height: 100dvh !important;
  min-height: 100dvh !important;
}
.brand-title, .brand-sub, .top-hint, .homage-badge, .map-label, .controls-hint {
  display: none !important;
}

/* ===== PASS5: 传奇式快捷栏 1-6（底部居中，避开左摇杆/右攻击区） ===== */
.skill-bar.quickbar {
  position: absolute !important;
  left: 50% !important;
  right: auto !important;
  bottom: 6px !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  gap: 4px;
  padding: 5px 7px !important;
  max-width: none !important;
  background: linear-gradient(180deg, #4a1810 0%, #120404 100%) !important;
  border: 2px solid #c9a24a !important;
  border-radius: 4px;
  box-shadow: inset 0 1px 0 rgba(255,220,120,0.35), 0 4px 14px rgba(0,0,0,0.8) !important;
  z-index: 8;
}
.qslot {
  position: relative;
  width: 46px; height: 46px;
  padding: 0;
  border: 2px solid #8a5a28;
  border-radius: 3px;
  background: radial-gradient(circle at 50% 40%, #2a0e08, #080202 80%);
  color: #f0d060;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.qslot.press { transform: scale(0.92); border-color: #fff0a0; }
.qslot.empty { opacity: 0.55; }
.qslot.off { filter: grayscale(1) brightness(0.55); }
.qslot .q-icon {
  position: absolute; left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  font-size: 0.78rem; font-weight: 800; letter-spacing: -1px;
  text-shadow: 0 0 4px #000, 0 0 2px #000;
}
.qslot.pot-red .q-icon, .qslot.pot-blue .q-icon {
  width: 20px; height: 24px; border-radius: 45% 45% 50% 50%;
  border: 1px solid #e8d8a0;
  box-shadow: inset -3px -4px 6px rgba(0,0,0,0.5), inset 3px 3px 4px rgba(255,255,255,0.45);
}
.qslot.pot-red .q-icon { background: radial-gradient(circle at 35% 35%, #ff8080, #b01010 60%, #500000); }
.qslot.pot-blue .q-icon { background: radial-gradient(circle at 35% 35%, #90b0ff, #1030c0 60%, #001050); }
.qslot.pot-red .q-icon::before, .qslot.pot-blue .q-icon::before {
  content: ''; position: absolute; left: 6px; top: -6px; width: 6px; height: 6px;
  background: #a07040; border: 1px solid #e8d8a0; border-radius: 1px;
}
.qslot.sk-warrior .q-icon { color: #ffd070; }
.qslot.sk-mage .q-icon { color: #90c8ff; }
.qslot.sk-taoist .q-icon { color: #a0f0a0; }
.qslot .q-key { position: absolute; left: 2px; top: 0; font-size: 0.58rem; color: #fff; text-shadow: 0 0 2px #000; }
.qslot .q-cnt { position: absolute; right: 2px; bottom: 0; font-size: 0.6rem; color: #fff; font-weight: 700; text-shadow: 0 0 2px #000, 0 0 2px #000; }
.qslot .q-name { display: none; }
.qslot .q-cd {
  position: absolute; inset: 0; display: none;
  align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800; color: #fff;
  pointer-events: none;
}
.q-assign {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  z-index: 60; padding: 10px; min-width: 220px;
  background: linear-gradient(165deg, #3a1410, #050101); border: 2px solid #c9a24a;
  display: flex; flex-direction: column; gap: 6px; color: #f0d060;
}
.q-assign .qa-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.q-assign .qa-title { text-align: center; font-weight: 700; }
.auto-pot-row { display: flex; align-items: center; gap: 6px; color: #f0d060; font-size: 0.75rem; padding: 4px 8px; }
@media (max-height: 400px) {
  .qslot { width: 42px; height: 42px; }
}
.qslot .q-icon { white-space: nowrap; }
#chat-log { bottom: auto !important; top: 96px !important; max-height: 54px !important; width: min(260px, 34vw) !important; }

/* ===== 稳定全屏布局（iOS WebView 防边框闪烁/触点偏移） ===== */
html, body {
  position: fixed; inset: 0; margin: 0; padding: 0;
  width: 100vw; height: 100vh; height: 100dvh;
  overflow: hidden; overscroll-behavior: none; touch-action: none;
  -webkit-text-size-adjust: 100%;
}
.app {
  position: fixed !important; inset: 0 !important;
  width: 100vw !important; height: 100vh !important; height: 100dvh !important;
  max-height: none !important; margin: 0 !important; border: 0 !important;
  grid-template-rows: 0 1fr 0 !important;
}
.stage { width: 100%; height: 100%; border: 0 !important; margin: 0 !important; touch-action: none; }
#game-canvas {
  position: absolute; inset: 0; width: 100% !important; height: 100% !important;
  border: 0 !important; touch-action: none;
}

/* ===== Readdle/WebView 工具栏防遮挡：底部控件抬高 ~60px，顶部留 ~40px ===== */
html body .vstick-base { bottom: 62px !important; }
html body .touch-actions { bottom: 62px !important; }
html body .skill-bar.quickbar { bottom: 54px !important; }
html body .map-label { top: 42px !important; }
html body #chat-log { top: 132px !important; }
.qslot.scroll-tp .q-icon, .qslot.scroll-town .q-icon { width: 26px; height: 18px; display:flex; align-items:center; justify-content:center; border:1px solid #5a4018; box-shadow: 0 1px 2px #000; border-radius: 3px; background: linear-gradient(90deg,#8a6a30,#f0e0b0 20%,#e8d8a0 80%,#8a6a30); }
.qslot.scroll-tp .q-icon::after { content: '随'; color: #2040a0; font-weight: 700; font-size: 11px; }
.qslot.scroll-town .q-icon::after { content: '回'; color: #a02010; font-weight: 700; font-size: 11px; }
/* ===== 小地图 / 全图 ===== */
#minimap { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 4px); right: calc(env(safe-area-inset-right, 0px) + 4px); width: 132px; z-index: 40; background: #0b0806; border: 1px solid #6a4a20; box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #2a1a0a; padding: 2px; touch-action: none; }
#minimap-cv { display: block; width: 128px; height: 84px; }
#minimap .mm-info { display: flex; justify-content: space-between; font-size: 10px; line-height: 13px; color: #f0d890; padding: 1px 2px 0; text-shadow: 0 1px 0 #000; }
#minimap .mm-btn { position: absolute; left: -30px; top: 0; width: 28px; height: 28px; padding: 0; font-size: 10px; color: #f0d890; background: linear-gradient(#4a3010, #1a0e04); border: 1px solid #8a6a30; border-radius: 3px; }
#fullmap { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,0.55); display: flex; align-items: center; justify-content: center; }
#fullmap.hidden { display: none; }
#fullmap .fm-frame { background: #120c06; border: 2px solid #8a6a30; box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #3a2410; padding: 4px 6px 6px; width: min(88vw, 620px); }
#fullmap .fm-head { display: flex; justify-content: space-between; align-items: center; color: #f0d890; font-weight: 700; font-size: 13px; padding: 0 2px 4px; }
#fullmap-cv { display: block; width: 100%; height: min(70vh, 430px); }
#fullmap .fm-legend { font-size: 11px; color: #d8c8a0; padding-top: 4px; }
#fullmap .fm-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin: 0 3px 0 8px; }
#fullmap .fm-legend span { float: right; }
#pwa-hint { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 8px); z-index: 120; background: rgba(20,12,4,0.92); color: #f0d890; border: 1px solid #8a6a30; padding: 6px 30px 6px 12px; font-size: 13px; border-radius: 4px; white-space: nowrap; }
#pwa-hint button { position: absolute; right: 4px; top: 2px; background: none; border: 0; color: #f0d890; font-size: 18px; }
/* 安全区 */


/* ===== 物品图标 / 物品弹窗 ===== */
.item-ico{display:inline-block;width:34px;height:34px;flex:0 0 auto;background:url(../assets/item_icons.webp) 0 0/1100% 100% no-repeat;border-radius:4px;box-shadow:inset 0 0 0 1px rgba(200,160,80,.35),0 1px 3px rgba(0,0,0,.6);vertical-align:middle}
.item-ico.big{width:84px;height:84px;border-radius:6px;box-shadow:inset 0 0 0 2px rgba(220,180,90,.55),0 2px 8px rgba(0,0,0,.8)}
.bag-slot{position:relative}
.bag-slot .item-ico{width:72%;height:auto;aspect-ratio:1;display:block;margin:2px auto 0}
.bag-slot .item-ico + .slot-name{font-size:9px;line-height:1.05;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.shop-row{display:flex;align-items:center;gap:8px}
.shop-row>span:nth-child(2){flex:1;text-align:left}
.qslot .q-icon .item-ico{width:100%;height:100%;box-shadow:none}
.doll-slot .item-ico,.equip-slot .item-ico{width:26px;height:26px;margin-right:4px}
.item-dlg-back{position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.55);display:flex;align-items:center;justify-content:center}
.item-dlg{min-width:280px;max-width:86vw;padding:12px 16px;background:linear-gradient(#2a1a10,#140c07);border:2px solid #b08840;border-radius:8px;color:#f0deb0;box-shadow:0 8px 30px rgba(0,0,0,.8),inset 0 0 0 1px #5a3c18}
.item-dlg-title{text-align:center;color:#ffd77a;font-weight:bold;margin-bottom:8px;letter-spacing:2px}
.item-dlg-body{display:flex;gap:12px;align-items:flex-start}
.item-dlg-name{font-size:16px;color:#fff2c0;font-weight:bold;margin-bottom:4px}
.item-dlg-stats{font-size:13px;color:#9fe08a;line-height:1.45}
.item-dlg-desc{font-size:12px;color:#c8b48c;margin-top:4px}
.item-dlg-qty{display:flex;align-items:center;justify-content:center;gap:10px;margin:10px 0 2px}
.item-dlg-qty button{min-width:38px;height:32px;background:#3a2614;color:#ffd77a;border:1px solid #8a6630;border-radius:4px;font-size:16px}
.item-dlg-qty .q{min-width:30px;text-align:center;font-size:18px;color:#fff}
.item-dlg-price{text-align:center;margin-top:8px;color:#ffd77a}
.item-dlg-btns{display:flex;justify-content:center;gap:14px;margin-top:12px}
.item-dlg-btns .btn{min-width:80px;height:36px}
.qslot.pot-red .q-icon,.qslot.pot-blue .q-icon,.qslot.scroll-tp .q-icon,.qslot.scroll-town .q-icon{background:none!important;border:0!important;box-shadow:none!important;width:34px!important;height:34px!important;border-radius:0}
.qslot.pot-red .q-icon::before,.qslot.pot-blue .q-icon::before,.qslot.scroll-tp .q-icon::before,.qslot.scroll-town .q-icon::before,.qslot.pot-red .q-icon::after,.qslot.pot-blue .q-icon::after{display:none!important}

/* ===== 安全区（刘海/灵动岛）：画布全屏铺满，HUD 内缩 ===== */
:root { --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px); --sab: env(safe-area-inset-bottom, 0px); }
body { padding-left: 0 !important; padding-right: 0 !important; }
#safe-probe { position: fixed; left: 0; top: 0; width: 0; height: 0; padding-left: var(--sal); padding-right: var(--sar); visibility: hidden; pointer-events: none; }
.vstick-base { margin-left: var(--sal) !important; }
.touch-actions { margin-right: var(--sar) !important; }
.chat-log { margin-left: var(--sal) !important; }
#minimap { right: calc(var(--sar) + 4px) !important; }
/* ===== 经典传奇风摇杆（SVG 美术） ===== */
html body .vstick-base { background: url(../assets/ui/stick_base.svg) center/100% 100% no-repeat !important; border: none !important; box-shadow: 0 4px 14px rgba(0,0,0,.6) !important; border-radius: 50% !important; }
html body .vstick-base::before, html body .vstick-base::after { display: none !important; }
html body .vstick-knob { background: url(../assets/ui/stick_knob.svg) center/100% 100% no-repeat !important; border: none !important; box-shadow: none !important; }
html body .vstick-base.active .vstick-knob { filter: brightness(1.15) drop-shadow(0 0 6px rgba(255,200,80,.7)); }
html body .vstick-label { display: none !important; }

/* paper-doll portrait */
.char-doll{grid-template-columns:1fr 1.1fr 1fr;grid-template-areas:"helmet portrait necklace" "weapon portrait armor" "bracelet portrait ring";}
.doll-portrait{grid-area:portrait;width:100%;height:170px;min-height:150px;align-self:stretch;background:radial-gradient(ellipse at 50% 70%,rgba(120,80,40,.25),rgba(0,0,0,0) 70%);}
/* hotfix: 横屏矮屏时按钮避开小地图；技 放在 包 左侧 */
@media (max-height: 430px) { #touch-actions, .touch-actions { top: 112px !important; } #btn-skill { position: absolute; right: 54px; top: 54px; } }

/* v1.2 双戒指/双手镯 */
.doll-bracelet2{grid-area:bracelet2;} .doll-ring2{grid-area:ring2;}
.char-doll{grid-template-columns:1fr 1.1fr 1fr;grid-template-areas:"helmet portrait necklace" "weapon portrait armor" "bracelet portrait ring" "bracelet2 portrait ring2";}
/* iOS 页面锁定：禁止滚动/回弹/缩放，世界层与 UI 不再相对移动 */
html, body { overflow: hidden !important; overscroll-behavior: none !important; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; height: 100%; }
#app, #stage, #game-canvas { touch-action: none; overscroll-behavior: none; }

/* ===== UI 皮肤 v1（art-deliver/ui）：1x/2x 自动选择，9-slice ===== */
.bag-panel,.char-panel,.modal-panel,.shop-panel,.warehouse-panel,#dialogue-panel,.item-dlg{
  border:24px solid transparent!important;background:none!important;box-shadow:0 8px 30px rgba(0,0,0,.6)!important;
  border-image:url(../assets/ui/skin/1x/panel.webp) 24 fill / 24px stretch!important}
.btn,.pad-btn{border:16px solid transparent!important;background:none!important;border-image:url(../assets/ui/skin/1x/btn.webp) 16 fill / 16px stretch!important;padding:0 6px}
.btn:active,.pad-btn:active{border-image-source:url(../assets/ui/skin/1x/btn_pressed.webp)!important}
.bag-close{background:url(../assets/ui/skin/1x/btn_close.webp) center/100% 100% no-repeat!important;border:0!important;color:transparent!important;width:28px;height:28px}
.bag-slot,.equip-slot,.doll-slot{border:8px solid transparent!important;background:none!important;border-image:url(../assets/ui/skin/1x/slot.webp) 8 fill / 8px stretch!important}
#minimap{border:12px solid transparent!important;border-image:url(../assets/ui/skin/1x/frame.webp) 12 / 12px stretch!important;background:#0b0806}
.skill-slot{background:url(../assets/ui/skin/1x/skill_base.webp) center/100% 100% no-repeat!important;border-color:transparent!important}
.vstick-base{background:url(../assets/ui/skin/1x/joy_base.webp) center/100% 100% no-repeat!important;border:0!important;box-shadow:none!important}
.vstick-knob{background:url(../assets/ui/skin/1x/joy_knob.webp) center/100% 100% no-repeat!important;border:0!important;box-shadow:none!important}
.vstick-base .vstick-label{display:none}
/* 血蓝球 */
.cq-orb{position:fixed;bottom:calc(4px + env(safe-area-inset-bottom));width:76px;height:76px;z-index:6;pointer-events:none;background:url(../assets/ui/skin/1x/orb_frame.webp) 0 0/100% 100% no-repeat}
.cq-orb .liq,.cq-orb .glass{position:absolute;left:6.6%;top:6.6%;width:86.8%;height:86.8%;background:0 0/100% 100% no-repeat}
.cq-orb .liq{clip-path:inset(calc(100% - var(--p,1) * 100%) 0 0 0);transition:clip-path .25s}
.cq-orb.hp .liq{background-image:url(../assets/ui/skin/1x/orb_hp.webp)}
.cq-orb.mp .liq{background-image:url(../assets/ui/skin/1x/orb_mp.webp)}
.cq-orb .glass{background-image:url(../assets/ui/skin/1x/orb_glass.webp)}
.cq-orb .t{position:absolute;left:0;right:0;top:50%;transform:translateY(-50%);text-align:center;font:700 11px/1 sans-serif;color:#fff;text-shadow:0 1px 2px #000,0 0 3px #000}
@media (-webkit-min-device-pixel-ratio:1.5),(min-resolution:144dpi){
  .bag-panel,.char-panel,.modal-panel,.shop-panel,.warehouse-panel,#dialogue-panel,.item-dlg{border-image:url(../assets/ui/skin/2x/panel.webp) 48 fill / 24px stretch!important}
  .btn,.pad-btn{border-image:url(../assets/ui/skin/2x/btn.webp) 32 fill / 16px stretch!important}
  .btn:active,.pad-btn:active{border-image-source:url(../assets/ui/skin/2x/btn_pressed.webp)!important}
  .bag-close{background-image:url(../assets/ui/skin/2x/btn_close.webp)!important}
  .bag-slot,.equip-slot,.doll-slot{border-image:url(../assets/ui/skin/2x/slot.webp) 16 fill / 8px stretch!important}
  #minimap{border-image:url(../assets/ui/skin/2x/frame.webp) 24 / 12px stretch!important}
  .skill-slot{background-image:url(../assets/ui/skin/2x/skill_base.webp)!important}
  .vstick-base{background-image:url(../assets/ui/skin/2x/joy_base.webp)!important}
  .vstick-knob{background-image:url(../assets/ui/skin/2x/joy_knob.webp)!important}
  .cq-orb{background-image:url(../assets/ui/skin/2x/orb_frame.webp)}
  .cq-orb.hp .liq{background-image:url(../assets/ui/skin/2x/orb_hp.webp)}
  .cq-orb.mp .liq{background-image:url(../assets/ui/skin/2x/orb_mp.webp)}
  .cq-orb .glass{background-image:url(../assets/ui/skin/2x/orb_glass.webp)}
}
