/* css/core-panels.css — janelas de bolsa/inventário, criar, vender, painel de Criaturas, construção, equipamento, loja, missões, NPC.
 * v0.74: dividido de core.css SEM mudar a ordem das regras (a cascata depende dela). Ordem de carga: ver index.html. */
/* 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: 60; width: min(360px, 94vw); max-height: 82vh;
    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);
    pointer-events: auto !important;
  }
  #shop-panel .shop-btn, #shop-panel .shop-tab, #shop-panel button,
  #quest-panel button, #shop-body, #shop-body * {
    pointer-events: auto !important;
    touch-action: manipulation;
  }
  #shop-panel h3, #quest-panel h3 { margin: 0 0 10px; font-size: 15px; color: #ffd166; letter-spacing: 0.04em; }
  #shop-panel .shop-gold-line { margin: 0 0 10px; font-size: 13px; color: #9aa4af; }
  #shop-panel .shop-gold-line b { color: #ffd166; }
  #shop-body { display: flex; flex-direction: column; gap: 2px; }
  .shop-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 6px; border-bottom: 1px solid rgba(255,255,255,0.06);
    gap: 8px;
  }
  .shop-row span { font-size: 12px; min-width: 0; flex: 1; }
  .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: 8px 12px; cursor: pointer; font-size: 12px; font-weight: 700;
    min-height: 36px; min-width: 72px; flex-shrink: 0;
  }
  .shop-btn:active { transform: scale(0.96); background: rgba(198,161,91,0.35); }
  .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: 36px; height: 36px; cursor: pointer;
    pointer-events: auto !important; touch-action: manipulation; z-index: 2; position: relative;
  }
  #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; }

  