:root {
    /* Paleta estilo Eidolon: noite fria + ouro antigo */
    --hp-color: #c45a4a;
    --accent: #c6a15b;
    --accent-soft: #e8d5a8;
    --panel: rgba(12, 14, 20, 0.90);
    --panel-border: rgba(185, 155, 98, 0.42);
    --ink: #d4deea;
    --muted: #8a96a8;
    --safe: #6ee7c8;
    --danger: #e0523f;
    --bg-deep: #07090e;
    --bg-mid: #12151f;
    --font-ui: "Source Sans 3", system-ui, sans-serif;
    --font-display: "Cinzel", Georgia, serif;
  }
  * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body {
    margin: 0; padding: 0; overflow: hidden; height: 100%;
    background-color: var(--bg-deep);
    background-image:
      radial-gradient(circle at 50% 34%, rgba(80, 64, 103, 0.28) 0, rgba(25, 29, 43, 0.14) 28%, transparent 58%),
      radial-gradient(circle at 18% 78%, rgba(35, 80, 73, 0.16) 0, transparent 38%),
      linear-gradient(154deg, #15131f 0%, #090d15 46%, #05070b 100%);
    background-attachment: fixed;
    font-family: var(--font-ui);
    color: var(--ink);
    touch-action: none;
  }
  #canvas-wrap { position: fixed; inset: 0; }
  canvas { display: block; width: 100%; height: 100%; }

  /* ---- Painéis unificados (look Eidolon) ---- */
  .eid-panel, #adventure-card, #minimap-panel, #mp-chat, #daily-hud, #dungeon-hud {
    background: linear-gradient(165deg, rgba(18,20,28,0.94), rgba(10,12,16,0.96)) !important;
    border: 1px solid rgba(185,155,98,0.38) !important;
    box-shadow: 0 10px 28px rgba(0,0,0,0.45) !important;
    color: var(--ink) !important;
  }
  #start-btn, .primary-cta {
    font-family: var(--font-display) !important;
    letter-spacing: 0.06em;
    background: linear-gradient(160deg, #e3c17e, #c6a15b) !important;
    color: #1a1208 !important;
    border: 1px solid #c6a15b !important;
    border-radius: 12px !important;
    box-shadow: 0 6px 20px rgba(198,161,91,0.25);
  }
  #enemy-banner, .banner-toast {
    font-family: var(--font-display);
    letter-spacing: 0.04em;
  }
  #target-plate {
    background: linear-gradient(165deg, rgba(16,14,20,0.92), rgba(10,10,14,0.95)) !important;
    border-color: rgba(185,155,98,0.4) !important;
  }
  #target-name { color: var(--accent-soft) !important; font-family: var(--font-display); }


  /* HUD */
  #hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
  #hp-bar-wrap {
    position: absolute; top: 14px; left: 14px; width: 220px; height: 14px;
    background: rgba(7,9,14,0.82); border: 1px solid rgba(185,155,98,0.5); border-radius: 4px; overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.55), 0 4px 14px rgba(0,0,0,0.35);
  }
  #hp-bar {
    height: 100%; width: 100%;
    background: linear-gradient(90deg, #6a1818, #d44a3a, #ff7a60);
    transition: width 0.15s ease;
  }
  #hp-label {
    position: absolute; top: 32px; left: 14px; color: var(--ink); font-size: 12px;
    letter-spacing: 0.03em; text-shadow: 0 1px 3px #000;
    font-family: var(--font-ui);
  }

  #status {
    position: absolute; top: 14px; right: 14px; color: var(--muted); font-size: 12px;
    text-align: right; line-height: 1.5; text-shadow: 0 1px 4px #000;
  }

  #score-wrap {
    position: absolute; top: 52px; right: 14px; color: #fff; font-size: 15px;
    text-align: right; font-weight: 700; letter-spacing: 0.03em;
  }
  #score-wrap .wave { color: #9aa4af; font-size: 11px; font-weight: 400; }
  #best-wrap {
        position: absolute; top: 92px; right: 14px; color: #e5b95c; font-size: 12px;
        text-align: right; font-weight: 600; letter-spacing: 0.02em; font-family: 'Courier New', monospace;
      }

      /* Barra de HP do BOSS (topo central) — visível só quando tem boss vivo */
      #boss-hp-wrap {
        position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
        width: 320px; max-width: 62vw; height: 15px;
        background: rgba(0,0,0,0.55); border: 1px solid rgba(255,90,60,0.6);
        border-radius: 6px; overflow: hidden; display: none;
        box-shadow: 0 0 14px rgba(255,60,50,0.35);
      }
      #boss-hp-wrap.show { display: block; }
      #boss-hp-label {
        position: absolute; top: 16px; left: 0; right: 0;
        color: #ff8a7a; font-size: 10px; font-weight: 700;
        letter-spacing: 0.1em; text-align: center; text-shadow: 0 1px 3px #000;
      }
      #boss-hp-bar {
        height: 100%; width: 100%;
        background: linear-gradient(90deg, #7a1a1a, #e0523f, #ff6f55);
        transition: width 0.15s ease;
      }

    /* Target do inimigo selecionado */
    #target-plate {
      position: absolute; top: max(40px, calc(env(safe-area-inset-top) + 36px)); left: 50%; transform: translateX(-50%);
      width: 260px; max-width: 72vw; display: none;
      background: rgba(8,10,14,0.82); border: 1px solid rgba(224,82,63,0.55);
      border-radius: 10px; padding: 8px 28px 9px 12px;
      pointer-events: auto; user-select: none; z-index: 28;
      box-shadow: 0 4px 16px rgba(0,0,0,0.5);
    }
    #target-plate.show { display: block; }
    #target-clear {
      position: absolute; top: 2px; right: 2px; width: 40px; height: 40px;
      border: 1px solid rgba(255,255,255,0.15); border-radius: 10px;
      background: rgba(0,0,0,0.35);
      color: #ffd9c9; font-size: 22px; line-height: 1; cursor: pointer;
      pointer-events: auto; z-index: 29;
      display: flex; align-items: center; justify-content: center;
    }
    #target-name {
      color: #ffd9c9; font-size: 13px; font-weight: 700; letter-spacing: 0.04em;
      margin-bottom: 5px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    #target-hp-wrap {
      height: 11px; background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.18);
      border-radius: 5px; overflow: hidden;
    }
    #target-hp-bar {
      height: 100%; width: 100%;
      background: linear-gradient(90deg, #7a1a1a, #e0523f, #ff6f55);
      transition: width 0.12s ease;
    }
    #target-plate .tgt-tag {
      position: absolute; top: -7px; left: 8px; font-size: 9px; font-weight: 800;
      color: #ffb347; background: rgba(8,10,14,0.9); border: 1px solid rgba(255,179,71,0.5);
      border-radius: 4px; padding: 1px 5px; letter-spacing: 0.06em;
    }
    #target-intent {
      text-align: center; font-size: 10px; font-weight: 700; margin-top: 4px;
      color: #9aa4af; letter-spacing: 0.03em;
    }
    #target-intent.in-range { color: #6ee7c8; }
    #target-intent.out-range { color: #ffb347; }
    /* Eidolon-style: Attack grande + feedback de alcance */
    #btn-mobile-attack.has-target {
      box-shadow: 0 0 0 3px rgba(255,120,80,0.55), 0 6px 18px rgba(200,40,20,0.45);
      transform: scale(1.05);
    }
    #btn-mobile-attack.in-range {
      box-shadow: 0 0 0 3px rgba(110,231,200,0.7), 0 8px 22px rgba(40,180,120,0.4) !important;
      border-color: #6ee7c8 !important;
      filter: brightness(1.12);
    }
    #btn-mobile-attack:active {
      transform: scale(0.94);
      filter: brightness(1.25);
    }
    #btn-mobile-attack {
      width: 88px !important; height: 88px !important;
      font-size: 15px !important;
      border-width: 2.5px !important;
    }

    /* Killstreak flair */
    #killstreak {
      position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%);
      color: #fff; font-size: 26px; font-weight: 800; letter-spacing: 0.06em;
      text-shadow: 0 2px 10px rgba(0,0,0,0.6); opacity: 0;
      transition: transform 0.09s ease, opacity 0.25s ease;
      pointer-events: none; user-select: none; white-space: nowrap;
    }

  /* Barra de XP + nível */
  #xp-wrap {
    position: absolute; top: 54px; left: 14px; width: 200px; height: 10px;
    background: rgba(0,0,0,0.45); border: 1px solid rgba(255,255,255,0.2); border-radius: 4px; overflow: hidden;
  }
  #xp-bar { height: 100%; width: 0%; background: #7ec8e3; transition: width 0.2s ease; }
  #xp-label { position: absolute; top: 66px; left: 14px; color: #9aa4af; font-size: 10px; }

  /* Ouro */
  #gold-wrap {
    position: absolute; top: 14px; left: 14px; margin-left: 210px; color: #ffd166;
    font-size: 14px; font-weight: 700;
  }

  /* Coordenadas — perto do minimapa */
  /* Info compacta: hora + coords numa linha, canto superior direito ABAIXO dos botões */
  #map-coords, #time-of-day {
    position: absolute; z-index: 22; pointer-events: none;
    background: rgba(0,0,0,0.5); padding: 3px 7px; border-radius: 5px;
    font: 10px/1.2 system-ui, sans-serif; border: 1px solid rgba(255,255,255,0.1);
  }
  #time-of-day {
    top: max(50px, calc(env(safe-area-inset-top) + 44px));
    right: max(8px, env(safe-area-inset-right));
    color: #f0e6d0; font-weight: 600;
  }
  #map-coords {
    top: max(72px, calc(env(safe-area-inset-top) + 66px));
    right: max(8px, env(safe-area-inset-right));
    color: #9ee6c8; font-family: ui-monospace, monospace;
  }
  #mp-badge {
    position: fixed !important;
    top: max(10px, env(safe-area-inset-top)) !important;
    left: 50% !important; right: auto !important; bottom: auto !important;
    transform: translateX(-50%) !important;
    z-index: 23 !important;
    font-size: 9px !important; padding: 3px 8px !important;
    max-width: 36vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    opacity: 0.85;
  }

  /* Chat: só a barra fina embaixo */
  #mp-chat {
    position: fixed; left: 8px; right: 8px; bottom: max(4px, env(safe-area-inset-bottom));
    z-index: 30; pointer-events: auto;
  }
  #mp-chat-toggle {
    width: 100%; text-align: left; padding: 10px 14px;
    background: rgba(12,16,22,0.92); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px; color: #c8d0da; font-size: 13px; font-weight: 600;
    cursor: pointer; pointer-events: auto;
  }
  #mp-chat-panel {
    display: none; flex-direction: column; gap: 6px;
    margin-bottom: 6px; max-height: 180px;
    background: rgba(10,14,20,0.94); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px; padding: 8px;
  }
  #mp-chat.open #mp-chat-panel { display: flex; }
  #mp-chat-log {
    overflow-y: auto; max-height: 120px; padding: 4px;
    font: 12px/1.35 system-ui, sans-serif; color: #e8eef5;
  }
  #mp-chat-log div { margin-bottom: 4px; word-break: break-word; }
  #mp-chat-log .n { color: #c6a15b; font-weight: 700; }
  #mp-chat-form { display: flex; gap: 6px; }
  #mp-chat-input {
    flex: 1; min-width: 0; padding: 10px 12px; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15); background: rgba(0,0,0,0.55);
    color: #fff; font-size: 15px;
  }
  #mp-chat-send {
    padding: 10px 14px; border: none; border-radius: 8px;
    background: #c6a15b; color: #1a1208; font-weight: 700;
  }
  #mp-chat-toggle.has-unread { border-color: #6ee7c8; color: #6ee7c8; }

  /* Banco da vila */
  #bank-panel {
    display: none; position: fixed; left: 50%; top: 50%;
    transform: translate(-50%, -50%); z-index: 55;
    width: min(340px, 94vw); max-height: 70vh; overflow-y: auto;
    background: rgba(12,14,18,0.96); border: 1px solid rgba(198,161,91,0.5);
    border-radius: 12px; padding: 12px; color: #ddd;
    font: 12px/1.35 system-ui, sans-serif;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  }
  #bank-panel.open { display: block; }
  .bank-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
  .bank-head h3 { margin: 0; font-size: 14px; color: #e8d5a8; }
  #bank-close {
    width: 28px; height: 28px; border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2); background: transparent; color: #ccc; cursor: pointer;
  }
  .bank-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .bank-col {
    background: rgba(0,0,0,0.28); border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; padding: 8px;
  }
  .bank-label { font-size: 11px; color: #c6a15b; font-weight: 700; margin-bottom: 6px; }
  .bank-items { min-height: 80px; max-height: 160px; overflow-y: auto; margin-bottom: 6px; }
  .bank-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 4px 2px; border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 11px; cursor: pointer;
  }
  .bank-item:active { background: rgba(198,161,91,0.15); }
  .bank-btn {
    width: 100%; padding: 8px; border-radius: 8px; border: 1px solid rgba(198,161,91,0.4);
    background: rgba(198,161,91,0.15); color: #e8d5a8; font-weight: 700; font-size: 11px; cursor: pointer;
  }
  .bank-hint { margin-top: 8px; font-size: 10px; color: #6a7380; }

  /* Overlay fim de jogo */
  #overlay {
    position: fixed; inset: 0; z-index: 20; display: none;
    align-items: center; justify-content: center; flex-direction: column;
    background: rgba(8, 10, 14, 0.78); backdrop-filter: blur(4px);
    color: #fff; text-align: center; gap: 10px; padding: 24px;
  }
  #overlay.show { display: flex; }
  #overlay h1 { font-size: 42px; margin: 0; letter-spacing: 0.05em; }
  #overlay h1.win { color: #6ee7c8; }
  #overlay h1.lose { color: #e0523f; }
  #overlay .sub { color: #9aa4af; font-size: 14px; }
  #restart-btn {
    margin-top: 14px; padding: 14px 32px; font-size: 16px; font-weight: 700;
    color: #0d1117; background: #6ee7c8; border: none; border-radius: 8px;
    cursor: pointer; letter-spacing: 0.03em; pointer-events: auto;
  }
  #restart-btn:active { transform: scale(0.96); }

  /* Tela inicial MMORPG — arte + UI por cima */
  #menu {
    position: fixed; inset: 0; z-index: 40; display: flex;
    align-items: center; justify-content: flex-end; flex-direction: column;
    background:
      radial-gradient(circle at 50% 30%, rgba(80,64,103,0.35) 0, transparent 55%),
      radial-gradient(circle at 20% 80%, rgba(35,80,73,0.22) 0, transparent 40%),
      linear-gradient(154deg, #15131f 0%, #090d15 50%, #05070b 100%);
    color: #d4deea; text-align: center; gap: 0; padding: 0;
    overflow: hidden;
  }
  #menu.hidden { display: none !important; visibility: hidden !important; pointer-events: none !important; }
  #title-canvas {
    position: absolute; inset: 0; width: 100%; height: 100%;
    z-index: 0; pointer-events: none; display: block;
    background: transparent;
  }
  /* ===== CENA 2D CSS (mobile — substitui o título 3D sem gastar WebGL) ===== */
  #title-scene-2d { position: absolute; inset: 0; z-index: 0; pointer-events: none; display: none; overflow: hidden; }
  #title-scene-2d.on { display: block; }
  #title-scene-2d .stars i {
    position: absolute; width: 2px; height: 2px; border-radius: 50%;
    background: #dfe8ff; opacity: .8; animation: twinkle 3s infinite ease-in-out;
  }
  #title-scene-2d .stars i:nth-child(1) { left: 8%; top: 12%; animation-delay: 0s; }
  #title-scene-2d .stars i:nth-child(2) { left: 20%; top: 6%; animation-delay: .7s; }
  #title-scene-2d .stars i:nth-child(3) { left: 33%; top: 15%; animation-delay: 1.4s; }
  #title-scene-2d .stars i:nth-child(4) { left: 47%; top: 8%; animation-delay: .3s; }
  #title-scene-2d .stars i:nth-child(5) { left: 61%; top: 14%; animation-delay: 1.9s; }
  #title-scene-2d .stars i:nth-child(6) { left: 74%; top: 5%; animation-delay: 1.1s; }
  #title-scene-2d .stars i:nth-child(7) { left: 86%; top: 16%; animation-delay: 2.4s; }
  #title-scene-2d .stars i:nth-child(8) { left: 15%; top: 24%; animation-delay: 2.8s; }
  #title-scene-2d .stars i:nth-child(9) { left: 55%; top: 22%; animation-delay: .9s; }
  #title-scene-2d .stars i:nth-child(10) { left: 92%; top: 26%; animation-delay: 1.6s; }
  #title-scene-2d .stars i:nth-child(11) { left: 4%; top: 32%; animation-delay: 2.1s; }
  #title-scene-2d .stars i:nth-child(12) { left: 68%; top: 28%; animation-delay: .5s; }
  @keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(1); } 50% { opacity: 1; transform: scale(1.6); } }
  #title-scene-2d .moon {
    position: absolute; right: 14%; top: 10%; width: 64px; height: 64px; border-radius: 50%;
    background: radial-gradient(circle at 38% 34%, #fff8e0 0%, #e8d9a0 45%, #b8a878 100%);
    box-shadow: 0 0 42px 10px rgba(255,240,200,0.22), 0 0 120px 40px rgba(120,140,200,0.12);
    animation: moonfloat 9s ease-in-out infinite;
  }
  @keyframes moonfloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
  #title-scene-2d .hills {
    position: absolute; left: 0; right: 0; bottom: 0; height: 34%;
  }
  #title-scene-2d .hills span {
    position: absolute; bottom: 0; border-radius: 50% 50% 0 0;
    background: linear-gradient(180deg, #1c2a1a 0%, #121c10 100%);
  }
  #title-scene-2d .hills span:nth-child(1) { left: -12%; width: 62%; height: 100%; opacity: .95; }
  #title-scene-2d .hills span:nth-child(2) { right: -8%; width: 55%; height: 88%; opacity: .9; }
  #title-scene-2d .hills span:nth-child(3) { left: 34%; width: 44%; height: 72%; opacity: .85; }
  #title-scene-2d .fire-pit {
    position: absolute; left: 50%; bottom: 20%; width: 54px; height: 14px; margin-left: -27px;
    background: linear-gradient(180deg, #4a3020 0%, #2a1a10 100%);
    border-radius: 50% / 40%; box-shadow: inset 0 3px 6px rgba(0,0,0,.6);
  }
  #title-scene-2d .fire-core {
    position: absolute; left: 50%; bottom: calc(20% + 8px); width: 26px; height: 34px; margin-left: -13px;
    background: radial-gradient(ellipse at 50% 85%, #ffd25a 0%, #ff9a2a 45%, #e05a10 75%, transparent 100%);
    border-radius: 50% 50% 45% 45%; filter: blur(1px);
    animation: fireflicker 1.15s ease-in-out infinite;
  }
  @keyframes fireflicker {
    0%, 100% { transform: scale(1) translateY(0); opacity: .95; }
    25% { transform: scale(1.08, 1.15) translateY(-2px); opacity: 1; }
    50% { transform: scale(.94, .92) translateY(1px); opacity: .85; }
    75% { transform: scale(1.04, 1.2) translateY(-3px); opacity: 1; }
  }
  #title-scene-2d .fire-glow {
    position: absolute; left: 50%; bottom: calc(20% - 26px); width: 190px; height: 120px; margin-left: -95px;
    background: radial-gradient(ellipse at center, rgba(255,150,50,.30) 0%, rgba(255,110,30,.12) 45%, transparent 72%);
    border-radius: 50%; animation: glowpulse 2.2s ease-in-out infinite;
  }
  @keyframes glowpulse { 0%, 100% { transform: scale(1); opacity: .8; } 50% { transform: scale(1.15); opacity: 1; } }
  #title-scene-2d .spark i {
    position: absolute; left: 50%; bottom: calc(20% + 14px); width: 3px; height: 3px; border-radius: 50%;
    background: #ffca6a; animation: sparkrise 1.8s linear infinite; opacity: 0;
  }
  #title-scene-2d .spark i:nth-child(1) { margin-left: -4px; animation-delay: 0s; }
  #title-scene-2d .spark i:nth-child(2) { margin-left: 3px; animation-delay: .35s; }
  #title-scene-2d .spark i:nth-child(3) { margin-left: -9px; animation-delay: .8s; }
  #title-scene-2d .spark i:nth-child(4) { margin-left: 7px; animation-delay: 1.15s; }
  #title-scene-2d .spark i:nth-child(5) { margin-left: -1px; animation-delay: 1.5s; }
  #title-scene-2d .spark i:nth-child(6) { margin-left: 11px; animation-delay: .55s; }
  @keyframes sparkrise {
    0% { transform: translateY(0) translateX(0); opacity: 1; }
    70% { opacity: .7; }
    100% { transform: translateY(-58px) translateX(var(--drift, 6px)); opacity: 0; }
  }
  #title-scene-2d .tent {
    position: absolute; left: 22%; bottom: 21%; width: 0; height: 0;
    border-left: 34px solid transparent; border-right: 34px solid transparent;
    border-bottom: 46px solid #3a2c1e; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5));
  }
  #title-scene-2d .tent::after {
    content: ''; position: absolute; left: -12px; top: 14px; width: 24px; height: 32px;
    background: #14100c; border-radius: 40% 40% 0 0;
  }
  #title-scene-2d .hero-2d {
    position: absolute; left: 50%; bottom: calc(20% + 10px); margin-left: 38px; width: 18px; height: 34px;
    background: linear-gradient(180deg, #6a8a5a 0%, #4a6a3a 55%, #2a2a2a 100%);
    border-radius: 9px 9px 4px 4px;
    box-shadow: inset 0 -6px 0 rgba(0,0,0,.25);
    animation: herobreathe 3.4s ease-in-out infinite;
  }
  #title-scene-2d .hero-2d::before { /* cabeça */
    content: ''; position: absolute; left: 4px; top: -12px; width: 10px; height: 10px;
    background: #d8a878; border-radius: 50%;
  }
  #title-scene-2d .hero-2d::after { /* espada nas costas */
    content: ''; position: absolute; right: -7px; top: 4px; width: 4px; height: 26px;
    background: linear-gradient(180deg, #cfd4dc 0%, #8a929e 100%); border-radius: 2px;
    transform: rotate(18deg);
  }
  @keyframes herobreathe { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5px); } }
  @media (min-width: 761px) { #title-scene-2d { display: none !important; } }
  #menu-ui {
    position: relative; z-index: 2;
    width: 100%; max-width: 440px;
    margin: 0 auto;
    padding: 64px 24px max(26px, env(safe-area-inset-bottom));
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    background: linear-gradient(to top, rgba(5,7,12,0.92) 0%, rgba(5,7,12,0.55) 45%, transparent 100%);
    animation: menuRise .9s cubic-bezier(.2,.8,.2,1) both;
  }
  @keyframes menuRise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
  .menu-vignette {
    position: absolute; inset: 0; z-index: 1; pointer-events: none;
    background: radial-gradient(ellipse at 50% 45%, transparent 38%, rgba(3,4,8,0.72) 100%);
  }
  .menu-bars i { position: absolute; left: 0; right: 0; height: 4.5vh; background: #05070b; z-index: 1; pointer-events: none; }
  .menu-bars i:first-child { top: 0; box-shadow: 0 6px 24px rgba(0,0,0,.7); }
  .menu-bars i:last-child { display: none; }
  .menu-logo { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 2px 0; }
  .menu-ornament { display: flex; align-items: center; gap: 10px; width: min(260px, 70vw); color: #c6a15b; font-size: 13px; opacity: .9; }
  .menu-ornament span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(198,161,91,.8)); }
  .menu-ornament span:last-child { background: linear-gradient(270deg, transparent, rgba(198,161,91,.8)); }
  .menu-tag { font-family: var(--font-display); font-size: 12px; letter-spacing: .62em; padding-left: .62em; color: rgba(240,217,160,.75); }
  #menu h1 {
    font-family: var(--font-display);
    font-size: clamp(40px, 11vw, 64px); margin: 0; line-height: 1;
    letter-spacing: 0.14em; padding-left: 0.14em;
    background: linear-gradient(180deg, #fff3c8 0%, #f0d080 42%, #b98a3a 100%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
    filter: drop-shadow(0 2px 14px rgba(255,150,40,0.45)) drop-shadow(0 0 2px rgba(0,0,0,.8));
    animation: logoGlow 4.2s ease-in-out infinite;
  }
  @keyframes logoGlow { 0%,100% { filter: drop-shadow(0 2px 12px rgba(255,150,40,0.35)) drop-shadow(0 0 2px rgba(0,0,0,.8)); } 50% { filter: drop-shadow(0 2px 22px rgba(255,170,60,0.65)) drop-shadow(0 0 2px rgba(0,0,0,.8)); } }
  #menu .sub {
    color: rgba(200,210,220,0.8); font-size: 12px; letter-spacing: .08em; max-width: 320px;
    text-shadow: 0 1px 8px rgba(0,0,0,0.8);
  }
  .menu-field { display: flex; flex-direction: column; gap: 5px; width: min(300px, 86vw); margin-top: 6px; text-align: left; }
  .menu-field span { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; color: rgba(198,161,91,.85); padding-left: 4px; }
  .menu-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; font-size: 11px; color: rgba(190,200,212,.8); margin-top: 6px; }
  .menu-keys kbd {
    font-family: inherit; font-size: 10px; font-weight: 700; color: #f0d9a0;
    border: 1px solid rgba(198,161,91,.45); border-bottom-width: 2px; border-radius: 5px;
    padding: 1px 6px; background: rgba(0,0,0,.45); margin-right: 3px;
  }
  #menu .hint { color: rgba(130,140,152,0.85); font-size: 10.5px; margin-top: 0; }
  #menu-name-input {
    width: 100%; padding: 13px 16px;
    border-radius: 12px; border: 1px solid rgba(198,161,91,0.5);
    background: rgba(0,0,0,0.55); color: #fff; font-size: 17px; text-align: center;
    backdrop-filter: blur(6px); outline: none; transition: border-color .2s, box-shadow .2s;
  }
  #menu-name-input::placeholder { color: rgba(200,210,220,.4); }
  #menu-name-input:focus { border-color: #f0d080; box-shadow: 0 0 0 3px rgba(240,208,128,.18), 0 0 22px rgba(240,170,60,.25); }
  #start-btn {
    margin-top: 6px; padding: 16px 0; width: min(300px, 86vw); font-size: 17px; font-weight: 700;
    animation: startPulse 2.6s ease-in-out infinite; transition: filter .2s, transform .15s;
    font-family: var(--font-display);
    color: #1a1208; background: linear-gradient(180deg, #f0d080, #c6a15b 45%, #a07830);
    border: none; border-radius: 14px; cursor: pointer; letter-spacing: 0.08em;
    box-shadow: 0 6px 28px rgba(198,161,91,0.45), 0 0 0 1px rgba(255,220,150,0.25) inset;
    pointer-events: auto; position: relative; z-index: 3;
    text-transform: uppercase;
  }
  @keyframes startPulse { 0%,100% { box-shadow: 0 6px 24px rgba(198,161,91,0.35), 0 0 0 1px rgba(255,220,150,0.25) inset; } 50% { box-shadow: 0 6px 38px rgba(240,170,60,0.7), 0 0 0 1px rgba(255,220,150,0.4) inset; } }
  #start-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
  #start-btn:active { transform: scale(0.96); }
  #start-btn:disabled { opacity: 0.7; cursor: wait; filter: saturate(0.85); }
  .menu-badge {
    font-size: 10px; letter-spacing: 0.2em; font-weight: 700;
    color: #c6a15b; border: 1px solid rgba(198,161,91,0.45);
    padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,0.35);
    text-shadow: 0 1px 6px rgba(0,0,0,0.6);
  }
  #boot-loader {
    width: min(300px, 86vw); margin-top: 4px;
    opacity: 0.95; transition: opacity 0.25s ease;
  }
  #boot-loader:not(.on) .boot-status { opacity: 0.75; }
  .boot-track {
    height: 8px; border-radius: 999px;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(198,161,91,0.35);
    overflow: hidden; box-shadow: 0 0 12px rgba(198,161,91,0.12) inset;
  }
  .boot-bar {
    height: 100%; width: 0%;
    background: linear-gradient(90deg, #a07830, #f0d080, #c6a15b);
    box-shadow: 0 0 12px rgba(240,208,128,0.55);
    transition: width 0.28s ease;
  }
  .boot-status {
    margin-top: 6px; font-size: 11px; color: rgba(200,210,220,0.9);
    text-align: center; min-height: 1.2em;
    text-shadow: 0 1px 6px rgba(0,0,0,0.8);
  }

  #menu-mute-btn {
    position: absolute; z-index: 5;
    top: max(14px, env(safe-area-inset-top)); right: 14px;
    width: 40px; height: 40px; border-radius: 50%;
    border: 1px solid rgba(198,161,91,0.4);
    background: rgba(5,7,12,0.55); color: #f0d9a0; font-size: 17px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; pointer-events: auto; backdrop-filter: blur(4px);
  }
  #menu-mute-btn:active { transform: scale(0.92); }
  /* dica enquanto o som ainda não foi liberado pelo navegador */
  #menu-mute-btn.waiting { animation: muteHintPulse 1.8s ease-in-out infinite; }
  #menu-mute-btn.waiting::after {
    content: 'toque para ligar o som';
    position: absolute; right: 48px; top: 50%; transform: translateY(-50%);
    white-space: nowrap; font-size: 12px; font-family: inherit; color: #f0d9a0;
    background: rgba(5,7,12,0.65); border: 1px solid rgba(198,161,91,0.3);
    border-radius: 99px; padding: 5px 10px; pointer-events: none;
  }
  @keyframes muteHintPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(240,217,160,0.0); }
    50% { box-shadow: 0 0 0 6px rgba(240,217,160,0.22); }
  }

  /* Botões legados do rodapé — escondidos (loja no mapa, inv pelo Bag) */
  #toggle-inv, #toggle-shop, #toggle-equip, #toggle-build, #toggle-quests, #toggle-map {
    display: none !important;
  }

  /* Bolsa mínima — só grid de ícones (mobile RPG) */
  #inventory-panel {
    position: fixed;
    right: max(6px, env(safe-area-inset-right));
    bottom: max(96px, calc(env(safe-area-inset-bottom) + 88px));
    left: auto; top: auto;
    transform: none;
    z-index: 32;
    width: 168px;
    max-height: 200px;
    background: rgba(10, 12, 16, 0.93);
    border: 1px solid rgba(198,161,91,0.4);
    border-radius: 10px;
    padding: 4px;
    color: #ddd; font-size: 10px;
    pointer-events: auto;
    backdrop-filter: blur(5px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.5);
    overflow-y: auto;
    display: none;
    overscroll-behavior: contain;
  }
  #inventory-panel.open { display: block; }
  @media (max-width: 720px) {
    #inventory-panel {
      width: 152px;
      max-height: 176px;
      bottom: max(88px, calc(env(safe-area-inset-bottom) + 80px));
    }
    /* No mobile: só cabeçalho + grid. Zero chrome. */
    #inventory-panel .inv-tabs,
    #inventory-panel #inv-equip-row,
    #inventory-panel .inv-quick-row,
    #inventory-panel #inv-drop-trash,
    #inventory-panel #sell-hint,
    #inventory-panel .panel-section-title.craft-toggle,
    #inventory-panel #craft-list { display: none !important; }
  }
  @media (min-width: 721px) {
    #inventory-panel {
      width: 220px;
      max-height: 260px;
    }
  }
  /* HUD da dungeon (estilo Tibia/Ultima) */
  #dungeon-hud {
    display: none;
    position: fixed;
    top: max(48px, calc(env(safe-area-inset-top) + 42px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 27;
    min-width: 180px;
    max-width: 90vw;
    padding: 6px 12px;
    background: rgba(20, 12, 28, 0.88);
    border: 1px solid rgba(176, 110, 255, 0.45);
    border-radius: 10px;
    color: #e8d5ff;
    font: 11px/1.35 system-ui, sans-serif;
    text-align: center;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  }
  #dungeon-hud.show { display: block; }
  #dungeon-hud b { color: #c9a0ff; }
  #inventory-panel .panel-head {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px;
    cursor: grab; user-select: none; min-height: 22px;
  }
  #inventory-panel .panel-head:active { cursor: grabbing; }
  #inventory-panel h3 { margin: 0; font-size: 11px; color: #e8d5a8; letter-spacing: 0.04em; font-weight: 700; }
  #inv-gold { color: #ffd166; font-weight: 700; font-size: 10px; }
  #inv-close {
    background: transparent; border: 1px solid rgba(255,255,255,0.15); color: #aaa;
    border-radius: 6px; width: 24px; height: 24px; cursor: pointer; font-size: 14px;
    padding: 0; line-height: 1;
  }
  #inv-grid {
    display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 4px;
  }
  #inv-player-target {
    min-height: 36px !important;
    border: 1px dashed rgba(198,161,91,0.4) !important;
    background: rgba(198,161,91,0.07) !important;
    padding: 2px !important;
  }
  #inv-player-target.drop-active {
    background: rgba(110,231,200,0.16) !important;
    border-color: #6ee7c8 !important;
  }
  #inventory-panel .panel-section-title.craft-toggle {
    cursor: pointer; color: #7a8490; font-size: 10px; margin-top: 4px;
    display: flex; align-items: center; gap: 4px; padding: 2px 0;
  }
  #inventory-panel.craft-open #craft-list { display: flex !important; }
  #craft-list { display: none !important; }
  #sell-hint { display: none !important; }
  #world-equip-hint {
    display: none; position: fixed; z-index: 31; pointer-events: none;
    width: 56px; height: 56px; margin-left: -28px; margin-top: -28px;
    border: 2px solid rgba(110,231,200,0.85); border-radius: 50%;
    box-shadow: 0 0 14px rgba(110,231,200,0.4);
    background: radial-gradient(circle, rgba(110,231,200,0.12), transparent 70%);
  }
  #world-equip-hint.show { display: block; }
  .inv-slot {
    background: rgba(0,0,0,0.35); border: 1px solid rgba(198,161,91,0.25);
    border-radius: 10px; padding: 10px 8px; text-align: center; min-height: 72px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  }
  .inv-slot .ico { font-size: 22px; line-height: 1; }
  .inv-slot .name { font-size: 11px; color: #aab; }
  .inv-slot .qty { font-size: 14px; font-weight: 700; color: #fff; }
  .inv-slot.empty { opacity: 0.45; }
  #craft-list { display: flex; flex-direction: column; gap: 6px; }
  .craft-btn {
    padding: 10px 12px; font-size: 12px;
    background: linear-gradient(160deg, rgba(40,48,40,0.9), rgba(20,24,20,0.95));
    color: #cfe; border: 1px solid rgba(198,161,91,0.3); border-radius: 8px; cursor: pointer;
    text-align: left; font-weight: 600;
  }
  .craft-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .craft-btn:active { border-color: #c6a15b; }
  #sell-hint { color: #9aa4af; font-size: 11px; margin-top: 10px; border-top: 1px solid rgba(255,255,255,0.1); padding-top: 10px; line-height: 1.4; }
  .panel-section-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #c6a15b;
    margin: 4px 0 8px;
  }

  /* Painel de criaturas */
  #creatures-panel {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    z-index: 36; width: min(360px, 94vw); max-height: 78vh; overflow-y: auto;
    background: rgba(14,18,26,0.97); border: 1px solid rgba(198,161,91,0.4);
    border-radius: 14px; padding: 14px 16px; color: #e8eef5; display: none;
    box-shadow: 0 16px 48px rgba(0,0,0,0.55); pointer-events: auto;
  }
  #creatures-panel h3 { margin: 0 0 6px; color: #e8d5a8; font-size: 16px; }
  #creatures-tamer { font-size: 12px; color: #9aa4af; margin-bottom: 10px; }
  .creature-row {
    border: 1px solid rgba(255,255,255,0.1); border-radius: 10px;
    padding: 8px 10px; margin-bottom: 8px; background: rgba(0,0,0,0.25);
  }
  .cr-main { font-size: 13px; margin-bottom: 6px; }
  .cr-meta { display: block; font-size: 11px; color: #9aa4af; margin-top: 2px; }
  .cr-actions { display: flex; flex-wrap: wrap; gap: 4px; }
  .cr-actions button, .breed-pick, #breed-collect, #breed-start, #creatures-close {
    border: 1px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.08);
    color: #e8eef5; border-radius: 8px; padding: 6px 10px; font-size: 11px; cursor: pointer;
  }
  #breed-collect { background: #c6a15b; color: #1a1208; font-weight: 700; }
  .breed-pick.selected { border-color: #c6a15b; background: rgba(198,161,91,0.25); }
  #breed-status { font-size: 12px; color: #cfe; margin: 8px 0; min-height: 24px; }

  .cr-tabs { display:flex; gap:5px; margin:8px 0 10px; flex-wrap:wrap; padding:4px; background:rgba(0,0,0,0.32); border:1px solid rgba(255,255,255,0.08); border-radius:12px; }
  .cr-tab {
    flex:1; min-width:64px; padding:9px 6px; font-size:11px; font-weight:700;
    border-radius:9px; border:1px solid transparent;
    background:transparent; color:#8a93a0; cursor:pointer; text-align:center;
    transition: background 0.18s ease, color 0.18s ease, transform 0.1s ease, border-color 0.18s ease;
    user-select:none;
  }
  .cr-tab:active { transform: scale(0.96); }
  .cr-tab.active { background:linear-gradient(160deg,#e3c17e,#c6a15b); border-color:rgba(198,161,91,0.55); color:#1a1208; box-shadow:0 3px 10px rgba(198,161,91,0.35); }
  .followers-slots { display:flex; gap:8px; margin-bottom:10px; }
  .follower-slot {
    flex:1; min-height:72px; border:1px dashed rgba(255,255,255,0.2); border-radius:10px;
    padding:8px; text-align:center; font-size:11px; background:rgba(0,0,0,0.2);
  }
  .follower-slot.filled { border-style:solid; border-color:rgba(124,242,150,0.45); background:rgba(30,50,35,0.4); }
  .follower-slot .fs-name { font-weight:700; color:#e8d5a8; display:block; margin-bottom:4px; }
  .follower-slot button { margin-top:4px; font-size:10px; padding:4px 8px; border-radius:6px;
    border:1px solid rgba(255,255,255,0.15); background:rgba(255,255,255,0.08); color:#eee; cursor:pointer; }


  #build-panel {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    z-index: 28; width: min(300px, 90vw);
    background: rgba(12,16,20,0.96); border: 1px solid rgba(176,110,255,0.35);
    border-radius: 12px; padding: 14px; color: #ddd; font-size: 12px; display: none;
  }
  #build-panel h3 { margin: 0 0 8px; font-size: 13px; color: #b06eff; }
  .build-btn {
    background: #2a342a; color: #b06eff; border: 1px solid rgba(176,110,255,0.4);
    border-radius: 6px; padding: 4px 12px; cursor: pointer; font-size: 14px; font-weight: 700; width: 32px;
  }
  .build-btn:disabled { opacity: 0.3; cursor: not-allowed; }
  #title-label { color: #b06eff; font-size: 11px; margin-top: 6px; font-weight: 700; }

  /* Inventário estilo Eidolon phone: sheet inferior no mobile, modal no desktop */
  #inv-panel {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    z-index: 28; width: min(340px, 92vw); max-height: 70vh;
    background: linear-gradient(165deg, rgba(22,18,14,0.98), rgba(10,10,12,0.98));
    border: 1px solid rgba(198,161,91,0.5);
    border-radius: 14px; padding: 14px; color: var(--ink, #f0e6d0); font-size: 13px;
    pointer-events: auto; overflow-y: auto; display: none;
    box-shadow: 0 16px 48px rgba(0,0,0,0.55);
  }
  #inv-panel h3 {
    margin: 0 0 10px; font-size: 15px; color: var(--accent, #c6a15b);
    font-family: var(--font-display, Cinzel, Georgia, serif); letter-spacing: 0.04em;
  }
  #equip-slots, #equip-list { display: flex; flex-direction: column; gap: 8px; }
  .equip-slot.on { background: rgba(198,161,91,0.1); border-radius: 8px; padding: 8px 10px; }
  .equip-slot.off { opacity: 0.55; padding: 6px 8px; }
  .equip-btn {
    background: linear-gradient(160deg, #2a4038, #1a2820); color: #6ee7c8;
    border: 1px solid rgba(110,231,200,0.45);
    border-radius: 10px; padding: 10px 14px; cursor: pointer; font-size: 13px; font-weight: 700;
    min-height: 44px; min-width: 44px; touch-action: manipulation;
  }
  .equip-btn.unequip { background: linear-gradient(160deg, #403028, #281818); color: #f0a0a0; border-color: rgba(224,82,63,0.45); }
  .equip-btn:disabled { opacity: 0.65; pointer-events: none; }
  .inv-row {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  @media (max-width: 720px), (pointer: coarse) {
    #inv-panel {
      left: 0; right: 0; top: auto; bottom: 0;
      transform: none;
      width: 100%; max-width: none;
      max-height: min(58vh, 420px);
      border-radius: 16px 16px 0 0;
      border-bottom: none;
      padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
      padding-top: 18px;
    }
    #inv-panel::before {
      content: '';
      position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
      width: 42px; height: 4px; border-radius: 2px;
      background: rgba(255,255,255,0.22);
    }
  }

  /* Loja — modal (abre no mercador físico) */
  #shop-panel, #quest-panel {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    z-index: 28; width: min(340px, 92vw); max-height: 80vh;
    background: linear-gradient(165deg, rgba(18,22,30,0.97), rgba(10,12,18,0.98));
    border: 1px solid rgba(255,209,102,0.4);
    border-radius: 14px; padding: 16px; color: #ddd; font-size: 13px;
    backdrop-filter: blur(8px); overflow-y: auto; display: none;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  }
  #shop-panel h3, #quest-panel h3 { margin: 0 0 10px; font-size: 15px; color: #ffd166; letter-spacing: 0.04em; }
  .shop-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .shop-row span { font-size: 12px; }
  .shop-btn {
    background: linear-gradient(160deg, rgba(60,50,20,0.9), rgba(30,24,10,0.95));
    color: #ffd166; border: 1px solid rgba(255,209,102,0.45);
    border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 12px; font-weight: 700;
  }
  .shop-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  #shop-close, #quest-close {
    float: right; background: transparent; border: 1px solid rgba(255,255,255,0.2);
    color: #ccc; border-radius: 8px; width: 32px; height: 32px; cursor: pointer;
  }
  #quest-list { display: flex; flex-direction: column; gap: 6px; }
  .quest-item { padding: 8px; border-radius: 8px; background: rgba(255,255,255,0.05); }
  .quest-item.done { color: #6ee7c8; text-decoration: line-through; }

  /* Modal de diálogo de NPC */
  #quest-dialog {
    position: fixed; inset: 0; z-index: 30; display: none;
    align-items: center; justify-content: center;
    background: rgba(6, 8, 12, 0.72); backdrop-filter: blur(3px);
  }
  #quest-dialog.show { display: flex; }
  .qd-box {
    width: min(440px, 92vw); max-height: 88vh; background: #141a22;
    border: 1px solid rgba(255,255,255,0.16); border-radius: 14px;
    padding: 18px 20px; color: #eaeef3; box-shadow: 0 18px 50px rgba(0,0,0,0.6);
    pointer-events: auto; text-align: left; overflow-y: auto;
  }
  .qd-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
  .qd-avatar {
    width: 46px; height: 46px; border-radius: 50%; flex: 0 0 auto;
    border: 2px solid rgba(255,255,255,0.25); box-shadow: inset 0 0 0 4px rgba(0,0,0,0.25);
  }
  .qd-name { font-size: 18px; font-weight: 800; letter-spacing: 0.04em; }
  .qd-quest-tag { font-size: 12px; color: #ffd166; letter-spacing: 0.02em; margin-top: 2px; }
  .qd-text {
    font-size: 15px; line-height: 1.55; min-height: 96px; max-height: 40vh; overflow-y: auto;
    color: #d7dde4; background: rgba(0,0,0,0.25); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px;
  }
  .qd-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
  .qd-btn {
    padding: 14px 20px; font-size: 15px; font-weight: 700; border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.2); color: #0d1117; cursor: pointer;
    min-height: 48px; touch-action: manipulation;
  }
  .qd-btn.primary { background: #6ee7c8; }
  .qd-btn.gold { background: #ffd166; }
  .qd-btn.callout { background: #b06eff; color: #fff; }
  .qd-btn.ghost { background: transparent; color: #9aa4af; border-color: rgba(255,255,255,0.15); }
  .qd-btn:active { transform: scale(0.96); }
  .qd-btn[hidden] { display: none; }

  /* Hint "aperte E" perto de NPC com quest */
  #npc-hint {
    position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 14;
    background: rgba(10,14,20,0.85); border: 1px solid #6ee7c8; color: #6ee7c8;
    padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 700;
    letter-spacing: 0.02em; pointer-events: none; white-space: nowrap;
    box-shadow: 0 0 18px rgba(110,231,200,0.25);
  }

  /* Botão contextual de interação (Domar/Baú/NPC) — canto direito, ACIMA do botão Use (mobile-first) */
  #interact-btn {
    position: fixed; right: 10px; bottom: 158px; z-index: 30;
    display: none; align-items: center; justify-content: center; gap: 6px;
    min-width: 64px; max-width: 150px; height: 56px; padding: 0 14px;
    font-size: 13px; font-weight: 800; letter-spacing: 0.02em; text-align: center;
    color: #0d1117; background: linear-gradient(160deg, #e3c17e, #c6a15b);
    border: 1.5px solid rgba(255,230,170,0.5); border-radius: 14px;
    box-shadow: 0 4px 16px rgba(198,161,91,0.4);
    cursor: pointer; touch-action: manipulation; white-space: nowrap; overflow: hidden;
    pointer-events: auto;
  }
  #interact-btn:active { transform: scale(0.95); }
  .skill-button {
    position: fixed; right: 14px; bottom: 88px; z-index: 13; padding: 14px 18px;
    background: #9b6bff; border: 2px solid #b06eff; border-radius: 50%; color: #fff;
    font-weight: 700; font-size: 14px; cursor: pointer; width: 72px; height: 72px;
    display: flex; align-items: center; justify-content: center; text-align: center;
    line-height: 1.1; box-shadow: 0 0 14px rgba(155,107,255,0.5);
  }
  .skill-button:disabled { opacity: 0.5; }

  #toggle-map {
    position: fixed; top: 14px; left: 14px; z-index: 13; padding: 8px 12px;
    background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.25);
    border-radius: 8px; color: #fff; font-weight: 700; cursor: pointer; font-size: 12px;
  }
  #minimap-panel {
    position: fixed; top: 54px; left: 14px; z-index: 12;
    background: rgba(12,16,20,0.92); border: 1px solid rgba(255,255,255,0.2);
    border-radius: 10px; padding: 8px;
  }
  #minimap-canvas { border-radius: 6px; display: block; }
  #minimap-label { color: #9aa4af; font-size: 11px; text-align: center; margin-top: 4px; }

  /* Flash de dano (vermelho na tela) */
  #damage-flash {
    position: fixed; inset: 0; z-index: 15; pointer-events: none;
    background: radial-gradient(circle, rgba(224,82,63,0) 0%, rgba(224,82,63,0.45) 100%);
    opacity: 0; transition: opacity 0.15s ease-out;
  }

  /* ===== HUD mobile limpa (sem sobreposição) ===== */
  #skill-btn { pointer-events:auto; }
  @media (pointer: coarse), (max-width: 899px) { #skill-btn { display:none !important; pointer-events:none !important; } }

  #mobile-ui {
    display: none; position: absolute; inset: 0; pointer-events: none; z-index: 20; touch-action: none;
  }
  .mobile-btn {
    pointer-events: auto;
    border: none; border-radius: 50%;
    display: flex; justify-content: center; align-items: center; font-weight: 700;
    user-select: none; touch-action: manipulation; font-size: 12px;
    box-shadow: 0 3px 12px rgba(0,0,0,0.45);
  }
  .mobile-btn:active { transform: scale(0.94); opacity: 0.9; }

  /* Camadas fixas:
     TOPO: barras | Menu+Pets
     BAIXO: chat → XP → joystick/ações
  */
  #joystick-zone {
    position: absolute;
    bottom: max(56px, calc(env(safe-area-inset-bottom) + 48px));
    left: max(14px, env(safe-area-inset-left));
    width: 118px; height: 118px;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.16);
    border-radius: 50%; pointer-events: auto; z-index: 22;
  }
  #joystick-knob, #joystick-stick {
    position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
    background: rgba(255,255,255,0.4);
    border-radius: 50%; pointer-events: none;
  }

  #mobile-actions {
    position: absolute;
    bottom: max(52px, calc(env(safe-area-inset-bottom) + 44px));
    right: max(12px, env(safe-area-inset-right));
    width: 120px; height: 150px; pointer-events: none; z-index: 26;
  }
  /* Skill removido da HUD — já está no hotbar slot 1 */
  #btn-mobile-ability { display: none !important; }
  #btn-mobile-attack {
    position: absolute; bottom: 0; right: 0; width: 88px; height: 88px;
    background: radial-gradient(circle at 35% 30%, #c45a52, #5a1c18);
    color: #f5e0d8; font-size: 15px; font-weight: 800;
    font-family: var(--font-display);
    pointer-events: auto;
    border: 2.5px solid #c58b70;
    border-radius: 50%;
    letter-spacing: 0.04em;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  }
  #target-plate, #daily-hud, #dungeon-hud, #mp-quest-hud {
    font-family: var(--font-ui);
  }
  #target-name, #dungeon-hud b, .daily-title {
    font-family: var(--font-display);
  }
  #btn-mobile-interact {
    position: absolute; bottom: 96px; right: 10px; width: 58px; height: 58px;
    background: radial-gradient(circle at 35% 30%, #3aaa62, #143828);
    color: #e8ffe8; font-size: 12px; font-weight: 800;
    pointer-events: auto;
    box-shadow: 0 4px 16px rgba(40,160,80,0.35);
    z-index: 27;
    border-radius: 50%;
  }
  #mobile-actions {
    width: 140px !important;
    height: 170px !important;
  }

  #mobile-top-right {
    position: absolute; top: max(10px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
    display: flex; gap: 6px; pointer-events: auto; z-index: 24;
  }
  .eid-top-btn {
    pointer-events: auto;
    min-width: 58px; height: 36px; padding: 0 10px;
    border-radius: 9px; border: 1px solid rgba(255,255,255,0.14);
    background: rgba(16,20,28,0.92); color: #e8eef5;
    font-size: 12px; font-weight: 700; cursor: pointer;
  }
  #btn-party { display: none !important; } /* Pets só pelo Menu hub */
  /* Effects vira item do Menu — escondido na HUD principal */
  #btn-effects { display: none !important; }
  /* Evita botões flutuantes sobrepostos na HUD */
  #btn-stats-toggle, #tame-action-btn { display: none !important; }
  @media (pointer: coarse), (max-width: 900px) {
    #status, #score-wrap, #best-wrap, #hunt-objective, #desktop-hint,
    #killstreak, #enemy-banner { display: none !important; }
    #mobile-top-right { top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); }
    #mobile-top-right .eid-top-btn { min-width: 64px; padding: 10px 12px; font-size: 13px; }
  }

  /* Hotbar 4 slots — sempre visível (estilo Eidolon) */
  #hotbar-container {
    display: flex !important;
    position: absolute;
    left: 50%;
    /* acima do chat/xp, à esquerda do Attack — não cobre Use */
    bottom: max(150px, calc(env(safe-area-inset-bottom) + 140px));
    transform: translateX(-50%);
    gap: 8px;
    pointer-events: auto;
    z-index: 23;
  }
  .hotbar-slot {
    width: 52px; height: 52px; border-radius: 10px;
    background: rgba(10,12,18,0.92);
    border: 1.5px solid rgba(198,161,91,0.35);
    box-shadow: 0 4px 14px rgba(0,0,0,0.45);
    position: relative;
    display: flex; align-items: center; justify-content: center;
    color: #e8d5a8; font-size: 20px;
    cursor: pointer; user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .hotbar-slot:active { transform: scale(0.94); border-color: #c6a15b; }
  .hotbar-slot.empty { opacity: 0.55; border-color: rgba(255,255,255,0.12); }
  .hotbar-slot .hotbar-key {
    position: absolute; top: 3px; left: 5px;
    font-size: 9px; color: #889; font-weight: 700;
  }
  .hotbar-slot .hotbar-cd {
    position: absolute; inset: 0; border-radius: 9px;
    background: rgba(0,0,0,0.55);
    display: none; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800; color: #fff;
  }
  .hotbar-slot.cd .hotbar-cd { display: flex; }
  .hotbar-slot .hotbar-qty {
    position: absolute; bottom: 2px; right: 4px;
    font-size: 10px; font-weight: 700; color: #ffe8a0;
  }
  @media (min-width: 900px) {
    #hotbar-container { bottom: 64px; }
    .hotbar-slot { width: 48px; height: 48px; }
  }

  /* Grid denso de slots (padrão Diablo / mobile RPG) */
  #inv-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 3px !important;
    max-height: 148px;
    overflow-y: auto;
    padding: 1px 0 2px;
  }
  .inv-item-card {
    position: relative;
    aspect-ratio: 1 / 1;
    display: flex; align-items: center; justify-content: center;
    background: rgba(16, 14, 20, 0.95);
    border: 1px solid rgba(198,161,91,0.25);
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.3);
    cursor: pointer;
    min-height: 0;
  }
  .inv-item-card:active { transform: scale(0.92); }
  .inv-item-card .ico { font-size: 16px; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.5)); pointer-events:none; }
  .inv-item-card .qty-badge {
    position: absolute; right: 1px; bottom: 0; font-size: 9px; font-weight: 800; color: #fff;
    background: rgba(0,0,0,0.75); padding: 0 3px; border-radius: 4px; line-height: 1.3; pointer-events:none;
  }
  .inv-item-card .eq-badge {
    position: absolute; left: 1px; top: 1px; font-size: 8px; font-weight: 800; color: #1a1208;
    background: #ffe8a0; border-radius: 3px; padding: 0 2px; line-height: 1.3; pointer-events:none;
  }
  .inv-item-card.rarity-rare   { border-color: #4a9fe0; }
  .inv-item-card.rarity-epic   { border-color: #a35fe0; }
  .inv-item-card.rarity-legend { border-color: #e0b34a; }
  .inv-item-card.equipped { border-color: #ffe8a0; }
  #inv-equip-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
    margin: 3px 0 4px;
  }
  .inv-equip-slot {
    background: rgba(12,14,18,0.9);
    border: 1px solid rgba(198,161,91,0.28);
    border-radius: 6px;
    padding: 3px 1px;
    text-align: center;
    font-size: 9px;
    color: #9aa4af;
    min-height: 32px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
  }
  .inv-equip-slot .es-ico { font-size: 15px; display: block; margin: 0; line-height: 1.1; }
  .inv-equip-slot .es-name { display: none; }
  .inv-equip-slot.empty { opacity: 0.45; }
  #inv-footer-hint {
    font-size: 11px; color: #6a7380; margin-top: 6px; line-height: 1.35;
  }

  #player-hud-eid {
    position: absolute; top: max(10px, env(safe-area-inset-top));
    left: max(10px, env(safe-area-inset-left));
    width: min(190px, 46vw); pointer-events: none; display: none; z-index: 22;
  }
  .bar-container {
    width: 100%; height: 20px;
    background: rgba(8,10,16,0.8);
    border: 1px solid rgba(0,0,0,0.35);
    margin-bottom: 3px; position: relative; border-radius: 6px; overflow: hidden;
  }
  .bar-fill { height: 100%; width: 100%; transition: width 0.15s ease-out; }
  .health-fill { background: linear-gradient(90deg, #8b3030, #c45a5a); }
  .mana-fill { background: linear-gradient(90deg, #2a4a8a, #4a7ac8); }
  .bar-text {
    position: absolute; inset: 0; display: flex; justify-content: center; align-items: center;
    font-size: 10px; color: #fff; text-shadow: 0 1px 2px #000; font-weight: 700;
  }

  /* XP + nome: faixa central acima do chat, sem invadir botões */
  #bottom-xp-bar {
    position: absolute;
    left: 50%; transform: translateX(-50%);
    width: min(200px, 48vw);
    bottom: max(44px, calc(env(safe-area-inset-bottom) + 36px));
    height: 14px; z-index: 21; pointer-events: none;
    background: rgba(0,0,0,0.55); border-radius: 4px; overflow: hidden;
    border: 1px solid rgba(198,161,91,0.35);
  }
  #bottom-xp-fill {
    height: 100%; width: 0%; background: linear-gradient(90deg, #6a5020, #c6a15b);
    transition: width 0.2s;
  }
  #bottom-xp-label {
    position: absolute; left: 6px; right: 6px; top: 0; bottom: 0;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 9px; color: #f0e6d0; font-weight: 700; text-shadow: 0 1px 2px #000;
  }

  /* Painel Effects */
  #effects-panel {
    display: none; position: fixed; left: 50%; top: 22%; transform: translateX(-50%);
    z-index: 35; width: min(340px, 92vw);
    background: rgba(16,20,28,0.96); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 12px; padding: 14px 16px; color: #e8eef5;
    pointer-events: auto; box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  }
  #effects-panel.show { display: block; }
  #effects-panel h3 { margin: 0 0 10px; font-size: 15px; color: #e8d5a8; }
  #effects-panel .eff-card {
    border-left: 3px solid #6ee7c8; background: rgba(255,255,255,0.04);
    padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 13px; line-height: 1.4;
  }
  #effects-panel .eff-card b { display: block; margin-bottom: 4px; }
  #effects-close {
    float: right; border: none; background: rgba(255,255,255,0.1);
    color: #fff; border-radius: 8px; padding: 6px 12px; font-weight: 600; cursor: pointer;
  }

  #weapon-switch {
    position: absolute; right: 28px; bottom: 200px; display: none; flex-direction: column; gap: 8px;
    pointer-events: auto;
  }
  .weapon-btn {
    width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.3); color: #fff; font-size: 20px;
    pointer-events: auto; display: flex; align-items: center; justify-content: center; cursor: pointer;
  }
  .weapon-btn.active { border-color: #c6a15b; background: rgba(198,161,91,0.25); }

  #desktop-hint {
    position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
    color: #6b7480; font-size: 12px; letter-spacing: 0.02em;
  }

  #enemy-banner {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -160%);
    color: #ffd7d0; font-size: 13px; opacity: 0; transition: opacity 0.3s ease;
    pointer-events: none; text-shadow: 0 1px 4px #000;
  }
  #hunt-objective {
    position: absolute; top: max(58px, calc(env(safe-area-inset-top) + 52px));
    left: max(10px, env(safe-area-inset-left));
    max-width: min(200px, 48vw);
    background: rgba(10,14,20,0.9); border: 1px solid rgba(255,255,255,0.1);
    color: #e8eef5; font-size: 11px; font-weight: 600;
    padding: 6px 10px; border-radius: 8px; pointer-events: none;
  }
  #hunt-objective .avail { color: #e0b75a; font-weight: 700; margin-left: 4px; }
  #daily-hud {
    position: absolute;
    top: max(118px, calc(env(safe-area-inset-top) + 110px));
    left: max(10px, env(safe-area-inset-left));
    max-width: min(220px, 52vw);
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 8px 10px;
    pointer-events: none;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    z-index: 20;
  }
  /* V5 — Living World + Adventure Loop */
  #world-event-hud {
    position:absolute; top:max(220px,calc(env(safe-area-inset-top) + 212px)); left:max(10px,env(safe-area-inset-left));
    width:min(250px,58vw); background:rgba(12,16,21,.88); border:1px solid rgba(198,161,91,.32);
    border-radius:11px; padding:8px 10px; z-index:20; pointer-events:none; box-shadow:0 8px 22px rgba(0,0,0,.3);
    opacity:0; transform:translateY(-5px); transition:opacity .25s,transform .25s;
  }
  #world-event-hud.show{opacity:1;transform:none}
  #world-event-hud .we-title{font-family:var(--font-display);font-size:11px;color:#e8d5a8;font-weight:800;letter-spacing:.04em}
  #world-event-hud .we-text{font-size:11px;color:#d9e1e8;margin-top:3px;line-height:1.3}
  #world-event-hud .we-progress{height:4px;background:rgba(255,255,255,.1);border-radius:4px;overflow:hidden;margin-top:6px}
  #world-event-hud .we-fill{height:100%;width:0;background:linear-gradient(90deg,#c6a15b,#7cf296);transition:width .2s}
  #world-event-hud .we-time{font-size:9px;color:#8e98a5;margin-top:4px}

  #adventure-loop-hud{
    position:absolute;right:max(10px,env(safe-area-inset-right));top:max(118px,calc(env(safe-area-inset-top) + 110px));
    width:min(210px,44vw);background:rgba(10,14,20,.84);border:1px solid rgba(255,255,255,.09);
    border-radius:10px;padding:8px 10px;z-index:20;pointer-events:none;box-shadow:0 6px 18px rgba(0,0,0,.3);
  }
  #adventure-loop-hud .al-title{font-size:10px;color:#9fd8ff;font-weight:800;letter-spacing:.04em}
  #adventure-loop-hud .al-main{font-size:11px;color:#eef3f7;margin-top:3px;font-weight:700}
  #adventure-loop-hud .al-sub{font-size:9px;color:#8e98a5;margin-top:2px}
  #adventure-loop-hud .al-streak{color:#ffd166;font-weight:800}

  #daily-hud .daily-title {
    font-family: var(--font-display);
    font-size: 11px;
    color: var(--accent);
    letter-spacing: 0.04em;
    margin-bottom: 3px;
  }
  #daily-text { font-size: 11px; color: var(--ink); font-weight: 600; line-height: 1.3; }
  #daily-progress { font-size: 10px; color: var(--muted); margin-top: 3px; }
  #daily-hud.done #daily-text { color: var(--safe); }
  #safezone-label {
    position: absolute; top: max(88px, calc(env(safe-area-inset-top) + 82px));
    left: max(10px, env(safe-area-inset-left)); transform: none;
    background: rgba(20,40,25,0.9); border: 1px solid rgba(120,200,120,0.4);
    color: #b8ffc0; font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
    padding: 4px 8px; border-radius: 5px; pointer-events: none; opacity: 0; transition: opacity 0.25s;
    text-transform: uppercase;
  }
  /* --- PAINEL DE STATUS & SKILLS (ESTILO ULTIMA ONLINE) --- */
  #btn-stats-toggle {
    display: none !important; /* agora só pelo Menu do jogo */
  }
  /* Menu hub (Inventário / Pets / Habilidades) */
  #game-menu-panel {
    display: none;
    position: fixed;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    z-index: 35;
    width: min(300px, 90vw);
    background: linear-gradient(165deg, rgba(22,18,14,0.98), rgba(10,10,12,0.99));
    border: 1px solid rgba(198,161,91,0.55);
    border-radius: 14px;
    padding: 14px 14px 12px;
    color: var(--ink, #f0e6d0);
    pointer-events: auto;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  }
  #game-menu-panel.open { display: block; }
  @media (max-width: 720px), (pointer: coarse) {
    #game-menu-panel {
      left: 0; right: 0; top: auto; bottom: 0;
      transform: none;
      width: 100%; max-width: none;
      border-radius: 16px 16px 0 0;
      border-bottom: none;
      padding: 16px 14px calc(14px + env(safe-area-inset-bottom));
    }
  }
  #game-menu-panel .gm-title {
    font-size: 15px; font-weight: 700; color: var(--accent, #c6a15b);
    font-family: var(--font-display, Cinzel, Georgia, serif);
    margin: 0 0 12px; text-align: center; letter-spacing: 0.04em;
  }
  #game-menu-panel .gm-btn {
    display: block; width: 100%;
    margin: 0 0 8px; padding: 14px 14px;
    border-radius: 12px; border: 1px solid rgba(255,255,255,0.12);
    background: rgba(30,28,24,0.95); color: var(--ink, #f0e6d0);
    font-size: 15px; font-weight: 600; text-align: left; cursor: pointer;
    min-height: 48px;
  }
  #game-menu-panel .gm-btn:active { transform: scale(0.98); background: rgba(50,42,32,0.95); }
  #game-menu-panel .gm-close {
    margin-top: 4px; background: transparent; border-color: rgba(255,255,255,0.08);
    color: var(--muted, #9a8f7a); text-align: center;
  }

  #stats-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 640px;
    max-height: 85vh;
    background: linear-gradient(165deg, rgba(22,18,14,0.98), rgba(10,10,12,0.98));
    border: 2px solid rgba(198,161,91,0.55);
    box-shadow: 0 16px 48px rgba(0,0,0,0.7);
    border-radius: 14px;
    color: var(--ink, #f0e6d0);
    padding: 18px;
    display: none;
    flex-direction: column;
    z-index: 10000;
    overflow-y: auto;
    font-family: var(--font-ui, system-ui, sans-serif);
    backdrop-filter: blur(6px);
  }
  #stats-modal.open { display: flex; }
  @media (max-width: 720px), (pointer: coarse) {
    #stats-modal {
      top: auto; bottom: 0; left: 0; right: 0;
      transform: none;
      width: 100%; max-width: none;
      max-height: min(72vh, 560px);
      border-radius: 16px 16px 0 0;
      border-bottom: none;
      padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
    }
    #stats-modal::before {
      content: '';
      position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
      width: 42px; height: 4px; border-radius: 2px;
      background: rgba(255,255,255,0.22);
    }
  }

  .stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(198,161,91,0.35);
    padding-bottom: 8px;
    margin-bottom: 15px;
  }
  .stats-header h2 {
    margin: 0; color: var(--accent, #c6a15b); font-size: 18px;
    font-family: var(--font-display, Cinzel, Georgia, serif);
  }
  .stats-close-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    color: #ffb0a0;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    min-width: 44px; min-height: 44px;
  }

  /* Pets / Criaturas */
  .pet-slots-section {
    background: #241d17;
    border: 1px solid #483925;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
  }
  .pet-slots-section h3 { margin: 0 0 10px 0; color: #7cf296; font-size: 15px; }
  .pet-slots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .pet-card {
    background: #15110d;
    border: 1px solid #3d301f;
    border-radius: 6px;
    padding: 8px;
    text-align: center;
    font-size: 12px;
  }
  .pet-card.empty { color: #777; font-style: italic; }
  .pet-card.occupied { border-color: #55aa66; }
  .pet-card .pet-name { font-weight: bold; color: #e0e0e0; display: block; margin-bottom: 4px; }
  .btn-release {
    background: #8b2b2b;
    border: none;
    color: #fff;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    margin-top: 5px;
  }

  /* 4 Grupos de Habilidades */
  .skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
  }
  .skill-group {
    background: #241d17;
    border: 1px solid #483925;
    border-radius: 6px;
    padding: 10px;
  }
  .skill-group h4 {
    margin: 0 0 8px 0;
    color: #f7d28b;
    font-size: 14px;
    border-bottom: 1px solid #3e3220;
    padding-bottom: 4px;
  }
  .skill-row {
    display: flex;
    flex-direction: column;
    margin-bottom: 6px;
  }
  .skill-info {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-bottom: 2px;
  }
  .skill-bar {
    width: 100%;
    height: 6px;
    background: #110e0c;
    border-radius: 3px;
    overflow: hidden;
  }
  .skill-fill {
    height: 100%;
    background: linear-gradient(90deg, #996e36, #e3af5b);
    width: 0%;
  }

  /* Botão de Ação rápida para Domar */
  #tame-action-btn {
    display: none !important; /* acessível pelo Menu → Domar */
  }

  /* ---- Inventário unificado + Hero paper doll ---- */
  #hero-panel {
    display: none; position: fixed; inset: 0; z-index: 55;
    background: rgba(6,8,12,0.72);
    align-items: center; justify-content: center; padding: 12px;
  }
  #hero-panel.open { display: flex; }
  #hero-card {
    width: min(420px, 96vw); max-height: min(86vh, 700px); overflow-y: auto;
    background: linear-gradient(180deg, #16141c 0%, #0e1016 100%);
    border: 1px solid rgba(198,161,91,0.4); border-radius: 14px;
    padding: 14px 16px 18px; color: #e8e4dc;
    box-shadow: 0 12px 40px rgba(0,0,0,0.55);
  }
  #hero-card .hero-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
  #hero-card .hero-head h3 { margin:0; color:#e8d5a8; letter-spacing:0.08em; font-size:15px; }
  #hero-card .hero-close {
    background:rgba(0,0,0,0.35); border:1px solid rgba(255,255,255,0.15);
    color:#ccc; width:36px; height:36px; border-radius:10px; font-size:18px; cursor:pointer;
  }
  .doll-grid { display:grid; grid-template-columns:72px 1fr 72px; gap:8px; align-items:center; margin:8px 0 14px; }
  .doll-col { display:flex; flex-direction:column; gap:6px; }
  .doll-center { display:flex; flex-direction:column; align-items:center; gap:8px; }
  .doll-figure {
    width:110px; height:150px;
    background: radial-gradient(circle at 50% 30%, #2a3240 0%, #141820 70%);
    border:1px solid rgba(198,161,91,0.25); border-radius:12px;
    display:flex; align-items:center; justify-content:center; font-size:64px;
  }
  .doll-slot {
    width:72px; min-height:58px; background:rgba(12,14,18,0.95);
    border:1px solid rgba(198,161,91,0.32); border-radius:8px;
    padding:4px 2px; text-align:center; font-size:10px; color:#8a93a0; cursor:pointer;
  }
  .doll-slot .ds-ico { font-size:18px; display:block; }
  .doll-slot .ds-name { color:#e8d5a8; font-weight:700; font-size:9px; }
  .doll-slot.empty { opacity:0.55; }
  .doll-slot.filled { border-color:#c6a15b; background:rgba(40,32,18,0.5); }
  .hero-stats { display:grid; grid-template-columns:1fr 1fr; gap:6px; font-size:12px; }
  .hero-stats div {
    background:rgba(0,0,0,0.35); border-radius:8px; padding:8px 10px;
    border:1px solid rgba(255,255,255,0.06);
  }
  .hero-stats b { color:#ffe8a0; }
  .inv-compare { font-size:11px; color:#7cf296; margin-top:2px; }
  .inv-compare.worse { color:#ff8a7a; }
  .inv-tabs {
    display:flex; gap:2px; margin-bottom:4px; padding:2px;
    background:rgba(0,0,0,0.28); border:1px solid rgba(255,255,255,0.06); border-radius:8px;
  }
  .inv-tab {
    flex:1; padding:4px 2px; border-radius:6px; cursor:pointer;
    background:transparent; border:1px solid transparent;
    color:#7a8490; font-size:10px; font-weight:700; text-align:center;
    user-select:none;
  }
  .inv-tab:active { transform: scale(0.96); }
  .inv-tab.active {
    border-color:rgba(198,161,91,0.45); color:#1a1208;
    background:linear-gradient(160deg,#e3c17e,#c6a15b);
  }
  .inv-equip-slot.filled { border-color:#c6a15b; }

  /* ---- Drag & drop ---- */
  .inv-item-card { touch-action: none; transition: opacity 0.1s ease, transform 0.1s ease; }
  .inv-item-card.dragging { opacity: 0.35; }
  .inv-quick-row { display:flex; gap:4px; margin:0 0 4px; align-items:stretch; }
  .inv-player-target {
    flex:0 0 40px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:0;
    background:rgba(198,161,91,0.08); border:1px dashed rgba(198,161,91,0.4); border-radius:7px;
    font-size:8px; color:#c6a15b; padding:2px; transition: background 0.12s ease, border-color 0.12s ease;
  }
  .inv-player-target .ipt-ico { font-size:16px; line-height:1; }
  .inv-player-target .ipt-label { font-size:8px; }
  .inv-player-target.drop-active {
    background:rgba(198,161,91,0.28); border-color:#ffe8a0; border-style:solid;
  }
  .inv-pets-strip {
    flex:1; display:flex; gap:4px; overflow-x:auto; padding:1px;
    -webkit-overflow-scrolling:touch;
  }
  .inv-pets-strip .inv-pets-empty { font-size:9px; color:#6a7380; align-self:center; padding:0 2px; }
  .inv-pet-avatar {
    flex:0 0 auto; width:36px; display:flex; flex-direction:column; align-items:center; justify-content:center;
    background:rgba(12,14,18,0.9); border:1px solid rgba(255,255,255,0.1); border-radius:6px;
    padding:2px; font-size:8px; color:#9aa4af;
  }
  .inv-pet-avatar .ipa-ico { font-size:14px; }
  .inv-pet-avatar .ipa-name { display:none; }
  .inv-pet-avatar .ipa-hunger { width:100%; height:2px; border-radius:1px; background:rgba(255,255,255,0.12); overflow:hidden; }
  .inv-pet-avatar .ipa-hunger i { display:block; height:100%; background:linear-gradient(90deg,#e0523f,#7cf296); }
  .inv-pet-avatar.drop-active {
    background:rgba(198,161,91,0.28); border-color:#ffe8a0;
  }
  .inv-equip-slot { transition: background 0.12s ease, border-color 0.12s ease; }
  .inv-equip-slot.drop-active { background:rgba(198,161,91,0.28); border-color:#ffe8a0; }
  .inv-equip-slot.drop-invalid { border-color:#e05a4a; }
  #inv-drop-trash {
    display:flex; align-items:center; justify-content:center; gap:4px; margin-top:3px; padding:4px;
    border:1px dashed rgba(255,255,255,0.14); border-radius:7px;
    font-size:9px; color:#6a7380; line-height:1.2;
  }
  #inv-drop-trash .idt-ico { font-size:14px; flex:0 0 auto; }
  #inv-drop-trash-text { display:none; }
  #inv-drop-trash.drop-active {
    background:rgba(224,90,74,0.16); border-color:#ff8a7a; color:#ffb3a6; border-style:solid;
  }
  @media (min-width: 721px) {
    #inv-drop-trash-text { display:inline; }
    #inv-drop-trash { justify-content:flex-start; padding:6px 8px; }
  }
  .inv-drag-ghost {
    position:fixed; z-index:9999; pointer-events:none; left:0; top:0;
    display:flex; align-items:center; gap:8px; padding:8px 10px;
    background:rgba(20,18,14,0.96); border:1.5px solid #c6a15b; border-radius:10px;
    box-shadow:0 8px 24px rgba(0,0,0,0.5); color:#e8d5a8; font-size:12px; font-weight:700;
    transform: translate(-50%, -50%) scale(1.06);
  }
  .inv-drag-ghost .idg-ico { font-size:20px; }

  /* ---- Ficha do item (bottom sheet, jeito RPG mobile) ---- */
  #inv-detail-overlay {
    display: none; position: fixed; inset: 0; z-index: 45;
    background: rgba(0,0,0,0.55);
    align-items: flex-end; justify-content: center;
  }
  #inv-detail-overlay.show { display: flex; }
  #inv-detail-card {
    width: min(430px, 96vw);
    background: linear-gradient(180deg,#1b1720,#141119);
    border: 1.5px solid rgba(198,161,91,0.4);
    border-radius: 18px 18px 0 0;
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 30px rgba(0,0,0,0.55);
    animation: idc-up 0.18s ease;
  }
  @keyframes idc-up { from { transform: translateY(16px); opacity:0.4; } to { transform: translateY(0); opacity:1; } }
  #idc-head { display:flex; align-items:center; gap:12px; margin-bottom:10px; }
  #idc-icon {
    width:56px; height:56px; border-radius:12px; flex-shrink:0;
    background: radial-gradient(circle at 32% 28%, rgba(255,255,255,0.08), transparent 65%), #0e0c10;
    border: 1.5px solid rgba(198,161,91,0.4);
    display:flex; align-items:center; justify-content:center; font-size:30px;
  }
  #idc-name { font-weight:800; color:#e8d5a8; font-size:16px; line-height:1.25; }
  #idc-sub { font-size:11px; color:#9aa4af; margin-top:2px; }
  #idc-close {
    background:rgba(255,255,255,0.06); border:1px solid rgba(255,255,255,0.14); color:#c8c0b0;
    font-size:16px; line-height:1; width:30px; height:30px; border-radius:50%; cursor:pointer; flex-shrink:0;
  }
  #idc-desc { font-size:12.5px; color:#c8c0b0; line-height:1.45; margin-bottom:10px; }
  #idc-compare {
    display: none; margin-bottom: 12px; padding: 10px 12px;
    background: rgba(0,0,0,0.28); border: 1px solid rgba(198,161,91,0.28);
    border-radius: 10px; font-size: 12px; line-height: 1.45;
  }
  #idc-compare .cmp-title {
    font-family: var(--font-display, Cinzel, Georgia, serif);
    color: var(--accent, #c6a15b); font-size: 11px; letter-spacing: 0.06em;
    margin-bottom: 6px; text-transform: uppercase;
  }
  #idc-compare .cmp-row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
  #idc-compare .cmp-up { color: #6ee7c8; font-weight: 700; }
  #idc-compare .cmp-down { color: #ff8a7a; font-weight: 700; }
  #idc-compare .cmp-same { color: #9aa4af; }
  #idc-pets { display:none; gap:6px; overflow-x:auto; margin-bottom:12px; padding-bottom:2px; }
  #idc-actions { display:flex; gap:8px; flex-wrap:wrap; }
  .idc-btn {
    flex:1; min-width:100px; padding:11px 10px; border-radius:10px; text-align:center;
    font-size:13px; font-weight:700; cursor:pointer; border:1.5px solid transparent;
    background: rgba(255,255,255,0.06); color:#e8d5a8;
    min-height: 44px;
  }
  .idc-btn:active { transform: scale(0.96); }
  .idc-btn.primary { background: linear-gradient(160deg,#e3c17e,#c6a15b); color:#1a1208; border-color:#c6a15b; }
  .idc-btn.danger { background: rgba(224,90,74,0.14); color:#ff9a8a; border-color:rgba(224,90,74,0.4); }
  .idc-btn.disabled { opacity:0.4; pointer-events:none; }

/* CarpanoRPG Adventure Layer v1 */
#score-wrap,#best-wrap,#killstreak{display:none!important}
#adventure-hud{position:fixed;left:12px;top:88px;z-index:25;width:min(250px,calc(100vw - 24px));font:12px/1.35 system-ui,sans-serif;color:#eee;pointer-events:none}
#adventure-card{background:linear-gradient(180deg,rgba(12,15,20,.90),rgba(12,15,20,.72));border:1px solid rgba(198,161,91,.34);border-radius:12px;padding:10px 12px;box-shadow:0 8px 25px rgba(0,0,0,.28);backdrop-filter:blur(7px);pointer-events:auto;cursor:default}
#adventure-region{font-size:14px;font-weight:800;color:#f2dfb1;letter-spacing:.2px}.adv-small{font-size:10px;color:#9aa4af}.adv-objective{margin-top:7px;color:#f0f0f0}.adv-progress{height:4px;background:#242a31;border-radius:5px;overflow:hidden;margin-top:6px}.adv-progress>i{display:block;height:100%;width:0;background:#c6a15b;transition:width .25s}
#adventure-gates{margin-top:7px;font-size:10px;color:#aeb7c2}.adv-gate{display:inline-block;margin-right:5px;margin-top:3px;padding:2px 5px;border-radius:5px;background:rgba(255,255,255,.06)}
.adv-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
#adv-min-btn{flex:none;width:22px;height:22px;line-height:1;border:none;border-radius:6px;background:rgba(255,255,255,.08);color:#f2dfb1;font-size:13px;cursor:pointer;padding:0}
#adv-min-btn:active{background:rgba(255,255,255,.16)}
#adventure-card.min #adv-body{display:none}
#adventure-card.min{padding:6px 10px}
#adventure-toast{position:fixed;left:50%;top:18%;transform:translate(-50%,-12px);z-index:90;padding:10px 15px;border-radius:12px;background:rgba(12,15,20,.94);border:1px solid rgba(198,161,91,.55);color:#f6e7c1;font:700 13px system-ui,sans-serif;opacity:0;pointer-events:none;transition:opacity .2s,transform .2s;box-shadow:0 10px 35px rgba(0,0,0,.35)}
#adventure-toast.show{opacity:1;transform:translate(-50%,0)}
@media(max-width:700px){#adventure-hud{top:76px;left:8px;width:205px}#adventure-card{padding:8px 10px}.adv-small{font-size:9px}.adv-objective{font-size:11px}}

#boot-fail {
    position: fixed; inset: 0; z-index: 999; display: flex;
    align-items: center; justify-content: center; padding: 24px;
    background: #05070c; color: #fff; text-align: center;
  }
  #boot-fail .boot-fail-box { max-width: 320px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
  #boot-fail .boot-fail-title { font-size: 20px; font-weight: 700; color: #f0d9a0; }
  #boot-fail .boot-fail-sub { font-size: 14px; color: rgba(220,225,230,0.85); line-height: 1.4; }
  #boot-fail-retry {
    margin-top: 6px; padding: 14px 32px; font-size: 15px; font-weight: 700;
    color: #1a1208; background: linear-gradient(180deg, #f0d080, #c6a15b 45%, #a07830);
    border: none; border-radius: 12px; cursor: pointer;
  }

/* ---------- UI Manager (v7.2): botão minimizar + dock de janelas minimizadas ---------- */
.ui-min-btn {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 32px; height: 32px; padding: 0;
  border-radius: 8px; border: 1px solid rgba(255,255,255,0.2);
  background: transparent; color: #ccc;
  font: 700 18px/1 system-ui, sans-serif; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.ui-min-btn.inline { position: static; flex: 0 0 auto; }
.ui-min-btn.float { float: right; margin-right: 6px; }
#inventory-panel .ui-min-btn { width: 24px; height: 24px; border-radius: 6px; font-size: 15px; border-color: rgba(255,255,255,0.15); color: #aaa; }
.ui-min-btn:hover { background: rgba(255,255,255,0.08); }
.ui-min-btn:active { transform: scale(0.94); }
#ui-dock {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(max(0px, env(safe-area-inset-bottom)) + 120px); z-index: 46;
  display: none; flex-wrap: wrap-reverse; gap: 6px; justify-content: center;
  max-width: calc(100vw - 24px); pointer-events: none;
}
#ui-dock.has-chips { display: flex; }
.ui-chip {
  pointer-events: auto; min-height: 40px; padding: 0 14px; border-radius: 20px;
  border: 1px solid rgba(232,213,168,0.55); background: rgba(16,20,28,0.94); color: #e8d5a8;
  font: 600 14px/1 'Source Sans 3', system-ui, sans-serif; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 2px 10px rgba(0,0,0,0.45);
}
.ui-chip:active { transform: scale(0.96); }
@media (pointer: coarse) {
  .ui-chip { min-height: 44px; }
  #ui-dock { bottom: calc(max(0px, env(safe-area-inset-bottom)) + 215px); }
}

/* MMO mobile combat */
.stamina-fill{background:linear-gradient(90deg,#55b7e8,#8de6ff);}
#btn-mobile-ability.blocking{box-shadow:0 0 0 2px #9fd8ff inset,0 0 12px rgba(100,190,255,.55);}
